Пример #1
0
 /**
  * Creates a new instance of the class and adds all the options
  *
  * @param array       $input
  * @param UTCW_Plugin $plugin
  *
  * @since 2.3
  */
 public function __construct(array $input, UTCW_Plugin $plugin)
 {
     $this->addOption('strategy', 'class', array('classMap' => array('popularity' => 'UTCW_PopularityStrategy', 'random' => 'UTCW_RandomStrategy', 'creation' => 'UTCW_CreationTimeStrategy', 'current_list' => 'UTCW_CurrentListStrategy'), 'baseClass' => 'UTCW_SelectionStrategy', 'default' => 'popularity', 'factory' => array($this, 'strategyFactory')));
     $this->addOption('order', 'set', array('values' => array('name', 'random', 'slug', 'id', 'color', 'count')));
     $this->addOption('tags_list_type', 'set', array('values' => array('exclude', 'include')));
     $this->addOption('color', 'set', array('values' => array('none', 'random', 'set', 'span')));
     $this->addOption('color_span_to', 'color', array('default' => ''));
     $this->addOption('color_span_from', 'color', array('default' => ''));
     $this->addOption('color_set', 'array', array('type' => 'color'));
     $this->addOption('taxonomy', 'array', array('type' => 'set', 'typeOptions' => array('values' => $plugin->getAllowedTaxonomies()), 'default' => array('post_tag')));
     $this->addOption('post_type', 'array', array('type' => 'set', 'typeOptions' => array('values' => $plugin->getAllowedPostTypes()), 'default' => array('post')));
     $this->addOption('authors', 'array', array('type' => 'integer'));
     $this->addOption('tags_list', 'array', array('type' => 'integer'));
     $this->addOption('post_term', 'array', array('type' => 'integer'));
     $this->addOption('size_from', 'measurement', array('default' => '10px'));
     $this->addOption('size_to', 'measurement', array('default' => '30px'));
     $this->addOption('max', 'integer', array('default' => 45, 'min' => 1));
     $this->addOption('minimum', 'integer', array('default' => 1));
     $this->addOption('days_old', 'integer');
     $this->addOption('reverse', 'boolean');
     $this->addOption('case_sensitive', 'boolean');
     $this->addOption('post_term_query_var', 'boolean');
     $this->plugin = $plugin;
     parent::__construct($input, $plugin);
     $this->checkSizes();
 }