コード例 #1
0
ファイル: widgets.php プロジェクト: xpander54/wp-drz
 protected function onSetupOptions(\Drone\Options\Group\Widget $options)
 {
     $options->addOption('text', 'title', '', __('Title', $this->_domain));
     $options->addOption('codeline', 'username', '', __('Username', $this->_domain), '', array('on_sanitize' => function ($option, $original_value, &$value) {
         if (preg_match('|^((https?://)?(www\\.)?twitter\\.com/(#!/)?)?(?P<username>.+?)/?$|i', $value, $matches)) {
             $value = $matches['username'];
         }
     }));
     $options->addOption('number', 'count', 5, __('Tweets count', $this->_domain), '', array('min' => 1, 'max' => 20));
     $options->addOption('interval', 'interval', array('quantity' => 30, 'unit' => 'm'), __('Update interval', $this->_domain), __('Tweets receiving interval.', $this->_domain), array('min' => '1m'));
     $options->addOption('boolean', 'include_retweets', true, '', '', array('caption' => __('Include retweets', $this->_domain)));
     $options->addOption('boolean', 'exclude_replies', false, '', '', array('caption' => __('Exclude replies', $this->_domain)));
     $oauth = $options->addGroup('oauth');
     $oauth->addOption('codeline', 'consumer_key', '', __('API key', $this->_domain));
     $oauth->addOption('codeline', 'consumer_secret', '', __('API secret', $this->_domain), '', array('password' => true));
     $oauth->addOption('codeline', 'access_token', '', __('Access token', $this->_domain));
     $oauth->addOption('codeline', 'access_token_secret', '', __('Access token secret', $this->_domain), '', array('password' => true));
 }
コード例 #2
0
ファイル: widgets.php プロジェクト: xpander54/wp-drz
 protected function onSetupOptions(\Drone\Options\Group\Widget $options)
 {
     $options->addOption('text', 'title', '', __('Title', 'everything'));
     $options->addOption('select', 'id', 0, __('Children of', 'everything'), __('Displays child portfolios of selected portfolio.', 'everything'), array('required' => false, 'options' => function () {
         return array_map(function ($s) {
             return Func::stringCut($s, 55);
         }, Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'portfolio')));
     }));
     $options->addOption('select', 'columns', '2', __('Layout', 'everything'), '', array('options' => array('1' => __('One column', 'everything'), '1+' => __('One+ column', 'everything'), '2' => __('Two columns', 'everything'), '3' => __('Three columns', 'everything'), '4' => __('Four columns', 'everything'))));
     $options->addOption('select', 'filter', '', __('Filter', 'everything'), '', array('options' => array('' => '(' . __('None', 'everything') . ')', 'category' => __('Category', 'everything'), 'tag' => __('Tag', 'everything'))));
     $options->addOption('select', 'orderby', 'date', __('Sort by', 'everything'), '', array('options' => array('title' => __('Title', 'everything'), 'date' => __('Date', 'everything'), 'modified' => __('Modified date', 'everything'), 'comment_count' => __('Comment count', 'everything'), 'rand' => __('Random order', 'everything'), 'menu_order' => __('Custom order', 'everything'))));
     $options->addOption('select', 'order', 'desc', __('Sort order', 'everything'), '', array('options' => array('asc' => __('Ascending', 'everything'), 'desc' => __('Descending', 'everything'))));
     $options->addOption('number', 'count', '', __('Count', 'everything'), '', array('required' => false, 'min' => 1));
     $options->addOption('boolean', 'show_title', true, '', '', array('caption' => __('Show title', 'everything')));
     $content = $options->addGroup('content', __('Content', 'everything'));
     $visible = $content->addOption('boolean', 'visible', false, '', '', array('caption' => __('Show content', 'everything')));
     $content->addOption('group', 'content', 'excerpt_content', '', __('Regular content means everything before the "Read more" tag.', 'everything'), array('options' => array('content' => __('Regular content', 'everything'), 'excerpt_content' => __('Excerpt or regular content', 'everything'), 'excerpt' => __('Excerpt', 'everything')), 'indent' => true, 'owner' => $visible));
     $taxonomy = $options->addGroup('taxonomy', __('Taxonomy', 'everything'));
     $visible = $taxonomy->addOption('boolean', 'visible', true, '', '', array('caption' => __('Show taxonomies', 'everything')));
     $taxonomy->addOption('select', 'taxonomy', 'tag', '', '', array('options' => array('category' => __('Categories', 'everything'), 'tag' => __('Tags', 'everything')), 'indent' => true, 'owner' => $visible));
     $options->addOption('select', 'image_hover', 'inherit', __('Hover effect', 'everything'), '', array('options' => array('inherit' => __('Inherit', 'everything'), '' => __('None', 'everything'), 'zoom' => __('Default', 'everything'), 'grayscale' => __('Grayscale', 'everything'))));
 }