. * * @package ReduxFramework * @subpackage Field_slides * @author Luciano "WebCaos" Ubertini * @author Daniel J Griffiths (Ghost1227) * @author Dovy Paukstys * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) exit; // Don't duplicate me! if (!class_exists('ReduxFramework_slideshow')) { /** * Main ReduxFramework_slideshow class * * @since 1.0.0 */ class ReduxFramework_slideshow extends widget_handler{ var $titles = array(); var $field_id = ""; /** * Field Constructor. * * Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function * * @since 1.0.0 * @access public * @param array $field * @param string $value * @param $parent * @return \ReduxFramework_slideshow */ function __construct( $field = array(), $value ='', $parent ) { parent::__construct($field,$value,$parent); $this->field_id = $this->field['id']; $default_titles = array( 'name'=>"Slider", "add_slider" => "Add Slider", "add_slide" => "Add Slide", "remove_slider" => "Delete Slider", "remove_slide" => "Delete Slide", "new_slide" => "New item", ); if(!isset($this->field['titles']) || !is_array($this->field['titles'])) $this->field['titles'] = array(); $this->titles = wp_parse_args($this->field['titles'],$default_titles); $this->enqueue(); } public function blank_slider(){ echo '
"; $this->widget_field(self::$product_selector); $this->widget_field(self::$category_selector); $this->widget_field(self::$url); } /** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @param bool $hidden * @return void */ public function render($hidden = false) { if($hidden == false) { $this->blank_slider(); if(!isset($this->value['count']) || empty($this->value['count'])) $this->value['count']=1; if(!isset($this->value['sliders']) || empty($this->value['sliders'])) $this->value['sliders']="1"; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } $x = 0; if(!isset($this->value['items']) || empty($this->value['items'])){ if($this->field_id == "slider_widgets") { $this->value['items'] = array('1' => array('title' => 'Dummy Silder', 'slides' => array( array('title' => 'SLIDE 1', 'image' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 1', 'thumb' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 1' ), array('title' => 'SLIDE 2', 'image' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 2', 'thumb' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 2' ), array('title' => 'SLIDE 3', 'image' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 3', 'thumb' => 'http://dummyimage.com/300x100/ecf0f1/000000&text=SLIDE 3' ) ))); }elseif($this->field_id == "grid_widgets") { $this->value['items'] = array('1' => array('title' => 'Dummy Grid', 'slides' => array( array('title' => 'Grid Item 1', 'image' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+1', 'thumb' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+1' ), array('title' => 'Grid Item 2', 'image' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+2', 'thumb' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+2' ), array('title' => 'Grid Item 3', 'image' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+3', 'thumb' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+3' ), array('title' => 'Grid Item 4', 'image' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+4', 'thumb' => 'http://dummyimage.com/200x200/6a97a6/e0e0e0.png&text=GRID+ITEM+4' ), ))); }else{ $this->value['items'] = array('1' => array()); } }else if(isset($this->value['items']['_blank'])) unset($this->value['items']['_blank']); $filed_name = $this->field['name']; $id = $this->field['id']; if(isset($this->value['items'] )){ ksort($this->value['items']); } foreach($this->value['items'] as $key=>$value){ if(!$hidden) { if(empty($value['title'])) $value['title'] = $this->titles['name'].' '.$key; echo '