示例#1
0
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     if (true == Redux_Helpers::isTheme(__FILE__)) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
示例#2
0
文件: options.php 项目: daibien/test
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     // This is needed. Bah WordPress bugs.  <img draggable="false" class="emoji" alt="😉" src="http://s.w.org/images/core/emoji/72x72/1f609.png">
     if (true == Redux_Helpers::isTheme(__FILE__)) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
示例#3
0
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     // This is needed. Bah WordPress bugs.  ;)
     if (true == Redux_Helpers::isTheme(__FILE__) || true == Redux_Helpers::isTheme(get_template_directory() . '/inc/plugins/redux.php')) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     // This is needed. Bah WordPress bugs.  ;)
     if (TRUE == Redux_Helpers::isTheme(__FILE__)) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
 }
示例#5
0
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     // This is needed. Bah WordPress bugs.  ;)
     if (true == Redux_Helpers::isTheme(__FILE__)) {
         $this->initSettings();
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
     add_action('redux/page/ro_settings/enqueue', array($this, 'redux_custom_css'));
 }
示例#6
0
 public function __construct()
 {
     if (!class_exists('ReduxFramework')) {
         return;
     }
     if (true == Redux_Helpers::isTheme(__FILE__)) {
         $this->initSettings();
         add_action('init', array($this, 'onUpdated'), 10);
     } else {
         add_action('plugins_loaded', array($this, 'initSettings'), 10);
     }
     if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'theme-options') {
         add_action('admin_enqueue_scripts', array($this, 'load_scripts'));
     }
 }
示例#7
0
 /**
  * Class Constructor. Defines the args for the theme options class
  *
  * @since       1.0.0
  *
  * @param       array $sections   Panel sections.
  * @param       array $args       Class constructor arguments.
  * @param       array $extra_tabs Extra panel tabs. // REMOVE
  *
  * @return \ReduxFramework
  */
 public function __construct($sections = array(), $args = array(), $extra_tabs = array())
 {
     // Disregard WP AJAX 'heartbeat'call.  Why waste resources?
     if (isset($_POST) && isset($_POST['action']) && $_POST['action'] == 'heartbeat') {
         // Hook, for purists.
         if (!has_action('redux/ajax/heartbeat')) {
             do_action('redux/ajax/heartbeat', $this);
         }
         // Buh bye!
         return;
     }
     // Pass parent pointer to function helper.
     Redux_Functions::$_parent = $this;
     $this->filesystem = new Redux_Filesystem($this);
     //set redux upload folder
     $this->set_redux_content();
     // Set values
     $this->set_default_args();
     $this->args = wp_parse_args($args, $this->args);
     if (empty($this->args['transient_time'])) {
         $this->args['transient_time'] = 60 * MINUTE_IN_SECONDS;
     }
     if (empty($this->args['footer_credit'])) {
         $this->args['footer_credit'] = '<span id="footer-thankyou">' . sprintf(__('Options panel created using %1$s', 'redux-framework'), '<a href="' . esc_url($this->framework_url) . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version) . '</span>';
     }
     if (empty($this->args['menu_title'])) {
         $this->args['menu_title'] = __('Options', 'redux-framework');
     }
     if (empty($this->args['page_title'])) {
         $this->args['page_title'] = __('Options', 'redux-framework');
     }
     /**
      * filter 'redux/args/{opt_name}'
      *
      * @param  array $args ReduxFramework configuration
      */
     $this->args = apply_filters("redux/args/{$this->args['opt_name']}", $this->args);
     /**
      * filter 'redux/options/{opt_name}/args'
      *
      * @param  array $args ReduxFramework configuration
      */
     $this->args = apply_filters("redux/options/{$this->args['opt_name']}/args", $this->args);
     if (!empty($this->args['opt_name'])) {
         /**
          * SHIM SECTION
          * Old variables and ways of doing things that need correcting.  ;)
          **/
         // Variable name change
         if (!empty($this->args['page_cap'])) {
             $this->args['page_permissions'] = $this->args['page_cap'];
             unset($this->args['page_cap']);
         }
         if (!empty($this->args['page_position'])) {
             $this->args['page_priority'] = $this->args['page_position'];
             unset($this->args['page_position']);
         }
         if (!empty($this->args['page_type'])) {
             $this->args['menu_type'] = $this->args['page_type'];
             unset($this->args['page_type']);
         }
         // Get rid of extra_tabs! Not needed.
         if (is_array($extra_tabs) && !empty($extra_tabs)) {
             foreach ($extra_tabs as $tab) {
                 array_push($this->sections, $tab);
             }
         }
         // Move to the first loop area!
         /**
          * filter 'redux-sections'
          *
          * @deprecated
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters('redux-sections', $sections);
         // REMOVE LATER
         /**
          * filter 'redux-sections-{opt_name}'
          *
          * @deprecated
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters("redux-sections-{$this->args['opt_name']}", $this->sections);
         // REMOVE LATER
         /**
          * filter 'redux/options/{opt_name}/sections'
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters("redux/options/{$this->args['opt_name']}/sections", $this->sections);
         /**
          * Construct hook
          * action 'redux/construct'
          *
          * @param object $this ReduxFramework
          */
         do_action('redux/construct', $this);
         // Set the default values
         $this->_default_cleanup();
         // Internataionalization
         $this->_internationalization();
         // Register extra extensions
         $this->_register_extensions();
         // Grab database values
         $this->get_options();
         // Tracking
         if (true != Redux_Helpers::isTheme(__FILE__) || true == Redux_Helpers::isTheme(__FILE__) && !$this->args['disable_tracking']) {
             $this->_tracking();
         }
         //DOVY!!  HERE!!!
         // Getting started page
         //                    if (  is_admin () && $this->args['dev_mode'] ) {
         //
         //                        if ( isset($_GET['page']) && ($_GET['page'] == 'redux-about' || $_GET['page'] == 'redux-getting-started' || $_GET['page'] == 'redux-credits' || $_GET['page'] == 'redux-changelog' )) {
         //                            //logconsole('inc');
         //                            require_once( dirname( __FILE__ ) . '/inc/welcome.php' );
         //                        } else {
         //                            //logconsole('compare');
         //                            if (isset($_GET['page']) && $_GET['page'] == $this->args['page_slug']) {
         //                                $saveVer = get_option('redux_version_upgraded_from');
         //                                $curVer = self::$_version;
         //
         //                                if (empty($saveVer)) {
         //                                    //logconsole('redir');
         //                                    wp_safe_redirect ( admin_url ( 'index.php?page=redux-getting-started' ) );
         //                                    exit;
         //                                } else if (version_compare($curVer, $saveVer, '>')) {
         //                                    wp_safe_redirect ( admin_url ( 'index.php?page=redux-about' ) );
         //                                    exit;
         //                                }
         //                            }
         //                        }
         //                    }
         // Options page
         add_action('admin_menu', array($this, '_options_page'));
         // Add a network menu
         if ($this->args['database'] == "network" && $this->args['network_admin']) {
             add_action('network_admin_menu', array($this, '_options_page'));
         }
         // Admin Bar menu
         add_action('admin_bar_menu', array($this, '_admin_bar_menu'), $this->args['admin_bar_priority']);
         // Register setting
         add_action('admin_init', array($this, '_register_settings'));
         // Display admin notices in dev_mode
         if (true == $this->args['dev_mode']) {
             require_once self::$_dir . 'inc/debug.php';
             $this->debug = new ReduxDebugObject($this);
             if (true == $this->args['update_notice']) {
                 add_action('admin_init', array($this, '_update_check'));
             }
         }
         // Display admin notices
         add_action('admin_notices', array($this, '_admin_notices'));
         // Check for dismissed admin notices.
         add_action('admin_init', array($this, '_dismiss_admin_notice'), 9);
         // Enqueue the admin page CSS and JS
         if (isset($_GET['page']) && $_GET['page'] == $this->args['page_slug']) {
             add_action('admin_enqueue_scripts', array($this, '_enqueue'), 1);
         }
         // Output dynamic CSS
         // Frontend: Maybe enqueue dynamic CSS and Google fonts
         if (empty($this->args['output_location']) || in_array('frontend', $this->args['output_location'])) {
             add_action('wp_head', array(&$this, '_output_css'), 150);
             add_action('wp_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         // Login page: Maybe enqueue dynamic CSS and Google fonts
         if (in_array('login', $this->args['output_location'])) {
             add_action('login_head', array(&$this, '_output_css'), 150);
             add_action('login_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         // Admin area: Maybe enqueue dynamic CSS and Google fonts
         if (in_array('admin', $this->args['output_location'])) {
             add_action('admin_head', array(&$this, '_output_css'), 150);
             add_action('admin_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         add_action('wp_print_scripts', array($this, 'vc_fixes'), 100);
         add_action('admin_enqueue_scripts', array($this, 'vc_fixes'), 100);
         require_once self::$_dir . 'inc/import_export.php';
         $this->import_export = new Redux_import_export($this);
         if ($this->args['database'] == "network" && $this->args['network_admin']) {
             add_action('network_admin_edit_redux_' . $this->args['opt_name'], array($this, 'save_network_page'), 10, 0);
             add_action('admin_bar_menu', array($this, 'network_admin_bar'), 999);
         }
     }
     /**
      * Loaded hook
      * action 'redux/loaded'
      *
      * @param  object $this ReduxFramework
      */
     do_action('redux/loaded', $this);
 }
示例#8
0
 /**
  * Class Constructor. Defines the args for the theme options class
  *
  * @since       1.0.0
  *
  * @param       array $sections   Panel sections.
  * @param       array $args       Class constructor arguments.
  * @param       array $extra_tabs Extra panel tabs. // REMOVE
  *
  * @return \ReduxFramework
  */
 public function __construct($sections = array(), $args = array(), $extra_tabs = array())
 {
     // Disregard WP AJAX 'heartbeat'call.  Why waste resources?
     if (isset($_POST) && isset($_POST['action']) && $_POST['action'] == 'heartbeat') {
         // Hook, for purists.
         if (!has_action('redux/ajax/heartbeat')) {
             do_action('redux/ajax/heartbeat', $this);
         }
         // Buh bye!
         return;
     }
     // Pass parent pointer to function helper.
     Redux_Functions::$_parent = $this;
     Redux_CDN::$_parent = $this;
     Redux_Admin_Notices::$_parent = $this;
     // Set values
     $this->set_default_args();
     $this->args = wp_parse_args($args, $this->args);
     if (empty($this->args['transient_time'])) {
         $this->args['transient_time'] = 60 * MINUTE_IN_SECONDS;
     }
     if (empty($this->args['footer_credit'])) {
         $this->args['footer_credit'] = '<span id="footer-thankyou">' . sprintf(__('Options panel created using %1$s', 'redux-framework'), '<a href="' . esc_url($this->framework_url) . '" target="_blank">' . __('Redux Framework', 'redux-framework') . '</a> v' . self::$_version) . '</span>';
     }
     if (empty($this->args['menu_title'])) {
         $this->args['menu_title'] = __('Options', 'redux-framework');
     }
     if (empty($this->args['page_title'])) {
         $this->args['page_title'] = __('Options', 'redux-framework');
     }
     $this->old_opt_name = $this->args['opt_name'];
     /**
      * filter 'redux/args/{opt_name}'
      *
      * @param  array $args ReduxFramework configuration
      */
     $this->args = apply_filters("redux/args/{$this->args['opt_name']}", $this->args);
     /**
      * filter 'redux/options/{opt_name}/args'
      *
      * @param  array $args ReduxFramework configuration
      */
     $this->args = apply_filters("redux/options/{$this->args['opt_name']}/args", $this->args);
     if ($this->args['opt_name'] == $this->old_opt_name) {
         unset($this->old_opt_name);
     }
     // Do not save the defaults if we're on a live preview!
     if ($GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
         $this->args['save_defaults'] = false;
     }
     if (!empty($this->args['opt_name'])) {
         /**
          * SHIM SECTION
          * Old variables and ways of doing things that need correcting.  ;)
          * */
         // Variable name change
         if (!empty($this->args['page_cap'])) {
             $this->args['page_permissions'] = $this->args['page_cap'];
             unset($this->args['page_cap']);
         }
         if (!empty($this->args['page_position'])) {
             $this->args['page_priority'] = $this->args['page_position'];
             unset($this->args['page_position']);
         }
         if (!empty($this->args['page_type'])) {
             $this->args['menu_type'] = $this->args['page_type'];
             unset($this->args['page_type']);
         }
         // Get rid of extra_tabs! Not needed.
         if (is_array($extra_tabs) && !empty($extra_tabs)) {
             foreach ($extra_tabs as $tab) {
                 array_push($this->sections, $tab);
             }
         }
         // Move to the first loop area!
         /**
          * filter 'redux-sections'
          *
          * @deprecated
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters('redux-sections', $sections);
         // REMOVE LATER
         /**
          * filter 'redux-sections-{opt_name}'
          *
          * @deprecated
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters("redux-sections-{$this->args['opt_name']}", $this->sections);
         // REMOVE LATER
         /**
          * filter 'redux/options/{opt_name}/sections'
          *
          * @param  array $sections field option sections
          */
         $this->sections = apply_filters("redux/options/{$this->args['opt_name']}/sections", $this->sections);
         /**
          * Construct hook
          * action 'redux/construct'
          *
          * @param object $this ReduxFramework
          */
         do_action('redux/construct', $this);
         // Set the default values
         $this->_default_cleanup();
         // Internataionalization
         $this->_internationalization();
         $this->filesystem = Redux_Filesystem::get_instance($this);
         //set redux upload folder
         $this->set_redux_content();
         // Register extra extensions
         $this->_register_extensions();
         // Grab database values
         $this->get_options();
         // Tracking
         if (isset($this->args['allow_tracking']) && $this->args['allow_tracking'] && Redux_Helpers::isTheme(__FILE__)) {
             $this->_tracking();
         }
         // Options page
         add_action('admin_menu', array($this, '_options_page'));
         // Add a network menu
         if ($this->args['database'] == "network" && $this->args['network_admin']) {
             add_action('network_admin_menu', array($this, '_options_page'));
         }
         // Admin Bar menu
         add_action('admin_bar_menu', array($this, '_admin_bar_menu'), $this->args['admin_bar_priority']);
         // Register setting
         add_action('admin_init', array($this, '_register_settings'));
         // Display admin notices in dev_mode
         if (true == $this->args['dev_mode']) {
             if (true == $this->args['update_notice']) {
                 add_action('admin_init', array($this, '_update_check'));
             }
         }
         // Display admin notices
         add_action('admin_notices', array($this, '_admin_notices'), 99);
         // Check for dismissed admin notices.
         add_action('admin_init', array($this, '_dismiss_admin_notice'), 9);
         // Enqueue the admin page CSS and JS
         if (isset($_GET['page']) && $_GET['page'] == $this->args['page_slug']) {
             add_action('admin_enqueue_scripts', array($this, '_enqueue'), 1);
         }
         // Output dynamic CSS
         // Frontend: Maybe enqueue dynamic CSS and Google fonts
         if (empty($this->args['output_location']) || in_array('frontend', $this->args['output_location'])) {
             add_action('wp_head', array(&$this, '_output_css'), 150);
             add_action('wp_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         // Login page: Maybe enqueue dynamic CSS and Google fonts
         if (in_array('login', $this->args['output_location'])) {
             add_action('login_head', array(&$this, '_output_css'), 150);
             add_action('login_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         // Admin area: Maybe enqueue dynamic CSS and Google fonts
         if (in_array('admin', $this->args['output_location'])) {
             add_action('admin_head', array(&$this, '_output_css'), 150);
             add_action('admin_enqueue_scripts', array(&$this, '_enqueue_output'), 150);
         }
         add_action('wp_print_scripts', array($this, 'vc_fixes'), 100);
         add_action('admin_enqueue_scripts', array($this, 'vc_fixes'), 100);
         if ($this->args['database'] == "network" && $this->args['network_admin']) {
             add_action('network_admin_edit_redux_' . $this->args['opt_name'], array($this, 'save_network_page'), 10, 0);
             add_action('admin_bar_menu', array($this, 'network_admin_bar'), 999);
         }
         // Ajax saving!!!
         add_action("wp_ajax_" . $this->args['opt_name'] . '_ajax_save', array($this, "ajax_save"));
         if ($this->args['dev_mode'] == true || Redux_Helpers::isLocalHost() == true) {
             require_once 'core/dashboard.php';
             if (!isset($GLOBALS['redux_notice_check'])) {
                 require_once 'core/newsflash.php';
                 $params = array('dir_name' => 'notice', 'server_file' => 'http://www.reduxframework.com/' . 'wp-content/uploads/redux/redux_notice.json', 'interval' => 3, 'cookie_id' => 'redux_blast');
                 new reduxNewsflash($this, $params);
                 $GLOBALS['redux_notice_check'] = 1;
             }
         }
     }
     /**
      * Loaded hook
      * action 'redux/loaded'
      *
      * @param  object $this ReduxFramework
      */
     do_action('redux/loaded', $this);
 }