예제 #1
0
 /**
  * Loads a saved configuration if given by the settings
  *
  * @param array $new_instance
  *
  * @return array
  * @since 2.6
  */
 protected function load_config($new_instance)
 {
     $load_config = isset($new_instance['load_config']) && isset($new_instance['load_config_name']) && $new_instance['load_config_name'];
     // Overwrite the form values with the saved configuration
     if ($load_config) {
         $loaded_configuration = $this->plugin->loadConfiguration($new_instance['load_config_name']);
         if ($loaded_configuration) {
             return $loaded_configuration;
         }
     }
     return $new_instance;
 }
예제 #2
0
 /**
  * Short code handler for 'utcw' hook
  *
  * @param array $args
  *
  * @return string
  * @since 2.4
  */
 public function render(array $args)
 {
     global $wpdb;
     if (isset($args['load_config'])) {
         $loaded = $this->plugin->loadConfiguration($args['load_config']);
         if (is_array($loaded)) {
             $args = $loaded;
         }
     }
     $this->plugin->set('wpdb', $wpdb);
     $this->plugin->set('dataConfig', new UTCW_DataConfig($args, $this->plugin));
     $this->plugin->set('renderConfig', new UTCW_RenderConfig($args, $this->plugin));
     $this->plugin->set('data', new UTCW_Data($this->plugin));
     $render = new UTCW_Render($this->plugin);
     do_action('utcw_shortcode', $args);
     return apply_filters('filter_shortcode', $render->getCloud());
 }