public function enqueue_static()
 {
     wp_enqueue_style('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/css/styles.css'));
     wp_enqueue_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/js/scripts.js'), array('fw-events'), false, true);
     wp_localize_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), 'fw_form_builder_item_type_' . $this->get_type(), array('l10n' => array('item_title' => __('Dropdown', 'fw'), 'label' => __('Label', 'fw'), 'toggle_required' => __('Toggle mandatory field', 'fw'), 'edit' => __('Edit', 'fw'), 'delete' => __('Delete', 'fw'), 'edit_label' => __('Edit Label', 'fw')), 'options' => $this->get_options(), 'defaults' => array('type' => $this->get_type(), 'options' => fw_get_options_values_from_input($this->get_options(), array()))));
     fw()->backend->enqueue_options_static($this->get_options());
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _render($id, $option, $data)
 {
     $static_uri = fw()->extensions->get('page-builder')->get_uri('/includes/page-builder/static');
     $version = fw()->extensions->get('page-builder')->manifest->get_version();
     wp_enqueue_style('fw-option-type-' . $this->get_type(), $static_uri . '/css/styles.css', array(), $version);
     /*
      * there should not be (and it does not make sens to be)
      * more than one page builder per page that is integrated
      * with the default post content editor
      * integration in the sens of inserting the button to activate/deactivate
      * the builder, to replace the post content with the shortcode notation
      */
     if ($this->editor_integration_enabled && $option['editor_integration'] === true) {
         trigger_error(__('There must not be more than one page Editor integrated with the wp post editor per page', 'fw'), E_USER_ERROR);
     } elseif ($option['editor_integration'] === true) {
         $this->editor_integration_enabled = true;
         wp_enqueue_style('fw-option-type-' . $this->get_type() . '-editor-integration', $static_uri . '/css/editor_integration.css', array(), $version);
         wp_enqueue_script('fw-option-type-' . $this->get_type() . '-editor-integration', $static_uri . '/js/editor_integration.js', array('jquery', 'fw-events'), $version, true);
         $builder_templates = apply_filters('fw_ext_page_builder_templates', array());
         // remove not existing templates
         $builder_templates = array_intersect(array_keys(wp_get_theme()->get_page_templates()), $builder_templates);
         /**
          * Make sure the array is not associative array('template.php', ...)
          * instead of array(2 => 'template.php', ...)
          * because the json needs to be ['template.php', ...] instead of {2: 'template.php', ...}
          */
         $builder_templates = array_values($builder_templates);
         wp_localize_script('fw-option-type-' . $this->get_type() . '-editor-integration', 'fw_option_type_' . str_replace('-', '_', $this->get_type()) . '_editor_integration_data', array('l10n' => array('showButton' => __('Visual Page Builder', 'fw'), 'hideButton' => __('Default Editor', 'fw')), 'optionId' => $option['attr']['id'], 'renderInBuilderMode' => isset($data['value']['builder_active']) ? $data['value']['builder_active'] : apply_filters('fw_page_builder_set_as_default', false), 'builderTemplates' => $builder_templates));
     }
     return parent::_render($id, $option, $data);
 }
 public function enqueue_static()
 {
     wp_enqueue_style('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/css/styles.css'));
     wp_enqueue_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), $this->get_uri('/static/js/scripts.js'), array('fw-events'), false, true);
     wp_localize_script('fw-builder-' . $this->get_builder_type() . '-item-' . $this->get_type(), 'fw_form_builder_item_type_' . $this->get_type(), array('options' => $this->get_options(), 'l10n' => array('item_title' => __('Recaptcha', 'fw'), 'label' => __('Label', 'fw'), 'edit_label' => __('Edit Label', 'fw'), 'edit' => __('Edit', 'fw'), 'delete' => __('Delete', 'fw'), 'site_key' => __('Set site key', 'fw'), 'secret_key' => __('Set secret key', 'fw')), 'defaults' => array('type' => $this->get_type(), 'options' => fw_get_options_values_from_input($this->get_options(), array()))));
     fw()->backend->enqueue_options_static($this->get_options());
 }
 public function __construct()
 {
     $user_config = fw()->extensions->get('sidebars')->get_config();
     $this->config['sidebar_positions'] = fw_akg('sidebar_positions', $user_config, array());
     $this->config['dynamic_sidebar_args'] = fw_akg('dynamic_sidebar_args', $user_config, array());
     $this->config = array_merge($this->config, $this->get_config_defaults());
 }
 /**
  * @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);
 }
 /**
  * @internal
  * {@inheritdoc}
  */
 protected function _enqueue_static($id, $option, $data)
 {
     wp_enqueue_script('fw-option-type-' . $this->get_type(), $this->js_uri . '/scripts.js', array('jquery', 'fw-events', 'editor', 'fw'), fw()->manifest->get_version(), true);
     wp_enqueue_style('editor-buttons-css', includes_url("/css/editor.min.css"), array(), fw()->manifest->get_version());
     wp_enqueue_style('dashicons-css', includes_url("css/dashicons.min.css"), array(), fw()->manifest->get_version());
     wp_enqueue_style('fw-option-type-' . $this->get_type(), $this->css_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'), 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);
     fw()->backend->enqueue_options_static($option['popup-options']);
     return true;
 }
 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_EXTENSIONS_DIR . $rel_path . '/shortcodes';
         if (file_exists($fw_path)) {
             self::load_from_shortcodes_folder(array('path' => $fw_path, 'uri' => FW_EXTENSIONS_URI . $rel_path . '/shortcodes'));
         }
         // parent theme framework-customizations
         $parent_fws_path = FW_PT_EXTENSIONS_DIR . $rel_path . '/shortcodes';
         if (file_exists($parent_fws_path)) {
             self::load_from_shortcodes_folder(array('path' => $parent_fws_path, 'uri' => FW_PT_EXTENSIONS_URI . $rel_path . '/shortcodes'));
         }
         // child theme framework-customizations
         if (FW_CT) {
             $child_fws_path = FW_CT_EXTENSIONS_DIR . $rel_path . '/shortcodes';
             if (file_exists($child_fws_path)) {
                 self::load_from_shortcodes_folder(array('path' => $child_fws_path, 'uri' => FW_CT_EXTENSIONS_URI . $rel_path . '/shortcodes'));
             }
         }
         if (!empty($children)) {
             self::load_from_extensions_recursive($children);
         }
     }
 }
Esempio n. 9
0
/**
 * @param WP_Post[] $items
 * @param array $categories
 * @param string $prefix
 *
 * @return array
 */
function fw_ext_portfolio_get_sort_classes(array $items, array $categories, $prefix = 'category_')
{
    $ext_portfolio_settings = fw()->extensions->get('portfolio')->get_settings();
    $taxonomy = $ext_portfolio_settings['taxonomy_name'];
    $classes = array();
    $categories_classes = array();
    foreach ($items as $key => $item) {
        $class_name = '';
        $terms = wp_get_post_terms($item->ID, $taxonomy);
        foreach ($terms as $term) {
            foreach ($categories as $category) {
                if ($term->term_id == $category->term_id) {
                    $class_name .= $prefix . $category->term_id . ' ';
                    $categories_classes[$term->term_id] = true;
                } else {
                    if (in_array($term->term_id, $category->children, true)) {
                        $class_name .= $prefix . $category->term_id . ' ';
                        $categories_classes[$term->term_id] = true;
                    }
                }
                $classes[$item->ID] = $class_name;
            }
        }
    }
    return $classes;
}
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     $data['value'] = fw_ext('mailer')->get_db_settings_option();
     $wrapper_attr = $option['attr'];
     unset($wrapper_attr['name'], $wrapper_attr['value']);
     return '<div ' . fw_attr_to_html($wrapper_attr) . '>' . fw()->backend->option_type('multi')->render($id, array('inner-options' => $this->get_inner_options()), $data) . '</div>';
 }
Esempio n. 11
0
function woffice_pre_set_transient_update_theme($transient)
{
    /*We first check if it's the purchase code has been entered */
    $status = get_option('woffice_license');
    if ($status == "checked") {
        if (empty($transient->checked)) {
            return $transient;
        }
        $theme_version = fw()->theme->manifest->get('version');
        $theme_slug = fw()->theme->manifest->get('id');
        $request_string = array('body' => array('action' => 'check_updated', 'version' => $theme_version));
        /* We use our API */
        $raw_response = wp_remote_post('http://alka-web.com/woffice-updater/theme-updater.php', $request_string);
        /* We check */
        $response = null;
        if (!is_wp_error($raw_response) && $raw_response['response']['code'] == 200) {
            $response = unserialize($raw_response['body']);
        }
        if (!empty($response)) {
            // Feed the update data into WP updater
            $transient->response[$theme_slug] = $response;
        }
        return $transient;
    }
}
 /**
  * @param FW_Extension $extension
  */
 private static function load_extension_shortcodes($extension)
 {
     $ext_name = $extension->get_name();
     if (version_compare(fw()->manifest->get_version(), '2.2', '<')) {
         $ext_rel_path = $extension->get_rel_path();
         if ($extension->get_declared_source() === 'framework') {
             self::load_folder_shortcodes($ext_name, array('path' => $extension->get_declared_path('/shortcodes'), 'uri' => $extension->get_declared_URI('/shortcodes')), array('paths' => array(fw_get_stylesheet_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes'), fw_get_template_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes')), 'uris' => array(fw_get_stylesheet_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes'), fw_get_template_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes'))));
             self::load_folder_shortcodes($ext_name, array('path' => fw_get_template_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes'), 'uri' => fw_get_template_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes')), array('paths' => array(fw_get_stylesheet_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes')), 'uris' => array(fw_get_stylesheet_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes'))));
             self::load_folder_shortcodes($ext_name, array('path' => fw_get_stylesheet_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes'), 'uri' => fw_get_stylesheet_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes')));
         } elseif ($extension->get_declared_source() === 'parent') {
             self::load_folder_shortcodes($ext_name, array('path' => $extension->get_declared_path('/shortcodes'), 'uri' => $extension->get_declared_URI('/shortcodes')), array('paths' => array(fw_get_stylesheet_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes')), 'uris' => array(fw_get_stylesheet_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes'))));
             self::load_folder_shortcodes($ext_name, array('path' => fw_get_stylesheet_customizations_directory('/extensions' . $ext_rel_path . '/shortcodes'), 'uri' => fw_get_stylesheet_customizations_directory_uri('/extensions' . $ext_rel_path . '/shortcodes')));
         } else {
             self::load_folder_shortcodes($ext_name, array('path' => $extension->get_declared_path('/shortcodes'), 'uri' => $extension->get_declared_URI('/shortcodes')));
         }
     } else {
         $customizations_locations = array('paths' => array(), 'uris' => array());
         foreach ($extension->get_customizations_locations() as $path => $uri) {
             $customizations_locations['paths'][] = $path . '/shortcodes';
             $customizations_locations['uris'][] = $uri . '/shortcodes';
         }
         $path = $extension->get_path('/shortcodes');
         $uri = $extension->get_uri('/shortcodes');
         do {
             if (empty($customizations_locations['paths'])) {
                 $customizations_locations = array();
             }
             self::load_folder_shortcodes($ext_name, array('path' => $path, 'uri' => $uri), $customizations_locations);
             if ($customizations_locations) {
                 $path = array_pop($customizations_locations['paths']);
                 $uri = array_pop($customizations_locations['uris']);
             }
         } while ($customizations_locations);
     }
 }
Esempio n. 13
0
/**
 * Check if the there are defined views for the commercial templates, otherwise are used theme templates
 *
 * @param string $template
 *
 * @return string
 */
function _filter_fw_ext_commercial_template_include($template)
{
    /**
     * @var FW_Extension_Commercial $Commercial
     */
    $commercial = fw()->extensions->get('commercial');
    if (is_singular($commercial->get_post_type_name())) {
        if (preg_match('/single-' . '.*\\.php/i', basename($template)) === 1) {
            return $template;
        }
        if ($commercial->locate_view_path('single')) {
            return $commercial->locate_view_path('single');
        } else {
            add_filter('the_content', '_filter_fw_ext_commercial_the_content');
        }
    } else {
        if (is_tax($commercial->get_taxonomy_name()) && $commercial->locate_view_path('taxonomy')) {
            if (preg_match('/taxonomy-' . '.*\\.php/i', basename($template)) === 1) {
                return $template;
            }
            return $commercial->locate_view_path('taxonomy');
        } else {
            if (is_post_type_archive($commercial->get_post_type_name()) && $commercial->locate_view_path('archive')) {
                if (preg_match('/archive-' . '.*\\.php/i', basename($template)) === 1) {
                    return $template;
                }
                return $commercial->locate_view_path('archive');
            }
        }
    }
    return $template;
}
 /**
  * @internal
  */
 protected function _render($id, $option, $data)
 {
     wp_enqueue_style('fw-option-' . $this->get_type(), FW_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_URI . '/includes/option-types/' . $this->get_type() . '/static/js/scripts.js', array('jquery'), fw()->manifest->get_version());
     $output = fw_render_view(FW_DIR . '/includes/option-types/' . $this->get_type() . '/view.php', array('id' => $id, 'option' => $option, 'data' => $data));
     return $output;
 }
Esempio n. 15
0
 function fw_ext_events_render_map($post_id = 0)
 {
     if (0 === $post_id && null === ($post_id = get_the_ID())) {
         return null;
     }
     $fw_ext_events = fw()->extensions->get('events');
     if (empty($fw_ext_events)) {
         return null;
     }
     $post = get_post($post_id);
     if ($post->post_type !== $fw_ext_events->get_post_type_name()) {
         return null;
     }
     $shortcode_ext = fw()->extensions->get('shortcodes');
     if (empty($shortcode_ext)) {
         return null;
     }
     $shortcode_map = $shortcode_ext->get_shortcode('map');
     if (empty($shortcode_map)) {
         return null;
     }
     $options = fw_get_db_post_option($post->ID, $fw_ext_events->get_event_option_id());
     if (empty($options['event_location']['location']) or empty($options['event_location']['coordinates']['lat']) or empty($options['event_location']['coordinates']['lng'])) {
         return null;
     }
     return $shortcode_map->render_custom(array(array('title' => $post->post_title, 'url' => get_permalink($post->ID), 'description' => $options['event_location']['location'], 'thumb' => array('attachment_id' => get_post_thumbnail_id($post->ID)), 'location' => array('coordinates' => array('lat' => $options['event_location']['coordinates']['lat'], 'lng' => $options['event_location']['coordinates']['lng'])))), array('map_height' => false, 'map_type' => false));
 }
 /**
  * @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());
 }
 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);
         }
     }
 }
 private function get_builder_data()
 {
     if (empty($this->builder_data)) {
         $shortcodes = fw()->extensions->get('shortcodes')->get_shortcodes();
         foreach ($shortcodes as $tag => $shortcode) {
             $config = $shortcode->get_config('page_builder');
             if ($config) {
                 // check if the shortcode type is valid
                 $config = array_merge(array('type' => $this->type), $config);
                 if ($config['type'] !== $this->get_type()) {
                     continue;
                 }
                 if (!isset($config['tab'])) {
                     trigger_error(sprintf(__("No Page Builder tab specified for shortcode: %s", 'fw'), $tag), E_USER_WARNING);
                 }
                 $item_data = array_merge(array('tab' => '~', 'title' => $tag, 'description' => '', 'localize' => array('edit' => __('Edit', 'fw'), 'remove' => __('Remove', 'fw'), 'duplicate' => __('Duplicate', 'fw')), 'icon' => null, 'title_template' => null), $config);
                 if (!isset($item_data['icon']) && ($icon = $shortcode->locate_URI('/static/img/page_builder.png'))) {
                     $item_data['icon'] = $icon;
                 }
                 // if the shortcode has options we store them and then they are passed to the modal
                 $options = $shortcode->get_options();
                 if ($options) {
                     $item_data['options'] = $this->transform_options($options);
                     fw()->backend->enqueue_options_static($options);
                 }
                 $this->builder_data[$tag] = $item_data;
             }
         }
     }
     return $this->builder_data;
 }
Esempio n. 20
0
 function _action_init_framework()
 {
     remove_action('after_setup_theme', '_action_init_framework');
     $fw_dir = dirname(__FILE__);
     include $fw_dir . '/bootstrap-helpers.php';
     require $fw_dir . '/core/Fw.php';
     fw();
     /**
      * Load helpers
      */
     foreach (array('meta', 'class-fw-access-key', 'class-fw-dumper', 'general', 'class-fw-wp-filesystem', 'class-fw-cache', 'class-fw-form', 'class-fw-request', 'class-fw-session', 'class-fw-wp-option', 'class-fw-wp-meta', 'database', 'class-fw-flash-messages', 'class-fw-resize', 'class-fw-wp-list-table') as $file) {
         require $fw_dir . '/helpers/' . $file . '.php';
     }
     /**
      * Load includes
      */
     foreach (array('hooks') as $file) {
         require $fw_dir . '/includes/' . $file . '.php';
     }
     $components = array('theme', 'extensions', 'backend');
     foreach ($components as $component) {
         fw()->{$component}->_init();
     }
     foreach ($components as $component) {
         fw()->{$component}->_after_components_init();
     }
     /**
      * The framework is loaded
      */
     do_action('fw_init');
 }
 /**
  * @internal
  */
 public function _admin_action_enqueue_static()
 {
     $screen = get_current_screen();
     if ($screen->id === fw()->extensions->get('slider')->get_post_type()) {
         wp_enqueue_style('fw-selectize');
         wp_enqueue_script('fw-population-method-categories', $this->locate_js_URI($this->get_name()), array('fw-selectize'), $this->manifest->get_version());
     }
 }
 /**
  * @param string $id
  * @param array $option
  * @param array $data
  *
  * @return string
  */
 protected function _render($id, $option, $data)
 {
     $language = substr(get_locale(), 0, 2);
     $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);
     return fw()->backend->option_type('text')->render($id, $option, $data);
 }
 /**
  * @internal
  */
 public function _theme_action_print_styling_switcher()
 {
     echo $this->render_view('panel', array('options' => $this->options, 'description' => fw_get_db_ext_settings_option($this->get_parent()->get_name(), 'switch_style_panel_description')));
     wp_enqueue_style('fw-ext-' . $this->get_name(), $this->locate_URI('/static/css/panel.css'), array(), fw()->theme->manifest->get_version());
     wp_enqueue_script('fw-ext-' . $this->get_name(), $this->locate_URI('/static/js/panel.js'), array('jquery'), fw()->theme->manifest->get_version());
     wp_localize_script('fw-ext-' . $this->get_name(), 'fwGoogleFonts', fw_get_google_fonts());
     wp_localize_script('fw-ext-' . $this->get_name(), 'fwSwitchStylePanel', array('cache_key' => $this->cache_key));
 }
 /**
  * @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-events'), fw()->manifest->get_version(), true);
     $option = $this->check_parameters($option);
     $data = $this->check_data($option, $data);
     return fw_render_view(fw_get_framework_directory('/includes/option-types/' . $this->get_type() . '/view.php'), array('id' => $id, 'option' => $option, 'data' => $data));
 }
 /**
  * @param string $builder_type Builder option type
  * @return bool
  */
 protected function builder_type_is_valid($builder_type)
 {
     if (empty($builder_type) || !fw()->backend->option_type($builder_type) || !fw()->backend->option_type($builder_type) instanceof FW_Option_Type_Builder) {
         return false;
     } else {
         return true;
     }
 }
 public function render()
 {
     $code = trim(fw()->extensions->get('analytics')->get_analytics_code());
     if (empty($code)) {
         return '';
     }
     return $this->render_view('view', array('code' => $code));
 }
 /**
  * Search relative path in '/extensions/forms/{builder_type}/items/{item_type}/'
  *
  * @param string $rel_path
  * @param string $default_path Used if no path found
  *
  * @return false|string
  */
 protected final function locate_path($rel_path, $default_path)
 {
     if ($path = fw()->extensions->get('forms')->locate_path('/' . $this->get_builder_type() . '/items/' . $this->get_type() . $rel_path)) {
         return $path;
     } else {
         return $default_path;
     }
 }
 /**
  * @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>');
 }
 /**
  * {@inheritdoc}
  */
 protected function _save($id, array $option, $value, array $params)
 {
     if ($wp_option = $this->get_wp_option($option, $params)) {
         update_option($wp_option, $value, false);
         return fw()->backend->option_type($option['type'])->get_value_from_input(array('type' => $option['type']), null);
     } else {
         return $value;
     }
 }
Esempio n. 30
0
function fw_ext_seo_sitemap_get_settings_options()
{
    $ext_name = fw()->extensions->get('seo-sitemap')->get_name();
    $prefix = $ext_name . '-';
    return array($ext_name => array('title' => __('Sitemap', 'fw'), 'type' => 'tab', 'options' => array($prefix . 'box' => array('title' => __('Sitemap Settings', 'fw'), 'type' => 'box', 'options' => array($prefix . 'group-sitemap-button' => array('type' => 'group', 'options' => array($prefix . 'sitemap-button' => array('label' => __('View Sitemap', 'fw'), 'desc' => __('Press button to view sitemap file', 'fw'), 'type' => 'html', 'html' => '<a href="' . fw_ext_seo_sitemap_get_stiemap_link() . '" target="_blank" class="button-secondary">' . __('XML Sitemap', 'fw') . '</a>', 'value' => ''))), $prefix . 'group-search-engines' => array('type' => 'group', 'options' => array($prefix . 'search-engies-pings' => array('label' => __('Search Engines', 'fw'), 'type' => 'html', 'html' => __('After adding content the extension will automatically ping to:', 'fw') . ' <strong>' . fw_ext_seo_sitemap_get_search_engines_names(false) . '</strong>', 'value' => ''))), $prefix . 'group-custom-posts' => array('type' => 'group', 'options' => array($prefix . 'exclude-custom-posts-html' => array('label' => __('Exclude Pages', 'fw'), 'type' => 'html', 'html' => __('Please check the pages you do not want to include in sitemap', 'fw'), 'value' => ''), fw_ext_seo_sitemap_get_posts_types_options())), $prefix . 'group-taxonomies' => array('type' => 'group', 'options' => array($prefix . 'exclude-taxonomies-html' => array('label' => __('Exclude Categories', 'fw'), 'type' => 'html', 'html' => __('Please check the categories you do not want to include in sitemap', 'fw'), 'value' => ''), fw_ext_seo_sitemap_get_taxonomies_options())), $prefix . 'update-sitemap' => array('label' => __('Update Sitemap', 'fw'), 'desc' => __('Update sitemap XML file', 'fw'), 'type' => 'html', 'html' => '<a href="#" onclick="fw_ext_seo_sitemap_update(this); return false;" class="button-secondary">' . __('Update XML Sitemap', 'fw') . '</a><span class="spinner"></span>
							<span class="sitemap-update-response sitemap-successfully">' . __('The sitemap was updated successfully') . '</span>
							<span class="sitemap-update-response sitemap-unsuccessfully">' . __('Unable to update the sitemap') . '</span>
							', 'value' => ''))))));
}