Пример #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;
 }
 /**
  * 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');
 }
 /**
  * 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);
 }