-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-volunteer-manager-integration.php
70 lines (59 loc) · 2.65 KB
/
api-volunteer-manager-integration.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
<?php
/**
* Plugin Name: API Volunteer Manager Integration
* Plugin URI: https://github.com/helsingborg-stad/api-volunteer-manager-integration
* Description: Frontend integration for api-volunteer-manager.
* Version: 3.2.0
* Author: Nikolas Ramstedt
* Author URI: https://github.com/helsingborg-stad
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: api-volunteer-manager-integration
* Domain Path: /languages
*/
use APIVolunteerManagerIntegration\Helper\DIContainer\DIContainerFactory;
if ( ! defined('WPINC')) {
die();
}
define('API_VOLUNTEER_MANAGER_INTEGRATION_PATH', plugin_dir_path(__FILE__));
define('API_VOLUNTEER_MANAGER_INTEGRATION_URL', plugins_url('', __FILE__));
define('API_VOLUNTEER_MANAGER_INTEGRATION_TEMPLATE_PATH', API_VOLUNTEER_MANAGER_INTEGRATION_PATH.'templates/');
define('API_VOLUNTEER_MANAGER_INTEGRATION_TEXT_DOMAIN', 'api-volunteer-manager-integration');
define('API_VOLUNTEER_MANAGER_MODULE_PATH', API_VOLUNTEER_MANAGER_INTEGRATION_PATH.'source/php/Modularity/');
require_once API_VOLUNTEER_MANAGER_INTEGRATION_PATH.'Public.php';
// Register the autoloader
require __DIR__.'/vendor/autoload.php';
load_plugin_textdomain(
API_VOLUNTEER_MANAGER_INTEGRATION_TEXT_DOMAIN,
false,
plugin_basename(dirname(__FILE__)).'/languages/'
);
// Acf auto import and export
add_action('acf/init', function () {
if (class_exists('\AcfExportManager\AcfExportManager')) {
/** @noinspection PhpFullyQualifiedNameUsageInspection */
$acfExportManager = new \AcfExportManager\AcfExportManager();
$acfExportManager->setTextdomain(API_VOLUNTEER_MANAGER_INTEGRATION_TEXT_DOMAIN);
$acfExportManager->setExportFolder(
API_VOLUNTEER_MANAGER_INTEGRATION_PATH.'source/php/AcfFields/'
);
$acfExportManager->autoExport([
'api-volunteer-manager-integration-settings' => 'group_644ad1b3d7072',
'api-volunteer-manager-integration-assignment-form' => 'group_64abba2660644',
'api-volunteer-manager-integration-volunteer-form' => 'group_64abbfd89cb56',
]);
$acfExportManager->import();
}
});
if (function_exists('register_activation_hook')) {
register_activation_hook(__FILE__, function () {
wp_clear_scheduled_hook('import_volunteer_assignments_daily');
wp_schedule_event(time(), 'hourly', 'import_volunteer_assignments_daily');
});
}
if (function_exists('register_deactivation_hook')) {
register_deactivation_hook(__FILE__, function () {
wp_clear_scheduled_hook('import_volunteer_assignments_daily');
});
}
(new APIVolunteerManagerIntegration\App())->init(DIContainerFactory::create());