/**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type() . 'ion-range-slider', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.css'), '2.0.3');
     wp_enqueue_script('fw-option-' . $this->get_type() . 'ion-range-slider', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/libs/ion-range-slider/ion.rangeSlider.min.js'), array('jquery', 'fw-moment'), '2.0.3');
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'fw-events', 'underscore', 'fw-option-' . $this->get_type() . 'ion-range-slider'), fw()->manifest->get_version());
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-selectize'), fw()->manifest->get_version());
     fw()->backend->option_type('color-picker')->enqueue_static();
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'underscore', 'fw', 'fw-selectize'), fw()->manifest->get_version());
     wp_localize_script('fw-option-' . $this->get_type(), 'fw_typography_fonts', $this->get_fonts());
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery'), fw()->manifest->get_version());
     $output = fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data));
     return $output;
 }
 protected function _enqueue_static($id, $option, $values, $data)
 {
     $uri = fw_get_framework_directory_uri('/includes/container-types/popup');
     wp_enqueue_script('fw-container-type-' . $this->get_type(), $uri . '/scripts.js', array('jquery', 'fw-events', 'fw'), fw()->manifest->get_version());
     wp_enqueue_style('fw');
     wp_enqueue_style('fw-container-type-' . $this->get_type(), $uri . '/styles.css', array(), fw()->manifest->get_version());
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'jquery-ui-sortable'), fw()->manifest->get_version(), true);
     fw()->backend->enqueue_options_static($option['box-options']);
     return true;
 }
 /**
  * @internal
  */
 protected function _init()
 {
     $this->views_path = dirname(__FILE__) . '/views/';
     $static_uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/');
     $this->js_uri = $static_uri . 'js/';
     $this->css_uri = $static_uri . 'css/';
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type() . '-adaptive-switch', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/adaptive-switch/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type() . '-adaptive-switch', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/adaptive-switch/jquery.adaptive-switch.js'), array('jquery'), fw()->manifest->get_version(), true);
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-option-' . $this->get_type() . '-adaptive-switch'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'fw-option-' . $this->get_type() . '-adaptive-switch'), fw()->manifest->get_version(), true);
 }
Ejemplo n.º 8
0
 private static function load_from_extensions_recursive($extensions)
 {
     /*
      * Loop each extension
      * if it has a shortcodes folder load the shortcodes from it
      * if an extension has subextensions then recursion
      */
     foreach ($extensions as $ext_name => $children) {
         $extension = fw()->extensions->get($ext_name);
         $rel_path = $extension->get_rel_path();
         // framework
         $fw_path = fw_get_framework_directory('/extensions' . $rel_path . '/shortcodes');
         if (file_exists($fw_path)) {
             self::load_from_shortcodes_folder(array('path' => $fw_path, 'uri' => fw_get_framework_directory_uri('/extensions' . $rel_path . '/shortcodes')));
         }
         // parent theme framework-customizations
         $parent_fws_path = fw_get_template_customizations_directory('/extensions' . $rel_path . '/shortcodes');
         if (file_exists($parent_fws_path)) {
             self::load_from_shortcodes_folder(array('path' => $parent_fws_path, 'uri' => fw_get_template_customizations_directory_uri('/extensions' . $rel_path . '/shortcodes')));
         }
         // child theme framework-customizations
         if (is_child_theme()) {
             $child_fws_path = fw_get_stylesheet_customizations_directory('/extensions' . $rel_path . '/shortcodes');
             if (file_exists($child_fws_path)) {
                 self::load_from_shortcodes_folder(array('path' => $child_fws_path, 'uri' => fw_get_stylesheet_customizations_directory_uri('/extensions' . $rel_path . '/shortcodes')));
             }
         }
         if (!empty($children)) {
             self::load_from_extensions_recursive($children);
         }
     }
 }
 /**
  * Generate option's html from option array
  * @param string $id
  * @param array $option
  * @param array $data
  * @return string HTML
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     unset($option['attr']['name'], $option['attr']['value']);
     $option['attr']['data-for-js'] = json_encode(array('title' => empty($option['popup-title']) ? $option['label'] : $option['popup-title'], 'options' => $this->transform_options($option['popup-options']), 'template' => $option['template'], 'size' => $option['size'], 'limit' => $option['limit']));
     $sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     $uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type());
     wp_enqueue_style('fw-option-type-' . $this->get_type(), $uri . '/static/css/multi-picker.css', array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-type-' . $this->get_type(), $uri . '/static/js/multi-picker.js', array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     fw()->backend->enqueue_options_static($this->prepare_option($id, $option));
     return true;
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     // this js contains custom changes
     wp_enqueue_script('fw-option-' . $this->get_type() . '-image-picker', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/image-picker/image-picker.js'), array(), fw()->manifest->get_version(), true);
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('qtip'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'qtip'), fw()->manifest->get_version(), true);
     $wrapper_attr = array('id' => $option['attr']['id'], 'class' => $option['attr']['class']);
     foreach ($wrapper_attr as $attr_name => $attr_val) {
         unset($option['attr'][$attr_name]);
     }
     $option['value'] = (string) $data['value'];
     unset($option['attr']['multiple']);
     /**
      * pre loads images on page load
      *
      * fixes glitch with preview:
      * * hover first time  - show wrong because image not loaded and has no height/width and cannot detect correctly popup position
      * * hover second time - show correctly
      */
     $pre_load_images_html = '';
     $html = '';
     $html .= '<select ' . fw_attr_to_html($option['attr']) . '>';
     if (!empty($option['blank']) and $option['blank'] === true) {
         $html .= '<option value=""></option>';
     }
     foreach ($option['choices'] as $key => $choice) {
         $attr = array('value' => $key);
         if ($option['value'] == $key) {
             $attr['selected'] = 'selected';
         }
         if (is_string($choice)) {
             // is 'http://.../small.png'
             $choice = array('small' => array('src' => $choice));
         }
         if (is_string($choice['small'])) {
             // is 'http://.../small.png'
             $choice['small'] = array('src' => $choice['small']);
         }
         $attr['data-small-img-attr'] = json_encode($choice['small']);
         // required by image-picker plugin
         $attr['data-img-src'] = $choice['small']['src'];
         if (!empty($choice['large'])) {
             if (is_string($choice['large'])) {
                 // is 'http://.../large.png'
                 $choice['large'] = array('src' => $choice['large']);
             }
             $attr['data-large-img-attr'] = json_encode($choice['large']);
             $pre_load_images_html .= fw_html_tag('img', array('src' => $choice['large']['src']));
         }
         if (!empty($choice['data'])) {
             // used in js events
             $attr['data-extra-data'] = json_encode($choice['data']);
         }
         $html .= fw_html_tag('option', $attr, fw_htmlspecialchars(isset($choice['label']) ? $choice['label'] : ''));
     }
     $html .= '</select>';
     return fw_html_tag('div', $wrapper_attr, $html . '<div class="pre-loaded-images"><br/><br/>' . $pre_load_images_html . '</div>');
 }
Ejemplo n.º 12
0
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-type-' . $this->get_type() . '-if', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-font-awesome'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-type-' . $this->get_type() . '-dialog', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'fw-events'), fw()->manifest->get_version());
     $option['value'] = (string) $data['value'];
     unset($option['attr']['value']);
     // be sure to remove value from attributes
     return fw_render_view(dirname(__FILE__) . '/view.php', compact('id', 'option', 'data'));
 }
 protected function _enqueue_static($id, $option, $data)
 {
     $this->packs_loader->enqueue_admin_css();
     $static_URI = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/');
     wp_enqueue_style('fw-selectize');
     wp_enqueue_script('fw-option-type-' . $this->get_type() . '-backend-previews', $static_URI . 'js/render-icon-previews.js', array('jquery', 'fw', 'fw-events', 'fw-selectize'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-type-' . $this->get_type() . '-backend-picker', $static_URI . 'js/icon-picker.js', array('fw-option-type-' . $this->get_type() . '-backend-previews'), fw()->manifest->get_version());
     wp_enqueue_style('fw-option-type-' . $this->get_type() . '-backend-picker', $static_URI . 'css/picker.css', array(), fw()->manifest->get_version());
     wp_localize_script('fw-option-type-' . $this->get_type() . '-backend-previews', 'fw_icon_v2_data', array('edit_icon_label' => __('Edit Icon', 'fw'), 'add_icon_label' => __('Add Icon', 'fw'), 'icon_fonts_label' => __('Icon Fonts', 'fw'), 'custom_upload_label' => __('Custom Upload', 'fw'), 'favorites_label' => __('Favorites', 'fw'), 'search_label' => __('Search Icon', 'fw'), 'select_pack_label' => __('Select Pack', 'fw'), 'all_packs_label' => __('All Packs', 'fw'), 'favorites_empty_label' => __('<h4>You have no favorite icons yet.</h4> To add icons here, simply click on the star (<i class="fw-icon-v2-info dashicons dashicons-star-filled"></i>) button that\'s on top of each icon.', 'fw'), 'icons' => $this->packs_loader->get_packs()));
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     $css_path = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/');
     $js_path = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/');
     wp_enqueue_style('fw-option-type' . $this->get_type(), $css_path . 'multi-picker.css', array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-type' . $this->get_type(), $js_path . 'multi-picker.js', array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     $options_array = $this->prepare_option($id, $option);
     unset($option['attr']['name'], $option['attr']['value']);
     return '<div ' . fw_attr_to_html($option['attr']) . '>' . fw()->backend->render_options($options_array, $data['value'], array('id_prefix' => $data['id_prefix'] . $id . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']')) . '</div>';
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     static $enqueue = true;
     if ($enqueue) {
         wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
         $enqueue = false;
     }
     fw()->backend->enqueue_options_static($option['inner-options']);
     return true;
 }
Ejemplo n.º 16
0
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     if (empty($data['value'])) {
         $data['value'] = array();
     }
     $div_attr = $option['attr'];
     unset($div_attr['name'], $div_attr['value']);
     return '<div ' . fw_attr_to_html($div_attr) . '>' . fw()->backend->render_options($option['inner-options'], $data['value'], array('id_prefix' => $data['id_prefix'] . $id . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']')) . '</div>';
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     /*
      * ensures that the static of option type upload
      * and image-picker is enqueued
      */
     fw()->backend->enqueue_options_static(array('background-image-dummy-upload' => array('type' => 'upload'), 'background-image-dummy-image-picker' => array('type' => 'image-picker')));
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-selectize'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'underscore', 'fw', 'fw-selectize'), fw()->manifest->get_version());
     if (!self::$googleFontsPrinted) {
         wp_localize_script('fw-option-' . $this->get_type(), 'googleFonts', self::$fonts['google']);
         self::$googleFontsPrinted = true;
     }
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'fonts' => self::$fonts));
 }
 protected function _enqueue_static($id, $option, $data)
 {
     add_action('admin_footer', array($this, 'load_templates'));
     $this->packs_loader->enqueue_admin_css();
     $static_URI = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/');
     wp_enqueue_style('fw-selectize');
     wp_enqueue_script('fw-option-type-' . $this->get_type() . '-backend-previews', $static_URI . 'js/render-icon-previews.js', array('jquery', 'fw', 'fw-events', 'fw-selectize'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-type-' . $this->get_type() . '-backend-picker-v2', $static_URI . 'js/icon-picker-v2.js', array('fw'), fw()->manifest->get_version(), true);
     wp_enqueue_style('fw-option-type-' . $this->get_type() . '-backend-picker', $static_URI . 'css/picker.css', array(), fw()->manifest->get_version());
     wp_localize_script('fw-option-type-' . $this->get_type() . '-backend-previews', 'fw_icon_v2_data', array('edit_icon_label' => __('Change Icon', 'fw'), 'add_icon_label' => __('Add Icon', 'fw')));
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('wp-color-picker');
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events'), fw()->manifest->get_version(), true);
     $option['attr']['value'] = (string) $data['value'];
     $option['attr']['class'] .= ' code';
     $option['attr']['size'] = '7';
     $option['attr']['maxlength'] = '7';
     $option['attr']['onclick'] = 'this.select()';
     return '<input type="text" ' . fw_attr_to_html($option['attr']) . '>';
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     if (!self::$enqueued) {
         wp_enqueue_style('fw-option-type-' . $this->get_type() . '-dashicons', includes_url('css/dashicons.min.css'), array(), fw()->manifest->get_version());
         wp_enqueue_style('fw-option-type-' . $this->get_type() . '-editor-buttons', includes_url('/css/editor.min.css'), array('dashicons'), fw()->manifest->get_version());
         $uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static');
         wp_enqueue_script('fw-option-type-' . $this->get_type(), $uri . '/scripts.js', array('jquery', 'fw-events', 'editor', 'fw'), fw()->manifest->get_version(), true);
         wp_enqueue_style('fw-option-type-' . $this->get_type(), $uri . '/styles.css', array('dashicons', 'editor-buttons'), fw()->manifest->get_version());
         self::$enqueued = true;
     }
     return true;
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     $css_lib_uri = fw_get_framework_directory_uri('/includes/option-types/datetime-picker/static/css/jquery.datetimepicker.css');
     $js_lib_uri = fw_get_framework_directory_uri('/includes/option-types/datetime-picker/static/js/jquery.datetimepicker.js');
     $css_main_uri = fw_get_framework_directory_uri('/includes/option-types/datetime-picker/static/css/style.css');
     $js_main_uri = fw_get_framework_directory_uri('/includes/option-types/datetime-picker/static/js/script.js');
     wp_enqueue_style('fw-option-datetime-picker-lib-css', $css_lib_uri);
     wp_enqueue_style('fw-option-datetime-picker-main-css', $css_main_uri);
     wp_enqueue_script('fw-moment');
     wp_enqueue_script('fw-option-datetime-picker-lib-js', $js_lib_uri, array('jquery', 'fw-moment'), false, true);
     wp_enqueue_script('fw-option-datetime-picker-main-js', $js_main_uri, array('jquery', 'fw-option-datetime-picker-lib-js', 'fw-events'), false, true);
     fw()->backend->option_type('text')->enqueue_static();
 }
 /**
  * Generate option's html from option array
  * @param string $id
  * @param array $option
  * @param array $data
  * @return string HTML
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     unset($option['attr']['name'], $option['attr']['value']);
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/' . $this->get_type() . '.js'), array('underscore', 'fw-events', 'jquery-ui-sortable', 'fw'), fw()->manifest->get_version(), true);
     $transformed_options = $this->transform_options($option['popup-options']);
     $localize_var_name = 'fw_option_type_' . str_replace('-', '_', $this->get_type()) . '_localize_' . md5(json_encode($transformed_options));
     wp_localize_script('fw-option-' . $this->get_type(), $localize_var_name, array('title' => empty($option['popup-title']) ? $option['label'] : $option['popup-title'], 'options' => $this->transform_options($option['popup-options']), 'template' => $option['template']));
     $option['attr']['data-localize-var-name'] = $localize_var_name;
     fw()->backend->render_options($option['popup-options']);
     // This makes sure that the option's static is enqueued
     $sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
 }
 /**
  * Generate option's html from option array
  *
  * @param string $id
  * @param array $option
  * @param array $data
  *
  * @return string HTML
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     unset($option['attr']['name'], $option['attr']['value']);
     $option['attr']['data-for-js'] = json_encode(array('title' => isset($option['popup-title']) ? $option['popup-title'] : (string) $option['label'], 'options' => $this->transform_options($option['popup-options']), 'button' => $option['button'], 'size' => $option['size'], 'custom-events' => $option['custom-events']));
     if (!empty($data['value'])) {
         if (is_array($data['value'])) {
             $data['value'] = json_encode($data['value']);
         }
     } else {
         $data['value'] = '';
     }
     $sortable_image = fw_get_framework_directory_uri('/static/img/sort-vertically.png');
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/views/view.php'), compact('id', 'option', 'data', 'sortable_image'));
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     $uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static');
     $css_uri = $uri . '/css/datepicker.css';
     $js_uri = $uri . '/js/scripts.js';
     $date_picker_js_uri = $uri . '/js/bootstrap-datepicker.js';
     $locale_uri = ($language = substr(get_locale(), 0, 2)) != 'en' ? $uri . '/js/locales/bootstrap-datepicker.' . $language . '.min.js' : null;
     wp_enqueue_style('fw-option-' . $this->get_type(), $css_uri, array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), $js_uri, array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     wp_enqueue_script('fw-option-' . $this->get_type() . '-date-picker', $date_picker_js_uri, array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     if ($locale_uri) {
         wp_enqueue_script('fw-option-' . $this->get_type() . '-date-picker-locale', $locale_uri, array('fw-option-' . $this->get_type() . '-date-picker'), fw()->manifest->get_version(), true);
     }
     fw()->backend->option_type('text')->enqueue_static();
 }
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'jquery-ui-sortable'), fw()->manifest->get_version(), true);
     if (empty($data['value']) || !is_array($data['value'])) {
         $data['value'] = array();
     }
     $controls = array_merge(array('delete' => '<small class="dashicons dashicons-no-alt" title="' . esc_attr(__('Remove', 'fw')) . '"></small>'), $option['box-controls']);
     if (isset($controls['delete'])) {
         $_delete = $controls['delete'];
         unset($controls['delete']);
         $controls['delete'] = $_delete;
         unset($_delete);
     }
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data, 'controls' => $controls));
 }
 /**
  * @param string $id
  * @param array $option
  * @param array $data
  *
  * @return string
  */
 protected function _render($id, $option, $data)
 {
     $language = substr(get_locale(), 0, 2);
     $css_uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/datepicker.css');
     $js_uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js');
     $date_picker_js_uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/bootstrap-datepicker.js');
     $properties = array('language' => $language, 'weekStart' => $option['monday-first'] == true ? 1 : 0, 'minDate' => $option['min-date'] !== null ? $option['min-date'] : null, 'maxDate' => $option['max-date'] !== null ? $option['max-date'] : null);
     $option['attr']['readonly'] = 'readonly';
     $option['attr']['data-fw-option-date-picker-opts'] = json_encode($properties);
     wp_enqueue_style('fw-option-' . $this->get_type(), $css_uri, array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), $js_uri, array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     wp_enqueue_script('fw-option-' . $this->get_type() . '-date-picker', $date_picker_js_uri, array('jquery', 'fw-events'), fw()->manifest->get_version(), true);
     if ($language != 'en') {
         $locale_uri = fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/locales/bootstrap-datepicker.' . $language . '.js');
         wp_enqueue_script('fw-option-' . $this->get_type() . '-date-picker-locale', $locale_uri, array('fw-option-' . $this->get_type() . '-date-picker'), fw()->manifest->get_version(), true);
     }
     return fw()->backend->option_type('text')->render($id, $option, $data);
 }
Ejemplo n.º 28
0
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type() . '-adaptive-switch', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/adaptive-switch/styles.css'), array(), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type() . '-adaptive-switch', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/adaptive-switch/jquery.adaptive-switch.js'), array('jquery'), fw()->manifest->get_version(), true);
     wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('fw-option-' . $this->get_type() . '-adaptive-switch'), fw()->manifest->get_version());
     wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'fw-option-' . $this->get_type() . '-adaptive-switch'), fw()->manifest->get_version(), true);
     $input_attr = array('name' => $option['attr']['name'], 'id' => $option['attr']['id'] . '--checkbox', 'data-switch-left' => $option['left-choice']['label'], 'data-switch-right' => $option['right-choice']['label']);
     foreach (array('left', 'right') as $value_type) {
         if (is_bool($option[$value_type . '-choice']['value'])) {
             $input_attr['data-switch-' . $value_type . '-bool-value'] = $option[$value_type . '-choice']['value'] ? 'true' : 'false';
         } else {
             $input_attr['data-switch-' . $value_type . '-value'] = $option[$value_type . '-choice']['value'];
         }
     }
     if ($data['value'] === $option['right-choice']['value']) {
         // right choice means checked
         $input_attr['checked'] = 'checked';
     }
     unset($option['attr']['name'], $option['attr']['value'], $option['attr']['checked'], $option['attr']['type']);
     return '<div ' . fw_attr_to_html($option['attr']) . '>' . '<input type="checkbox" ' . fw_attr_to_html($input_attr) . ' />' . '</div>';
 }
Ejemplo n.º 29
0
 /**
  * @internal
  */
 public function _action_enqueue_customizer_static()
 {
     $options_for_enqueue = array();
     $customizer_options = fw()->theme->get_customizer_options();
     /**
      * In customizer options is allowed to have container with unspecified (or not existing) 'type'
      * fw()->backend->enqueue_options_static() tries to enqueue both options and container static
      * not existing container types will throw notices.
      * To prevent that, extract and send it only options (without containers)
      */
     fw_collect_options($options_for_enqueue, $customizer_options);
     fw()->backend->enqueue_options_static($options_for_enqueue);
     unset($options_for_enqueue, $customizer_options);
     wp_enqueue_script('fw-backend-customizer', fw_get_framework_directory_uri('/static/js/backend-customizer.js'), array('jquery', 'fw-events', 'backbone'), fw()->manifest->get_version(), true);
     wp_localize_script('fw-backend-customizer', '_fw_backend_customizer_localized', array('change_timeout' => apply_filters('fw_customizer_option_change_timeout', 333)));
     do_action('fw_admin_enqueue_scripts:customizer');
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_style($this->get_type() . '-styles', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/style.css'), array('fw-selectize'), fw()->manifest->get_version());
     wp_enqueue_script($this->get_type() . '-styles', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('jquery', 'fw-events', 'fw-selectize'), fw()->manifest->get_version(), true);
     fw()->backend->option_type('text')->enqueue_static();
 }