本文整理汇总了PHP中Redux_Helpers::isLocalHost方法的典型用法代码示例。如果您正苦于以下问题:PHP Redux_Helpers::isLocalHost方法的具体用法?PHP Redux_Helpers::isLocalHost怎么用?PHP Redux_Helpers::isLocalHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redux_Helpers
的用法示例。
在下文中一共展示了Redux_Helpers::isLocalHost方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_version
public function check_version()
{
global $pagenow;
if ($pagenow == "admin-ajax.php" || $GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
return;
}
$saveVer = Redux_Helpers::major_version(get_option('redux_version_upgraded_from'));
$curVer = Redux_Helpers::major_version(ReduxFramework::$_version);
$compare = false;
if (Redux_Helpers::isLocalHost()) {
$compare = true;
} else {
if (class_exists('ReduxFrameworkPlugin')) {
$compare = true;
} else {
$redux = ReduxFrameworkInstances::get_all_instances();
if (is_array($redux)) {
foreach ($redux as $panel) {
if ($panel->args['dev_mode'] == 1) {
$compare = true;
break;
}
}
}
}
}
if ($compare) {
$redirect = false;
if (empty($saveVer)) {
$redirect = true;
// First time
} else {
if (version_compare($curVer, $saveVer, '>')) {
$redirect = true;
// Previous version
}
}
if ($redirect && !defined('WP_TESTS_DOMAIN')) {
add_action('init', array($this, 'do_redirect'));
}
}
}
示例2: check_version
public function check_version()
{
global $pagenow;
if ($pagenow == "admin-ajax.php" || $GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
return;
}
$saveVer = Redux_Helpers::major_version(get_option('redux_version_upgraded_from'));
$curVer = Redux_Helpers::major_version(ReduxFramework::$_version);
$compare = false;
if (Redux_Helpers::isLocalHost()) {
$compare = true;
} else {
if (class_exists('ReduxFrameworkPlugin')) {
$compare = true;
} else {
$redux = ReduxFrameworkInstances::get_all_instances();
foreach ($redux as $panel) {
if ($panel->args['dev_mode'] == 1) {
$compare = true;
break;
}
}
}
}
if ($compare) {
$redirect = false;
if (empty($saveVer)) {
$redirect = true;
// First time
} else {
if (version_compare($curVer, $saveVer, '>')) {
$redirect = true;
// Previous version
}
}
if ($redirect) {
//wp_safe_redirect( admin_url( 'tools.php?page=redux-about' ) );
//exit();
}
}
}
示例3: _default_cleanup
/**
* Set default options on admin_init if option doesn't exist
*
* @since 1.0.0
* @access public
* @return void
*/
private function _default_cleanup()
{
// Fix the global variable name
if ($this->args['global_variable'] == "" && $this->args['global_variable'] !== false) {
$this->args['global_variable'] = str_replace('-', '_', $this->args['opt_name']);
}
// Force dev_mode on WP_DEBUG = true and if it's a local server
if (Redux_Helpers::isLocalHost() || Redux_Helpers::isWpDebug()) {
if ($this->args['dev_mode'] != true) {
$this->args['update_notice'] = false;
}
$this->dev_mode_forced = true;
$this->args['dev_mode'] = true;
if (isset($this->args['forced_dev_mode_off']) && $this->args['forced_dev_mode_off'] == true) {
$this->dev_mode_forced = false;
$this->args['dev_mode'] = false;
}
}
// Auto create the page_slug appropriately
if (empty($this->args['page_slug'])) {
if (!empty($this->args['display_name'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['display_name']);
} else {
if (!empty($this->args['page_title'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['page_title']);
} else {
if (!empty($this->args['menu_title'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['menu_title']);
} else {
$this->args['page_slug'] = str_replace('-', '_', $this->args['opt_name']);
}
}
}
}
if (isset($this->args['customizer_only']) && $this->args['customizer_only'] == true) {
$this->args['menu_type'] = 'hidden';
$this->args['customizer'] = true;
$this->args['admin_bar'] = false;
$this->args['allow_sub_menu'] = false;
}
// Check if the Airplane Mode plugin is installed
if (class_exists('Airplane_Mode_Core')) {
$airplane = Airplane_Mode_Core::getInstance();
if (method_exists($airplane, 'enabled')) {
if ($airplane->enabled()) {
$this->args['use_cdn'] = false;
}
} else {
if ($airplane->check_status() == 'on') {
$this->args['use_cdn'] = false;
}
}
}
}
示例4: __construct
//.........这里部分代码省略.........
* @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 = new Redux_Filesystem($this);
//set redux upload folder
$this->set_redux_content();
// 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();
}
// 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'), 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) {
include_once 'core/dashboard.php';
if (!isset($GLOBALS['redux_notice_check'])) {
include_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);
}
示例5: change_demo_defaults
private function change_demo_defaults()
{
if ($this->args['dev_mode'] == true || Redux_Helpers::isLocalHost() == true) {
if (!empty($this->args['admin_bar_links'])) {
foreach ($this->args['admin_bar_links'] as $idx => $arr) {
if (is_array($arr) && !empty($arr)) {
foreach ($arr as $x => $y) {
if (strpos(strtolower($y), 'redux') !== false) {
$msg = __('<strong>Redux Framework Notice: </strong>There are references to the Redux Framework support site in your config\'s <code>admin_bar_links</code> argument. This is sample data. Please change or remove this data before shipping your product.', 'redux-framework');
$this->display_arg_change_notice('admin', $msg);
$this->omit_admin_items = true;
continue;
}
}
}
}
}
if (!empty($this->args['share_icons'])) {
foreach ($this->args['share_icons'] as $idx => $arr) {
if (is_array($arr) && !empty($arr)) {
foreach ($arr as $x => $y) {
if (strpos(strtolower($y), 'redux') !== false) {
$msg = __('<strong>Redux Framework Notice: </strong>There are references to the Redux Framework support site in your config\'s <code>share_icons</code> argument. This is sample data. Please change or remove this data before shipping your product.', 'redux-framework');
$this->display_arg_change_notice('share', $msg);
$this->omit_share_icons = true;
}
}
}
}
}
}
}
示例6: _default_cleanup
/**
* Set default options on admin_init if option doesn't exist
*
* @since 1.0.0
* @access public
* @return void
*/
private function _default_cleanup()
{
// Fix the global variable name
if ($this->args['global_variable'] == "" && $this->args['global_variable'] !== false) {
$this->args['global_variable'] = str_replace('-', '_', $this->args['opt_name']);
}
// Force dev_mode on WP_DEBUG = true and if it's a local server
if (Redux_Helpers::isLocalHost() || Redux_Helpers::isWpDebug()) {
if ($this->args['dev_mode'] != true) {
$this->args['update_notice'] = false;
}
$this->dev_mode_forced = true;
$this->args['dev_mode'] = true;
}
// Auto create the page_slug appropriately
if (empty($this->args['page_slug'])) {
if (!empty($this->args['display_name'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['display_name']);
} else {
if (!empty($this->args['page_title'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['page_title']);
} else {
if (!empty($this->args['menu_title'])) {
$this->args['page_slug'] = sanitize_html_class($this->args['menu_title']);
} else {
$this->args['page_slug'] = str_replace('-', '_', $this->args['opt_name']);
}
}
}
}
}
示例7: __
*
* @author Redux Framework
* @package ReduxFramework/Templates
* @version: 3.5.4.18
*/
$tip_title = __('Developer Mode Enabled', 'redux-framework');
if ($this->parent->dev_mode_forced) {
$is_debug = false;
$is_localhost = false;
$debug_bit = '';
if (Redux_Helpers::isWpDebug()) {
$is_debug = true;
$debug_bit = __('WP_DEBUG is enabled', 'redux-framework');
}
$localhost_bit = '';
if (Redux_Helpers::isLocalHost()) {
$is_localhost = true;
$localhost_bit = __('you are working in a localhost environment', 'redux-framework');
}
$conjunction_bit = '';
if ($is_localhost && $is_debug) {
$conjunction_bit = ' ' . __('and', 'redux-framework') . ' ';
}
$tip_msg = __('This has been automatically enabled because', 'redux-framework') . ' ' . $debug_bit . $conjunction_bit . $localhost_bit . '.';
} else {
$tip_msg = __('If you are not a developer, your theme/plugin author shipped with developer mode enabled. Contact them directly to fix it.', 'redux-framework');
}
?>
<div id="redux-header">
<?php
if (!empty($this->parent->args['display_name'])) {