-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-sponsor-manager.php
More file actions
69 lines (59 loc) · 2.55 KB
/
api-sponsor-manager.php
File metadata and controls
69 lines (59 loc) · 2.55 KB
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
<?php
/**
* Plugin Name: API Sponsor Manager
* Plugin URI: https://github.com/helsingborg-stad/api-sponsor-manager
* Description: Manages looking for sponsor listnings.
* Version: 1.0.0
* Author: Nikolas Ramsted
* Author URI: https://github.com/helsingborg-stad
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: api-sponsor-manager
* Domain Path: /languages
*/
use AcfService\Implementations\NativeAcfService;
use ApiSponsorManager\Helper\CronScheduler\CronScheduler;
use ApiSponsorManager\Helper\NotificationServices\FakeNotificationService;
use ApiSponsorManager\Helper\NotificationServices\WordPressNotificationService;
use WpService\Implementations\NativeWpService;
use WpUtilService\WpUtilService;
// Protect agains direct file access
if (!defined('WPINC')) {
die();
}
define('API_SPONSOR_MANAGER_PATH', plugin_dir_path(__FILE__));
define('API_SPONSOR_MANAGER_URL', plugins_url('', __FILE__));
define('API_SPONSOR_MANAGER_TEMPLATE_PATH', API_SPONSOR_MANAGER_PATH . 'templates/');
define('API_SPONSOR_MANAGER_TEXT_DOMAIN', 'api-sponsor-manager');
load_plugin_textdomain(API_SPONSOR_MANAGER_TEXT_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/languages');
require_once API_SPONSOR_MANAGER_PATH . 'Public.php';
// Register the autoloader
require __DIR__ . '/vendor/autoload.php';
// Acf auto import and export
add_action('acf/init', function () {
$acfExportManager = new \AcfExportManager\AcfExportManager();
$acfExportManager->setTextdomain('api-sponsor-manager');
$acfExportManager->setExportFolder(API_SPONSOR_MANAGER_PATH . 'source/php/AcfFields/');
$acfExportManager->autoExport(array(
'api-sponsor-manager-assignment' => 'group_69a97690d547c',
'api-sponsor-manager-company' => 'group_69a99c976cbfe',
'api-sponsor-manager-offering' => 'group_69a99cbe03b51',
'api-sponsor-manager-association' => 'group_69a9552f0e029',
'api-sponsor-manager-notifications' => 'group_69bbaf273446a',
));
$acfExportManager->import();
});
$wpService = new NativeWpService();
$wpUtilService = new WpUtilService($wpService);
$cronScheduler = new CronScheduler($wpService);
$notificationService = defined('SPONSOR_MANAGER_EMAIL_SERVICE')
&& SPONSOR_MANAGER_EMAIL_SERVICE === 'fake'
? new FakeNotificationService()
: new WordPressNotificationService($wpService);
// Start application
new ApiSponsorManager\App(
$wpService,
new NativeAcfService(),
$notificationService,
$cronScheduler
);