本文整理汇总了PHP中Redux::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Redux::init方法的具体用法?PHP Redux::init怎么用?PHP Redux::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redux
的用法示例。
在下文中一共展示了Redux::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileSystemStatus
public static function compileSystemStatus($json_output = false, $remote_checks = false)
{
global $wpdb;
$sysinfo = array();
$sysinfo['home_url'] = home_url();
$sysinfo['site_url'] = site_url();
$sysinfo['redux_ver'] = esc_html(ReduxFramework::$_version);
$sysinfo['redux_data_dir'] = ReduxFramework::$_upload_dir;
$f = 'fo' . 'pen';
// Only is a file-write check
$sysinfo['redux_data_writeable'] = self::makeBoolStr(@$f(ReduxFramework::$_upload_dir . 'test-log.log', 'a'));
$sysinfo['wp_content_url'] = WP_CONTENT_URL;
$sysinfo['wp_ver'] = get_bloginfo('version');
$sysinfo['wp_multisite'] = is_multisite();
$sysinfo['permalink_structure'] = get_option('permalink_structure') ? get_option('permalink_structure') : 'Default';
$sysinfo['front_page_display'] = get_option('show_on_front');
if ($sysinfo['front_page_display'] == 'page') {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$sysinfo['front_page'] = $front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
$sysinfo['posts_page'] = $blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
}
$sysinfo['wp_mem_limit']['raw'] = self::let_to_num(WP_MEMORY_LIMIT);
$sysinfo['wp_mem_limit']['size'] = size_format($sysinfo['wp_mem_limit']['raw']);
$sysinfo['db_table_prefix'] = 'Length: ' . strlen($wpdb->prefix) . ' - Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable');
$sysinfo['wp_debug'] = 'false';
if (defined('WP_DEBUG') && WP_DEBUG) {
$sysinfo['wp_debug'] = 'true';
}
$sysinfo['wp_lang'] = get_locale();
if (!class_exists('Browser')) {
require_once ReduxFramework::$_dir . 'inc/browser.php';
}
$browser = new Browser();
$sysinfo['browser'] = array('agent' => $browser->getUserAgent(), 'browser' => $browser->getBrowser(), 'version' => $browser->getVersion(), 'platform' => $browser->getPlatform());
$sysinfo['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
$sysinfo['localhost'] = self::makeBoolStr(self::isLocalHost());
$sysinfo['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
$sysinfo['abspath'] = ABSPATH;
if (function_exists('ini_get')) {
$sysinfo['php_mem_limit'] = size_format(self::let_to_num(ini_get('memory_limit')));
$sysinfo['php_post_max_size'] = size_format(self::let_to_num(ini_get('post_max_size')));
$sysinfo['php_time_limit'] = ini_get('max_execution_time');
$sysinfo['php_max_input_var'] = ini_get('max_input_vars');
$sysinfo['php_display_errors'] = self::makeBoolStr(ini_get('display_errors'));
}
$sysinfo['suhosin_installed'] = extension_loaded('suhosin');
$sysinfo['mysql_ver'] = $wpdb->db_version();
$sysinfo['max_upload_size'] = size_format(wp_max_upload_size());
$sysinfo['def_tz_is_utc'] = 'true';
if (date_default_timezone_get() !== 'UTC') {
$sysinfo['def_tz_is_utc'] = 'false';
}
$sysinfo['fsockopen_curl'] = 'false';
if (function_exists('fsockopen') || function_exists('curl_init')) {
$sysinfo['fsockopen_curl'] = 'true';
}
//$sysinfo['soap_client'] = 'false';
//if ( class_exists( 'SoapClient' ) ) {
// $sysinfo['soap_client'] = 'true';
//}
//
//$sysinfo['dom_document'] = 'false';
//if ( class_exists( 'DOMDocument' ) ) {
// $sysinfo['dom_document'] = 'true';
//}
//$sysinfo['gzip'] = 'false';
//if ( is_callable( 'gzopen' ) ) {
// $sysinfo['gzip'] = 'true';
//}
if ($remote_checks == true) {
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'ReduxFramework/' . ReduxFramework::$_version, 'body' => array('cmd' => '_notify-validate')));
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$sysinfo['wp_remote_post'] = 'true';
$sysinfo['wp_remote_post_error'] = '';
} else {
$sysinfo['wp_remote_post'] = 'false';
$sysinfo['wp_remote_post_error'] = $response->get_error_message();
}
$response = wp_remote_get('http://reduxframework.com/wp-admin/admin-ajax.php?action=get_redux_extensions');
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$sysinfo['wp_remote_get'] = 'true';
$sysinfo['wp_remote_get_error'] = '';
} else {
$sysinfo['wp_remote_get'] = 'false';
$sysinfo['wp_remote_get_error'] = $response->get_error_message();
}
}
$active_plugins = (array) get_option('active_plugins', array());
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
}
$sysinfo['plugins'] = array();
foreach ($active_plugins as $plugin) {
$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
$plugin_name = esc_html($plugin_data['Name']);
$sysinfo['plugins'][$plugin_name] = $plugin_data;
}
$redux = ReduxFrameworkInstances::get_all_instances();
$sysinfo['redux_instances'] = array();
//.........这里部分代码省略.........
示例2: __
} else {
$args['intro_text'] = __('<p>This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.</p>', 'redux-framework-demo');
}
// Add content after the form.
$args['footer_text'] = __('<p>This text is displayed below the options panel. It isn\'t required, but more info is always better! The footer_text field accepts all HTML.</p>', 'redux-framework-demo');
Redux::setArgs($opt_name, $args);
/*
* ---> END ARGUMENTS
*/
/*
* ---> START HELP TABS
*/
$tabs = array(array('id' => 'redux-help-tab-1', 'title' => __('Theme Information 1', 'redux-framework-demo'), 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'redux-framework-demo')), array('id' => 'redux-help-tab-2', 'title' => __('Theme Information 2', 'redux-framework-demo'), 'content' => __('<p>This is the tab content, HTML is allowed.</p>', 'redux-framework-demo')));
Redux::setHelpTab($opt_name, $tabs);
/*
* <--- END HELP TABS
*/
/*
*
* ---> START SECTIONS
*
*/
/*
As of Redux 3.5+, there is an extensive API. This API can be used in a mix/match mode allowing for
*/
Redux::setSection($opt_name, array('title' => __('Global Message', 'pay2publish'), 'desc' => __('Set the message to display when the user does not have enough funds', 'pay2publish'), 'id' => 'global_message', 'subsection' => true, 'customizer_width' => '700px', 'fields' => array(array('id' => 'global_message_editor', 'type' => 'editor', 'title' => __('Message when no funds', 'pay2publish'), 'subtitle' => __('', 'pay2publish'), 'desc' => __('Set the message to display when the user does not have enough funds', 'pay2publish'), 'default' => __('You do not have enought credits to create a new publication of that Post Type', 'pay2publish'), 'validate_callback' => array('myCRED_P2P_Main', 'validation_callback')), array('id' => 'opt-raw', 'type' => 'raw', 'title' => __('Support', 'pay2publish'), 'subtitle' => __('If you like this plugin you can support it by doing the following:.', 'pay2publish'), 'desc' => __('Rate, follow or donate... will not ask for more', 'pay2publish'), 'content' => file_get_contents(P2PADDON_ROOT_DIR . 'myfile.txt')))));
Redux::init($opt_name);
/*
* <--- END SECTIONS
*/
示例3: vortex_systen_main_function
function vortex_systen_main_function()
{
if (!function_exists('is_plugin_active')) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (class_exists('myCRED_Hook')) {
include plugin_dir_path(__FILE__) . 'mycredcomments.php';
include plugin_dir_path(__FILE__) . 'mycredposts.php';
function vortex_mycred_references_filter($references)
{
$references['vortex_like_posts_mycred_author_content'] = __('Receive like for posts(content author)', 'vortex_system_ld');
$references['vortex_like_posts_mycred_author'] = __('Receive like for posts(like author)', 'vortex_system_ld');
$references['vortex_like_coms_mycred_author_content'] = __('Receive like for comments(content author)', 'vortex_system_ld');
$references['vortex_like_coms_mycred_author'] = __('Receive like for comments(like author)', 'vortex_system_ld');
return $references;
}
add_filter('mycred_all_references', 'vortex_mycred_references_filter');
}
if (function_exists('is_plugin_active')) {
if (is_plugin_active('redux-framework/redux-framework.php')) {
load_plugin_textdomain('vortex_system_ld', FALSE, basename(plugin_dir_path(__FILE__)) . '/languages');
$reduxoption = plugin_dir_path(__FILE__) . 'admin/vortexlikedislike.php';
$reduxframework = plugin_dir_path(plugin_dir_path(__FILE__)) . 'redux-framework/ReduxCore/framework.php';
if (!class_exists('ReduxFramework') && file_exists($reduxframework)) {
include $reduxframework;
}
if (!isset($vortex_like_dislike) && file_exists($reduxoption)) {
include $reduxoption;
}
//donation button
function vortex_system_donation_button()
{
echo '<form style="width:260px;margin:0 auto;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="VVGFFVJSFVZ7S">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
';
}
add_action('redux/vortex_like_dislike/panel/before', 'vortex_system_donation_button');
add_action('redux/vortex_like_dislike/panel/after', 'vortex_system_donation_button');
Redux::init('vortex_like_dislike');
global $vortex_like_dislike;
if ($vortex_like_dislike['v-switch-posts'] && isset($vortex_like_dislike['v-switch-posts'])) {
include plugin_dir_path(__FILE__) . 'posts-pages.php';
//load metabox
include plugin_dir_path(__FILE__) . 'metabox.php';
}
if ($vortex_like_dislike['v-switch-comments'] && isset($vortex_like_dislike['v-switch-comments'])) {
include plugin_dir_path(__FILE__) . 'comments.php';
}
//add custom fields when comment is submited
add_action('comment_post', 'vortex_system_add_likes_dislikes_comments');
function vortex_system_add_likes_dislikes_comments($comment_ID)
{
global $vortex_like_dislike;
$likes = 0;
$dislikes = 0;
if (isset($vortex_like_dislike['v_start_comment_like'])) {
$likes = $vortex_like_dislike['v_start_comment_like'];
}
if (isset($vortex_like_dislike['v_start_comment_dislike'])) {
$dislikes = $vortex_like_dislike['v_start_comment_dislike'];
}
add_comment_meta($comment_ID, 'vortex_system_likes', $likes, true);
add_comment_meta($comment_ID, 'vortex_system_dislikes', $dislikes, true);
}
//add custom fields when post is published
add_action('publish_post', 'post_published_notification');
function post_published_notification($ID)
{
global $vortex_like_dislike;
$likes = 0;
$dislikes = 0;
if (isset($vortex_like_dislike['v_start_post_like'])) {
$likes = $vortex_like_dislike['v_start_post_like'];
}
if (isset($vortex_like_dislike['v_start_post_dislike'])) {
$dislikes = $vortex_like_dislike['v_start_post_dislike'];
}
add_post_meta($ID, 'vortex_system_likes', $likes, true);
add_post_meta($ID, 'vortex_system_dislikes', $dislikes, true);
}
}
}
}
示例4: cdt_sharing
function cdt_sharing()
{
global $callto_opt;
Redux::init('use_cdt_sharing');
if (!empty($callto_opt['use_cdt_sharing'])) {
echo '
<div class="addthis_toolbox cdt_share_container social-toggle">
<div class="cdt_share_tools">
<a class="addthis_button_facebook"><i class="fa fa-facebook"></i></a>
<a class="addthis_button_twitter"><i class="fa fa-twitter"></i></a>
<a class="addthis_button_google"><i class="fa fa-google-plus share_gp"></i></a>
</div>
<div class="cdt_share_toggle share-toggle">
<i class="fa share-image-toggle share-move-right fa-caret-right" style="display:none;"></i><i class="fa share-image-toggle share-move-left fa-caret-left"></i><p>SHARE</p>
</div>
</div>
';
}
}