config->get('master_addons_templates'); wp_localize_script( 'master-addons-editor-js', 'MasterAddonsData', apply_filters( 'master-addons-core/assets/editor/localize', array( 'master_image_dir' => JLTMA_IMAGE_DIR . 'ma-editor-icon.svg', 'MasterAddonsEditorBtn' => $button, 'get_templates_nonce' => wp_create_nonce('jltma_get_templates_nonce_action'), 'insert_template_nonce' => wp_create_nonce('jltma_insert_templates_nonce_action'), 'refresh_cache_nonce' => wp_create_nonce('master_addons_nonce'), 'modalRegions' => $this->get_modal_region(), 'license' => array( 'status' => Templates\master_addons_templates()->config->get('status'), 'activateLink' => Templates\master_addons_templates()->config->get('license_page'), 'proMessage' => Templates\master_addons_templates()->config->get('pro_message') ), ) ) ); } public function get_modal_region() { return array( 'modalHeader' => '.dialog-header', 'modalContent' => '.dialog-message', ); } public function load_footer_scripts() { $scripts = glob(JLTMA_PATH . 'inc/admin/templates/editor/*.php'); array_map(function ($file) { $name = basename($file, '.php'); ob_start(); include $file; printf('', esc_attr( $name ), ob_get_clean()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- ob_get_clean() returns a PHP template file's output intended for Backbone/Underscore JS template rendering }, $scripts); // Add cache refresh functionality for template modal $this->add_cache_refresh_script(); } public function add_cache_refresh_script() { ?>