-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapi-event-manager.php
executable file
·82 lines (73 loc) · 2.89 KB
/
api-event-manager.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Plugin Name: Event Manager
* Plugin URI: https://github.com/helsingborg-stad/api-event-manager
* Description: Creates a api that may be used to manage events
* Version: 3.10.0
* Author: Thor Brink, Sebastian Thulin @ Helsingborg Stad
* Author URI: https://github.com/helsingborg-stad
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: api-event-manager
* Domain Path: /languages
*/
use AcfService\Implementations\NativeAcfService;
use EventManager\HooksRegistrar\HooksRegistrar;
use EventManager\App;
use EventManager\CronScheduler\CronScheduler;
use WpService\FileSystem\BaseFileSystem;
use WpService\FileSystemResolvers\ManifestFilePathResolver;
use WpService\FileSystemResolvers\UrlFilePathResolver;
use WpService\Implementations\FilePathResolvingWpService;
use WpService\Implementations\NativeWpService;
use WpService\Implementations\WpServiceLazyDecorator;
use WpService\Implementations\WpServiceWithTextDomain;
// Protect against direct file access
if (!defined('WPINC')) {
die;
}
define('EVENT_MANAGER_PATH', plugin_dir_path(__FILE__));
define('EVENT_MANAGER_URL', plugins_url('', __FILE__));
define('EVENT_MANAGER_TEMPLATE_PATH', EVENT_MANAGER_PATH . 'templates/');
/**
* Composer autoload
*/
if (file_exists(EVENT_MANAGER_PATH . 'vendor/autoload.php')) {
require EVENT_MANAGER_PATH . '/vendor/autoload.php';
}
$textDomain = 'api-event-manager';
$hooksRegistrar = new HooksRegistrar();
$acfService = new NativeAcfService();
$manifestFileWpService = new WpServiceLazyDecorator();
$urlFilePathResolver = new UrlFilePathResolver($manifestFileWpService);
$baseFileSystem = new BaseFileSystem();
$manifestFilePathResolver = new ManifestFilePathResolver(EVENT_MANAGER_PATH . "dist/manifest.json", $baseFileSystem, $manifestFileWpService, $urlFilePathResolver);
$wpService = new FilePathResolvingWpService(new NativeWpService(), $manifestFilePathResolver);
$manifestFileWpService->setInner(new WpServiceWithTextDomain($wpService, $textDomain));
$cronScheduler = new CronScheduler($wpService);
$hooksRegistrar->register($cronScheduler);
$app = new App(
'api-event-manager',
$wpService,
$acfService,
$hooksRegistrar,
$cronScheduler
);
$app->loadPluginTextDomain();
$app->setupAcfExportManager();
$app->setupPluginSettingsPage();
$app->convertRestApiPostsToSchemaObjects();
$app->setupCleanupUnusedTags();
$app->setPostTermsFromPostContent();
$app->cleanUpExpiredEvents();
$app->modifyAdminTablesColumns();
$app->disableGutenbergEditor();
$app->setupPostTypes();
$app->setupTaxonomies();
$app->setupUserRoles();
$app->setupUserCapabilities();
$app->setupFrontendForm();
$app->setupAcfFieldContentModifiers();
$app->setupAcfSavePostActions();
$app->setupFeatureToShowOrHideAcfFieldsOnFrontendAndInAdmin();
$app->setupNotifications();