acf-extended
Last commit date
assets
3 years ago
includes
3 years ago
lang
3 years ago
acf-extended.php
3 years ago
readme.txt
3 years ago
acf-extended.php
395 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Advanced Custom Fields: Extended |
| 4 | * Description: All-in-one enhancement suite that improves WordPress & Advanced Custom Fields. |
| 5 | * Version: 0.8.8.9 |
| 6 | * Author: ACF Extended |
| 7 | * Plugin URI: https://www.acf-extended.com |
| 8 | * Author URI: https://www.acf-extended.com |
| 9 | * Text Domain: acfe |
| 10 | * Domain Path: /lang |
| 11 | */ |
| 12 | |
| 13 | if(!defined('ABSPATH')){ |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | if(!class_exists('ACFE')): |
| 18 | |
| 19 | class ACFE{ |
| 20 | |
| 21 | // vars |
| 22 | var $version = '0.8.8.9'; |
| 23 | |
| 24 | /** |
| 25 | * construct |
| 26 | */ |
| 27 | function __construct(){ |
| 28 | // ... |
| 29 | } |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * initialize |
| 34 | */ |
| 35 | function initialize(){ |
| 36 | |
| 37 | // Constants |
| 38 | $this->constants(array( |
| 39 | 'ACFE' => true, |
| 40 | 'ACFE_FILE' => __FILE__, |
| 41 | 'ACFE_PATH' => plugin_dir_path(__FILE__), |
| 42 | 'ACFE_VERSION' => $this->version, |
| 43 | 'ACFE_BASENAME' => plugin_basename(__FILE__), |
| 44 | )); |
| 45 | |
| 46 | // Init |
| 47 | include_once(ACFE_PATH . 'includes/init.php'); |
| 48 | |
| 49 | // Functions |
| 50 | acfe_include('includes/acfe-field-functions.php'); |
| 51 | acfe_include('includes/acfe-field-group-functions.php'); |
| 52 | acfe_include('includes/acfe-file-functions.php'); |
| 53 | acfe_include('includes/acfe-form-functions.php'); |
| 54 | acfe_include('includes/acfe-helper-functions.php'); |
| 55 | acfe_include('includes/acfe-meta-functions.php'); |
| 56 | acfe_include('includes/acfe-post-functions.php'); |
| 57 | acfe_include('includes/acfe-screen-functions.php'); |
| 58 | acfe_include('includes/acfe-template-functions.php'); |
| 59 | acfe_include('includes/acfe-term-functions.php'); |
| 60 | acfe_include('includes/acfe-user-functions.php'); |
| 61 | acfe_include('includes/acfe-wp-functions.php'); |
| 62 | |
| 63 | // Compatibility |
| 64 | acfe_include('includes/compatibility.php'); |
| 65 | acfe_include('includes/third-party.php'); |
| 66 | |
| 67 | // Load |
| 68 | add_action('acf/include_field_types', array($this, 'load')); |
| 69 | |
| 70 | } |
| 71 | |
| 72 | |
| 73 | /** |
| 74 | * load |
| 75 | * |
| 76 | * acf/include_field_types |
| 77 | */ |
| 78 | function load(){ |
| 79 | |
| 80 | // Bail early |
| 81 | if(!acfe_has_acf()){ |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | // Vars |
| 86 | $theme_path = acf_get_setting('acfe/theme_path', get_stylesheet_directory()); |
| 87 | $theme_url = acf_get_setting('acfe/theme_url', get_stylesheet_directory_uri()); |
| 88 | $reserved_post_types = array('acf-field', 'acf-field-group', 'acfe-dbt', 'acfe-form', 'acfe-dop', 'acfe-dpt', 'acfe-dt'); |
| 89 | $reserved_taxonomies = array('acf-field-group-category'); |
| 90 | $reserved_field_groups = array( |
| 91 | 'group_acfe_dynamic_block_type', |
| 92 | 'group_acfe_dynamic_form', |
| 93 | 'group_acfe_dynamic_options_page', |
| 94 | 'group_acfe_dynamic_post_type', |
| 95 | 'group_acfe_dynamic_taxonomy', |
| 96 | ); |
| 97 | |
| 98 | // Settings |
| 99 | $this->settings(array( |
| 100 | |
| 101 | // General |
| 102 | 'url' => plugin_dir_url(__FILE__), |
| 103 | 'theme_path' => $theme_path, |
| 104 | 'theme_url' => $theme_url, |
| 105 | 'theme_folder' => parse_url($theme_url, PHP_URL_PATH), |
| 106 | 'reserved_post_types' => $reserved_post_types, |
| 107 | 'reserved_taxonomies' => $reserved_taxonomies, |
| 108 | 'reserved_field_groups' => $reserved_field_groups, |
| 109 | |
| 110 | // Php |
| 111 | 'php' => true, |
| 112 | 'php_save' => "{$theme_path}/acfe-php", |
| 113 | 'php_load' => array("{$theme_path}/acfe-php"), |
| 114 | 'php_found' => false, |
| 115 | |
| 116 | // Json |
| 117 | 'json' => acf_get_setting('json'), |
| 118 | 'json_save' => acf_get_setting('save_json'), |
| 119 | 'json_load' => acf_get_setting('load_json'), |
| 120 | 'json_found' => false, |
| 121 | |
| 122 | // Modules |
| 123 | 'dev' => false, |
| 124 | 'modules/author' => true, |
| 125 | 'modules/categories' => true, |
| 126 | 'modules/block_types' => true, |
| 127 | 'modules/forms' => true, |
| 128 | 'modules/options_pages' => true, |
| 129 | 'modules/post_types' => true, |
| 130 | 'modules/taxonomies' => true, |
| 131 | 'modules/multilang' => true, |
| 132 | 'modules/options' => true, |
| 133 | 'modules/single_meta' => false, |
| 134 | 'modules/ui' => true, |
| 135 | |
| 136 | // Fields |
| 137 | 'field/recaptcha/site_key' => null, |
| 138 | 'field/recaptcha/secret_key' => null, |
| 139 | 'field/recaptcha/version' => null, |
| 140 | 'field/recaptcha/v2/theme' => null, |
| 141 | 'field/recaptcha/v2/size' => null, |
| 142 | 'field/recaptcha/v3/hide_logo' => null, |
| 143 | |
| 144 | )); |
| 145 | |
| 146 | // Load textdomain file |
| 147 | acfe_load_textdomain(); |
| 148 | |
| 149 | // Includes |
| 150 | add_action('acf/init', array($this, 'init'), 99); |
| 151 | add_action('acf/include_fields', array($this, 'include_fields'), 5); |
| 152 | add_action('acf/include_field_types', array($this, 'include_field_types'), 99); |
| 153 | add_action('acf/include_admin_tools', array($this, 'include_admin_tools')); |
| 154 | add_action('acf/include_admin_tools', array($this, 'include_admin_tools_late'), 20); |
| 155 | |
| 156 | // Admin |
| 157 | acfe_include('includes/admin/compatibility.php'); |
| 158 | acfe_include('includes/admin/menu.php'); |
| 159 | acfe_include('includes/admin/plugins.php'); |
| 160 | acfe_include('includes/admin/settings.php'); |
| 161 | |
| 162 | // Core |
| 163 | acfe_include('includes/field.php'); |
| 164 | acfe_include('includes/field-extend.php'); |
| 165 | acfe_include('includes/local-meta.php'); |
| 166 | acfe_include('includes/multilang.php'); |
| 167 | acfe_include('includes/settings.php'); |
| 168 | acfe_include('includes/upgrades.php'); |
| 169 | |
| 170 | // Screens |
| 171 | acfe_include('includes/screens/screen-attachment.php'); |
| 172 | acfe_include('includes/screens/screen-options-page.php'); |
| 173 | acfe_include('includes/screens/screen-post.php'); |
| 174 | acfe_include('includes/screens/screen-settings.php'); |
| 175 | acfe_include('includes/screens/screen-taxonomy.php'); |
| 176 | acfe_include('includes/screens/screen-user.php'); |
| 177 | |
| 178 | } |
| 179 | |
| 180 | |
| 181 | /** |
| 182 | * init |
| 183 | * |
| 184 | * acf/init:99 |
| 185 | */ |
| 186 | function init(){ |
| 187 | |
| 188 | // Action |
| 189 | do_action('acfe/init'); |
| 190 | |
| 191 | // Core |
| 192 | acfe_include('includes/assets.php'); |
| 193 | acfe_include('includes/hooks.php'); |
| 194 | |
| 195 | // Fields |
| 196 | acfe_include('includes/fields/field-checkbox.php'); |
| 197 | acfe_include('includes/fields/field-clone.php'); |
| 198 | acfe_include('includes/fields/field-file.php'); |
| 199 | acfe_include('includes/fields/field-flexible-content.php'); |
| 200 | acfe_include('includes/fields/field-group.php'); |
| 201 | acfe_include('includes/fields/field-image.php'); |
| 202 | acfe_include('includes/fields/field-post-object.php'); |
| 203 | acfe_include('includes/fields/field-repeater.php'); |
| 204 | acfe_include('includes/fields/field-select.php'); |
| 205 | acfe_include('includes/fields/field-textarea.php'); |
| 206 | acfe_include('includes/fields/field-wysiwyg.php'); |
| 207 | |
| 208 | //Fields Settings |
| 209 | acfe_include('includes/fields-settings/bidirectional.php'); |
| 210 | acfe_include('includes/fields-settings/data.php'); |
| 211 | acfe_include('includes/fields-settings/instructions.php'); |
| 212 | acfe_include('includes/fields-settings/permissions.php'); |
| 213 | acfe_include('includes/fields-settings/settings.php'); |
| 214 | acfe_include('includes/fields-settings/validation.php'); |
| 215 | |
| 216 | //Field Groups |
| 217 | acfe_include('includes/field-groups/field-group.php'); |
| 218 | acfe_include('includes/field-groups/field-group-advanced.php'); |
| 219 | acfe_include('includes/field-groups/field-group-category.php'); |
| 220 | acfe_include('includes/field-groups/field-group-display-title.php'); |
| 221 | acfe_include('includes/field-groups/field-group-hide-on-screen.php'); |
| 222 | acfe_include('includes/field-groups/field-group-instruction-placement.php'); |
| 223 | acfe_include('includes/field-groups/field-group-meta.php'); |
| 224 | acfe_include('includes/field-groups/field-group-permissions.php'); |
| 225 | acfe_include('includes/field-groups/field-groups.php'); |
| 226 | acfe_include('includes/field-groups/field-groups-local.php'); |
| 227 | |
| 228 | // Locations |
| 229 | acfe_include('includes/locations/post-type-all.php'); |
| 230 | acfe_include('includes/locations/post-type-archive.php'); |
| 231 | acfe_include('includes/locations/post-type-list.php'); |
| 232 | acfe_include('includes/locations/taxonomy-list.php'); |
| 233 | |
| 234 | // Modules |
| 235 | acfe_include('includes/modules/module.php'); |
| 236 | acfe_include('includes/modules/author.php'); |
| 237 | acfe_include('includes/modules/dev.php'); |
| 238 | acfe_include('includes/modules/dev-clean-meta.php'); |
| 239 | acfe_include('includes/modules/dev-delete-meta.php'); |
| 240 | acfe_include('includes/modules/block-types.php'); |
| 241 | acfe_include('includes/modules/forms.php'); |
| 242 | acfe_include('includes/modules/options.php'); |
| 243 | acfe_include('includes/modules/options-pages.php'); |
| 244 | acfe_include('includes/modules/post-types.php'); |
| 245 | acfe_include('includes/modules/taxonomies.php'); |
| 246 | acfe_include('includes/modules/single-meta.php'); |
| 247 | acfe_include('includes/modules/ui.php'); |
| 248 | acfe_include('includes/modules/ui-attachment.php'); |
| 249 | acfe_include('includes/modules/ui-settings.php'); |
| 250 | acfe_include('includes/modules/ui-term.php'); |
| 251 | acfe_include('includes/modules/ui-user.php'); |
| 252 | |
| 253 | } |
| 254 | |
| 255 | |
| 256 | /** |
| 257 | * include_fields |
| 258 | * |
| 259 | * acf/include_fields:5 |
| 260 | */ |
| 261 | function include_fields(){ |
| 262 | |
| 263 | // AutoSync |
| 264 | acfe_include('includes/modules/autosync.php'); |
| 265 | |
| 266 | } |
| 267 | |
| 268 | |
| 269 | /** |
| 270 | * include_field_types |
| 271 | * |
| 272 | * acf/include_field_types:99 |
| 273 | */ |
| 274 | function include_field_types(){ |
| 275 | |
| 276 | acfe_include('includes/fields/field-advanced-link.php'); |
| 277 | acfe_include('includes/fields/field-button.php'); |
| 278 | acfe_include('includes/fields/field-code-editor.php'); |
| 279 | acfe_include('includes/fields/field-column.php'); |
| 280 | acfe_include('includes/fields/field-dynamic-render.php'); |
| 281 | acfe_include('includes/fields/field-forms.php'); |
| 282 | acfe_include('includes/fields/field-hidden.php'); |
| 283 | acfe_include('includes/fields/field-post-statuses.php'); |
| 284 | acfe_include('includes/fields/field-post-types.php'); |
| 285 | acfe_include('includes/fields/field-recaptcha.php'); |
| 286 | acfe_include('includes/fields/field-slug.php'); |
| 287 | acfe_include('includes/fields/field-taxonomies.php'); |
| 288 | acfe_include('includes/fields/field-taxonomy-terms.php'); |
| 289 | acfe_include('includes/fields/field-user-roles.php'); |
| 290 | |
| 291 | } |
| 292 | |
| 293 | |
| 294 | /** |
| 295 | * include_admin_tools |
| 296 | * |
| 297 | * acf/include_admin_tools |
| 298 | */ |
| 299 | function include_admin_tools(){ |
| 300 | |
| 301 | // Modules |
| 302 | acfe_include('includes/admin/tools/module-export.php'); |
| 303 | acfe_include('includes/admin/tools/module-import.php'); |
| 304 | |
| 305 | acfe_include('includes/admin/tools/post-types-export.php'); |
| 306 | acfe_include('includes/admin/tools/post-types-import.php'); |
| 307 | acfe_include('includes/admin/tools/taxonomies-export.php'); |
| 308 | acfe_include('includes/admin/tools/taxonomies-import.php'); |
| 309 | acfe_include('includes/admin/tools/options-pages-export.php'); |
| 310 | acfe_include('includes/admin/tools/options-pages-import.php'); |
| 311 | acfe_include('includes/admin/tools/block-types-export.php'); |
| 312 | acfe_include('includes/admin/tools/block-types-import.php'); |
| 313 | acfe_include('includes/admin/tools/forms-export.php'); |
| 314 | acfe_include('includes/admin/tools/forms-import.php'); |
| 315 | |
| 316 | } |
| 317 | |
| 318 | |
| 319 | /** |
| 320 | * include_admin_tools_late |
| 321 | * |
| 322 | * acf/include_admin_tools:99 |
| 323 | */ |
| 324 | function include_admin_tools_late(){ |
| 325 | |
| 326 | // Field Groups |
| 327 | acfe_include('includes/admin/tools/field-groups-local.php'); |
| 328 | acfe_include('includes/admin/tools/field-groups-export.php'); |
| 329 | |
| 330 | } |
| 331 | |
| 332 | |
| 333 | /** |
| 334 | * constants |
| 335 | * |
| 336 | * @param $array |
| 337 | */ |
| 338 | function constants($array = array()){ |
| 339 | |
| 340 | foreach($array as $name => $value){ |
| 341 | if(!defined($name)){ |
| 342 | define($name, $value); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | } |
| 347 | |
| 348 | |
| 349 | /** |
| 350 | * settings |
| 351 | * |
| 352 | * @param $array |
| 353 | */ |
| 354 | function settings($array = array()){ |
| 355 | |
| 356 | foreach($array as $name => $value){ |
| 357 | |
| 358 | // update |
| 359 | acf_update_setting("acfe/{$name}", $value); |
| 360 | |
| 361 | // filter |
| 362 | add_filter("acf/settings/acfe/{$name}", function($value) use($name){ |
| 363 | return apply_filters("acfe/settings/{$name}", $value); |
| 364 | }, 5); |
| 365 | |
| 366 | } |
| 367 | |
| 368 | } |
| 369 | |
| 370 | } |
| 371 | |
| 372 | |
| 373 | /** |
| 374 | * acfe |
| 375 | * |
| 376 | * @return ACFE |
| 377 | */ |
| 378 | function acfe(){ |
| 379 | |
| 380 | global $acfe; |
| 381 | |
| 382 | if(!isset($acfe)){ |
| 383 | |
| 384 | $acfe = new ACFE(); |
| 385 | $acfe->initialize(); |
| 386 | |
| 387 | } |
| 388 | |
| 389 | return $acfe; |
| 390 | |
| 391 | } |
| 392 | |
| 393 | acfe(); |
| 394 | |
| 395 | endif; |