Exemple #1
0
 protected function onSetupOptions(\Drone\Options\Group\Widget $options)
 {
     $options->addOption('text', 'title', '', __('Title', $this->_domain));
     $options->addOption('select', 'page', 0, __('Page', $this->_domain), '', array('required' => false, 'options' => function () {
         return Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'page'));
     }));
 }
Exemple #2
0
 public function __construct($name, $default, $properties = array())
 {
     parent::__construct($name, $default, $properties);
     $type_options = array('' => __('None', 'everything'), 'empty' => __('Empty space', 'everything'), 'image' => __('Image', 'everything'), 'thumbnail' => __('Featured image', 'everything'), 'slider' => __('Slider', 'everything'), 'map' => __('Map', 'everything'), 'page' => __('Page', 'everything'), 'embed' => __('Embeding code', 'everything'), 'custom' => __('Custom HTML', 'everything'));
     if (!isset($this->slider)) {
         unset($type_options['slider']);
     }
     if (!isset($this->map)) {
         unset($type_options['map']);
     }
     $this->type->options = $type_options;
     $this->height->unit = 'px';
     $this->height->min = 0;
     $this->height->indent = true;
     $this->height->owner = $this->type;
     $this->height->owner_value = 'empty';
     $this->image->indent = true;
     $this->image->owner = $this->type;
     $this->image->owner_value = 'image';
     if (isset($this->slider)) {
         $this->slider->required = false;
         $this->slider->options = function ($option) {
             $options = array();
             if (\Everything::isPluginActive('layerslider')) {
                 foreach (\lsSliders() as $slider) {
                     $options['layerslider-' . $slider['id']] = $slider['name'];
                     $option->groups['LayerSlider WP'][] = 'layerslider-' . $slider['id'];
                 }
             }
             if (\Everything::isPluginActive('masterslider')) {
                 foreach (get_masterslider_names() as $id => $name) {
                     $options['masterslider-' . $id] = $name;
                     $option->groups['Master Slider WP'][] = 'masterslider-' . $id;
                 }
             }
             if (\Everything::isPluginActive('revslider')) {
                 $revslider = new \RevSlider();
                 foreach ($revslider->getArrSliders() as $slider) {
                     $options['revslider-' . $slider->getID()] = $slider->getTitle();
                     $option->groups['Revolution Slider'][] = 'revslider-' . $slider->getID();
                 }
             }
             return $options;
         };
         $this->slider->indent = true;
         $this->slider->owner = $this->type;
         $this->slider->owner_value = 'slider';
     }
     if (isset($this->map)) {
         $this->map->required = false;
         $this->map->options = function ($option) {
             $options = array();
             if (\Everything::isPluginActive('wild-googlemap')) {
                 $maps = \WiLD_BackendGooglemapManager::getInstance()->get_maps();
                 foreach ($maps as $map) {
                     $options['wild-googlemap-' . $map->id] = $map->name;
                     $option->groups['WiLD Googlemap'][] = 'wild-googlemap-' . $map->id;
                 }
             }
             if (\Everything::isPluginActive('wp-google-map-plugin')) {
                 $maps = $GLOBALS['wpdb']->get_results("SELECT map_id, map_title FROM {$GLOBALS['wpdb']->prefix}create_map ORDER BY map_id ASC", ARRAY_A);
                 foreach ($maps as $map) {
                     $options['wp-google-map-plugin-' . $map['map_id']] = $map['map_title'];
                     $option->groups['WP Google Map Plugin'][] = 'wp-google-map-plugin-' . $map['map_id'];
                 }
             }
             return $options;
         };
         $this->map->indent = true;
         $this->map->owner = $this->type;
         $this->map->owner_value = 'map';
     }
     $this->page->required = false;
     $this->page->options = function () {
         return \Drone\Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'page'));
     };
     $this->page->indent = true;
     $this->page->owner = $this->type;
     $this->page->owner_value = 'page';
     $this->embed->description = __('Embeding code from YouTube, Vimeo, Google Maps or other.', 'everything');
     $this->embed->indent = true;
     $this->embed->owner = $this->type;
     $this->embed->owner_value = 'embed';
     $this->custom->indent = true;
     $this->custom->owner = $this->type;
     $this->custom->owner_value = 'custom';
 }
Exemple #3
0
 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'))));
 }
Exemple #4
0
 protected function onSetupOptions(\Drone\Options\Group\Shortcode $options)
 {
     $options->addOption('select', 'id', 0, __('Children of', 'everything'), __('Displays child portfolios of selected portfolio.', 'everything'), array('options' => function () {
         return array(0 => '(' . __('This', 'everything') . ')') + array_map(function ($s) {
             return Func::stringCut($s, 55);
         }, Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'portfolio')));
     }));
     $options->addOption('select', 'columns', '4', __('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'), '5' => __('Five columns', 'everything'), '6' => __('Six columns', 'everything'), '7' => __('Seven columns', 'everything'), '8' => __('Eight columns', 'everything'))));
     $options->addOption('select', 'filter', 'category', __('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', 'pagination', true, __('Pagination', 'everything'), '', array('caption' => __('Yes', 'everything')));
     $options->addOption('boolean', 'title', true, __('Title', 'everything'), '', array('caption' => __('Yes', 'everything')));
     $options->addOption('select', 'teaser', 'excerpt_content', __('Teaser', 'everything'), __('Regular content means everything before the "Read more" tag.', 'everything'), array('options' => array('' => '(' . __('None', 'everything') . ')', 'content' => __('Regular content', 'everything'), 'excerpt_content' => __('Excerpt or regular content', 'everything'), 'excerpt' => __('Excerpt', 'everything'))));
     //$options->addOption('number', 'excerpt_length', 55, __('Excerpt length', 'everything'), '', array('unit' => __('words', 'everything'), 'min' => 1, 'max' => 100));
     $options->addOption('select', 'taxonomy', 'tag', __('Taxonomy', 'everything'), '', array('options' => array('' => '(' . __('None', 'everything') . ')', 'category' => __('Category', 'everything'), 'tag' => __('Tag', 'everything'))));
     $options->addOption('select', 'image_hover', 'inherit', __('Hover effect', 'everything'), '', array('options' => array('inherit' => __('Inherit', 'everything'), '' => __('None', 'everything'), 'zoom' => __('Default', 'everything'), 'grayscale' => __('Grayscale', 'everything'))));
 }
Exemple #5
0
 protected function onSetupOptions(\Drone\Options\Group\Shortcode $options)
 {
     $options->addOption('select', 'id', 0, __('Page', $this->domain), '', array('required' => false, 'options' => function () {
         return Func::wpPostsList(array('numberposts' => -1, 'post_type' => 'page'));
     }));
 }