choices)) { return; } ?> icon_array = $args['icon_array']; } parent::__construct($manager, $id, $args); } public function render_content() { ?> choices)) { return; } ?> label); ?> description) { ?> description); ?> value()) ? explode(',', $this->value()) : $this->value(); ?> link(); ?> value="" /> label)) : ?>

label); ?>

description) { ?> description); ?> placeholder = $args['placeholder']; parent::__construct($manager, $id, $args); } public function render_content() { if (empty($this->choices)) { return; } ?> cats = get_categories($options); parent::__construct($manager, $id, $args); } public function render_content() { if (!empty($this->cats)) { ?> image_path = $args['image_path']; $this->choices = $args['choices']; parent::__construct($manager, $id, $args); } public function render_content() { if (!empty($this->choices)) { ?> on_off_label = $args['on_off_label']; $this->class = isset($args['class']) ? $args['class'] : ''; parent::__construct($manager, $id, $args); } public function render_content() { $switch_class = ($this->value() == 'on') ? 'switch-on ' : ''; $switch_class .= $this->class; $on_off_label = $this->on_off_label; ?>
link(); ?> type="hidden" value="value()); ?>"/> label); ?> description) { ?> description); ?> label); ?> description) { ?> description); ?> options = $args['options']; $this->class = isset($args['class']) ? $args['class'] : ''; parent::__construct($manager, $id, $args); } public function render_content() { $options = $this->options; ?> palette)) { $palette = implode('|', $this->palette); } else { // Default to true. $palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true'; } // Support passing show_opacity as string or boolean. Default to true. $show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true'; // Begin the output. ?> link(); ?> />
link(); ?> value()); ?>>
label); ?> description)) { ?> description); ?>

get_button_labels(); $this->button_labels = apply_filters('business_shuffle_customizer_background_button_labels', $button_labels, $id); // Set field labels $field_labels = $this->get_field_labels(); $this->field_labels = apply_filters('business_shuffle_customizer_background_field_labels', $field_labels, $id); // Set background choices $background_choices = $this->get_background_choices(); $this->background_choices = apply_filters('business_shuffle_customizer_background_choices', $background_choices, $id); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function to_json() { parent::to_json(); $background_choices = $this->background_choices; $field_labels = $this->field_labels; // Loop through each of the settings and set up the data for it. foreach ($this->settings as $setting_key => $setting_id) { $this->json[$setting_key] = array( 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), 'label' => isset($field_labels[$setting_key]) ? $field_labels[$setting_key] : '' ); if ('image_url' === $setting_key) { if ($this->value($setting_key)) { // Get the attachment model for the existing file. $attachment_id = attachment_url_to_postid($this->value($setting_key)); if ($attachment_id) { $this->json['attachment'] = wp_prepare_attachment_for_js($attachment_id); } } } elseif ('repeat' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['repeat']; } elseif ('size' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['size']; } elseif ('position' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['position']; } elseif ('attach' === $setting_key) { $this->json[$setting_key]['choices'] = $background_choices['attach']; } } } /** * Render a JS template for the content of the media control. * * @since 1.0.0 */ public function content_template() { parent::content_template(); ?>
<# if ( data.attachment && data.repeat && data.repeat.choices ) { #>
  • <# if ( data.repeat.label ) { #> {{ data.repeat.label }} <# } #>
  • <# } #> <# if ( data.attachment && data.size && data.size.choices ) { #>
  • <# if ( data.size.label ) { #> {{ data.size.label }} <# } #>
  • <# } #> <# if ( data.attachment && data.position && data.position.choices ) { #>
  • <# if ( data.position.label ) { #> {{ data.position.label }} <# } #>
  • <# } #> <# if ( data.attachment && data.attach && data.attach.choices ) { #>
  • <# if ( data.attach.label ) { #> {{ data.attach.label }} <# } #>
  • <# } #>
    esc_html__('Select Image', 'business-shuffle'), 'change' => esc_html__('Change Image', 'business-shuffle'), 'remove' => esc_html__('Remove', 'business-shuffle'), 'default' => esc_html__('Default', 'business-shuffle'), 'placeholder' => esc_html__('No image selected', 'business-shuffle'), 'frame_title' => esc_html__('Select Image', 'business-shuffle'), 'frame_button' => esc_html__('Choose Image', 'business-shuffle'), ); return $button_labels; } /** * Returns field labels. * * @since 1.0.0 */ public static function get_field_labels() { $field_labels = array( 'repeat' => esc_html__('Repeat', 'business-shuffle'), 'size' => esc_html__('Size', 'business-shuffle'), 'position' => esc_html__('Position', 'business-shuffle'), 'attach' => esc_html__('Attachment', 'business-shuffle') ); return $field_labels; } /** * Returns the background choices. * * @since 1.0.0 * @return array */ public static function get_background_choices() { $choices = array( 'repeat' => array( 'no-repeat' => esc_html__('No Repeat', 'business-shuffle'), 'repeat' => esc_html__('Tile', 'business-shuffle'), 'repeat-x' => esc_html__('Tile Horizontally', 'business-shuffle'), 'repeat-y' => esc_html__('Tile Vertically', 'business-shuffle') ), 'size' => array( 'auto' => esc_html__('Default', 'business-shuffle'), 'cover' => esc_html__('Cover', 'business-shuffle'), 'contain' => esc_html__('Contain', 'business-shuffle') ), 'position' => array( 'left-top' => esc_html__('Left Top', 'business-shuffle'), 'left-center' => esc_html__('Left Center', 'business-shuffle'), 'left-bottom' => esc_html__('Left Bottom', 'business-shuffle'), 'right-top' => esc_html__('Right Top', 'business-shuffle'), 'right-center' => esc_html__('Right Center', 'business-shuffle'), 'right-bottom' => esc_html__('Right Bottom', 'business-shuffle'), 'center-top' => esc_html__('Center Top', 'business-shuffle'), 'center-center' => esc_html__('Center Center', 'business-shuffle'), 'center-bottom' => esc_html__('Center Bottom', 'business-shuffle') ), 'attach' => array( 'fixed' => esc_html__('Fixed', 'business-shuffle'), 'scroll' => esc_html__('Scroll', 'business-shuffle') ) ); return $choices; } } class Business_shuffle_Control_Tab extends WP_Customize_Control { public $type = 'tab'; public $buttons = ''; public function __construct($manager, $id, $args = array()) { parent::__construct($manager, $id, $args); } public function to_json() { parent::to_json(); $first = true; $formatted_buttons = array(); $all_fields = array(); foreach ($this->buttons as $button) { //$fields = array(); $active = isset($button['active']) ? $button['active'] : false; if ($active && $first) { $first = false; } elseif ($active && !$first) { $active = false; } $formatted_buttons[] = array( 'name' => $button['name'], 'fields' => $button['fields'], 'active' => $active, ); $all_fields = array_merge($all_fields, $button['fields']); } $this->json['buttons'] = $formatted_buttons; $this->json['fields'] = $all_fields; } public function content_template() { ?>
    <# if ( data.buttons ) { #>
    <# for (tab in data.buttons) { #> {{ data.buttons[tab].name }} <# } #>
    <# } #>
    render_content() for the internals. * * @see WP_Customize_Control::render() */ protected function render() { $id = 'customize-control-' . str_replace(array('[', ']'), array('-', ''), $this->id); $class = 'customize-control has-switchers customize-control-' . $this->type; ?>
  • render_content(); ?>
  • json['id'] = $this->id; $this->json['l10n'] = $this->l10n(); $this->json['title'] = esc_html__('Link values together', 'business-shuffle'); $this->json['inputAttrs'] = ''; foreach ($this->input_attrs as $attr => $value) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr($value) . '" '; } $this->json['desktop'] = array(); $this->json['tablet'] = array(); $this->json['mobile'] = array(); foreach ($this->settings as $setting_key => $setting) { list( $_key ) = explode('_', $setting_key); $this->json[$_key][$setting_key] = array( 'id' => $setting->id, 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), ); } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> <# if ( data.label ) { #> {{{ data.label }}} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> esc_attr__('Top', 'business-shuffle'), 'desktop_right' => esc_attr__('Right', 'business-shuffle'), 'desktop_bottom' => esc_attr__('Bottom', 'business-shuffle'), 'desktop_left' => esc_attr__('Left', 'business-shuffle'), 'tablet_top' => esc_attr__('Top', 'business-shuffle'), 'tablet_right' => esc_attr__('Right', 'business-shuffle'), 'tablet_bottom' => esc_attr__('Bottom', 'business-shuffle'), 'tablet_left' => esc_attr__('Left', 'business-shuffle'), 'mobile_top' => esc_attr__('Top', 'business-shuffle'), 'mobile_right' => esc_attr__('Right', 'business-shuffle'), 'mobile_bottom' => esc_attr__('Bottom', 'business-shuffle'), 'mobile_left' => esc_attr__('Left', 'business-shuffle'), ); if (false === $id) { return $translation_strings; } return $translation_strings[$id]; } } class Business_shuffle_Range_Slider_Control extends WP_Customize_Control { /** * The control type. * * @access public * @var string */ public $type = 'range-slider'; /** * Renders the control wrapper and calls $this->render_content() for the internals. * * @see WP_Customize_Control::render() */ protected function render() { $id = 'customize-control-' . str_replace(array('[', ']'), array('-', ''), $this->id); $class = 'customize-control has-switchers customize-control-' . $this->type; ?>
  • render_content(); ?>
  • json['id'] = $this->id; $this->json['inputAttrs'] = ''; foreach ($this->input_attrs as $attr => $value) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr($value) . '" '; } $this->json['desktop'] = array(); $this->json['tablet'] = array(); $this->json['mobile'] = array(); foreach ($this->settings as $setting_key => $setting) { $this->json[$setting_key] = array( 'id' => $setting->id, 'default' => $setting->default, 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), ); } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> <# if ( data.label ) { #> {{{ data.label }}} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <# if ( data.desktop ) { #>
    <# } #> <# if ( data.tablet ) { #>
    <# } #> <# if ( data.mobile ) { #>
    <# } #> json['default'] = $this->setting->default; if (isset($this->default)) { $this->json['default'] = $this->default; } $this->json['value'] = maybe_unserialize($this->value()); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['inputAttrs'] = ''; foreach ($this->input_attrs as $attr => $value) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr($value) . '" '; } $this->json['inputAttrs'] = maybe_serialize($this->input_attrs()); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> label); ?>
    link(); ?> />
    description) { ?> description); ?> palette = $args['palette']; } parent::__construct($manager, $id, $args); } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); // Process the palette if (is_array($this->palette)) { $palette_string = implode('|', $this->palette); } else { // Default to true. $palette_string = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true'; } $this->json['show_opacity'] = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true'; $this->json['group'] = array(); $this->json['l10n'] = $this->l10n(); $this->json['group'] = $this->group; $this->json['palette'] = $palette_string; foreach ($this->settings as $setting_key => $setting) { list( $_key ) = explode('_', $setting_key); $this->json[$_key][$setting_key] = array( 'id' => $setting->id, 'link' => $this->get_link($setting_key), 'value' => $this->value($setting_key), 'default' => $setting->default ); } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?> <# if ( data.label ) { #>
    <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> esc_attr__('Normal', 'business-shuffle'), 'hover' => esc_attr__('Hover', 'business-shuffle') ); if (false === $id) { return $translation_strings; } return $translation_strings[$id]; } } } if (class_exists('WP_Customize_Section')) { /** * Class Business_shuffle_Toggle_Section * * @access public */ class Business_shuffle_Toggle_Section extends WP_Customize_Section { /** * The type of customize section being rendered. * * @access public * @var string */ public $type = 'toggle-section'; /** * Flag to display icon when entering in customizer * * @access public * @var bool */ public $hide; /** * Name of customizer hiding control. * * @access public * @var bool */ public $hiding_control; /** * Business_shuffle_Toggle_Section constructor. * * @param WP_Customize_Manager $manager Customizer Manager. * @param string $id Control id. * @param array $args Arguments. */ public function __construct(WP_Customize_Manager $manager, $id, array $args = array()) { parent::__construct($manager, $id, $args); if (isset($args['hiding_control'])) { $this->hide = get_theme_mod($args['hiding_control'], 'off'); } add_action('customize_controls_init', array($this, 'enqueue')); } /** * Add custom parameters to pass to the JS via JSON. * * @access public */ public function json() { $json = parent::json(); $json['hide'] = $this->hide; $json['hiding_control'] = $this->hiding_control; return $json; } /** * Enqueue function. * * @access public * @return void */ public function enqueue() { wp_enqueue_script('business-shuffle-toggle-section', get_template_directory_uri() . '/inc/customizer/js/toggle-section.js', array('jquery'), '1.0', true); } /** * Outputs the Underscore.js template. * * @access public * @return void */ protected function render_template() { ?>
  • {{ data.title }} <# if ( data.hide != 'on' ) { #> <# } else { #> <# } #>