예제 #1
0
 private function set_localized_data()
 {
     $this->parent->localize_data['required'] = $this->parent->required;
     $this->parent->localize_data['fonts'] = $this->parent->fonts;
     $this->parent->localize_data['required_child'] = $this->parent->required_child;
     $this->parent->localize_data['fields'] = $this->parent->fields;
     if (isset($this->parent->font_groups['google'])) {
         $this->parent->localize_data['googlefonts'] = $this->parent->font_groups['google'];
     }
     if (isset($this->parent->font_groups['std'])) {
         $this->parent->localize_data['stdfonts'] = $this->parent->font_groups['std'];
     }
     if (isset($this->parent->font_groups['customfonts'])) {
         $this->parent->localize_data['customfonts'] = $this->parent->font_groups['customfonts'];
     }
     $this->parent->localize_data['folds'] = $this->parent->folds;
     // Make sure the children are all hidden properly.
     foreach ($this->parent->fields as $key => $value) {
         if (in_array($key, $this->parent->fieldsHidden)) {
             foreach ($value as $k => $v) {
                 if (!in_array($k, $this->parent->fieldsHidden)) {
                     $this->parent->fieldsHidden[] = $k;
                     $this->parent->folds[$k] = "hide";
                 }
             }
         }
     }
     if (isset($this->parent->args['dev_mode']) && $this->parent->args['dev_mode'] == true || $this->parent->args['dev_mode'] == false && isset($this->parent->args['forced_dev_mode_off']) && $this->parent->args['forced_dev_mode_off'] == true) {
         $nonce = wp_create_nonce('redux-ads-nonce');
         $base = admin_url('admin-ajax.php') . '?action=redux_p&nonce=' . $nonce . '&url=';
         $this->parent->localize_data['rAds'] = Redux_Helpers::rURL_fix($base, $this->parent->args['opt_name']);
     }
     $this->parent->localize_data['fieldsHidden'] = $this->parent->fieldsHidden;
     $this->parent->localize_data['options'] = $this->parent->options;
     $this->parent->localize_data['defaults'] = $this->parent->options_defaults;
     /**
      * Save pending string
      * filter 'redux/{opt_name}/localize/save_pending
      *
      * @param       string        save_pending string
      */
     $save_pending = apply_filters("redux/{$this->parent->args['opt_name']}/localize/save_pending", esc_html__('You have changes that are not saved. Would you like to save them now?', 'redux-framework'));
     /**
      * Reset all string
      * filter 'redux/{opt_name}/localize/reset
      *
      * @param       string        reset all string
      */
     $reset_all = apply_filters("redux/{$this->parent->args['opt_name']}/localize/reset", esc_html__('Are you sure? Resetting will lose all custom values.', 'redux-framework'));
     /**
      * Reset section string
      * filter 'redux/{opt_name}/localize/reset_section
      *
      * @param       string        reset section string
      */
     $reset_section = apply_filters("redux/{$this->parent->args['opt_name']}/localize/reset_section", esc_html__('Are you sure? Resetting will lose all custom values in this section.', 'redux-framework'));
     /**
      * Preset confirm string
      * filter 'redux/{opt_name}/localize/preset
      *
      * @param       string        preset confirm string
      */
     $preset_confirm = apply_filters("redux/{$this->parent->args['opt_name']}/localize/preset", esc_html__('Your current options will be replaced with the values of this preset. Would you like to proceed?', 'redux-framework'));
     global $pagenow;
     $this->parent->localize_data['args'] = array('save_pending' => $save_pending, 'reset_confirm' => $reset_all, 'reset_section_confirm' => $reset_section, 'preset_confirm' => $preset_confirm, 'please_wait' => esc_html__('Please Wait', 'redux-framework'), 'opt_name' => $this->parent->args['opt_name'], 'slug' => $this->parent->args['page_slug'], 'hints' => $this->parent->args['hints'], 'disable_save_warn' => $this->parent->args['disable_save_warn'], 'class' => $this->parent->args['class'], 'ajax_save' => $this->parent->args['ajax_save'], 'menu_search' => $pagenow . '?page=' . $this->parent->args['page_slug'] . "&tab=");
     $this->parent->localize_data['ajax'] = array('console' => esc_html__('There was an error saving. Here is the result of your action:', 'redux-framework'), 'alert' => esc_html__('There was a problem with your action. Please try again or reload the page.', 'redux-framework'));
     $this->get_warnings_and_errors_array();
     wp_localize_script('redux-js', 'redux', $this->parent->localize_data);
     wp_enqueue_script('redux-js');
     // Enque the JS now
 }
 public static function localize($localize)
 {
     $redux = ReduxFrameworkInstances::get_instance($localize['args']['opt_name']);
     $nonce = wp_create_nonce('redux-ads-nonce');
     $base = admin_url('admin-ajax.php') . '?action=redux_p&nonce=' . $nonce . '&url=';
     $localize['rAds'] = Redux_Helpers::rURL_fix($base, $redux->args['opt_name']);
     return $localize;
 }