acf-extended
Last commit date
assets
6 months ago
includes
6 months ago
lang
6 months ago
acf-extended.php
6 months ago
readme.txt
6 months ago
acf-extended.php
489 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.9.2.2 |
| 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.9.2.2'; |
| 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-deprecated-functions.php'); |
| 51 | acfe_include('includes/acfe-field-functions.php'); |
| 52 | acfe_include('includes/acfe-field-group-functions.php'); |
| 53 | acfe_include('includes/acfe-file-functions.php'); |
| 54 | acfe_include('includes/acfe-form-functions.php'); |
| 55 | acfe_include('includes/acfe-helper-functions.php'); |
| 56 | acfe_include('includes/acfe-meta-functions.php'); |
| 57 | acfe_include('includes/acfe-post-functions.php'); |
| 58 | acfe_include('includes/acfe-screen-functions.php'); |
| 59 | acfe_include('includes/acfe-template-functions.php'); |
| 60 | acfe_include('includes/acfe-term-functions.php'); |
| 61 | acfe_include('includes/acfe-user-functions.php'); |
| 62 | acfe_include('includes/acfe-wp-functions.php'); |
| 63 | |
| 64 | // compatibility |
| 65 | acfe_include('includes/compatibility.php'); |
| 66 | acfe_include('includes/third-party.php'); |
| 67 | |
| 68 | // load |
| 69 | add_action('acf/include_field_types', array($this, 'load')); |
| 70 | |
| 71 | } |
| 72 | |
| 73 | |
| 74 | /** |
| 75 | * load |
| 76 | * |
| 77 | * acf/include_field_types |
| 78 | */ |
| 79 | function load(){ |
| 80 | |
| 81 | // bail early |
| 82 | if(!acfe_has_acf()){ |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | // vars |
| 87 | $theme_path = acf_get_setting('acfe/theme_path', get_stylesheet_directory()); |
| 88 | $theme_url = acf_get_setting('acfe/theme_url', get_stylesheet_directory_uri()); |
| 89 | |
| 90 | // settings |
| 91 | $this->settings(array( |
| 92 | |
| 93 | // general |
| 94 | 'url' => plugin_dir_url(__FILE__), |
| 95 | 'theme_path' => $theme_path, |
| 96 | 'theme_url' => $theme_url, |
| 97 | 'theme_folder' => parse_url($theme_url, PHP_URL_PATH), |
| 98 | 'reserved_post_types' => array('acf-field', 'acf-field-group'), |
| 99 | 'reserved_taxonomies' => array('acf-field-group-category'), |
| 100 | 'reserved_field_groups' => array(), |
| 101 | |
| 102 | // php |
| 103 | 'php' => true, |
| 104 | 'php_save' => "{$theme_path}/acfe-php", |
| 105 | 'php_load' => array("{$theme_path}/acfe-php"), |
| 106 | 'php_found' => false, |
| 107 | |
| 108 | // json |
| 109 | 'json' => acf_get_setting('json'), |
| 110 | 'json_save' => acf_get_setting('save_json'), |
| 111 | 'json_load' => acf_get_setting('load_json'), |
| 112 | 'json_found' => false, |
| 113 | |
| 114 | // modules |
| 115 | 'dev' => false, |
| 116 | 'modules/author' => true, |
| 117 | 'modules/categories' => true, |
| 118 | 'modules/block_types' => true, |
| 119 | 'modules/forms' => true, |
| 120 | 'modules/forms/top_level' => false, |
| 121 | 'modules/options_pages' => true, |
| 122 | 'modules/post_types' => true, |
| 123 | 'modules/taxonomies' => true, |
| 124 | 'modules/multilang' => true, |
| 125 | 'modules/options' => true, |
| 126 | 'modules/performance' => false, |
| 127 | 'modules/ui' => true, |
| 128 | 'modules/attachment_ui' => true, |
| 129 | 'modules/settings_ui' => true, |
| 130 | 'modules/term_ui' => true, |
| 131 | 'modules/user_ui' => true, |
| 132 | |
| 133 | // fields |
| 134 | 'field/recaptcha/site_key' => '', |
| 135 | 'field/recaptcha/secret_key' => '', |
| 136 | 'field/recaptcha/version' => '', |
| 137 | 'field/recaptcha/v2/theme' => '', |
| 138 | 'field/recaptcha/v2/size' => '', |
| 139 | 'field/recaptcha/v3/hide_logo' => '', |
| 140 | 'compatibility/legacy_title_toggle' => false, |
| 141 | |
| 142 | )); |
| 143 | |
| 144 | // load textdomain |
| 145 | acfe_load_textdomain(); |
| 146 | |
| 147 | // includes |
| 148 | add_action('acf/init', array($this, 'init'), 99); |
| 149 | add_action('acf/include_fields', array($this, 'include_fields'), 5); |
| 150 | add_action('acf/include_field_types', array($this, 'include_field_types'), 99); |
| 151 | add_action('acf/include_admin_tools', array($this, 'include_admin_tools')); |
| 152 | add_action('acf/include_admin_tools', array($this, 'include_admin_tools_late'), 20); |
| 153 | |
| 154 | // compatibility |
| 155 | acfe_include('includes/compatibility-acf-6.0.php'); |
| 156 | acfe_include('includes/compatibility-acf-6.4.php'); |
| 157 | acfe_include('includes/compatibility-acf-6.5.php'); |
| 158 | |
| 159 | // admin |
| 160 | acfe_include('includes/admin/menu.php'); |
| 161 | acfe_include('includes/admin/plugins.php'); |
| 162 | acfe_include('includes/admin/settings.php'); |
| 163 | |
| 164 | // core |
| 165 | acfe_include('includes/field.php'); |
| 166 | acfe_include('includes/field-extend.php'); |
| 167 | acfe_include('includes/local-meta.php'); |
| 168 | acfe_include('includes/multilang.php'); |
| 169 | acfe_include('includes/settings.php'); |
| 170 | acfe_include('includes/template-tags.php'); |
| 171 | acfe_include('includes/upgrades.php'); |
| 172 | |
| 173 | // module |
| 174 | acfe_include('includes/module.php'); |
| 175 | acfe_include('includes/module-acf.php'); |
| 176 | acfe_include('includes/module-db.php'); |
| 177 | acfe_include('includes/module-l10n.php'); |
| 178 | acfe_include('includes/module-manager.php'); |
| 179 | acfe_include('includes/module-post.php'); |
| 180 | acfe_include('includes/module-posts.php'); |
| 181 | acfe_include('includes/module-upgrades.php'); |
| 182 | |
| 183 | // block type |
| 184 | acfe_include('includes/modules/block-type/module-block-type.php'); |
| 185 | acfe_include('includes/modules/block-type/module-block-type-fields.php'); |
| 186 | acfe_include('includes/modules/block-type/module-block-type-upgrades.php'); |
| 187 | |
| 188 | // form |
| 189 | acfe_include('includes/modules/form/module-form.php'); |
| 190 | acfe_include('includes/modules/form/module-form-action.php'); |
| 191 | acfe_include('includes/modules/form/module-form-action-custom.php'); |
| 192 | acfe_include('includes/modules/form/module-form-action-email.php'); |
| 193 | acfe_include('includes/modules/form/module-form-action-post.php'); |
| 194 | acfe_include('includes/modules/form/module-form-action-redirect.php'); |
| 195 | acfe_include('includes/modules/form/module-form-action-term.php'); |
| 196 | acfe_include('includes/modules/form/module-form-action-user.php'); |
| 197 | acfe_include('includes/modules/form/module-form-compatibility.php'); |
| 198 | acfe_include('includes/modules/form/module-form-deprecated.php'); |
| 199 | acfe_include('includes/modules/form/module-form-fields.php'); |
| 200 | acfe_include('includes/modules/form/module-form-format.php'); |
| 201 | acfe_include('includes/modules/form/module-form-front.php'); |
| 202 | acfe_include('includes/modules/form/module-form-front-hooks.php'); |
| 203 | acfe_include('includes/modules/form/module-form-front-render.php'); |
| 204 | acfe_include('includes/modules/form/module-form-shortcode.php'); |
| 205 | acfe_include('includes/modules/form/module-form-upgrades.php'); |
| 206 | |
| 207 | // performance |
| 208 | acfe_include('includes/modules/performance/module-performance.php'); |
| 209 | acfe_include('includes/modules/performance/module-performance-connector.php'); |
| 210 | acfe_include('includes/modules/performance/module-performance-functions.php'); |
| 211 | acfe_include('includes/modules/performance/module-performance-ui.php'); |
| 212 | acfe_include('includes/modules/performance/module-performance-upgrades.php'); |
| 213 | |
| 214 | // options page |
| 215 | acfe_include('includes/modules/options-page/module-options-page.php'); |
| 216 | acfe_include('includes/modules/options-page/module-options-page-fields.php'); |
| 217 | acfe_include('includes/modules/options-page/module-options-page-features.php'); |
| 218 | acfe_include('includes/modules/options-page/module-options-page-upgrades.php'); |
| 219 | |
| 220 | // post type |
| 221 | acfe_include('includes/modules/post-type/module-post-type.php'); |
| 222 | acfe_include('includes/modules/post-type/module-post-type-fields.php'); |
| 223 | acfe_include('includes/modules/post-type/module-post-type-features.php'); |
| 224 | acfe_include('includes/modules/post-type/module-post-type-upgrades.php'); |
| 225 | |
| 226 | // taxonomy |
| 227 | acfe_include('includes/modules/taxonomy/module-taxonomy.php'); |
| 228 | acfe_include('includes/modules/taxonomy/module-taxonomy-fields.php'); |
| 229 | acfe_include('includes/modules/taxonomy/module-taxonomy-features.php'); |
| 230 | acfe_include('includes/modules/taxonomy/module-taxonomy-upgrades.php'); |
| 231 | |
| 232 | // screens |
| 233 | acfe_include('includes/screens/screen-attachment.php'); |
| 234 | acfe_include('includes/screens/screen-options-page.php'); |
| 235 | acfe_include('includes/screens/screen-post.php'); |
| 236 | acfe_include('includes/screens/screen-settings.php'); |
| 237 | acfe_include('includes/screens/screen-taxonomy.php'); |
| 238 | acfe_include('includes/screens/screen-user.php'); |
| 239 | |
| 240 | } |
| 241 | |
| 242 | |
| 243 | /** |
| 244 | * init |
| 245 | * |
| 246 | * acf/init:99 |
| 247 | */ |
| 248 | function init(){ |
| 249 | |
| 250 | // action |
| 251 | do_action('acfe/init'); |
| 252 | |
| 253 | // core |
| 254 | acfe_include('includes/assets.php'); |
| 255 | acfe_include('includes/hooks.php'); |
| 256 | |
| 257 | // fields |
| 258 | acfe_include('includes/fields/field-checkbox.php'); |
| 259 | acfe_include('includes/fields/field-clone.php'); |
| 260 | acfe_include('includes/fields/field-file.php'); |
| 261 | acfe_include('includes/fields/field-flexible-content.php'); |
| 262 | acfe_include('includes/fields/field-group.php'); |
| 263 | acfe_include('includes/fields/field-image.php'); |
| 264 | acfe_include('includes/fields/field-relationship.php'); |
| 265 | acfe_include('includes/fields/field-post-object.php'); |
| 266 | acfe_include('includes/fields/field-radio.php'); |
| 267 | acfe_include('includes/fields/field-repeater.php'); |
| 268 | acfe_include('includes/fields/field-select.php'); |
| 269 | acfe_include('includes/fields/field-textarea.php'); |
| 270 | acfe_include('includes/fields/field-taxonomy.php'); |
| 271 | acfe_include('includes/fields/field-user.php'); |
| 272 | acfe_include('includes/fields/field-wysiwyg.php'); |
| 273 | |
| 274 | // fields settings |
| 275 | acfe_include('includes/fields-settings/bidirectional.php'); |
| 276 | acfe_include('includes/fields-settings/choices-label.php'); |
| 277 | acfe_include('includes/fields-settings/data.php'); |
| 278 | acfe_include('includes/fields-settings/instructions.php'); |
| 279 | acfe_include('includes/fields-settings/permissions.php'); |
| 280 | acfe_include('includes/fields-settings/settings.php'); |
| 281 | acfe_include('includes/fields-settings/validation.php'); |
| 282 | |
| 283 | // field groups |
| 284 | acfe_include('includes/field-groups/field-group.php'); |
| 285 | acfe_include('includes/field-groups/field-group-advanced.php'); |
| 286 | acfe_include('includes/field-groups/field-group-category.php'); |
| 287 | acfe_include('includes/field-groups/field-group-display-title.php'); |
| 288 | acfe_include('includes/field-groups/field-group-hide-on-screen.php'); |
| 289 | acfe_include('includes/field-groups/field-group-instruction-placement.php'); |
| 290 | acfe_include('includes/field-groups/field-group-meta.php'); |
| 291 | acfe_include('includes/field-groups/field-group-permissions.php'); |
| 292 | acfe_include('includes/field-groups/field-groups.php'); |
| 293 | acfe_include('includes/field-groups/field-groups-local.php'); |
| 294 | acfe_include('includes/field-groups/field-types.php'); |
| 295 | |
| 296 | // locations |
| 297 | acfe_include('includes/locations/post-type-all.php'); |
| 298 | acfe_include('includes/locations/post-type-archive.php'); |
| 299 | acfe_include('includes/locations/post-type-list.php'); |
| 300 | acfe_include('includes/locations/taxonomy-list.php'); |
| 301 | |
| 302 | // modules |
| 303 | acfe_include('includes/modules/author.php'); |
| 304 | acfe_include('includes/modules/dev/module-dev.php'); |
| 305 | acfe_include('includes/modules/dev/module-dev-delete-meta.php'); |
| 306 | acfe_include('includes/modules/option/module-option.php'); |
| 307 | acfe_include('includes/modules/ui/module-ui.php'); |
| 308 | acfe_include('includes/modules/ui/module-ui-attachment.php'); |
| 309 | acfe_include('includes/modules/ui/module-ui-settings.php'); |
| 310 | acfe_include('includes/modules/ui/module-ui-term.php'); |
| 311 | acfe_include('includes/modules/ui/module-ui-user.php'); |
| 312 | |
| 313 | // performance |
| 314 | acfe_include('includes/modules/performance/module-performance-ultra.php'); |
| 315 | acfe_include('includes/modules/performance/module-performance-ultra-fields.php'); |
| 316 | acfe_include('includes/modules/performance/module-performance-ultra-revisions.php'); |
| 317 | |
| 318 | } |
| 319 | |
| 320 | |
| 321 | /** |
| 322 | * include_fields |
| 323 | * |
| 324 | * acf/include_fields:5 |
| 325 | */ |
| 326 | function include_fields(){ |
| 327 | |
| 328 | // autosync |
| 329 | acfe_include('includes/modules/autosync-php.php'); |
| 330 | acfe_include('includes/modules/autosync-json.php'); |
| 331 | |
| 332 | } |
| 333 | |
| 334 | |
| 335 | /** |
| 336 | * include_field_types |
| 337 | * |
| 338 | * acf/include_field_types:99 |
| 339 | */ |
| 340 | function include_field_types(){ |
| 341 | |
| 342 | acfe_include('includes/fields/field-advanced-link.php'); |
| 343 | acfe_include('includes/fields/field-button.php'); |
| 344 | acfe_include('includes/fields/field-code-editor.php'); |
| 345 | acfe_include('includes/fields/field-column.php'); |
| 346 | acfe_include('includes/fields/field-dynamic-render.php'); |
| 347 | acfe_include('includes/fields/field-forms.php'); |
| 348 | acfe_include('includes/fields/field-hidden.php'); |
| 349 | acfe_include('includes/fields/field-post-statuses.php'); |
| 350 | acfe_include('includes/fields/field-post-types.php'); |
| 351 | acfe_include('includes/fields/field-recaptcha.php'); |
| 352 | acfe_include('includes/fields/field-slug.php'); |
| 353 | acfe_include('includes/fields/field-taxonomies.php'); |
| 354 | acfe_include('includes/fields/field-taxonomy-terms.php'); |
| 355 | acfe_include('includes/fields/field-user-roles.php'); |
| 356 | |
| 357 | } |
| 358 | |
| 359 | |
| 360 | /** |
| 361 | * include_admin_tools |
| 362 | * |
| 363 | * acf/include_admin_tools |
| 364 | */ |
| 365 | function include_admin_tools(){ |
| 366 | |
| 367 | // modules |
| 368 | acfe_include('includes/admin/tools/module-export.php'); |
| 369 | acfe_include('includes/admin/tools/module-import.php'); |
| 370 | |
| 371 | } |
| 372 | |
| 373 | |
| 374 | /** |
| 375 | * include_admin_tools_late |
| 376 | * |
| 377 | * acf/include_admin_tools:99 |
| 378 | */ |
| 379 | function include_admin_tools_late(){ |
| 380 | |
| 381 | // field groups |
| 382 | acfe_include('includes/admin/tools/field-groups-local.php'); |
| 383 | acfe_include('includes/admin/tools/field-groups-export.php'); |
| 384 | |
| 385 | } |
| 386 | |
| 387 | |
| 388 | /** |
| 389 | * constants |
| 390 | * |
| 391 | * @param $array |
| 392 | */ |
| 393 | function constants($array = array()){ |
| 394 | |
| 395 | foreach($array as $name => $value){ |
| 396 | if(!defined($name)){ |
| 397 | define($name, $value); |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | } |
| 402 | |
| 403 | |
| 404 | /** |
| 405 | * settings |
| 406 | * |
| 407 | * @param $array |
| 408 | */ |
| 409 | function settings($array = array()){ |
| 410 | |
| 411 | foreach($array as $name => $value){ |
| 412 | |
| 413 | // acf_update_setting |
| 414 | acf_update_setting("acfe/{$name}", $value); |
| 415 | |
| 416 | // acf_get_setting |
| 417 | add_filter("acf/settings/acfe/{$name}", function($value) use($name){ |
| 418 | return apply_filters("acfe/settings/{$name}", $value); |
| 419 | }, 5); |
| 420 | |
| 421 | } |
| 422 | |
| 423 | } |
| 424 | |
| 425 | } |
| 426 | |
| 427 | |
| 428 | /** |
| 429 | * acfe |
| 430 | * |
| 431 | * @return ACFE |
| 432 | */ |
| 433 | function acfe(){ |
| 434 | |
| 435 | global $acfe; |
| 436 | |
| 437 | if(!isset($acfe)){ |
| 438 | |
| 439 | $acfe = new ACFE(); |
| 440 | $acfe->initialize(); |
| 441 | |
| 442 | } |
| 443 | |
| 444 | return $acfe; |
| 445 | |
| 446 | } |
| 447 | |
| 448 | acfe(); |
| 449 | |
| 450 | else: |
| 451 | |
| 452 | add_action('after_plugin_row_' . plugin_basename(__FILE__), function($plugin_file, $plugin_data, $status){ |
| 453 | |
| 454 | // vars |
| 455 | $colspan = version_compare($GLOBALS['wp_version'], '5.5', '<') ? 3 : 4; |
| 456 | $pro = defined('ACFE_PRO') && ACFE_PRO; |
| 457 | |
| 458 | // message |
| 459 | $message = __('An another version of ACF Extended has been detected. Please activate only one version.', 'acfe'); |
| 460 | if($pro){ |
| 461 | $message = __('ACF Extended Pro has been detected. Please activate only one version.', 'acfe'); |
| 462 | } |
| 463 | |
| 464 | // class |
| 465 | $class = 'acfe-plugin-tr'; |
| 466 | if(isset($plugin_data['update']) && !empty($plugin_data['update'])){ |
| 467 | $class .= ' acfe-plugin-tr-update'; |
| 468 | } |
| 469 | |
| 470 | ?> |
| 471 | <style> |
| 472 | .plugins tr[data-plugin='<?php echo $plugin_file; ?>'] th, |
| 473 | .plugins tr[data-plugin='<?php echo $plugin_file; ?>'] td{ |
| 474 | box-shadow:none; |
| 475 | } |
| 476 | </style> |
| 477 | |
| 478 | <tr class="plugin-update-tr active <?php echo $class; ?>"> |
| 479 | <td colspan="<?php echo $colspan; ?>" class="plugin-update colspanchange"> |
| 480 | <div class="update-message notice inline notice-error notice-alt"> |
| 481 | <p><?php echo $message; ?></p> |
| 482 | </div> |
| 483 | </td> |
| 484 | </tr> |
| 485 | <?php |
| 486 | |
| 487 | }, 5, 3); |
| 488 | |
| 489 | endif; |