Esempio n. 1
0
 /**
  * construct method
  * @param unknown $widget
  * @param string $apply_plugin
  * @param string $skin_folder
  * @param string $skin_name
  * @param string $default_skin_path
  */
 function __construct($widget, $apply_plugin = '', $skin_folder = '', $skin_name = '', $default_skin_path = '')
 {
     if (is_object($widget)) {
         $this->widget_ref = $widget;
     }
     if ($skin_folder) {
         $this->skin_folder = $skin_folder;
         //skin folder. note: you can set path to skin folder like this: 'folder1/folder2'
     }
     if ($skin_name) {
         $this->skin_name = $skin_name;
     }
     //skin name
     $this->add_skin_name_list($skin_name);
     //add list allow skin name
     $this->is_main = true;
     //this can be modify by sub-skin
     $this->skinID = null;
     //skin id
     $this->_apply_plugin = $this->apply_plugin = $apply_plugin;
     if (!is_dir($apply_plugin) && is_dir(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $apply_plugin)) {
         $this->apply_plugin = rtrim(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $apply_plugin, DIRECTORY_SEPARATOR);
     }
     if ($default_skin_path) {
         $this->_default_skin_path = $default_skin_path;
     }
     //default skins folder locate in this plugins
     /*if(!is_dir($default_skin_path)) { //since we use relative path to skin file
           $default_skin_path = rtrim($this->apply_plugin,'/').'/'.ltrim($default_skin_path,'/');
       }
       */
     $this->default_skin_path = $default_skin_path;
     //plugin_dir_path(__FILE__).'/skins';
     $this->skins_holders = array(WP_CONTENT_DIR => array('folder' => 0, 'url' => WP_CONTENT_URL, 'group' => 'WP_CONTENT'), $this->apply_plugin => array('folder' => $this->_default_skin_path, 'url' => 'get_ref_plugin_url', 'group' => self::DEFAULT_GROUP), get_stylesheet_directory() => array('folder' => 0, 'url' => get_bloginfo('template_url'), 'group' => 'Theme'));
     //get file types
     self::$FILE_TYPES = array('link' => 'gif,png,jpeg,jpg,bmp,tif', 'file' => 'php');
     if (empty($this->template_header_info)) {
         $this->template_header_info = array('name' => 'HW Template', 'description' => 'Description', 'author' => 'Author', 'uri' => 'Author URI');
     }
     //init actions
     $this->setup_actions();
     if ($this->widget_ref instanceof WP_Widget && isset($this->widget_ref->id)) {
         //maintain reference widget id
         //$this->number = $this->widget_ref->number;
         $this->id = $this->widget_ref->id;
     }
     //init default ddslick params
     $this->set_dropdown_ddslick_setting();
     $this->enable_template_engine();
     //by default enable skin template & disable skin file
     //next instance indentifier
     self::$count++;
     //init skin options manager
     parent::__construct($this);
 }