class-redux-enqueue.php (23070B)
1 <?php 2 /** 3 * Redux Primary Enqueue Class 4 * 5 * @class Redux_Core 6 * @version 4.0.0 7 * @package Redux Framework/Classes 8 */ 9 10 defined( 'ABSPATH' ) || exit; 11 12 if ( ! class_exists( 'Redux_Enqueue', false ) ) { 13 14 /** 15 * Class Redux_Enqueue 16 */ 17 class Redux_Enqueue extends Redux_Class { 18 19 /** 20 * Data to localize. 21 * 22 * @var array 23 */ 24 public $localize_data = array(); 25 26 /** 27 * Min string for .min files. 28 * 29 * @var string 30 */ 31 private $min = ''; 32 33 /** 34 * Timestamp for file versions. 35 * 36 * @var string 37 */ 38 private $timestamp = ''; 39 40 /** 41 * Localize data required for the repeater extension. 42 * 43 * @var array 44 */ 45 private $repeater_data = array(); 46 47 /** 48 * Redux_Enqueue constructor. 49 * 50 * @param object $parent ReduxFramework pointer. 51 */ 52 public function __construct( $parent ) { 53 parent::__construct( $parent ); 54 55 // Enqueue the admin page CSS and JS. 56 if ( isset( $_GET['page'] ) && $_GET['page'] === $parent->args['page_slug'] ) { // phpcs:ignore WordPress.Security.NonceVerification 57 add_action( 'admin_enqueue_scripts', array( $this, 'init' ), 1 ); 58 } 59 60 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_init' ), 10 ); 61 62 // phpcs:ignore WordPress.NamingConventions.ValidHookName 63 do_action( "redux/{$parent->args['opt_name']}/enqueue/construct", $this ); 64 // phpcs:ignore WordPress.NamingConventions.ValidHookName 65 do_action( 'redux/enqueue/construct', $this ); 66 } 67 68 /** 69 * Scripts to enqueue on the frontend 70 */ 71 public function frontend_init() { 72 $core = $this->core(); 73 74 if ( $core->args['elusive_frontend'] ) { 75 wp_enqueue_style( 76 'redux-elusive-icon', 77 Redux_Core::$url . 'assets/css/vendor/elusive-icons.min.css', 78 array(), 79 Redux_Core::$version 80 ); 81 } 82 } 83 84 /** 85 * Class init functions. 86 */ 87 public function init() { 88 $core = $this->core(); 89 90 Redux_Functions::$parent = $core; 91 Redux_CDN::$parent = $core; 92 93 $this->min = Redux_Functions::is_min(); 94 95 $this->timestamp = Redux_Core::$version; 96 if ( $core->args['dev_mode'] ) { 97 $this->timestamp .= '.' . time(); 98 } 99 100 $this->register_styles( $core ); 101 $this->register_scripts( $core ); 102 103 add_thickbox(); 104 105 $this->enqueue_fields( $core ); 106 107 add_filter( "redux/{$core->args['opt_name']}/localize", array( 'Redux_Helpers', 'localize' ) ); 108 109 $this->set_localized_data( $core ); 110 111 /** 112 * Action 'redux/page/{opt_name}/enqueue' 113 */ 114 // phpcs:ignore WordPress.NamingConventions.ValidHookName 115 do_action( "redux/page/{$core->args['opt_name']}/enqueue" ); 116 } 117 118 /** 119 * Register all core framework styles. 120 * 121 * @param object $core ReduxFramework object. 122 */ 123 private function register_styles( $core ) { 124 125 // ***************************************************************** 126 // Redux Admin CSS 127 // ***************************************************************** 128 if ( 'wordpress' === $core->args['admin_theme'] || 'wp' === $core->args['admin_theme'] ) { // phpcs:ignore WordPress.WP.CapitalPDangit 129 $color_scheme = get_user_option( 'admin_color' ); 130 } elseif ( 'classic' === $core->args['admin_theme'] || '' === $core->args['admin_theme'] ) { 131 $color_scheme = 'classic'; 132 } else { 133 $color_scheme = $core->args['admin_theme']; 134 } 135 136 if ( ! file_exists( Redux_Core::$dir . "assets/css/colors/$color_scheme/colors$this->min.css" ) ) { 137 $color_scheme = 'fresh'; 138 } 139 140 $css = Redux_Core::$url . "assets/css/colors/$color_scheme/colors$this->min.css"; 141 142 // phpcs:ignore WordPress.NamingConventions.ValidHookName 143 $css = apply_filters( 'redux/enqueue/' . $core->args['opt_name'] . '/args/admin_theme/css_url', $css ); 144 145 wp_register_style( 146 'redux-admin-theme-css', 147 $css, 148 array(), 149 $this->timestamp 150 ); 151 152 wp_enqueue_style( 153 'redux-admin-css', 154 Redux_Core::$url . "assets/css/redux-admin$this->min.css", 155 array( 'redux-admin-theme-css' ), 156 $this->timestamp 157 ); 158 159 // ***************************************************************** 160 // Redux Fields CSS 161 // ***************************************************************** 162 if ( ! $core->args['dev_mode'] ) { 163 wp_enqueue_style( 164 'redux-fields-css', 165 Redux_Core::$url . 'assets/css/redux-fields.min.css', 166 array(), 167 $this->timestamp 168 ); 169 } 170 171 // ***************************************************************** 172 // Select2 CSS 173 // ***************************************************************** 174 wp_enqueue_style( 175 'select2-css', 176 Redux_Core::$url . 'assets/css/vendor/select2.min.css', 177 array(), 178 '4.1.0' 179 ); 180 181 // ***************************************************************** 182 // Spectrum CSS 183 // ***************************************************************** 184 $css_file = 'redux-spectrum.css'; 185 186 wp_register_style( 187 'redux-spectrum-css', 188 Redux_Core::$url . "assets/css/vendor/spectrum$this->min.css", 189 array(), 190 '1.3.3' 191 ); 192 193 // ***************************************************************** 194 // Elusive Icon CSS 195 // ***************************************************************** 196 wp_enqueue_style( 197 'redux-elusive-icon', 198 Redux_Core::$url . "assets/css/vendor/elusive-icons$this->min.css", 199 array(), 200 $this->timestamp 201 ); 202 203 // ***************************************************************** 204 // QTip CSS 205 // ***************************************************************** 206 wp_enqueue_style( 207 'qtip-css', 208 Redux_Core::$url . "assets/css/vendor/qtip$this->min.css", 209 array(), 210 '3.0.3' 211 ); 212 213 // ***************************************************************** 214 // JQuery UI CSS 215 // ***************************************************************** 216 217 wp_enqueue_style( 218 'jquery-ui-css', 219 // phpcs:ignore WordPress.NamingConventions.ValidHookName 220 apply_filters( 221 // phpcs:ignore WordPress.NamingConventions.ValidHookName 222 "redux/page/{$core->args['opt_name']}/enqueue/jquery-ui-css", 223 Redux_Core::$url . 'assets/css/vendor/jquery-ui-1.10.0.custom.css' 224 ), 225 array(), 226 $this->timestamp 227 ); 228 229 // ***************************************************************** 230 // Iris CSS 231 // ***************************************************************** 232 wp_enqueue_style( 'wp-color-picker' ); 233 234 if ( $core->args['dev_mode'] ) { 235 // ***************************************************************** 236 // Media CSS 237 // ***************************************************************** 238 wp_enqueue_style( 239 'redux-field-media-css', 240 Redux_Core::$url . 'assets/css/media.css', 241 array(), 242 $this->timestamp 243 ); 244 } 245 246 // ***************************************************************** 247 // RTL CSS 248 // ***************************************************************** 249 if ( is_rtl() ) { 250 wp_enqueue_style( 251 'redux-rtl-css', 252 Redux_Core::$url . 'assets/css/rtl.css', 253 array( 'redux-admin-css' ), 254 $this->timestamp 255 ); 256 } 257 } 258 259 /** 260 * Register all core framework scripts. 261 * 262 * @param object $core ReduxFramework object. 263 */ 264 private function register_scripts( $core ) { 265 // ***************************************************************** 266 // JQuery / JQuery UI JS 267 // ***************************************************************** 268 wp_enqueue_script( 'jquery' ); 269 wp_enqueue_script( 'jquery-ui-core' ); 270 wp_enqueue_script( 'jquery-ui-dialog' ); 271 272 // ***************************************************************** 273 // Select2 Sortable JS 274 // ***************************************************************** 275 wp_register_script( 276 'redux-select2-sortable-js', 277 Redux_Core::$url . 'assets/js/vendor/select2-sortable/redux.select2.sortable' . $this->min . '.js', 278 array( 'jquery', 'jquery-ui-sortable' ), 279 $this->timestamp, 280 true 281 ); 282 283 wp_enqueue_script( 284 'select2-js', 285 Redux_Core::$url . 'assets/js/vendor/select2/select2' . $this->min . '.js`', 286 array( 'jquery', 'redux-select2-sortable-js' ), 287 '4.1.0', 288 true 289 ); 290 291 // ***************************************************************** 292 // QTip JS 293 // ***************************************************************** 294 wp_enqueue_script( 295 'qtip-js', 296 Redux_Core::$url . 'assets/js/vendor/qtip/qtip' . $this->min . '.js', 297 array( 'jquery' ), 298 '3.0.3', 299 true 300 ); 301 302 // ***************************************************************** 303 // Iris alpha color picker 304 // ***************************************************************** 305 306 if ( ! wp_script_is( 'redux-wp-color-picker-alpha-js' ) ) { 307 wp_enqueue_style( 'wp-color-picker' ); 308 309 wp_register_script( 310 'redux-wp-color-picker-alpha-js', 311 Redux_Core::$url . 'assets/js/vendor/wp-color-picker-alpha/wp-color-picker-alpha' . $this->min . '.js', 312 array( 'jquery', 'wp-color-picker' ), 313 '3.0.0', 314 true 315 ); 316 } 317 318 // ***************************************************************** 319 // Spectrum JS 320 // ***************************************************************** 321 wp_register_script( 322 'redux-spectrum-js', 323 Redux_Core::$url . 'assets/js/vendor/spectrum/redux-spectrum' . $this->min . '.js', 324 array( 'jquery' ), 325 '1.3.3', 326 true 327 ); 328 329 // ***************************************************************** 330 // Vendor JS 331 // ***************************************************************** 332 wp_register_script( 333 'redux-vendor', 334 Redux_Core::$url . 'assets/js/redux-vendors' . $this->min . '.js', 335 array( 'jquery' ), 336 $this->timestamp, 337 true 338 ); 339 340 // ***************************************************************** 341 // Redux JS 342 // ***************************************************************** 343 wp_register_script( 344 'redux-js', 345 Redux_Core::$url . 'assets/js/redux' . $this->min . '.js', 346 array( 'jquery', 'redux-vendor' ), 347 $this->timestamp, 348 true 349 ); 350 } 351 352 /** 353 * Enqueue fields that are in use. 354 * 355 * @param object $core ReduxFramework object. 356 * @param array $field Field array. 357 */ 358 public function enqueue_field( $core, array $field ) { 359 if ( isset( $field['type'] ) && 'callback' !== $field['type'] ) { 360 361 /** 362 * Field class file 363 * filter 'redux/{opt_name}/field/class/{field.type} 364 * 365 * @param string field class file path 366 * @param array $field field config data 367 */ 368 $field_type = str_replace( '_', '-', $field['type'] ); 369 $core_path = Redux_Core::$dir . "inc/fields/{$field['type']}/class-redux-$field_type.php"; 370 371 // Shim for v3 extension class names. 372 if ( ! file_exists( $core_path ) ) { 373 $core_path = Redux_Core::$dir . "inc/fields/{$field['type']}/field_{$field['type']}.php"; 374 } 375 376 if ( Redux_Core::$pro_loaded ) { 377 $pro_path = ''; 378 379 if ( class_exists( 'Redux_Pro' ) ) { 380 $pro_path = Redux_Pro::$dir . "core/inc/fields/{$field['type']}/class-redux-$field_type.php"; 381 } 382 383 if ( file_exists( $pro_path ) ) { 384 $filter_path = $pro_path; 385 } else { 386 $filter_path = $core_path; 387 } 388 } else { 389 $filter_path = $core_path; 390 } 391 392 // phpcs:ignore WordPress.NamingConventions.ValidHookName 393 $class_file = apply_filters( 394 // phpcs:ignore WordPress.NamingConventions.ValidHookName 395 "redux/{$core->args['opt_name']}/field/class/{$field['type']}", 396 $filter_path, 397 $field 398 ); 399 400 $field_classes = array( 'Redux_' . $field['type'], 'ReduxFramework_' . $field['type'] ); 401 402 if ( $class_file ) { 403 $field_class = Redux_Functions::class_exists_ex( $field_classes ); 404 if ( false === $field_class ) { 405 if ( file_exists( $class_file ) ) { 406 require_once $class_file; 407 408 $field_class = Redux_Functions::class_exists_ex( $field_classes ); 409 } else { 410 return; 411 } 412 } 413 414 if ( false !== $field_class && ( ( method_exists( $field_class, 'enqueue' ) ) || method_exists( $field_class, 'localize' ) ) ) { 415 if ( ! isset( $core->options[ $field['id'] ] ) ) { 416 $core->options[ $field['id'] ] = ''; 417 } 418 419 $data = array( 420 'field' => $field, 421 'value' => $core->options[ $field['id'] ], 422 'core' => $core, 423 'mode' => 'enqueue', 424 ); 425 426 Redux_Functions::load_pro_field( $data ); 427 428 $the_field = new $field_class( $field, $core->options[ $field['id'] ], $core ); 429 430 if ( Redux_Core::$pro_loaded ) { 431 $field_filter = ''; 432 433 if ( class_exists( 'Redux_Pro' ) ) { 434 $field_filter = Redux_Pro::$dir . 'core/inc/fields/' . $field['type'] . '/class-redux-pro-' . $field_type . '.php'; 435 } 436 437 if ( file_exists( $field_filter ) ) { 438 require_once $field_filter; 439 440 $filter_class_name = 'Redux_Pro_' . $field['type']; 441 442 if ( class_exists( $filter_class_name ) ) { 443 $extend = new $filter_class_name( $field, $core->options[ $field['id'] ], $core ); 444 $extend->init( 'enqueue' ); 445 } 446 } 447 } 448 449 // Move dev_mode check to a new if/then block. 450 if ( ( ! wp_script_is( 'redux-field-' . $field_type . '-js' ) || 451 ! wp_script_is( 'redux-extension-' . $field_type . '-js' ) || 452 ! wp_script_is( 'redux-pro-field-' . $field_type . '-js' ) ) && 453 class_exists( $field_class ) && method_exists( $field_class, 'enqueue' ) ) { 454 $the_field->enqueue(); 455 } 456 457 if ( method_exists( $field_class, 'localize' ) ) { 458 $params = $the_field->localize( $field ); 459 if ( ! isset( $this->localize_data[ $field['type'] ] ) ) { 460 $this->localize_data[ $field['type'] ] = array(); 461 } 462 463 $localize_data = $the_field->localize( $field ); 464 465 $shims = array( 'repeater' ); 466 467 // phpcs:ignore WordPress.NamingConventions.ValidHookName 468 $shims = apply_filters( 'redux/' . $core->args['opt_name'] . '/localize/shims', $shims ); 469 470 if ( is_array( $shims ) && in_array( $field['type'], $shims, true ) ) { 471 $this->repeater_data[ $field['type'] ][ $field['id'] ] = $localize_data; 472 } 473 474 $this->localize_data[ $field['type'] ][ $field['id'] ] = $localize_data; 475 } 476 477 unset( $the_field ); 478 } 479 } 480 } 481 } 482 483 /** 484 * Enqueue field files. 485 * 486 * @param object $core ReduxFramework object. 487 */ 488 private function enqueue_fields( $core ) { 489 $data = array(); 490 491 foreach ( $core->sections as $section ) { 492 if ( isset( $section['fields'] ) ) { 493 foreach ( $section['fields'] as $field ) { 494 $this->enqueue_field( $core, $field ); 495 } 496 } 497 } 498 } 499 500 /** 501 * Build localize array from field functions, if any. 502 * 503 * @param object $core ReduxFramework object. 504 * @param string $type Field type. 505 */ 506 private function build_local_array( $core, string $type ) { 507 if ( isset( $core->transients['last_save_mode'] ) && ! empty( $core->transients['notices'][ $type ] ) ) { 508 $the_total = 0; 509 $messages = array(); 510 511 foreach ( $core->transients['notices'][ $type ] as $msg ) { 512 $messages[ $msg['section_id'] ][ $type ][] = $msg; 513 514 if ( ! isset( $messages[ $msg['section_id'] ]['total'] ) ) { 515 $messages[ $msg['section_id'] ]['total'] = 0; 516 } 517 518 $messages[ $msg['section_id'] ]['total'] ++; 519 $the_total ++; 520 } 521 522 $this->localize_data[ $type ] = array( 523 'total' => $the_total, 524 "$type" => $messages, 525 ); 526 527 unset( $core->transients['notices'][ $type ] ); 528 } 529 } 530 531 /** 532 * Compile panel errors and warings for locaize array. 533 */ 534 public function get_warnings_and_errors_array() { 535 $core = $this->core(); 536 537 $this->build_local_array( $core, 'errors' ); 538 $this->build_local_array( $core, 'warnings' ); 539 $this->build_local_array( $core, 'sanitize' ); 540 541 if ( empty( $core->transients['notices'] ) ) { 542 unset( $core->transients['notices'] ); 543 } 544 } 545 546 /** 547 * Commit localized data to global array. 548 * 549 * @param object $core ReduxFramework object. 550 */ 551 private function set_localized_data( $core ) { 552 if ( ! empty( $core->args['last_tab'] ) ) { 553 $this->localize_data['last_tab'] = $core->args['last_tab']; 554 } 555 556 $this->localize_data['core_instance'] = $core->core_instance; 557 $this->localize_data['core_thread'] = $core->core_thread; 558 559 $this->localize_data['font_weights'] = $this->args['font_weights']; 560 561 $this->localize_data['required'] = $core->required; 562 $this->repeater_data['fonts'] = $core->fonts; 563 if ( ! isset( $this->repeater_data['opt_names'] ) ) { 564 $this->repeater_data['opt_names'] = array(); 565 } 566 $this->repeater_data['opt_names'][] = $core->args['opt_name']; 567 $this->repeater_data['folds'] = array(); 568 $this->localize_data['required_child'] = $core->required_child; 569 $this->localize_data['fields'] = $core->fields; 570 571 if ( isset( $core->font_groups['google'] ) ) { 572 $this->repeater_data['googlefonts'] = $core->font_groups['google']; 573 } 574 575 if ( isset( $core->font_groups['std'] ) ) { 576 $this->repeater_data['stdfonts'] = $core->font_groups['std']; 577 } 578 579 if ( isset( $core->font_groups['customfonts'] ) ) { 580 $this->repeater_data['customfonts'] = $core->font_groups['customfonts']; 581 } 582 583 if ( isset( $core->font_groups['typekitfonts'] ) ) { 584 $this->repeater_data['typekitfonts'] = $core->font_groups['typekitfonts']; 585 } 586 587 $this->localize_data['folds'] = $core->folds; 588 589 // Make sure the children are all hidden properly. 590 foreach ( $core->fields as $key => $value ) { 591 if ( in_array( $key, $core->fields_hidden, true ) ) { 592 foreach ( $value as $k => $v ) { 593 if ( ! in_array( $k, $core->fields_hidden, true ) ) { 594 $core->fields_hidden[] = $k; 595 $core->folds[ $k ] = 'hide'; 596 } 597 } 598 } 599 } 600 601 $this->localize_data['fields_hidden'] = $core->fields_hidden; 602 $this->localize_data['options'] = $core->options; 603 $this->localize_data['defaults'] = $core->options_defaults; 604 605 /** 606 * Save pending string 607 * filter 'redux/{opt_name}/localize/save_pending 608 * 609 * @param string save_pending string 610 */ 611 // phpcs:ignore WordPress.NamingConventions.ValidHookName 612 $save_pending = apply_filters( 613 // phpcs:ignore WordPress.NamingConventions.ValidHookName 614 "redux/{$core->args['opt_name']}/localize/save_pending", 615 esc_html__( 616 'You have changes that are not saved. Would you like to save them now?', 617 'redux-framework' 618 ) 619 ); 620 621 /** 622 * Reset all string 623 * filter 'redux/{opt_name}/localize/reset 624 * 625 * @param string reset all string 626 */ 627 // phpcs:ignore WordPress.NamingConventions.ValidHookName 628 $reset_all = apply_filters( 629 // phpcs:ignore WordPress.NamingConventions.ValidHookName 630 "redux/{$core->args['opt_name']}/localize/reset", 631 esc_html__( 632 'Are you sure? Resetting will lose all custom values.', 633 'redux-framework' 634 ) 635 ); 636 637 /** 638 * Reset section string 639 * filter 'redux/{opt_name}/localize/reset_section 640 * 641 * @param string reset section string 642 */ 643 // phpcs:ignore WordPress.NamingConventions.ValidHookName 644 $reset_section = apply_filters( 645 // phpcs:ignore WordPress.NamingConventions.ValidHookName 646 "redux/{$core->args['opt_name']}/localize/reset_section", 647 esc_html__( 648 'Are you sure? Resetting will lose all custom values in this section.', 649 'redux-framework' 650 ) 651 ); 652 653 /** 654 * Preset confirm string 655 * filter 'redux/{opt_name}/localize/preset 656 * 657 * @param string preset confirm string 658 */ 659 // phpcs:ignore WordPress.NamingConventions.ValidHookName 660 $preset_confirm = apply_filters( 661 // phpcs:ignore WordPress.NamingConventions.ValidHookName 662 "redux/{$core->args['opt_name']}/localize/preset", 663 esc_html__( 664 'Your current options will be replaced with the values of this preset. Would you like to proceed?', 665 'redux-framework' 666 ) 667 ); 668 669 /** 670 * Import confirm string 671 * filter 'redux/{opt_name}/localize/import 672 * 673 * @param string import confirm string 674 */ 675 // phpcs:ignore WordPress.NamingConventions.ValidHookName 676 $import_confirm = apply_filters( 677 // phpcs:ignore WordPress.NamingConventions.ValidHookName 678 "redux/{$core->args['opt_name']}/localize/import", 679 esc_html__( 680 'Your current options will be replaced with the values of this import. Would you like to proceed?', 681 'redux-framework' 682 ) 683 ); 684 685 global $pagenow; 686 687 $this->localize_data['args'] = array( 688 'dev_mode' => $core->args['dev_mode'], 689 'save_pending' => $save_pending, 690 'reset_confirm' => $reset_all, 691 'reset_section_confirm' => $reset_section, 692 'preset_confirm' => $preset_confirm, 693 'import_section_confirm' => $import_confirm, 694 'please_wait' => esc_html__( 'Please Wait', 'redux-framework' ), 695 'opt_name' => $core->args['opt_name'], 696 'flyout_submenus' => $core->args['flyout_submenus'] ?? false, 697 'slug' => $core->args['page_slug'], 698 'hints' => $core->args['hints'], 699 'disable_save_warn' => $core->args['disable_save_warn'], 700 'class' => $core->args['class'], 701 'ajax_save' => $core->args['ajax_save'], 702 'menu_search' => $pagenow . '?page=' . $core->args['page_slug'] . '&tab=', 703 ); 704 705 $this->localize_data['ajax'] = array( 706 'console' => esc_html__( 707 'There was an error saving. Here is the result of your action:', 708 'redux-framework' 709 ), 710 'alert' => esc_html__( 711 'There was a problem with your action. Please try again or reload the page.', 712 'redux-framework' 713 ), 714 ); 715 716 // phpcs:ignore WordPress.NamingConventions.ValidHookName 717 $this->localize_data = apply_filters( "redux/{$core->args['opt_name']}/localize", $this->localize_data ); 718 719 // phpcs:ignore WordPress.NamingConventions.ValidHookName 720 $this->repeater_data = apply_filters( "redux/{$core->args['opt_name']}/repeater", $this->repeater_data ); 721 722 $this->get_warnings_and_errors_array(); 723 724 if ( ! isset( $core->repeater_data ) ) { 725 $core->repeater_data = array(); 726 } 727 $core->repeater_data = Redux_Functions_Ex::nested_wp_parse_args( 728 $this->repeater_data, 729 $core->repeater_data 730 ); 731 732 if ( ! isset( $core->localize_data ) ) { 733 $core->localize_data = array(); 734 } 735 $core->localize_data = Redux_Functions_Ex::nested_wp_parse_args( 736 $this->localize_data, 737 $core->localize_data 738 ); 739 740 // Shim for extension compatibility. 741 if ( Redux::$extension_compatibility ) { 742 $this->repeater_data = Redux_Functions_Ex::nested_wp_parse_args( 743 $this->repeater_data, 744 $core->localize_data 745 ); 746 } 747 748 wp_localize_script( 749 'redux-js', 750 'redux', 751 $this->repeater_data 752 ); 753 754 wp_localize_script( 755 'redux-js', 756 'redux_' . str_replace( '-', '_', $core->args['opt_name'] ), 757 $this->localize_data 758 ); 759 760 wp_enqueue_script( 'redux-js' ); // Enqueue the JS now. 761 } 762 } 763 } 764 765 if ( ! class_exists( 'reduxCoreEnqueue' ) ) { 766 class_alias( 'Redux_Enqueue', 'reduxCoreEnqueue' ); 767 }