function ot_type_revslider_select($args = array()) { extract($args); $has_desc = $field_desc ? true : false; echo '<div class="format-setting type-revslider-select ' . ($has_desc ? 'has-desc' : 'no-desc') . '">'; echo $has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : ''; echo '<div class="format-setting-inner">'; // Add This only if RevSlider is Activated if (class_exists('RevSliderAdmin')) { echo '<select name="' . esc_attr($field_name) . '" id="' . esc_attr($field_id) . '" class="option-tree-ui-select ' . $field_class . '">'; /* get revolution array */ $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); /* has slides */ if (!empty($arrSliders)) { echo '<option value="">-- ' . __('Choose One', 'option-tree') . ' --</option>'; foreach ($arrSliders as $rev_id => $rev_slider) { echo '<option value="' . esc_attr($rev_id) . '"' . selected($field_value, $rev_id, false) . '>' . esc_attr($rev_slider) . '</option>'; } } else { echo '<option value="">' . __('No Sliders Found', 'option-tree') . '</option>'; } echo '</select>'; } else { echo '<span style="color: red;">' . __('Sorry! Revolution Slider is not Installed or Activated', 'ventus') . '</span>'; } echo '</div>'; echo '</div>'; }
function register() { // Init Post Type $post = new SpyropressCustomPostType('Page'); $menus = wp_get_nav_menus(); $menu_options = array(); if (isset($menus) && count($menus) > 0) { foreach ($menus as $menu) { $menu_options[$menu->term_id] = $menu->name; } } // Add Meta Boxes $meta_fields['options'] = array(array('label' => __('Slider', 'spyropress'), 'type' => 'heading', 'slug' => 'options'), array('label' => __('OnePage Navigation Menu', 'spyropress'), 'id' => 'onepage_menu', 'type' => 'select', 'class' => 'page_template one-page-php', 'options' => $menu_options), array('label' => __('Slider', 'spyropress'), 'type' => 'sub_heading'), array('label' => __('Slider Type', 'spyropress'), 'id' => 'slider', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('nivo' => __('Nivo Slider', 'spyropress'), 'rev' => __('Revolution Slider', 'spyropress'))), array('label' => __('Nivo Slider', 'spyropress'), 'id' => 'nivo_slider', 'type' => 'select', 'class' => 'slider nivo', 'options' => spyropress_get_sliders())); if (class_exists('RevSlider')) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $meta_fields['options'][] = array('label' => __('Revolution Slider', 'spyropress'), 'id' => 'rev_slider', 'type' => 'select', 'class' => 'slider rev', 'options' => $arrSliders); $meta_fields['options'][] = array('label' => __('Revolution Slider Skin', 'spyropress'), 'id' => 'rev_slider_skin', 'type' => 'select', 'class' => 'slider rev', 'options' => array('dark' => __('Dark', 'spyropress'), 'light' => __('Light', 'spyropress'), 'full' => __('FullScreen', 'spyropress'), 'dark dark-video' => __('Video - Dark', 'spyropress'), 'light dark-light' => __('Video - Light', 'spyropress')), 'std' => 'dark'); } $meta_fields['options'][] = array('label' => __('Header', 'spyropress'), 'type' => 'sub_heading'); $meta_fields['options'][] = array('label' => __('Header Type', 'spyropress'), 'id' => 'top_header', 'type' => 'select', 'class' => 'enable_changer', 'options' => array('none' => __('None', 'spyropress'), 'default' => __('Default', 'spyropress'), 'custom' => __('Custom Header', 'spyropress')), 'std' => 'default'); $meta_fields['options'][] = array('label' => __('Custom Header Bucket', 'spyropress'), 'id' => 'bucket', 'type' => 'select', 'class' => 'top_header custom', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'options' => spyropress_get_buckets()); $meta_fields['options'][] = array('label' => __('Custom Header Content', 'spyropress'), 'id' => 'header_content', 'type' => 'editor', 'desc' => __('Either use Bucket or Content', 'spyropress'), 'class' => 'top_header custom'); $meta_fields['options'][] = array('label' => __('Custom Header Background', 'spyropress'), 'id' => 'background', 'type' => 'background', 'class' => 'top_header custom'); $meta_fields['options'][] = array('label' => __('Top Border color', 'spyropress'), 'id' => 'border_top', 'type' => 'colorpicker', 'class' => 'top_header custom'); $meta_fields['options'][] = array('label' => __('Bottom Border color', 'spyropress'), 'id' => 'border_bottom', 'type' => 'colorpicker', 'class' => 'top_header custom'); $meta_fields['options'][] = array('label' => __('Layout', 'spyropress'), 'type' => 'sub_heading'); $meta_fields['options'][] = array('label' => __('Layout Type', 'spyropress'), 'id' => 'layout_type', 'type' => 'select', 'options' => array('full' => __('Full Width', 'spyropress'), 'left' => __('Left Sidebar', 'spyropress'), 'right' => __('Right Sidebar', 'spyropress')), 'std' => 'full'); $post->add_meta_box('page_options', __('Page Options', 'spyropress'), $meta_fields, '_page_options', false, 'normal', 'high'); }
function yit_get_revolution_sliders() { global $wpdb; if (!yit_if_thereis_revslider()) { return array(); } $tableName = GlobalsRevSlider::$table_sliders; $slider = new RevSlider(); return $slider->getArrSlidersShort(); }
/** * * the form */ public function form($instance) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $sliderID = UniteFunctionsRev::getVal($instance, "rev_slider"); if (empty($arrSliders)) { echo __("No sliders found, Please create a slider", tk_theme_name); } else { $field = "rev_slider"; $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); } echo "Choose slider: "; echo $select; }
/** * * the form */ public function form($instance) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); if (empty($arrSliders)) { echo __("No sliders found, Please create a slider"); } else { $sliderID = UniteFunctionsRev::getVal($instance, "rev_slider"); $homepage = UniteFunctionsRev::getVal($instance, "rev_slider_homepage"); $field = "rev_slider"; $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); $fieldCheck = "rev_slider_homepage"; $fieldID_check = $this->get_field_id($fieldCheck); $fieldName_check = $this->get_field_name($fieldCheck); $checked = ""; if ($homepage == "on") { $checked = "checked='checked'"; } ?> Choose Slider: <?php echo $select; ?> <div style="padding-top:10px;"></div> <label for="<?php echo $fieldID_check; ?> ">Home Page Only:</label> <input type="checkbox" name="<?php echo $fieldName_check; ?> " id="<?php echo $fieldID_check; ?> " <?php echo $checked; ?> > <div style="padding-top:10px;"></div> <?php } //else }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $this->requireFramework(); $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $selectedID = $this->value; if (empty($selectedID)) { $selectedID = JRequest::getCmd("sliderid"); } $html = "<select id='{$this->id}_id' name='{$this->name}'>"; foreach ($arrSliders as $id => $title) { $selected = ""; if ($id == $selectedID) { $selected = 'selected="selected"'; } $html .= "<option value='{$id}' {$selected}>{$title}</option>"; } $html .= "</select>"; return $html; }
/** * Local function that returns field that allows to select revolution slider. * * @return assoc */ function _adventure_tours_hsm_get_slider_selector() { $isRevoSliderInstalled = class_exists('RevSlider'); $revoSlidersList = array(); if ($isRevoSliderInstalled) { $slider = new RevSlider(); if ($arrSliders = $slider->getArrSlidersShort()) { foreach ($arrSliders as $sid => $stitle) { $revoSlidersList[] = array('value' => $sid, 'label' => $stitle); } } } $descriptionNoticeText = ''; if (!$isRevoSliderInstalled) { $descriptionNoticeText = esc_html__('Please install and activate the Slider Revolution plugin.', 'adventure-tours'); } else { if (empty($revoSlidersList)) { $descriptionNoticeText = esc_html__('Please go to Slider Revolution plugin and create a slider.', 'adventure-tours'); } } return array('label' => esc_html__('Choose Slider', 'adventure-tours'), 'type' => 'select', 'name' => 'slider_alias', 'description' => $descriptionNoticeText ? '<span style="color:#EE0000">' . $descriptionNoticeText . '</span>' : '', 'items' => $revoSlidersList, 'dependency' => array('field' => 'section_mode', 'function' => 'adventure_tours_vp_header_section_is_slider')); }
/** * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className * * * @param array $params this array holds the default values for $content and $args. * @return $params the return array usually holds an innerHtml key that holds item specific markup. */ function editor_element($params) { //fetch all registered slides and save them to the slides array $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $slides = array_flip($arrSliders); if (empty($params['args']['id']) && is_array($slides)) { $params['args']['id'] = reset($slides); } $element = array('subtype' => $slides, 'type' => 'select', 'std' => $params['args']['id'], 'class' => 'avia-recalc-shortcode', 'data' => array('attr' => 'id')); $inner = "<img src='" . $this->config['icon'] . "' title='" . $this->config['name'] . "' />"; if (empty($slides)) { $inner .= "<div><a target='_blank' href='" . admin_url('admin.php?page=revslider') . "'>" . __('No Revolution Slider Found. Click here to create one', 'avia_framework') . "</a></div>"; } else { $inner .= "<div class='avia-element-label'>" . $this->config['name'] . "</div>"; $inner .= AviaHtmlHelper::render_element($element); $inner .= "<a target='_blank' href='" . admin_url('admin.php?page=revslider') . "'>" . __('Edit Revolution Slider here', 'avia_framework') . "</a>"; } $params['class'] = "av_sidebar"; $params['content'] = NULL; $params['innerHtml'] = $inner; return $params; }
<div class="rd_metabox"> <?php $this->select('slider_type', 'Page Slider', array('no' => 'No Slider', 'layer' => 'Revolution Slider', 'layerslider' => 'LayerSlider'), ''); ?> <?php if (is_plugin_active('revslider/revslider.php')) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $arrSliders[0] = 'Select a slider'; $this->select('slider', 'Select Revolution Slider', $arrSliders, ''); } if (is_plugin_active('LayerSlider/layerslider.php')) { global $wpdb; $slides_array[0] = 'Select a slider'; // Table name $table_name = $wpdb->prefix . "layerslider"; // Get sliders $sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\t\tORDER BY date_c ASC"); if (!empty($sliders)) { foreach ($sliders as $key => $item) { $slides[$item->id] = ''; } } if (isset($slides) && $slides) { foreach ($slides as $key => $val) { $slides_array[$key] = 'LayerSlider #' . $key; } } $this->select('layerslider', 'Select LayerSlider', $slides_array, ''); }
} $patternViewSlide = self::getViewUrl("slide", "id=[slideid]"); //init slide object $slide = new RevSlide(); $slide->initByID($slideID); $slideParams = $slide->getParams(); $operations = new RevSliderOperations(); //init slider object $sliderID = $slide->getSliderID(); $slider = new RevSlider(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); $arrSlideNames = $slider->getArrSlideNames(); $arrSlides = $slider->getSlides(false); $arrSlidesWPML = $slider->getSlidesWPML(false, $slide); $arrSliders = $slider->getArrSlidersShort($sliderID); $selectSliders = RevSliderFunctions::getHTMLSelect($arrSliders, "", "id='selectSliders'", true); //check if slider is template $sliderTemplate = $slider->getParam("template", "false"); //set slide delay $sliderDelay = $slider->getParam("delay", "9000"); $slideDelay = $slide->getParam("delay", ""); if (empty($slideDelay)) { $slideDelay = $sliderDelay; } //add tools.min.js wp_enqueue_script('tp-tools', RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.tools.min.js', array(), RevSliderGlobals::SLIDER_REVISION); $arrLayers = $slide->getLayers(); //set Layer settings $cssContent = $operations->getCaptionsContent(); $arrCaptionClasses = $operations->getArrCaptionClasses($cssContent);
//init slide object $slide = new RevSlide(); $slide->initByID($slideID); $slideParams = $slide->getParams(); $operations = new RevSliderOperations(); $rs_nav = new RevSliderNavigation(); $arr_navigations = $rs_nav->get_all_navigations(); //init slider object $sliderID = $slide->getSliderID(); $slider = new RevSlider(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); $arrSlideNames = $slider->getArrSlideNames(); $arrSlides = $slider->getSlides(false); $arrSlidesWPML = $slider->getSlidesWPML(false, $slide); $arrSliders = $slider->getArrSlidersShort($sliderID); $arrSlidersFull = $slider->getArrSlidersShort(); $selectSliders = RevSliderFunctions::getHTMLSelect($arrSliders, "", "id='selectSliders'", true); //check if slider is template $sliderTemplate = $slider->getParam("template", "false"); //set slide delay $sliderDelay = $slider->getParam("delay", "9000"); $slideDelay = $slide->getParam("delay", ""); if (empty($slideDelay)) { $slideDelay = $sliderDelay; } //add tools.min.js wp_enqueue_script('tp-tools', RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.tools.min.js', array(), RevSliderGlobals::SLIDER_REVISION); $arrLayers = $slide->getLayers(); //set Layer settings $cssContent = $operations->getCaptionsContent();
function get_select_target_options($type) { $options = array(); switch ($type) { case 'page': $entries = get_pages('title_li=&orderby=name&number=40'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'cat': $entries = get_categories('orderby=name&hide_empty=0'); foreach ($entries as $key => $entry) { $options[$entry->term_id] = $entry->name; } break; case 'author': $mk_user_query = get_users(); if (!empty($mk_user_query)) { foreach ($mk_user_query as $user) { $options[$user_id] = $user->display_name; } } break; case 'post': $entries = get_posts('orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'portfolio': $entries = get_posts('post_type=portfolio&orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'flexslider': $entries = get_posts('post_type=slideshow&orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'banner_builder': $entries = get_posts('post_type=banner_builder&orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'icarousel': $entries = get_posts('post_type=icarousel&orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'edge': $entries = get_posts('post_type=edge&orderby=title&numberposts=20&order=ASC&suppress_filters=0'); foreach ($entries as $key => $entry) { $options[$entry->ID] = $entry->post_title; } break; case 'portfolio_category': $entries = get_terms('portfolio_category', 'orderby=name&hide_empty=0'); foreach ($entries as $key => $entry) { $options[$entry->slug] = $entry->name; } break; case 'portfolio_category_id': $entries = get_terms('portfolio_category', 'orderby=name&hide_empty=0'); foreach ($entries as $key => $entry) { $options[$entry->term_id] = $entry->name; } break; case 'revolution_slider': if (class_exists('RevSlider')) { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); foreach ($arrSliders as $key => $entry) { $options[$key] = $entry; } } break; case 'layer_slider_source': if (is_plugin_active('LayerSlider/layerslider.php')) { global $wpdb; $table_name = $wpdb->prefix . "layerslider"; $sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n WHERE flag_hidden = '0' AND flag_deleted = '0'\n ORDER BY date_c ASC LIMIT 100"); if ($sliders != null && !empty($sliders)) { foreach ($sliders as $item) { $options[$item->id] = $item->name; } } } } return $options; }
public function form($instance) { if (isset($instance['show_filter'])) { $show_filter = $instance['show_filter']; } else { $show_filter = TRUE; } if (isset($instance['horizontal_filter'])) { $horizontal_filter = $instance['horizontal_filter']; } else { $horizontal_filter = FALSE; } $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); $field = "revolution_slider"; $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $sliderID = UniteFunctionsRev::getVal($instance, $field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); ?> <p> <label for="<?php echo $this->get_field_id('revolution_slider'); ?> "><?php echo __('Revolution Slider', 'aviators'); ?> </label> <?php print $select; ?> </p> <p> <label for="<?php echo $this->get_field_id('show_filter'); ?> "><?php echo __('Show filter', 'aviators'); ?> </label> <input type="checkbox" id="<?php echo $this->get_field_id('show_filter'); ?> " name="<?php echo $this->get_field_name('show_filter'); ?> " value="1" <?php checked($show_filter); ?> > </p> <p> <label for="<?php echo $this->get_field_id('horizontal_filter'); ?> "><?php echo __('Horizontal filter', 'aviators'); ?> </label> <input type="checkbox" id="<?php echo $this->get_field_id('horizontal_filter'); ?> " name="<?php echo $this->get_field_name('horizontal_filter'); ?> " value="1" <?php checked($horizontal_filter); ?> > </p> <?php }
$arrSortBy = $arrSortBy + $arrEMSortBy; } $sliderMainSettings->addSelect("post_sortby", $arrSortBy, __("Sort Posts By", REVSLIDER_TEXTDOMAIN), RevSlider::DEFAULT_POST_SORTBY); //sort direction $arrSortDir = UniteFunctionsWPRev::getArrSortDirection(); $sliderMainSettings->addRadio("posts_sort_direction", $arrSortDir, __("Sort Direction", REVSLIDER_TEXTDOMAIN), RevSlider::DEFAULT_POST_SORTDIR); //max posts for slider $arrParams = array("class" => "small", "unit" => "posts"); $sliderMainSettings->addTextBox("max_slider_posts", "30", __("Max Posts Per Slider", REVSLIDER_TEXTDOMAIN), $arrParams); //exerpt limit $arrParams = array("class" => "small", "unit" => "words"); $sliderMainSettings->addTextBox("excerpt_limit", "55", __("Limit The Excerpt To", REVSLIDER_TEXTDOMAIN), $arrParams); //slider template $sliderMainSettings->addhr(); $slider1 = new RevSlider(); $arrSlidersTemplates = $slider1->getArrSlidersShort(null, RevSlider::SLIDER_TYPE_TEMPLATE); $sliderMainSettings->addSelect("slider_template_id", $arrSlidersTemplates, __("Template Slider", REVSLIDER_TEXTDOMAIN), "", array()); $sliderMainSettings->endBulkControl(); $arrParams = array("description" => __("Type here the post IDs you want to use separated by coma. ex: 23,24,25", REVSLIDER_TEXTDOMAIN)); $sliderMainSettings->addTextBox("posts_list", "", __("Specific Posts List", REVSLIDER_TEXTDOMAIN), $arrParams); $sliderMainSettings->addControl("source_type", "posts_list", UniteSettingsRev::CONTROL_TYPE_SHOW, "specific_posts"); $sliderMainSettings->addHr(); //set slider type / texts $sliderMainSettings->addRadio("slider_type", array("fixed" => __("Fixed", REVSLIDER_TEXTDOMAIN), "responsitive" => __("Custom", REVSLIDER_TEXTDOMAIN), "fullwidth" => __("Auto Responsive", REVSLIDER_TEXTDOMAIN), "fullscreen" => __("Full Screen", REVSLIDER_TEXTDOMAIN)), __("Slider Layout", REVSLIDER_TEXTDOMAIN), "fullwidth"); $arrParams = array("class" => "medium", "description" => __("Example: #header or .header, .footer, #somecontainer | The height of fullscreen slider will be decreased with the height of these Containers to fit perfect in the screen", REVSLIDER_TEXTDOMAIN)); $sliderMainSettings->addTextBox("fullscreen_offset_container", "", __("Offset Containers", REVSLIDER_TEXTDOMAIN), $arrParams); $sliderMainSettings->addControl("slider_type", "fullscreen_offset_container", UniteSettingsRev::CONTROL_TYPE_SHOW, "fullscreen"); $arrParams = array("class" => "medium", "description" => __("Defines an Offset to the top. Can be used with px and %. Example: 40px or 10%", REVSLIDER_TEXTDOMAIN)); $sliderMainSettings->addTextBox("fullscreen_offset_size", "", __("Offset Size", REVSLIDER_TEXTDOMAIN), $arrParams); $sliderMainSettings->addControl("slider_type", "fullscreen_offset_size", UniteSettingsRev::CONTROL_TYPE_SHOW, "fullscreen"); $arrParams = array("description" => __("", REVSLIDER_TEXTDOMAIN));
/** * Constructor */ public function __construct() { parent::__construct(); $operations = new RevOperations(); $sliderID = $this->getRequest()->getParam('id'); $storeID = $this->getRequest()->getParam('store_id', 0); if (empty($sliderID)) { UniteFunctionsRev::throwError("Slider ID not found"); } $slider = new RevSlider(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); $arrSliders = $slider->getArrSlidersShort($sliderID); $selectSliders = UniteFunctionsRev::getHTMLSelect($arrSliders, "", "id='selectSliders'", true); $numSliders = count($arrSliders); //set iframe parameters $width = $sliderParams["width"]; $height = $sliderParams["height"]; $iframeWidth = $width + 60; $iframeHeight = $height + 50; $iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;"; $arrSlides = $slider->getSlides(false, $storeID); $numSlides = count($arrSlides); $linksSliderSettings = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/' . $sliderID); $patternViewSlide = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/[slideid]'); $useStaticLayers = $slider->getParam("enable_static_layers", "off"); //treat in case of slides from gallery if ($slider->isSlidesFromPosts() == false) { $templateName = "slides_gallery"; // store view $selectStoreView = Mage::app()->getLayout()->createBlock('core/html_select')->setName('select_storeview')->setId('select_storeview')->setTitle('Store View')->setValue($storeID)->setOptions(Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))->getHtml(); $this->assign('storeID', $storeID); $this->assign('selectStoreView', $selectStoreView); $this->setTemplate('nwdthemes/revslider/templates/slides_gallery.phtml'); } else { //slides from posts $templateName = "slides_posts"; $sourceType = $slider->getParam("source_type", "posts"); $showSortBy = $sourceType == "posts" ? true : false; $showDelete = $sourceType == "specific_posts" ? true : false; //get button links $urlNewPost = $this->helper('adminhtml')->getUrl('adminhtml/catalog_product/new'); $linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, $this->__("<i class='revicon-pencil-1'></i>New Product"), "button_new_post", "button-primary revblue", true); //get ordering $arrSortBy = $this->helper('nwdrevslider')->getArrSortBy(); $sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY); $selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true); $this->assign('showSortBy', $showSortBy); $this->assign('showDelete', $showDelete); $this->assign('selectSortBy', $selectSortBy); $this->assign('linkNewPost', $linkNewPost); $this->setTemplate('nwdthemes/revslider/templates/slides_posts.phtml'); } $this->assign('sliderID', $sliderID); $this->assign('iframeStyle', $iframeStyle); $this->assign('patternViewSlide', $patternViewSlide); $this->assign('selectSliders', $selectSliders); $this->assign('linksSliderSettings', $linksSliderSettings); $this->assign('useStaticLayers', $useStaticLayers); $this->assign('arrSlides', $arrSlides); $this->assign('slider', $slider); $this->assign('numSlides', $numSlides); $this->assign('numSliders', $numSliders); }
function get_external_sliders($type) { global $wpdb; $sliders = array(); if ($type == 'layerslider') { /* SLIDER VALUES */ if (class_exists('LS_Sliders')) { $layer_sliders = LS_Sliders::find(array('data' => false)); foreach ($layer_sliders as $item) { $sliders = array_merge($sliders, array("layerslider_" . $item['id'] => "LayerSlider - " . $item['name'])); } } } else { if ($type == 'revslider') { if (class_exists('RevSlider')) { $revo = new RevSlider(); $revo_sliders = $revo->getArrSlidersShort(); foreach ($revo_sliders as $rev_id => $rev_title) { $s = new RevSlider(); $s->initByID($rev_id); $alias = $s->getAlias(); $sliders = array_merge($sliders, array("revslider_" . $alias => "Revolution Slider - " . $rev_title)); } } } else { if ($type == 'masterslider') { if (function_exists('get_mastersliders')) { $master_sliders = get_mastersliders(); foreach ($master_sliders as $slider) { $sliders = array_merge($sliders, array("masterslider_" . $slider['ID'] => "Master Slider - " . $slider['title'])); } } } } } return $sliders; }
function select($option) { $value = $this->value($option); $toggle = isset($option['toggle']) ? ' toggle="' . $this->toggle($option) . '"' : ''; // Source : Post Type if (isset($option['source']['post_type'])) { $source[''] = ''; $args = array('post_type' => $option['source']['post_type'], 'numberposts' => -1, 'orderby' => 'parent', 'order' => 'DESC', 'suppress_filters' => 0); $posts = get_posts($args); foreach ($posts as $post) { $source[$post->ID] = $post->post_title . ' (' . $post->ID . ')'; } } // Source : RevSlider if (isset($option['source']['revslider']) && class_exists('RevSlider')) { $slider = new RevSlider(); $revsliders = $slider->getArrSlidersShort(); foreach ($revsliders as $id => $name) { $source[$id] = $name . ' (' . $id . ')'; } } // Source : Layer Slider if (isset($option['source']['layer_slider'])) { global $wpdb; $table_name = $wpdb->prefix . "layerslider"; if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") == $table_name) { $sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\tORDER BY id ASC LIMIT 200"); if (!empty($sliders)) { foreach ($sliders as $slider) { $source[$slider->id] = $slider->name . ' (' . $slider->id . ')'; } } } } // Source : Category if (isset($option['source']['category'])) { $args = array('type' => $option['source']['category'], 'orderby' => 'term_group'); $taxanomies = get_categories($args); foreach ($taxanomies as $taxanomy) { $source[$taxanomy->term_id] = $taxanomy->category_nicename; } } // Source : Taxonomy if (isset($option['source']['taxonomy'])) { $args = array('taxonomy' => $option['source']['taxonomy'], 'orderby' => 'term_group'); $taxanomies = get_categories($args); foreach ($taxanomies as $taxanomy) { $source[$taxanomy->term_id] = $taxanomy->category_nicename; } } // Source : Font Awesome if (isset($option['source']['font-awesome'])) { $source[''] = 'Select icon ...'; asort($GLOBALS['font_awesome_list']); foreach ($GLOBALS['font_awesome_list'] as $key => $val) { $source[$key] = str_replace('icon-', '', $val); } } // Source : Option Custom Sidebar if (isset($option['source']['option-custom-sidebar'])) { if (is_array(theme_options('sidebar', 'custom_sidebars'))) { foreach (theme_options('sidebar', 'custom_sidebars') as $list) { $source[preg_replace('/[^A-Za-z0-9\\-]/', '', str_replace(' ', '-', strtolower($list['stack_title'])))] = $list['stack_title']; } } } // Source : Google Web Font if (isset($option['source']['gfonts'])) { $items = get_transient(THEME_SLUG . 'gfont_items'); if (!$items) { // No transient, request the new one $google_api_url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyALn_gIORMu90pZJhO4-z5xULIWH9Lce-A'; $response = wp_remote_retrieve_body(wp_remote_get($google_api_url, array('sslverify' => false))); if (is_wp_error($response)) { // Failed, get from option $items = get_option(THEME_SLUG . 'gfont_items'); } else { // Success $response = json_decode($response); $items = $response->items; // Store set_transient(THEME_SLUG . 'gfont_items', $items, 60 * 60 * 12); if (!add_option(THEME_SLUG . 'gfont_items', $items)) { update_option(THEME_SLUG . 'gfont_items', $items); } } } // Add to source $source[''] = __('Please Select', 'theme_admin'); if ($items) { foreach ($items as $item) { $source[$item->family] = $item->family; } } else { $source[$value] = $value; } } // Multiple $multiple = isset($option['multiple']) ? ' multiple size="' . $option['multiple'] . '"' : ''; $name = isset($option['multiple']) ? 'name="' . $this->name($option) . '[]"' : 'name="' . $this->name($option) . '"'; // Generate echo '<select ' . $multiple . ' class="input-select" ' . $name . '" id="' . $this->id($option) . '" ' . $toggle . '>'; if (isset($option['options'])) { foreach ($option['options'] as $select_slug => $select_title) { $selected = $select_slug == $value || is_array($value) && in_array($select_slug, $value) ? 'selected="selected"' : ''; echo '<option value="' . $select_slug . '" ' . $selected . '>' . $select_title . '</option>'; } } if (isset($source)) { foreach ($source as $select_slug => $select_title) { $selected = $select_slug == $value || is_array($value) && in_array($select_slug, $value) ? 'selected="selected"' : ''; echo '<option value="' . $select_slug . '" ' . $selected . '>' . $select_title . '</option>'; } } echo '</select>'; }
/** * * the form */ public function form($instance) { try { $slider = new RevSlider(); $arrSliders = $slider->getArrSlidersShort(); } catch (Exception $e) { } if (empty($arrSliders)) { echo __("No sliders found, Please create a slider", REVSLIDER_TEXTDOMAIN); } else { $field = "rev_slider"; $fieldPages = "rev_slider_pages"; $fieldCheck = "rev_slider_homepage"; $fieldTitle = "rev_slider_title"; $sliderID = UniteFunctionsRev::getVal($instance, $field); $homepage = UniteFunctionsRev::getVal($instance, $fieldCheck); $pagesValue = UniteFunctionsRev::getVal($instance, $fieldPages); $title = UniteFunctionsRev::getVal($instance, $fieldTitle); $fieldID = $this->get_field_id($field); $fieldName = $this->get_field_name($field); $select = UniteFunctionsRev::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true); $fieldID_check = $this->get_field_id($fieldCheck); $fieldName_check = $this->get_field_name($fieldCheck); $checked = ""; if ($homepage == "on") { $checked = "checked='checked'"; } $fieldPages_ID = $this->get_field_id($fieldPages); $fieldPages_Name = $this->get_field_name($fieldPages); $fieldTitle_ID = $this->get_field_id($fieldTitle); $fieldTitle_Name = $this->get_field_name($fieldTitle); ?> <label for="<?php echo $fieldTitle_ID; ?> "><?php _e("Title", REVSLIDER_TEXTDOMAIN); ?> :</label> <input type="text" name="<?php echo $fieldTitle_Name; ?> " id="<?php echo $fieldTitle_ID; ?> " value="<?php echo $title; ?> " class="widefat"> <br><br> <?php _e("Choose Slider", REVSLIDER_TEXTDOMAIN); ?> : <?php echo $select; ?> <div style="padding-top:10px;"></div> <label for="<?php echo $fieldID_check; ?> "><?php _e("Home Page Only", REVSLIDER_TEXTDOMAIN); ?> :</label> <input type="checkbox" name="<?php echo $fieldName_check; ?> " id="<?php echo $fieldID_check; ?> " <?php echo $checked; ?> > <br><br> <label for="<?php echo $fieldPages_ID; ?> "><?php _e("Pages: (example: 2,10)", REVSLIDER_TEXTDOMAIN); ?> </label> <input type="text" name="<?php echo $fieldPages_Name; ?> " id="<?php echo $fieldPages_ID; ?> " value="<?php echo $pagesValue; ?> "> <div style="padding-top:10px;"></div> <?php } //else }
function converio_draw_display_metabox($post) { global $post; $data = get_post_custom($post->ID); $hide_title = isset($data['hide_title']) ? esc_attr($data['hide_title'][0]) : 0; $hide_breadcrumb = isset($data['hide_breadcrumb']) ? esc_attr($data['hide_breadcrumb'][0]) : 0; $sidebar_position = isset($data['sidebar_position']) ? esc_attr($data['sidebar_position'][0]) : 0; //Revolution Slider if (is_plugin_active('revslider/revslider.php')) { $revolution_slider = isset($data['revolution_slider']) ? esc_attr($data['revolution_slider'][0]) : ''; } wp_nonce_field('converio_display_metabox_nonce', 'display_metabox_nonce'); ?> <p><label for="hide_title"><?php esc_attr_e('Show title?', 'converio'); ?> </label> <select name="hide_title" id="hide_title"> <option value="0" <?php if ($hide_title == 0) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Show', 'converio'); ?> </option> <option value="1" <?php if ($hide_title == 1) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Don\'t show', 'converio'); ?> </option> </select></p> <p><label for="hide_breadcrumb"><?php esc_attr_e('Show breadcrumb?', 'converio'); ?> </label> <select name="hide_breadcrumb" id="hide_breadcrumb"> <option value="0" <?php if ($hide_breadcrumb == 0) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Show', 'converio'); ?> </option> <option value="1" <?php if ($hide_breadcrumb == 1) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Don\'t show', 'converio'); ?> </option> <option value="2" <?php if ($hide_breadcrumb == 2) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Show without headline', 'converio'); ?> </option> <option value="3" <?php if ($hide_breadcrumb == 3) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('As set in Theme Customizer', 'converio'); ?> </option> </select></p> <p><label for="sidebar_position"><?php esc_attr_e('Sidebar position', 'converio'); ?> </label> <select name="sidebar_position" id="sidebar_position"> <option value="0" <?php if ($sidebar_position == 0) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Right (default)', 'converio'); ?> </option> <option value="1" <?php if ($sidebar_position == 1) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Left', 'converio'); ?> </option> <option value="2" <?php if ($sidebar_position == 2) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('Don\'t show', 'converio'); ?> </option> <option value="3" <?php if ($sidebar_position == 3) { echo 'selected="selected"'; } ?> ><?php esc_attr_e('As set in Theme Customizer', 'converio'); ?> </option> </select></p> <?php //Revolution Slider if (is_plugin_active('revslider/revslider.php')) { $slider = new RevSlider(); // Array of current slider "alias" names $arrSliders = $slider->getArrSlidersShort(); ?> <p><label for="revolution_slider"><?php esc_attr_e('Revolution Slider', 'converio'); ?> </label> <select name="revolution_slider" id="revolution_slider"> <option value="" <?php if ($revolution_slider == '') { echo 'selected="selected"'; } ?> ><?php esc_attr_e('None', 'converio'); ?> </option> <?php foreach ($arrSliders as $rev_id => $rev_slider) { ?> <option value="<?php echo esc_attr($rev_id); ?> " <?php if ($revolution_slider == $rev_id) { echo 'selected="selected"'; } ?> ><?php echo esc_attr($rev_slider); ?> </option> <?php } ?> </select></p> <?php } //end of Revolution Slider }