Пример #1
0
 /**
  * Render html UI_Background.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     $background_options = array('repeat' => array('no-repeat' => __('No repeat', 'cherry'), 'repeat' => __('Repeat All', 'cherry'), 'repeat-x' => __('Repeat Horizontally', 'cherry'), 'repeat-y' => __('Repeat Vertically', 'cherry')), 'position' => array('top-left' => __('Top Left', 'cherry'), 'top' => __('Top Center', 'cherry'), 'right-top' => __('Top Right', 'cherry'), 'left' => __('Middle Left', 'cherry'), 'center' => __('Middle Center', 'cherry'), 'right' => __('Middle Right', 'cherry'), 'bottom-left' => __('Bottom Left', 'cherry'), 'bottom' => __('Bottom Center', 'cherry'), 'bottom-right' => __('Bottom Right', 'cherry')), 'attachment' => array('notdefined' => __('Not defined', 'cherry'), 'scroll' => __('Scroll Normally', 'cherry'), 'fixed' => __('Fixed in Place', 'cherry')), 'clip' => array('notdefined' => __('Not defined', 'cherry'), 'padding-box' => __('Padding box', 'cherry'), 'border-box' => __('Border box', 'cherry'), 'content-box' => __('Content box', 'cherry')), 'size' => array('notdefined' => __('Not defined', 'cherry'), 'auto' => __('Auto', 'cherry'), 'cover' => __('Cover', 'cherry'), 'contain' => __('Contain', 'cherry')), 'origin' => array('notdefined' => __('Not defined', 'cherry'), 'padding-box' => __('Padding box', 'cherry'), 'border-box' => __('Border box', 'cherry'), 'content-box' => __('Content box', 'cherry')));
     $ui_media = new UI_Media(array('id' => $this->settings['id'] . '-image', 'name' => $this->settings['name'] . '[image]', 'value' => $this->settings['value']['image'], 'multi_upload' => $this->settings['multi_upload'], 'library_type' => $this->settings['library_type']));
     $ui_colorpicker = new UI_Colorpicker(array('id' => $this->settings['id'] . '-color', 'name' => $this->settings['name'] . '[color]', 'value' => $this->settings['value']['color']));
     $html .= '<div class="cherry-ui-background-wrap">';
     $html .= '<div class="cherry-ui-background-media">';
     $html .= $ui_media->render();
     $html .= '</div>';
     $html .= '<div class="cherry-ui-background-settings">';
     $html .= '<label for="' . $this->settings['id'] . '-settings">' . __('Background Settings', 'cherry') . '</label> ';
     $html .= '<div class="cherry-ui-background-color">';
     $html .= '<label for="' . $this->settings['id'] . '-color">' . __('Background Color', 'cherry') . '</label> ';
     $html .= $ui_colorpicker->render();
     $html .= '</div>';
     foreach ($background_options as $options_key => $options_settings) {
         if (isset($this->settings['value'][$options_key])) {
             $html .= '<div class="cherry-background-setting-item">';
             $ui_select = new UI_Select(array('id' => $this->settings['id'] . '[' . $options_key . ']', 'name' => $this->settings['name'] . '[' . $options_key . ']', 'value' => $this->settings['value'][$options_key], 'options' => $options_settings));
             $label = sprintf(__('Background %s', 'cherry'), $options_key);
             $html .= '<label for="' . $this->settings['id'] . '[$options_key]">' . $label . '</label> ';
             $html .= $ui_select->render();
             $html .= '</div>';
         }
     }
     $html .= '<div class="clear"></div>';
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
Пример #2
0
 /**
  * Render html UI_Typography.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     $text_align = array('notdefined' => __('Not defined', 'cherry'), 'inherit' => __('Inherit', 'cherry'), 'left' => __('Left', 'cherry'), 'right' => __('Right', 'cherry'), 'center' => __('Center', 'cherry'), 'justify' => __('Justify', 'cherry'));
     $google_fonts_array = $this->get_google_font();
     $standart_fonts_array = $this->get_standart_font();
     $character_array = array();
     $style_array = array();
     $fonttype = '';
     $html .= '<div class="cherry-ui-typography-wrap">';
     //Font Family
     $html .= '<div class="cherry-column-section">';
     $html .= '<div class="inner">';
     $html .= '<div class="field-font-family">';
     $html .= '<label for="' . $this->settings['id'] . '-family">' . __('Font Family', 'cherry') . '</label> ';
     $html .= '<select id="' . $this->settings['id'] . '-family" class="cherry-ui-select cherry-font-family" name="' . $this->settings['name'] . '[family]">';
     if ($standart_fonts_array && !empty($standart_fonts_array) && is_array($standart_fonts_array)) {
         $html .= '<optgroup label="' . __('Standart Webfonts', 'cherry') . '" data-font-type="standart">';
         foreach ($standart_fonts_array as $font_key => $font_value) {
             $category = is_array($font_value['category']) ? implode(",", $font_value['category']) : $font_value['category'];
             $style = is_array($font_value['variants']) ? implode(",", $font_value['variants']) : $font_value['variants'];
             $character = is_array($font_value['subsets']) ? implode(",", $font_value['subsets']) : $font_value['subsets'];
             $selected_state = '';
             if ($this->settings['value']['family'] && !empty($this->settings['value']['family'])) {
                 if (!is_array($this->settings['value']['family'])) {
                     $this->settings['value']['family'] = array($this->settings['value']['family']);
                 }
                 foreach ($this->settings['value']['family'] as $key => $value) {
                     $selected_state = selected($value, $font_value['family'], false);
                     if ($selected_state == " selected='selected'") {
                         $fonttype = 'standart';
                         break;
                     }
                 }
             }
             $html .= '<option value="' . $font_value['family'] . '" data-category="' . $category . '" data-style="' . $style . '" data-character="' . $character . '" ' . $selected_state . '>' . esc_html($font_value['family']) . '</option>';
         }
         $html .= '</optgroup>';
     }
     if ($google_fonts_array && !empty($google_fonts_array) && is_array($google_fonts_array)) {
         $html .= '<optgroup label="' . __('Google Webfonts', 'cherry') . '" data-font-type="web">';
         foreach ($google_fonts_array as $font_key => $font_value) {
             $category = is_array($font_value['category']) ? implode(",", $font_value['category']) : $font_value['category'];
             $style = is_array($font_value['variants']) ? implode(",", $font_value['variants']) : $font_value['variants'];
             $character = is_array($font_value['subsets']) ? implode(",", $font_value['subsets']) : $font_value['subsets'];
             foreach ($font_value['variants'] as $style_key => $style_value) {
                 if (!array_key_exists($style_value, $style_array)) {
                     $text_piece_1 = preg_replace('/[0-9]/s', '', $style_value);
                     $text_piece_2 = preg_replace('/[A-Za-z]/s', ' ', $style_value);
                     $value_text = ucwords($text_piece_2 . ' ' . $text_piece_1);
                     $style_array[$style_value] = $value_text;
                 }
             }
             foreach ($font_value['subsets'] as $character_key => $character_value) {
                 if (!array_key_exists($character_value, $character_array)) {
                     $value_text = str_replace('-ext', ' Extended', $character_value);
                     $value_text = ucwords($value_text);
                     $character_array[$character_value] = $value_text;
                 }
             }
             $selected_state = '';
             if ($this->settings['value']['family'] && !empty($this->settings['value']['family'])) {
                 if (!is_array($this->settings['value']['family'])) {
                     $this->settings['value']['family'] = array($this->settings['value']['family']);
                 }
                 foreach ($this->settings['value']['family'] as $key => $value) {
                     $selected_state = selected($value, $font_value['family'], false);
                     if ($selected_state == " selected='selected'") {
                         $fonttype = 'web';
                         break;
                     }
                 }
             }
             $html .= '<option value="' . $font_value['family'] . '" data-category="' . $category . '" data-style="' . $style . '" data-character="' . $character . '" ' . $selected_state . '>' . esc_html($font_value['family']) . '</option>';
         }
         $html .= '</optgroup>';
     }
     $html .= '</select>';
     $html .= '</div>';
     $html .= '<div class="field-font-style">';
     if ($style_array && !empty($style_array) && is_array($style_array)) {
         $html .= '<label for="' . $this->settings['id'] . '-style">' . __('Font Style', 'cherry') . '</label> ';
         $ui_style_select = new UI_Select(array('id' => $this->settings['id'] . '-style', 'name' => $this->settings['name'] . '[style]', 'value' => $this->settings['value']['style'], 'options' => $style_array, 'class' => 'cherry-font-style'));
         $html .= $ui_style_select->render();
     }
     $html .= '</div>';
     $html .= '<div class="field-font-character">';
     if ($character_array && !empty($character_array) && is_array($character_array)) {
         $html .= '<label for="' . $this->settings['id'] . '-character">' . __('Character Sets', 'cherry') . '</label> ';
         $ui_character_select = new UI_Select(array('id' => $this->settings['id'] . '-character', 'name' => $this->settings['name'] . '[character]', 'value' => $this->settings['value']['character'], 'options' => $character_array, 'class' => 'cherry-font-character'));
         $html .= $ui_character_select->render();
     }
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="cherry-column-section">';
     $html .= '<div class="inner">';
     $html .= '<div class="field-font-size">';
     $html .= '<label for="' . $this->settings['id'] . '-size">' . __('Size', 'cherry') . '</label> ';
     $ui_size_stepper = new UI_Stepper(array('id' => $this->settings['id'] . '-size>', 'name' => $this->settings['name'] . '[size]', 'value' => $this->settings['value']['size'], 'max_value' => 500, 'min_value' => 0, 'step_value' => 1, 'class' => 'font-size'));
     $html .= $ui_size_stepper->render();
     $html .= '</div>';
     $html .= '<div class="field-font-lineheight">';
     $html .= '<label for="' . $this->settings['id'] . '-lineheight">' . __('Line-height', 'cherry') . '</label> ';
     $ui_lineheight_stepper = new UI_Stepper(array('id' => $this->settings['id'] . '-lineheight>', 'name' => $this->settings['name'] . '[lineheight]', 'value' => $this->settings['value']['lineheight'], 'max_value' => 500, 'min_value' => 0, 'step_value' => 1, 'class' => 'font-lineheight'));
     $html .= $ui_lineheight_stepper->render();
     $html .= '</div>';
     $html .= '<div class="field-font-letter-spacing">';
     $html .= '<label for="' . $this->settings['id'] . '-letterspacing">' . __('Letter-spacing', 'cherry') . '</label> ';
     $ui_letterspacing_stepper = new UI_Stepper(array('id' => $this->settings['id'] . '-letterspacing>', 'name' => $this->settings['name'] . '[letterspacing]', 'value' => $this->settings['value']['letterspacing'], 'max_value' => 50, 'min_value' => -50, 'step_value' => 1, 'class' => 'font-letterspacing'));
     $html .= $ui_letterspacing_stepper->render();
     $html .= '</div>';
     $html .= '<div class="field-font-color">';
     $html .= '<label for="' . $this->settings['id'] . '-color">' . __('Font color', 'cherry') . '</label> ';
     $ui_colorpicker = new UI_Colorpicker(array('id' => $this->settings['id'] . '-color', 'name' => $this->settings['name'] . '[color]', 'value' => $this->settings['value']['color'], 'class' => 'cherry-color-picker'));
     $html .= $ui_colorpicker->render();
     $html .= '</div>';
     $html .= '<div class="field-font-align">';
     $html .= '<label for="' . $this->settings['id'] . '-align">' . __('Text align', 'cherry') . '</label> ';
     $ui_align_select = new UI_Select(array('id' => $this->settings['id'] . '-align', 'name' => $this->settings['name'] . '[align]', 'value' => $this->settings['value']['align'], 'options' => $text_align, 'class' => 'cherry-text-align'));
     $html .= $ui_align_select->render();
     $html .= '</div>';
     $html .= '<div class="clear"></div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="clear"></div>';
     $ui_preview_textarea = new UI_Textarea(array('id' => $this->settings['id'] . '-preview', 'name' => 'none', 'value' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", 'rows' => 4, 'class' => 'cherry-font-preview'));
     $html .= $ui_preview_textarea->render();
     $html .= '<input class="cherry-font-category" name="' . $this->settings['name'] . '[category]" value=""  type="hidden" />';
     $html .= '<input class="font-type" name="' . $this->settings['name'] . '[fonttype]" type="hidden" value="' . esc_html($fonttype) . '">';
     $html .= '</div>';
     return $html;
 }
 /**
  * Enqueue admin-specific javascript.
  *
  * @since 4.0.0
  */
 public function enqueue_builder_scripts($hook_suffix)
 {
     UI_Text::enqueue_assets();
     UI_Textarea::enqueue_assets();
     UI_Select::enqueue_assets();
     UI_Checkbox::enqueue_assets();
     UI_Radio::enqueue_assets();
     UI_Switcher::enqueue_assets();
     UI_Colorpicker::enqueue_assets();
     UI_Repeater::enqueue_assets();
     UI_Media::enqueue_assets();
     UI_Stepper::enqueue_assets();
     UI_Slider::enqueue_assets();
     UI_Range_Slider::enqueue_assets();
     UI_Background::enqueue_assets();
     UI_Typography::enqueue_assets();
     UI_Ace_Editor::enqueue_assets();
     UI_Layout_Editor::enqueue_assets();
     UI_Static_Area_Editor::enqueue_assets();
     UI_Tooltip::enqueue_assets();
     wp_enqueue_script('editor');
     wp_enqueue_script('interface-builder');
 }
 /**
  * Render html UI_Static_Area_Editor.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     global $cherry_registered_static_areas;
     $col_xs_array = array('none' => __('none', 'cherry'), 'col-xs-1' => __('col-xs-1', 'cherry'), 'col-xs-2' => __('col-xs-2', 'cherry'), 'col-xs-3' => __('col-xs-3', 'cherry'), 'col-xs-4' => __('col-xs-4', 'cherry'), 'col-xs-5' => __('col-xs-5', 'cherry'), 'col-xs-6' => __('col-xs-6', 'cherry'), 'col-xs-7' => __('col-xs-7', 'cherry'), 'col-xs-8' => __('col-xs-8', 'cherry'), 'col-xs-9' => __('col-xs-9', 'cherry'), 'col-xs-10' => __('col-xs-10', 'cherry'), 'col-xs-11' => __('col-xs-11', 'cherry'), 'col-xs-12' => __('col-xs-12', 'cherry'));
     $col_sm_array = array('none' => __('none', 'cherry'), 'col-sm-1' => __('col-sm-1', 'cherry'), 'col-sm-2' => __('col-sm-2', 'cherry'), 'col-sm-3' => __('col-sm-3', 'cherry'), 'col-sm-4' => __('col-sm-4', 'cherry'), 'col-sm-5' => __('col-sm-5', 'cherry'), 'col-sm-6' => __('col-sm-6', 'cherry'), 'col-sm-7' => __('col-sm-7', 'cherry'), 'col-sm-8' => __('col-sm-8', 'cherry'), 'col-sm-9' => __('col-sm-9', 'cherry'), 'col-sm-10' => __('col-sm-10', 'cherry'), 'col-sm-11' => __('col-sm-11', 'cherry'), 'col-sm-12' => __('col-sm-12', 'cherry'));
     $col_md_array = array('none' => __('none', 'cherry'), 'col-md-1' => __('col-md-1', 'cherry'), 'col-md-2' => __('col-md-2', 'cherry'), 'col-md-3' => __('col-md-3', 'cherry'), 'col-md-4' => __('col-md-4', 'cherry'), 'col-md-5' => __('col-md-5', 'cherry'), 'col-md-6' => __('col-md-6', 'cherry'), 'col-md-7' => __('col-md-7', 'cherry'), 'col-md-8' => __('col-md-8', 'cherry'), 'col-md-9' => __('col-md-9', 'cherry'), 'col-md-10' => __('col-md-10', 'cherry'), 'col-md-11' => __('col-md-11', 'cherry'), 'col-md-12' => __('col-md-12', 'cherry'));
     $col_lg_array = array('none' => __('none', 'cherry'), 'col-lg-1' => __('col-lg-1', 'cherry'), 'col-lg-2' => __('col-lg-2', 'cherry'), 'col-lg-3' => __('col-lg-3', 'cherry'), 'col-lg-4' => __('col-lg-4', 'cherry'), 'col-lg-5' => __('col-lg-5', 'cherry'), 'col-lg-6' => __('col-lg-6', 'cherry'), 'col-lg-7' => __('col-lg-7', 'cherry'), 'col-lg-8' => __('col-lg-8', 'cherry'), 'col-lg-9' => __('col-lg-9', 'cherry'), 'col-lg-10' => __('col-lg-10', 'cherry'), 'col-lg-11' => __('col-lg-11', 'cherry'), 'col-lg-12' => __('col-lg-12', 'cherry'));
     $html .= '<div id="' . $this->settings['id'] . '" class="cherry-static-area-editor-wrap" data-name="' . $this->settings['name'] . '">';
     $html .= '<div class="area-units">';
     foreach ($cherry_registered_static_areas as $area => $area_settings) {
         $html .= '<div class="area-unit" data-area="' . $area . '">';
         $html .= '<h3 class="title-primary_ title-mid_ text_center_">' . $area_settings['name'] . '</h3>';
         $html .= '<div class="accordion-unit">';
         foreach ($this->settings['value'] as $handle => $handleArray) {
             if ($area == $handleArray['options']['area'] && 'available-statics' !== $handleArray['options']['area']) {
                 $html .= '<div class="group" data-static-id="' . $handle . '">';
                 $html .= '<h3><span class="label">' . $handleArray['name'] . '</span><div class="delete-group dashicons dashicons-trash"></div></h3>';
                 $html .= '<div>';
                 $html .= '<div class="field-col-xs">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-xs">' . __('.col-xs-*', 'cherry') . '</label> ';
                 $ui_xs_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-xs', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-xs]', 'value' => $handleArray['options']['col-xs'], 'options' => $col_xs_array, 'class' => 'key-col-xs'));
                 $html .= $ui_xs_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-sm">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-sm">' . __('.col-sm-*', 'cherry') . '</label> ';
                 $ui_sm_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-sm', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-sm]', 'value' => $handleArray['options']['col-sm'], 'options' => $col_sm_array, 'class' => 'key-col-sm'));
                 $html .= $ui_sm_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-md">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-md">' . __('.col-md-*', 'cherry') . '</label> ';
                 $ui_md_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-md', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-md]', 'value' => $handleArray['options']['col-md'], 'options' => $col_md_array, 'class' => 'key-col-md'));
                 $html .= $ui_md_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-lg">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-lg">' . __('.col-lg-*', 'cherry') . '</label> ';
                 $ui_lg_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-lg', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-lg]', 'value' => $handleArray['options']['col-lg'], 'options' => $col_lg_array, 'class' => 'key-col-lg'));
                 $html .= $ui_lg_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-class">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-class">' . __('Custom class', 'cherry') . '</label> ';
                 $ui_class_text = new UI_Text(array('id' => $this->settings['id'] . '-' . $handle . '-class', 'name' => $this->settings['name'] . '[' . $handle . '][options][class]', 'value' => esc_html($handleArray['options']['class']), 'class' => 'key-custom-class'));
                 $html .= $ui_class_text->render();
                 $html .= '</div>';
                 $html .= '<input type="hidden" class="key-item-name" name="' . $this->settings['name'] . '[' . $handle . '][name]" value="' . $handleArray['name'] . '">';
                 $html .= '<input type="hidden" class="key-area" name="' . $this->settings['name'] . '[' . $handle . '][options][area]" value="' . $handleArray['options']['area'] . '">';
                 $html .= '<input type="hidden" class="key-position" name="' . $this->settings['name'] . '[' . $handle . '][options][position]" value="' . $handleArray['options']['position'] . '">';
                 $html .= '</div>';
                 $html .= '</div>';
             }
         }
         $html .= '</div>';
         //end accordion-unit
         $html .= '</div>';
         //end area-unit
     }
     // end foreach $available_areas
     $html .= '</div>';
     //end area-units
     $html .= '<div class="available-statics area-unit" data-area="available-statics">';
     $html .= '<h3 class="title-primary_ title-mid_ text_center_">' . __('Available statics', 'cherry') . '</h3>';
     $html .= '<div class="accordion-unit">';
     foreach ($this->settings['value'] as $handle => $handleArray) {
         if ('available-statics' == $handleArray['options']['area']) {
             $html .= '<div class="group" data-static-id="' . $handle . '">';
             $html .= '<h3><span class="label">' . $handleArray['name'] . '</span><div class="delete-group dashicons dashicons-trash"></div></h3>';
             $html .= '<div>';
             $html .= '<div class="field-col-xs">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-xs">' . __('.col-xs-*', 'cherry') . '</label> ';
             $ui_xs_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-xs', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-xs]', 'value' => $handleArray['options']['col-xs'], 'options' => $col_xs_array, 'class' => 'key-col-xs'));
             $html .= $ui_xs_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-sm">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-sm">' . __('.col-sm-*', 'cherry') . '</label> ';
             $ui_sm_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-sm', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-sm]', 'value' => $handleArray['options']['col-sm'], 'options' => $col_sm_array, 'class' => 'key-col-sm'));
             $html .= $ui_sm_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-md">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-md">' . __('.col-md-*', 'cherry') . '</label> ';
             $ui_md_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-md', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-md]', 'value' => $handleArray['options']['col-md'], 'options' => $col_md_array, 'class' => 'key-col-md'));
             $html .= $ui_md_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-lg">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-lg">' . __('.col-lg-*', 'cherry') . '</label> ';
             $ui_lg_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-lg', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-lg]', 'value' => $handleArray['options']['col-lg'], 'options' => $col_lg_array, 'class' => 'key-col-lg'));
             $html .= $ui_lg_select->render();
             $html .= '</div>';
             $html .= '<div class="field-class">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-class">' . __('Custom class', 'cherry') . '</label> ';
             $ui_class_text = new UI_Text(array('id' => $this->settings['id'] . '-' . $handle . '-class', 'name' => $this->settings['name'] . '[' . $handle . '][options][class]', 'value' => esc_html($handleArray['options']['class']), 'class' => 'key-custom-class'));
             $html .= $ui_class_text->render();
             $html .= '</div>';
             $html .= '<input type="hidden" class="key-item-name" name="' . $this->settings['name'] . '[' . $handle . '][name]" value="' . $handleArray['name'] . '">';
             $html .= '<input type="hidden" class="key-area" name="' . $this->settings['name'] . '[' . $handle . '][options][area]" value="' . $handleArray['options']['area'] . '">';
             $html .= '<input type="hidden" class="key-position" name="' . $this->settings['name'] . '[' . $handle . '][options][position]" value="' . $handleArray['options']['position'] . '">';
             $html .= '</div>';
             $html .= '</div>';
         }
     }
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="clear"></div>';
     $html .= '</div>';
     return $html;
 }
Пример #5
0
 /**
  * Get font subsets ui_select
  *
  * @param  string 		font name
  * @return string 		html
  *
  * @since  4.0.0
  */
 public function get_font_subsets($id, $name, $value, $font, $font_item_length)
 {
     $variants = array();
     //$value = is_array( $value ) ? array_filter( $value ) : $value;
     //$value = !empty( $value ) ? $value : 'latin';
     $value = isset($value) ? $value : 'latin';
     foreach ($this->get_google_font() as $key => $font_settings) {
         if ($font == $font_settings['family']) {
             $subsets = $font_settings['subsets'];
         }
     }
     foreach ($subsets as $subset_key => $subset_value) {
         $value_text = str_replace('-ext', ' Extended', $subset_value);
         $value_text = ucwords($value_text);
         $character_array[$subset_value] = $value_text;
     }
     if ($character_array && !empty($character_array) && is_array($character_array)) {
         $html = '<label for="' . $id . '-' . $font_item_length . '-character"><span>' . __('Character Sets', 'cherry') . '</span></label> ';
         $ui_character_select = new UI_Select(array('id' => $id . '-' . $font_item_length . '-character', 'name' => $name . '[' . $font_item_length . '][character]', 'value' => $value, 'options' => $character_array, 'multiple' => true, 'class' => 'cherry-font-character cherry-multi-select'));
         $html .= $ui_character_select->render();
         return $html;
     }
     return false;
 }
 /**
  * Render html UI_Layout_Editor.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     if ('' !== $this->settings['label']) {
         $html .= '<label class="cherry-label" for="' . $this->settings['id'] . '">' . $this->settings['label'] . '</label> ';
     }
     $html .= '<div id="' . $this->settings['id'] . '" class="cherry-layout-editor-wrap ' . $this->settings['class'] . '">';
     $html .= '<div class="cherry-layout-editor-inner">';
     $html .= '<input class="ui-layout-editor-input input-top" name="' . $this->settings['name'] . '[position][top]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['position']['top']) . '">';
     $html .= '<input class="ui-layout-editor-input input-right" name="' . $this->settings['name'] . '[position][right]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['position']['right']) . '">';
     $html .= '<input class="ui-layout-editor-input input-bottom" name="' . $this->settings['name'] . '[position][bottom]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['position']['bottom']) . '">';
     $html .= '<input class="ui-layout-editor-input input-left" name="' . $this->settings['name'] . '[position][left]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['position']['left']) . '">';
     $html .= '<div class="position-inner">';
     $html .= '<span class="hint-label">' . __('position', 'cherry') . '</span>';
     $html .= '<div class="margin-inner">';
     $html .= '<span class="hint-label">' . __('margin', 'cherry') . '</span>';
     $html .= '<input class="ui-layout-editor-input input-top" name="' . $this->settings['name'] . '[margin][top]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['margin']['top']) . '">';
     $html .= '<input class="ui-layout-editor-input input-right" name="' . $this->settings['name'] . '[margin][right]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['margin']['right']) . '">';
     $html .= '<input class="ui-layout-editor-input input-bottom" name="' . $this->settings['name'] . '[margin][bottom]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['margin']['bottom']) . '">';
     $html .= '<input class="ui-layout-editor-input input-left" name="' . $this->settings['name'] . '[margin][left]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['margin']['left']) . '">';
     $html .= '<div class="border-inner">';
     $html .= '<span class="hint-label">' . __('border', 'cherry') . '</span>';
     $html .= '<input class="ui-layout-editor-input input-top" name="' . $this->settings['name'] . '[border][top]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['border']['top']) . '">';
     $html .= '<input class="ui-layout-editor-input input-right" name="' . $this->settings['name'] . '[border][right]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['border']['right']) . '">';
     $html .= '<input class="ui-layout-editor-input input-bottom" name="' . $this->settings['name'] . '[border][bottom]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['border']['bottom']) . '">';
     $html .= '<input class="ui-layout-editor-input input-left" name="' . $this->settings['name'] . '[border][left]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['border']['left']) . '">';
     $html .= '<div class="padding-inner">';
     $html .= '<span class="hint-label">' . __('padding', 'cherry') . '</span>';
     $html .= '<input class="ui-layout-editor-input input-top" name="' . $this->settings['name'] . '[padding][top]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['padding']['top']) . '">';
     $html .= '<input class="ui-layout-editor-input input-right" name="' . $this->settings['name'] . '[padding][right]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['padding']['right']) . '">';
     $html .= '<input class="ui-layout-editor-input input-bottom" name="' . $this->settings['name'] . '[padding][bottom]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['padding']['bottom']) . '">';
     $html .= '<input class="ui-layout-editor-input input-left" name="' . $this->settings['name'] . '[padding][left]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['padding']['left']) . '">';
     $html .= '<div class="container-inner">';
     $html .= '<span class="hint-label">' . __('size', 'cherry') . '</span>';
     $html .= '<input class="ui-layout-editor-input input-width" name="' . $this->settings['name'] . '[container][width]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['container']['width']) . '">';
     $html .= '<input class="ui-layout-editor-input input-height" name="' . $this->settings['name'] . '[container][height]" type="text" placeholder="-" value="' . esc_html($this->settings['value']['container']['height']) . '">';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="border-controls">';
     $html .= '<div class="border-control border-control-style">';
     $border_styles = array('solid' => __('solid', 'cherry'), 'dashed' => __('dashed', 'cherry'), 'dotted' => __('dotted', 'cherry'), 'double' => __('double', 'cherry'), 'groove' => __('groove', 'cherry'), 'ridge' => __('ridge', 'cherry'), 'inset' => __('inset', 'cherry'), 'outset' => __('outset', 'cherry'), 'none' => __('none', 'cherry'));
     $html .= '<label for="' . $this->settings['id'] . '-border-style">' . __('Border style', 'cherry') . '</label> ';
     if ($border_styles && !empty($border_styles) && is_array($border_styles)) {
         $ui_border_style_select = new UI_Select(array('id' => $this->settings['id'] . '-border-style', 'name' => $this->settings['name'] . '[border][style]', 'value' => $this->settings['value']['border']['style'], 'options' => $border_styles, 'class' => 'cherry-border-style'));
         $html .= $ui_border_style_select->render();
     }
     $html .= '</div>';
     $html .= '<div class="border-control border-control-radius">';
     $html .= '<label for="' . $this->settings['id'] . '-border-radius">' . __('Border radius', 'cherry') . '</label> ';
     $ui_border_radius = new UI_Text(array('id' => $this->settings['id'] . '-border-radius', 'name' => $this->settings['name'] . '[border][radius]', 'value' => $this->settings['value']['border']['radius'], 'class' => 'cherry-border-radius'));
     $html .= $ui_border_radius->render();
     $html .= '</div>';
     $html .= '<div class="border-control border-control-color">';
     $html .= '<label for="' . $this->settings['id'] . '-border-color">' . __('Border color', 'cherry') . '</label> ';
     $ui_border_colorpicker = new UI_Colorpicker(array('id' => $this->settings['id'] . '-border-color', 'name' => $this->settings['name'] . '[border][color]', 'value' => $this->settings['value']['border']['color'], 'class' => 'cherry-border-color'));
     $html .= $ui_border_colorpicker->render();
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="clear"></div>';
     $html .= '</div>';
     return $html;
 }
 /**
  * Enqueue admin-specific javascript.
  *
  * @since 4.0.0
  */
 public function enqueue_builder_scripts($hook_suffix = false)
 {
     UI_Text::enqueue_assets();
     UI_Textarea::enqueue_assets();
     UI_Select::enqueue_assets();
     UI_Checkbox::enqueue_assets();
     UI_Radio::enqueue_assets();
     UI_Switcher::enqueue_assets();
     UI_Colorpicker::enqueue_assets();
     UI_Repeater::enqueue_assets();
     UI_Media::enqueue_assets();
     UI_Stepper::enqueue_assets();
     UI_Slider::enqueue_assets();
     UI_Range_Slider::enqueue_assets();
     UI_Background::enqueue_assets();
     UI_Typography::enqueue_assets();
     UI_Ace_Editor::enqueue_assets();
     UI_Layout_Editor::enqueue_assets();
     UI_Tooltip::enqueue_assets();
     UI_Webfont::enqueue_assets();
     wp_enqueue_script('editor');
     wp_enqueue_script('jquery-ui-dialog');
     wp_enqueue_script('interface-builder', trailingslashit(CHERRY_URI) . 'admin/assets/js/interface-builder.js', array('jquery'), CHERRY_VERSION, true);
 }
 /**
  * Render html UI_Static_Area_Editor.
  *
  * @since  4.0.0
  */
 public function render()
 {
     $html = '';
     global $cherry_registered_static_areas;
     $col_xs_array = array('none' => __('none', 'cherry'), 'col-xs-1' => __('col-xs-1', 'cherry'), 'col-xs-2' => __('col-xs-2', 'cherry'), 'col-xs-3' => __('col-xs-3', 'cherry'), 'col-xs-4' => __('col-xs-4', 'cherry'), 'col-xs-5' => __('col-xs-5', 'cherry'), 'col-xs-6' => __('col-xs-6', 'cherry'), 'col-xs-7' => __('col-xs-7', 'cherry'), 'col-xs-8' => __('col-xs-8', 'cherry'), 'col-xs-9' => __('col-xs-9', 'cherry'), 'col-xs-10' => __('col-xs-10', 'cherry'), 'col-xs-11' => __('col-xs-11', 'cherry'), 'col-xs-12' => __('col-xs-12', 'cherry'));
     $col_sm_array = array('none' => __('none', 'cherry'), 'col-sm-1' => __('col-sm-1', 'cherry'), 'col-sm-2' => __('col-sm-2', 'cherry'), 'col-sm-3' => __('col-sm-3', 'cherry'), 'col-sm-4' => __('col-sm-4', 'cherry'), 'col-sm-5' => __('col-sm-5', 'cherry'), 'col-sm-6' => __('col-sm-6', 'cherry'), 'col-sm-7' => __('col-sm-7', 'cherry'), 'col-sm-8' => __('col-sm-8', 'cherry'), 'col-sm-9' => __('col-sm-9', 'cherry'), 'col-sm-10' => __('col-sm-10', 'cherry'), 'col-sm-11' => __('col-sm-11', 'cherry'), 'col-sm-12' => __('col-sm-12', 'cherry'));
     $col_md_array = array('none' => __('none', 'cherry'), 'col-md-1' => __('col-md-1', 'cherry'), 'col-md-2' => __('col-md-2', 'cherry'), 'col-md-3' => __('col-md-3', 'cherry'), 'col-md-4' => __('col-md-4', 'cherry'), 'col-md-5' => __('col-md-5', 'cherry'), 'col-md-6' => __('col-md-6', 'cherry'), 'col-md-7' => __('col-md-7', 'cherry'), 'col-md-8' => __('col-md-8', 'cherry'), 'col-md-9' => __('col-md-9', 'cherry'), 'col-md-10' => __('col-md-10', 'cherry'), 'col-md-11' => __('col-md-11', 'cherry'), 'col-md-12' => __('col-md-12', 'cherry'));
     $col_lg_array = array('none' => __('none', 'cherry'), 'col-lg-1' => __('col-lg-1', 'cherry'), 'col-lg-2' => __('col-lg-2', 'cherry'), 'col-lg-3' => __('col-lg-3', 'cherry'), 'col-lg-4' => __('col-lg-4', 'cherry'), 'col-lg-5' => __('col-lg-5', 'cherry'), 'col-lg-6' => __('col-lg-6', 'cherry'), 'col-lg-7' => __('col-lg-7', 'cherry'), 'col-lg-8' => __('col-lg-8', 'cherry'), 'col-lg-9' => __('col-lg-9', 'cherry'), 'col-lg-10' => __('col-lg-10', 'cherry'), 'col-lg-11' => __('col-lg-11', 'cherry'), 'col-lg-12' => __('col-lg-12', 'cherry'));
     $action_conditions = array('show' => __('Show', 'cherry'), 'hide' => __('Hide', 'cherry'));
     $major_conditions_array = array('' => __('-- Select --', 'cherry'), 'category' => __('Category', 'cherry'), 'loggedin' => __('Logged in', 'cherry'), 'author' => __('Author', 'cherry'), 'role' => __('Role', 'cherry'), 'tag' => __('Tag', 'cherry'), 'date' => __('Date', 'cherry'), 'page' => __('Page', 'cherry'), 'taxonomy' => __('Taxonomy', 'cherry'));
     $html .= '<div id="' . $this->settings['id'] . '" class="cherry-static-area-editor-wrap" data-name="' . $this->settings['name'] . '">';
     $html .= '<div class="area-units">';
     foreach ($cherry_registered_static_areas as $area => $area_settings) {
         $html .= '<div class="area-unit" data-area="' . $area . '">';
         $html .= '<h3 class="title-primary_ title-mid_ text_center_">' . $area_settings['name'] . '</h3>';
         $html .= '<div class="accordion-unit">';
         foreach ($this->settings['value'] as $handle => $handleArray) {
             if ($area == $handleArray['options']['area'] && 'available-statics' !== $handleArray['options']['area']) {
                 $html .= '<div class="group" data-static-id="' . $handle . '">';
                 $html .= '<h3><span class="label">' . $handleArray['name'] . '</span><div class="delete-group dashicons dashicons-trash"></div></h3>';
                 $html .= '<div>';
                 $html .= '<div class="field-col-xs">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-xs">' . __('.col-xs-*', 'cherry') . '</label> ';
                 $ui_xs_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-xs', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-xs]', 'value' => $handleArray['options']['col-xs'], 'options' => $col_xs_array, 'class' => 'key-col-xs'));
                 $html .= $ui_xs_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-sm">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-sm">' . __('.col-sm-*', 'cherry') . '</label> ';
                 $ui_sm_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-sm', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-sm]', 'value' => $handleArray['options']['col-sm'], 'options' => $col_sm_array, 'class' => 'key-col-sm'));
                 $html .= $ui_sm_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-md">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-md">' . __('.col-md-*', 'cherry') . '</label> ';
                 $ui_md_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-md', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-md]', 'value' => $handleArray['options']['col-md'], 'options' => $col_md_array, 'class' => 'key-col-md'));
                 $html .= $ui_md_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-col-lg">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-lg">' . __('.col-lg-*', 'cherry') . '</label> ';
                 $ui_lg_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-lg', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-lg]', 'value' => $handleArray['options']['col-lg'], 'options' => $col_lg_array, 'class' => 'key-col-lg'));
                 $html .= $ui_lg_select->render();
                 $html .= '</div>';
                 $html .= '<div class="field-class">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-class">' . __('Custom class', 'cherry') . '</label> ';
                 $ui_class_text = new UI_Text(array('id' => $this->settings['id'] . '-' . $handle . '-class', 'name' => $this->settings['name'] . '[' . $handle . '][options][class]', 'value' => esc_html($handleArray['options']['class']), 'class' => 'key-custom-class'));
                 $html .= $ui_class_text->render();
                 $html .= '</div>';
                 $html .= '<div class="clear"></div>';
                 is_array($handleArray['conditions']['rules']) && count($handleArray['conditions']['rules']) > 0 ? $empty_class = '' : ($empty_class = 'empty');
                 $html .= '<div class="conditions ' . $empty_class . '">';
                 $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-conditions-action">' . __('Conditions', 'cherry') . '</label> ';
                 $ui_condition_action = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-conditions-action', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][action]', 'value' => $handleArray['conditions']['action'], 'options' => $action_conditions, 'class' => 'conditions-action'));
                 $html .= $ui_condition_action->render();
                 $html .= '<div class="label label-if"><span>' . __('if', 'cherry') . '</span></div>';
                 $html .= '<div class="conditions-rules">';
                 $name = $this->settings['name'] . '[' . $handle . '][conditions][rules]';
                 $html .= '<div class="dublicate-item" data-name="' . $name . '">';
                 $html .= '<div class="rule-major">';
                 $major_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-major-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules]', 'value' => '', 'options' => $major_conditions_array, 'class' => 'rule-major-select'));
                 $html .= $major_rule->render();
                 $html .= '</div>';
                 $html .= '<div class="label label-is"><span>' . __('is', 'cherry') . '</span></div>';
                 $html .= '<div class="rule-minor">';
                 $minor_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-minor-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules]', 'value' => '', 'options' => '', 'class' => 'rule-minor-select'));
                 $html .= $minor_rule->render();
                 $html .= '</div>';
                 $html .= '<div class="remove-rule-button"><span class="dashicons dashicons-no"></span></div>';
                 $html .= '<div class="clear"></div>';
                 $html .= '</div><!-- end dublicate item -->';
                 if (is_array($handleArray['conditions']['rules']) && !empty($handleArray['conditions']['rules'])) {
                     foreach ($handleArray['conditions']['rules'] as $index => $rule) {
                         $html .= '<div class="rule-item" data-name="' . $name . '">';
                         $html .= '<div class="rule-major">';
                         $major_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-major-rule-' . $index, 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules][' . $index . '][major]', 'value' => $rule['major'], 'options' => $major_conditions_array, 'class' => 'rule-major-select'));
                         $html .= $major_rule->render();
                         $html .= '</div>';
                         $html .= '<div class="label label-is"><span>' . __('is', 'cherry') . '</span></div>';
                         $html .= '<div class="rule-minor">';
                         $minor = isset($rule['minor']) ? $rule['minor'] : '';
                         $minor_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-minor-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules][' . $index . '][minor]', 'value' => $minor, 'options' => $this->get_minor_options($rule['major']), 'class' => 'rule-minor-select'));
                         $html .= $minor_rule->render();
                         $html .= '</div>';
                         $html .= '<div class="remove-rule-button"><span class="dashicons dashicons-no"></span></div>';
                         $html .= '<div class="clear"></div>';
                         $html .= '</div><!-- end dublicate item -->';
                     }
                 }
                 $html .= '</div><!-- end conditions-rules -->';
                 $html .= '<div class="add-rule-button"><span class="dashicons dashicons-plus"></span>' . __('Add rule', 'cherry') . '</div>';
                 $html .= '</div><!-- end conditions -->';
                 $html .= '<input type="hidden" class="key-item-name" name="' . $this->settings['name'] . '[' . $handle . '][name]" value="' . $handleArray['name'] . '">';
                 $html .= '<input type="hidden" class="key-area" name="' . $this->settings['name'] . '[' . $handle . '][options][area]" value="' . $handleArray['options']['area'] . '">';
                 $html .= '<input type="hidden" class="key-position" name="' . $this->settings['name'] . '[' . $handle . '][options][position]" value="' . $handleArray['options']['position'] . '">';
                 $html .= '</div>';
                 $html .= '</div>';
             }
         }
         $html .= '</div>';
         //end accordion-unit
         $html .= '</div>';
         //end area-unit
     }
     // end foreach $available_areas
     $html .= '</div>';
     //end area-units
     $html .= '<div class="available-statics area-unit" data-area="available-statics">';
     $html .= '<h3 class="title-primary_ title-mid_ text_center_">' . __('Available statics', 'cherry') . '</h3>';
     $html .= '<div class="accordion-unit">';
     foreach ($this->settings['value'] as $handle => $handleArray) {
         if ('available-statics' == $handleArray['options']['area']) {
             $html .= '<div class="group" data-static-id="' . $handle . '">';
             $html .= '<h3><span class="label">' . $handleArray['name'] . '</span><div class="delete-group dashicons dashicons-trash"></div></h3>';
             $html .= '<div>';
             $html .= '<div class="field-col-xs">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-xs">' . __('.col-xs-*', 'cherry') . '</label> ';
             $ui_xs_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-xs', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-xs]', 'value' => $handleArray['options']['col-xs'], 'options' => $col_xs_array, 'class' => 'key-col-xs'));
             $html .= $ui_xs_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-sm">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-sm">' . __('.col-sm-*', 'cherry') . '</label> ';
             $ui_sm_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-sm', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-sm]', 'value' => $handleArray['options']['col-sm'], 'options' => $col_sm_array, 'class' => 'key-col-sm'));
             $html .= $ui_sm_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-md">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-md">' . __('.col-md-*', 'cherry') . '</label> ';
             $ui_md_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-md', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-md]', 'value' => $handleArray['options']['col-md'], 'options' => $col_md_array, 'class' => 'key-col-md'));
             $html .= $ui_md_select->render();
             $html .= '</div>';
             $html .= '<div class="field-col-lg">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-col-lg">' . __('.col-lg-*', 'cherry') . '</label> ';
             $ui_lg_select = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-col-lg', 'name' => $this->settings['name'] . '[' . $handle . '][options][col-lg]', 'value' => $handleArray['options']['col-lg'], 'options' => $col_lg_array, 'class' => 'key-col-lg'));
             $html .= $ui_lg_select->render();
             $html .= '</div>';
             $html .= '<div class="field-class">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-class">' . __('Custom class', 'cherry') . '</label> ';
             $ui_class_text = new UI_Text(array('id' => $this->settings['id'] . '-' . $handle . '-class', 'name' => $this->settings['name'] . '[' . $handle . '][options][class]', 'value' => esc_html($handleArray['options']['class']), 'class' => 'key-custom-class'));
             $html .= $ui_class_text->render();
             $html .= '</div>';
             $html .= '<div class="clear"></div>';
             is_array($handleArray['conditions']['rules']) && count($handleArray['conditions']['rules']) > 0 ? $empty_class = '' : ($empty_class = 'empty');
             $html .= '<div class="conditions ' . $empty_class . '">';
             $html .= '<label for="' . $this->settings['id'] . '-' . $handle . '-conditions-action">' . __('Conditions', 'cherry') . '</label> ';
             $ui_condition_action = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-conditions-action', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][action]', 'value' => $handleArray['conditions']['action'], 'options' => $action_conditions, 'class' => 'conditions-action'));
             $html .= $ui_condition_action->render();
             $html .= '<div class="label label-if"><span>' . __('if', 'cherry') . '</span></div>';
             $html .= '<div class="conditions-rules">';
             $name = $this->settings['name'] . '[' . $handle . '][conditions][rules]';
             $html .= '<div class="dublicate-item" data-name="' . $name . '">';
             $html .= '<div class="rule-major">';
             $major_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-major-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules]', 'value' => '', 'options' => $major_conditions_array, 'class' => 'rule-major-select'));
             $html .= $major_rule->render();
             $html .= '</div>';
             $html .= '<div class="label label-is"><span>' . __('is', 'cherry') . '</span></div>';
             $html .= '<div class="rule-minor">';
             $minor_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-minor-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules]', 'value' => '', 'options' => '', 'class' => 'rule-minor-select'));
             $html .= $minor_rule->render();
             $html .= '</div>';
             $html .= '<div class="remove-rule-button"><span class="dashicons dashicons-no"></span></div>';
             $html .= '<div class="clear"></div>';
             $html .= '</div><!-- end dublicate item -->';
             if (is_array($handleArray['conditions']['rules']) && !empty($handleArray['conditions']['rules'])) {
                 foreach ($handleArray['conditions']['rules'] as $index => $rule) {
                     $html .= '<div class="rule-item" data-name="' . $name . '">';
                     $html .= '<div class="rule-major">';
                     $major_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-major-rule-' . $index, 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules][' . $index . '][major]', 'value' => $rule['major'], 'options' => $major_conditions_array, 'class' => 'rule-major-select'));
                     $html .= $major_rule->render();
                     $html .= '</div>';
                     $html .= '<div class="label label-is"><span>' . __('is', 'cherry') . '</span></div>';
                     $html .= '<div class="rule-minor">';
                     $minor = isset($rule['minor']) ? $rule['minor'] : '';
                     $minor_rule = new UI_Select(array('id' => $this->settings['id'] . '-' . $handle . '-minor-rule', 'name' => $this->settings['name'] . '[' . $handle . '][conditions][rules][' . $index . '][minor]', 'value' => $minor, 'options' => $this->get_minor_options($rule['major']), 'class' => 'rule-minor-select'));
                     $html .= $minor_rule->render();
                     $html .= '</div>';
                     $html .= '<div class="remove-rule-button"><span class="dashicons dashicons-no"></span></div>';
                     $html .= '<div class="clear"></div>';
                     $html .= '</div><!-- end dublicate item -->';
                 }
             }
             $html .= '</div><!-- end conditions-rules -->';
             $html .= '<div class="add-rule-button"><span class="dashicons dashicons-plus"></span>' . __('Add rule', 'cherry') . '</div>';
             $html .= '</div><!-- end conditions -->';
             $html .= '<input type="hidden" class="key-item-name" name="' . $this->settings['name'] . '[' . $handle . '][name]" value="' . $handleArray['name'] . '">';
             $html .= '<input type="hidden" class="key-area" name="' . $this->settings['name'] . '[' . $handle . '][options][area]" value="' . $handleArray['options']['area'] . '">';
             $html .= '<input type="hidden" class="key-position" name="' . $this->settings['name'] . '[' . $handle . '][options][position]" value="' . $handleArray['options']['position'] . '">';
             $html .= '</div>';
             $html .= '</div>';
         }
     }
     $html .= '</div>';
     $html .= '</div>';
     $html .= '<div class="clear"></div>';
     $html .= '</div>';
     return $html;
 }
        /**
         * Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
         * the layout they wish to use for the specific post.
         *
         * @since  1.0.0
         * @param  object $post    The post object currently being edited.
         * @param  array  $metabox Specific information about the meta box being loaded.
         * @return void
         */
        public function callback_metabox($post, $metabox)
        {
            wp_nonce_field(basename(__FILE__), 'cherry-sidebar-nonce');
            global $wp_registered_sidebars;
            $Cherry_Custom_Sidebars_Methods = new Cherry_Custom_Sidebars_Methods();
            $cusotm_sidebar_array = $Cherry_Custom_Sidebars_Methods->get_custom_sidebar_array();
            unset($cusotm_sidebar_array['cherry-sidebar-manager-counter']);
            $wp_registered_sidebars = array_merge($wp_registered_sidebars, $cusotm_sidebar_array);
            $select_sidebar = $this->get_post_sidebar($post->ID);
            $sidebars = array('post-main-sidebar' => array('title' => __('Main Sidebar:', 'cherry-sidebar-manager'), 'id' => 'cherry-post-main-sidebar', 'value' => is_array($select_sidebar['cherry-post-main-sidebar']) && isset($select_sidebar['cherry-post-main-sidebar']) ? $select_sidebar['cherry-post-main-sidebar'] : ''), 'post-secondary-sidebar' => array('title' => __('Secondary Sidebar:', 'cherry-sidebar-manager'), 'id' => 'cherry-post-secondary-sidebar', 'value' => is_array($select_sidebar['cherry-post-secondary-sidebar'] && isset($select_sidebar['cherry-post-secondary-sidebar'])) ? $select_sidebar['cherry-post-secondary-sidebar'] : ''));
            $select_options = array('' => __('Sidebar not selected', 'cherry-sidebar-manager'));
            foreach ($wp_registered_sidebars as $sidebar => $sidebar_value) {
                $sidebar_id = $sidebar_value['id'];
                $sidebar_name = $sidebar_value['name'];
                $select_options[$sidebar_id] = $sidebar_name;
            }
            foreach ($sidebars as $sidebar => $sidebar_value) {
                $output = '<p><strong>' . $sidebar_value['title'] . '</strong></p>';
                $UI_Select = new UI_Select(array('id' => $sidebar_value['id'], 'name' => $sidebar_value['id'], 'value' => $sidebar_value['value'], 'options' => $select_options));
                $output .= $UI_Select->render();
                echo $output;
            }
            ?>
				<p class="howto"><?php 
            printf(__('You can choose page sidebars or create a new sidebar on %swidgets page%s .', 'cherry-sidebar-manager'), '<a href="widgets.php" target="_blank" title="' . __('Widgets Page') . '">', '</a>');
            ?>
</p>
			<?php 
        }
        /**
         * Displays a meta box of radio selectors on the post editing screen, which allows theme users to select
         * the layout they wish to use for the specific post.
         *
         * @since  1.0.0
         * @param  object $post    The post object currently being edited.
         * @param  array  $metabox Specific information about the meta box being loaded.
         * @return void
         */
        public function callback_metabox($post, $metabox)
        {
            wp_nonce_field(basename(__FILE__), 'cherry-sidebar-nonce');
            global $wp_registered_sidebars;
            $select_sidebar = $this->get_post_sidebar($post->ID);
            $select_options = array('' => __('Sidebar not selected', 'cherry-sidebar-manager'));
            foreach ($wp_registered_sidebars as $sidebar => $sidebar_value) {
                $select_options[$sidebar_value['id']] = $sidebar_value['name'];
            }
            foreach ($wp_registered_sidebars as $sidebar => $sidebar_value) {
                if (array_key_exists('dynamic-sidebar', $sidebar_value)) {
                    continue;
                }
                if (array_key_exists('is_global', $sidebar_value) && false === $sidebar_value['is_global']) {
                    continue;
                }
                $output = '<p><strong>' . $sidebar_value['name'] . '</strong></p>';
                $value = is_array($select_sidebar) && array_key_exists($sidebar_value['id'], $select_sidebar) ? $select_sidebar[$sidebar_value['id']] : '';
                $UI_Select = new UI_Select(array('id' => $sidebar_value['id'], 'name' => 'theme_sidebar[' . $sidebar_value['id'] . ']', 'value' => $value, 'options' => $select_options));
                $output .= $UI_Select->render();
                echo $output;
            }
            ?>
				<p class="howto"><?php 
            printf(__('You can choose page sidebars or create a new sidebar on %swidgets page%s .', 'cherry-sidebar-manager'), '<a href="widgets.php" target="_blank" title="' . __('Widgets Page', 'cherry-sidebar-manager') . '">', '</a>');
            ?>
</p>
			<?php 
        }