. * * @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_kad_slides')) { /** * Main ReduxFramework_slides class * * @since 1.0.0 */ class ReduxFramework_kad_slides extends ReduxFramework{ /** * 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 * @return void */ function __construct( $field = array(), $value ='', $parent ) { parent::__construct( $parent->sections, $parent->args ); $this->parent = $parent; $this->field = $field; $this->value = $value; } /** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { echo '
'; $x = 0; $multi = (isset($this->field['multi']) && $this->field['multi']) ? ' multiple="multiple"' : ""; if (isset($this->value) && is_array($this->value)) { $slides = $this->value; foreach ($slides as $slide) { if ( empty( $slide ) ) { continue; } $defaults = array( 'title' => '', 'description' => '', 'sort' => '', 'link' => '', 'url' => '', 'thumb' => '', 'attachment_id' => '', 'height' => '', 'width' => '', 'select' => array(), ); $slide = wp_parse_args( $slide, $defaults ); if (empty($slide['url']) && !empty($slide['attachment_id'])) { $img = wp_get_attachment_image_src($slide['attachment_id'], 'full'); $slide['url'] = $img[0]; $slide['width'] = $img[1]; $slide['height'] = $img[2]; } echo '

' . $slide['title'] . '

'; $hide = ''; if ( empty( $slide['url'] ) ) { $hide = ' hide'; } echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '' . __('Upload', 'redux-framework') . ''; $hide = ''; if (empty($slide['url']) || $slide['url'] == '') $hide = ' hide'; echo '' . __('Remove', 'redux-framework') . ''; echo '
' . "\n"; echo '
    '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo '
  • '; echo ''; echo ''; echo ''; echo '
  • '; if ( isset( $this->field['options'] ) && !empty( $this->field['options'] ) ) { $placeholder = (isset($this->field['placeholder']['options'])) ? esc_attr($this->field['placeholder']['options']) : __( 'Select an Option', 'redux-framework' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( esc_attr( $this->field['select2'] ) ); $select2_params = htmlspecialchars( $select2_params , ENT_QUOTES); echo ''; } echo ''; } echo '
  • ' . __('Delete Slide', 'redux-framework') . '
  • '; echo '
'; $x++; } } if ($x == 0) { echo '

New Slide

'; $hide = ' hide'; echo '
'; echo ''; echo ''; echo ''; echo '
'; //Upload controls DIV echo '
'; //If the user has WP3.5+ show upload/remove button echo '' . __('Upload', 'redux-framework') . ''; echo '' . __('Remove', 'redux-framework') . ''; echo '
' . "\n"; echo '
    '; $placeholder = (isset($this->field['placeholder']['url'])) ? esc_attr($this->field['placeholder']['url']) : __( 'URL', 'redux-framework' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['title'])) ? esc_attr($this->field['placeholder']['title']) : __( 'Title', 'redux-framework' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['description'])) ? esc_attr($this->field['placeholder']['description']) : __( 'Description', 'redux-framework' ); echo '
  • '; $placeholder = (isset($this->field['placeholder']['link'])) ? esc_attr($this->field['placeholder']['link']) : __( 'Slide Link', 'virtue' ); echo '
  • '; echo '
  • '; echo '
  • '; echo ''; echo ''; echo '
  • '; if ( isset( $this->field['options'] ) && !empty( $this->field['options'] ) ) { $placeholder = (isset($this->field['placeholder']['select'])) ? esc_attr($this->field['placeholder']['select']) : __( 'Select an Option', 'redux-framework' ); if ( isset( $this->field['select2'] ) ) { // if there are any let's pass them to js $select2_params = json_encode( esc_attr( $this->field['select2'] ) ); $select2_params = htmlspecialchars( $select2_params , ENT_QUOTES); echo ''; } echo ''; } echo '
  • ' . __('Delete Slide', 'redux-framework') . '
  • '; echo '
'; } echo '
' . __('Add Slide', 'redux-framework') . '
'; } } }