forked from helsingborg-stad/Modularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modularity.php
85 lines (75 loc) · 3.29 KB
/
modularity.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
83
84
85
<?php
/*
* Plugin Name: Modularity
* Plugin URI: -
* Description: Modular component system for WordPress
* Version: 1.6.5
* Author: Kristoffer Svanmark, Sebastian Thulin
* Author URI: -
* Text domain: modularity
*
* Copyright (C) 2016
*/
define('MODULARITY_PATH', plugin_dir_path(__FILE__));
define('MODULARITY_URL', plugins_url('', __FILE__));
define('MODULARITY_CACHE_DIR', trailingslashit(wp_upload_dir()['basedir']) . 'cache/modules/');
define('MODULARITY_TEMPLATE_PATH', MODULARITY_PATH . 'templates/');
add_action('plugins_loaded', function () {
load_plugin_textdomain('modularity', false, plugin_basename(dirname(__FILE__)) . '/languages');
});
// Autoload from plugin
if (file_exists(MODULARITY_PATH . 'vendor/autoload.php')) {
require_once MODULARITY_PATH . 'vendor/autoload.php';
}
// Autoload from ABSPATH
if (file_exists(dirname(ABSPATH) . '/vendor/autoload.php')) {
require_once dirname(ABSPATH) . '/vendor/autoload.php';
}
require_once MODULARITY_PATH . 'source/php/Vendor/Psr4ClassLoader.php';
require_once MODULARITY_PATH . 'Public.php';
// Instantiate and register the autoloader
$loader = new Modularity\Vendor\Psr4ClassLoader();
$loader->addPrefix('Modularity', MODULARITY_PATH);
$loader->addPrefix('Modularity', MODULARITY_PATH . 'source/php/');
$loader->register();
// Acf auto import and export
add_action('plugins_loaded', function () {
$acfExportManager = new \AcfExportManager\AcfExportManager();
$acfExportManager->setTextdomain('modularity');
$acfExportManager->setExportFolder(MODULARITY_PATH . 'source/php/AcfFields/');
$acfExportManager->autoExport(array(
'mod-booking' => 'group_56a89f42b432b',
'mod-contact-info' => 'group_56a0a3928c017',
'mod-contact-contacts' => 'group_5757b93da8d5c',
'mod-contacts' => 'group_5805e5dc0a3be',
'mod-files' => 'group_5756ce3e48782',
'mod-fileslist' => 'group_5756ce3e48783',
'mod-gallery' => 'group_5666af6d26b7c',
'mod-iframe' => 'group_56c47016ea9d5',
'mod-image' => 'group_570770ab8f064',
'mod-index' => 'group_569ceab2c16ee',
'mod-inheritpost' => 'group_56a8b4fd3567b',
'mod-inlaylist' => 'group_569e054a7f9c2',
'mod-latest' => 'group_56a8c4581d906',
'mod-mainnews' => 'group_569e401dd4422',
'mod-notice' => 'group_575a842dd1283',
'mod-posts-displau' => 'group_571dfd3c07a77',
'mod-posts-filtering' => 'group_571e045dd555d',
'mod-posts-sorting' => 'group_571dffc63090c',
'mod-posts-source' => 'group_571dfaabc3fc5',
'mod-rss' => 'group_59535d940706c',
'mod-script' => 'group_56a8b9eddfced',
'mod-slider' => 'group_56a5e99108991',
'mod-social' => 'group_56dedc26e5327',
'mod-table' => 'group_5666a2a71d806',
'mod-text' => 'group_5891b49127038',
'mod-video' => 'group_57454ae7b0e9a',
'mod-wpwidget' => 'group_5729f4d3e7c7a',
'mod-sites' => 'group_58ecb6b6330f4',
));
$acfExportManager->import();
});
// Start application
add_action('plugins_loaded', function () {
new Modularity\App();
}, 20);