PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / trunk
Advanced Custom Fields: Extended vtrunk
0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / module-manager.php
acf-extended / includes Last commit date
admin 1 month ago field-groups 1 month ago fields 1 month ago fields-settings 1 month ago forms 1 month ago locations 1 month ago modules 1 month ago screens 1 month ago acfe-deprecated-functions.php 2 years ago acfe-field-functions.php 1 month ago acfe-field-group-functions.php 1 month ago acfe-file-functions.php 1 year ago acfe-form-functions.php 1 month ago acfe-helper-array-functions.php 1 month ago acfe-helper-functions.php 1 month ago acfe-helper-multi-functions.php 1 month ago acfe-helper-string-functions.php 1 month ago acfe-meta-functions.php 1 month ago acfe-post-functions.php 1 month ago acfe-screen-functions.php 1 month ago acfe-template-functions.php 1 month ago acfe-term-functions.php 1 month ago acfe-user-functions.php 1 month ago acfe-wp-functions.php 3 years ago assets.php 1 month ago compatibility-acf-5.8.php 2 months ago compatibility-acf-5.9.php 1 month ago compatibility-acf-6.5.php 1 month ago compatibility.php 1 month ago field-extend.php 2 months ago field.php 2 months ago hooks.php 1 month ago init.php 1 month ago local-meta.php 3 years ago media.php 1 month ago module-acf.php 1 month ago module-db.php 1 month ago module-l10n.php 1 month ago module-legacy.php 3 years ago module-manager.php 2 months ago module-post.php 1 month ago module-posts.php 2 months ago module-upgrades.php 3 years ago module.php 1 month ago multilang.php 1 month ago revisions.php 2 months ago screen.php 1 month ago settings.php 1 month ago template-tags.php 1 month ago third-party.php 3 years ago upgrades.php 1 month ago
module-manager.php
146 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_module_manager')):
8
9 class acfe_module_manager{
10
11 /**
12 * construct
13 */
14 function __construct(){
15
16 add_action('acfe/init', array($this, 'register_items'), 99);
17 add_action('init', array($this, 'register_items'));
18 add_action('init', array($this, 'register_post_types'));
19
20 }
21
22
23 /**
24 * register_items
25 */
26 function register_items(){
27
28 // get current hook
29 // ini or acf/init
30 $hook = current_filter();
31
32 // query modules by register hook
33 $modules = acfe_query_modules(array(
34 'register' => $hook
35 ));
36
37 // bail early
38 if(!$modules){
39 return;
40 }
41
42 // loop modules
43 foreach($modules as $module){
44
45 // check active
46 if(!$module->is_active()){
47 continue;
48 }
49
50 // get loaded items
51 $items = $module->get_items('local');
52 $items = $module->apply_module_filters('acfe/module/register_items', $items);
53
54 // loop items
55 foreach($items as $item){
56
57 // cleanup keys (ID, local, _valid...)
58 $item = $module->prepare_item_for_export($item);
59
60 // filters
61 $item = $module->apply_module_filters('acfe/module/register_item_args', $item);
62
63 // bail early
64 if($item === false){
65 continue;
66 }
67
68 // bail early
69 if(!$item['active']){
70 continue;
71 }
72
73 // actions
74 $module->do_module_action('acfe/module/register_item', $item);
75
76 }
77
78 }
79
80 }
81
82
83 /**
84 * register_post_types
85 */
86 function register_post_types(){
87
88 // get all modules
89 $modules = acfe_get_modules();
90
91 // loop modules
92 foreach($modules as $module){
93
94 // check active
95 if(!$module->is_active()){
96 continue;
97 }
98
99 // capability
100 $capability = acf_get_setting('show_admin') ? acf_get_setting('capability') : false;
101
102 // arguments
103 $args = wp_parse_args($module->args, array(
104 'label' => '',
105 'labels' => array(),
106 'supports' => array('title'),
107 'hierarchical' => false,
108 'public' => false,
109 'show_ui' => true,
110 'show_in_menu' => false,
111 'menu_icon' => 'dashicons-layout',
112 'show_in_admin_bar' => false,
113 'show_in_nav_menus' => false,
114 'can_export' => false,
115 'has_archive' => false,
116 'rewrite' => false,
117 'exclude_from_search' => true,
118 'publicly_queryable' => false,
119 'capabilities' => array(
120 'publish_posts' => $capability,
121 'edit_posts' => $capability,
122 'edit_others_posts' => $capability,
123 'delete_posts' => $capability,
124 'delete_others_posts' => $capability,
125 'read_private_posts' => $capability,
126 'edit_post' => $capability,
127 'delete_post' => $capability,
128 'read_post' => $capability,
129 ),
130 'acfe_admin_orderby' => 'title',
131 'acfe_admin_order' => 'ASC',
132 'acfe_admin_ppp' => 999,
133 ));
134
135 // register post type
136 register_post_type($module->post_type, $args);
137
138 }
139
140 }
141
142 }
143
144 acf_new_instance('acfe_module_manager');
145
146 endif;