本文整理汇总了PHP中w3_admin_redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_admin_redirect函数的具体用法?PHP w3_admin_redirect怎么用?PHP w3_admin_redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_admin_redirect函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_extensions_activate
/**
* @throws Exception
*/
function action_extensions_activate()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$extension = W3_Request::get_string('w3tc_extensions_activate');
if ($extension) {
w3tc_activate_extension($extension, $this->_config);
}
w3_admin_redirect(array('w3tc_note' => 'extension_activated'));
}
示例2: w3_admin_redirect_with_custom_messages
/**
* Redirect function to current admin page with errors and messages specified
*
* @param array $params
* @param array $errors
* @param array $notes
* @param bool $check_referrer
* @return void
*/
function w3_admin_redirect_with_custom_messages($params, $errors = null, $notes = null, $check_referrer = false)
{
if (empty($errors) && w3_admin_single_system_item($notes)) {
w3_admin_redirect(array_merge($params, array('w3tc_note' => $notes[0])), $check_referrer);
return;
}
if (w3_admin_single_system_item($errors) && empty($notes)) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => $errors[0])), $check_referrer);
return;
}
$message_id = uniqid();
set_transient('w3tc_message.' . $message_id, array('errors' => $errors, 'notes' => $notes), 600);
w3_admin_redirect(array_merge($params, array('w3tc_message' => $message_id)), $check_referrer);
}
示例3: action_save_new_relic
function action_save_new_relic()
{
if ($this->_config->get_boolean('newrelic.enabled')) {
/**
* @var $nerser W3_NewRelicService
*/
$nerser = w3_instance('W3_NewRelicService');
$application = W3_Request::get_array('application');
$application['alerts_enabled'] = $application['alerts_enabled'] == 1 ? 'true' : 'false';
$application['rum_enabled'] = $application['rum_enabled'] == 1 ? 'true' : 'false';
$result = $nerser->update_application_settings($application);
w3_admin_redirect(array('w3tc_note' => 'new_relic_save'), true);
}
}
示例4: action_aws_sns_subscribe
/**
* @throws Exception
*/
function action_aws_sns_subscribe()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$topic_arn = W3_Request::get_string('cluster_messagebus_sns_topic_arn_subscribe');
/**
* @var W3_Enterprise_SnsClient $sns_client
*/
$sns_client = w3_instance('W3_Enterprise_SnsClient');
$sns_client->subscribe(plugins_url('pub/sns.php', W3TC_FILE), $topic_arn);
try {
$this->_config->set('cluster.messagebus.sns.topic_arn', $topic_arn);
$this->_config->save();
} catch (Exception $ex) {
throw new Exception('<strong>Can\'t change configuration</strong>: ' . $ex->getMessage());
}
w3_admin_redirect(array('w3tc_note' => 'sns_subscribed'));
}
示例5: action_edge_mode_disable
public function action_edge_mode_disable()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/activation.php');
$config_path = w3_get_wp_config_path();
$config_data = @file_get_contents($config_path);
if ($config_data === false) {
return;
}
$new_config_data = $this->wp_config_evaluation_mode_remove_from_content($config_data);
if ($new_config_data != $config_data) {
try {
w3_wp_write_to_file($config_path, $new_config_data);
} catch (FilesystemOperationException $ex) {
throw new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), 'Edit file <strong>' . $config_path . '</strong> and remove next lines:', $config_path, $this->wp_config_evaluation_mode());
}
}
w3_admin_redirect(array('w3tc_note' => 'disabled_edge'));
}
示例6: action_config_update_upload_path
/**
* Update upload path action
*
* @return void
*/
function action_config_update_upload_path()
{
update_option('upload_path', '');
w3_admin_redirect();
}
示例7: action_support_request
/**
* Send support request action
*
* @return void
*/
function action_support_request()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$request_type = W3_Request::get_string('request_type');
$payment = W3_Request::get_boolean('payment');
$request_id = W3_Request::get_string('request_id');
$url = W3_Request::get_string('url');
$name = W3_Request::get_string('name');
$email = W3_Request::get_string('email');
$twitter = W3_Request::get_string('twitter');
$phone = W3_Request::get_string('phone');
$subject = W3_Request::get_string('subject');
$description = W3_Request::get_string('description');
$templates = W3_Request::get_array('templates');
$forum_url = W3_Request::get_string('forum_url');
$wp_login = W3_Request::get_string('wp_login');
$wp_password = W3_Request::get_string('wp_password');
$ftp_host = W3_Request::get_string('ftp_host');
$ftp_login = W3_Request::get_string('ftp_login');
$ftp_password = W3_Request::get_string('ftp_password');
$subscribe_releases = W3_Request::get_string('subscribe_releases');
$subscribe_customer = W3_Request::get_string('subscribe_customer');
$params = array('request_type' => $request_type, 'payment' => $payment, 'url' => $url, 'name' => $name, 'email' => $email, 'twitter' => $twitter, 'phone' => $phone, 'subject' => $subject, 'description' => $description, 'forum_url' => $forum_url, 'wp_login' => $wp_login, 'wp_password' => $wp_password, 'ftp_host' => $ftp_host, 'ftp_login' => $ftp_login, 'ftp_password' => $ftp_password, 'subscribe_releases' => $subscribe_releases, 'subscribe_customer' => $subscribe_customer);
$post = $params;
foreach ($templates as $template_index => $template) {
$template_key = sprintf('templates[%d]', $template_index);
$params[$template_key] = $template;
}
if (!isset($this->_request_types[$request_type])) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_type')), false);
}
$required = array('bug_report' => 'url,name,email,subject,description', 'new_feature' => 'url,name,email,subject,description', 'email_support' => 'url,name,email,subject,description', 'phone_support' => 'url,name,email,subject,description,phone', 'plugin_config' => 'url,name,email,subject,description,wp_login,wp_password', 'theme_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password', 'linux_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password');
if (strstr($required[$request_type], 'url') !== false && $url == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_url')), false);
}
if (strstr($required[$request_type], 'name') !== false && $name == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_name')), false);
}
if (strstr($required[$request_type], 'email') !== false && !preg_match('~^[a-z0-9_\\-\\.]+@[a-z0-9-\\.]+\\.[a-z]{2,5}$~', $email)) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_email')), false);
}
if (strstr($required[$request_type], 'phone') !== false && !preg_match('~^[0-9\\-\\.\\ \\(\\)\\+]+$~', $phone)) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_phone')), false);
}
if (strstr($required[$request_type], 'subject') !== false && $subject == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_subject')), false);
}
if (strstr($required[$request_type], 'description') !== false && $description == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_description')), false);
}
if (strstr($required[$request_type], 'wp_login') !== false && $wp_login == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_login')), false);
}
if (strstr($required[$request_type], 'wp_password') !== false && $wp_password == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_password')), false);
}
if (strstr($required[$request_type], 'ftp_host') !== false && $ftp_host == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_host')), false);
}
if (strstr($required[$request_type], 'ftp_login') !== false && $ftp_login == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_login')), false);
}
if (strstr($required[$request_type], 'ftp_password') !== false && $ftp_password == '') {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_password')), false);
}
/**
* Add attachments
*/
$attachments = array();
$attach_files = array(w3_get_wp_config_path(), w3_cache_blog_dir('log') . '/minify.log', w3_get_pgcache_rules_core_path(), w3_get_pgcache_rules_cache_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404wp_path(), w3_get_minify_rules_core_path(), w3_get_minify_rules_cache_path());
/**
* Attach config files
*/
if ($handle = opendir(W3TC_CONFIG_DIR)) {
while (($entry = @readdir($handle)) !== false) {
if ($entry == '.' || $entry == '..' || $entry == 'index.html') {
continue;
}
$attachments[] = W3TC_CONFIG_DIR . '/' . $entry;
}
closedir($handle);
}
foreach ($attach_files as $attach_file) {
if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) {
$attachments[] = $attach_file;
}
}
/**
* Attach server info
*/
$server_info = print_r($this->get_server_info(), true);
$server_info = str_replace("\n", "\r\n", $server_info);
$server_info_path = W3TC_CACHE_TMP_DIR . '/server_info.txt';
if (@file_put_contents($server_info_path, $server_info)) {
$attachments[] = $server_info_path;
//.........这里部分代码省略.........
示例8: action_test_pagespeed_results
/**
* Page Speed results action
*
* @return void
*/
function action_test_pagespeed_results()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
w3_require_once(W3TC_LIB_W3_DIR . '/PageSpeed.php');
$force = W3_Request::get_boolean('force');
$title = 'Google Page Speed';
$w3_pagespeed = new W3_PageSpeed();
$results = $w3_pagespeed->analyze(w3_get_home_url(), $force);
if ($force) {
w3_admin_redirect(array('w3tc_pagespeed_results' => 1, '_wpnonce' => wp_create_nonce('w3tc')));
}
include W3TC_INC_POPUP_DIR . '/pagespeed_results.php';
}
示例9: action_flush_pgcache_purge_page
/**
* PgCache purge page
*
* @return void
*/
function action_flush_pgcache_purge_page()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$post_id = W3_Request::get_integer('post_id');
do_action('w3tc_purge_from_pgcache', $post_id);
w3_admin_redirect(array('w3tc_note' => 'pgcache_purge_page'), true);
}
示例10: action_cdn_purge_attachment
/**
* CDN Purge Post
*
* @return void
*/
function action_cdn_purge_attachment()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$results = array();
$attachment_id = W3_Request::get_integer('attachment_id');
$w3_plugin_cdn = w3_instance('W3_Plugin_CdnAdmin');
if ($w3_plugin_cdn->purge_attachment($attachment_id, $results)) {
w3_admin_redirect(array('w3tc_note' => 'cdn_purge_attachment'), true);
} else {
w3_admin_redirect(array('w3tc_error' => 'cdn_purge_attachment'), true);
}
}
示例11: action_save_options
//.........这里部分代码省略.........
case 'cf':
$config->set('cdn.cf.cname', $cdn_domains);
break;
case 'cf2':
$config->set('cdn.cf2.cname', $cdn_domains);
break;
case 'rscf':
$config->set('cdn.rscf.cname', $cdn_domains);
break;
case 'azure':
$config->set('cdn.azure.cname', $cdn_domains);
break;
case 'mirror':
$config->set('cdn.mirror.domain', $cdn_domains);
break;
case 'maxcdn':
$config->set('cdn.maxcdn.domain', $cdn_domains);
break;
case 'netdna':
$config->set('cdn.netdna.domain', $cdn_domains);
break;
case 'cotendo':
$config->set('cdn.cotendo.domain', $cdn_domains);
break;
case 'edgecast':
$config->set('cdn.edgecast.domain', $cdn_domains);
break;
case 'att':
$config->set('cdn.att.domain', $cdn_domains);
break;
case 'akamai':
$config->set('cdn.akamai.domain', $cdn_domains);
break;
}
}
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/extensions.php');
w3_extensions_admin_init();
$all_extensions = w3_get_extensions($config);
$old_extensions = $this->_config->get_array('extensions.settings', array());
foreach ($all_extensions as $extension => $descriptor) {
$extension_values = W3_Request::get_as_array('extensions.settings.');
$extension_keys = array();
$extension_settings = array();
$tmp_grp = str_replace('.', '_', $extension) . '_';
foreach ($extension_values as $key => $value) {
if (strpos($key, $tmp_grp) !== false) {
$extension_settings[str_replace($tmp_grp, '', $key)] = $value;
}
}
if ($extension_settings) {
$old_extension_settings = isset($old_extensions[$extension]) ? $old_extensions[$extension] : array();
if (!isset($old_extensions[$extension])) {
$old_extensions[$extension] = array();
}
$extension_keys[$extension] = apply_filters("w3tc_save_extension_settings-{$extension}", $extension_settings, $old_extension_settings);
$new_settings = array_merge($old_extensions, $extension_keys);
$config->set("extensions.settings", $new_settings);
$old_extensions = $config->get_array('extensions.settings', array());
}
}
//CloudFront does not support expires header. So disable it when its used
if ($config->get_string('cdn.engine') == 'cf2') {
$config->set('browsercache.cssjs.expires', false);
$config->set('browsercache.html.expires', false);
$config->set('browsercache.other.expires', false);
}
$config = apply_filters('w3tc_save_options', $config, $this->_config, $config_admin);
$config = apply_filters("w3tc_save_options-{$this->_page}", $config, $this->_config, $config_admin);
do_action('w3tc_saving_options', $config, $this->_config, $config_admin);
do_action("w3tc_saving_options-{$this->_page}", $config, $this->_config, $config_admin);
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
w3_config_save($this->_config, $config, $config_admin);
switch ($this->_page) {
case 'w3tc_cdn':
/**
* Handle Set Cookie Domain
*/
$set_cookie_domain_old = W3_Request::get_boolean('set_cookie_domain_old');
$set_cookie_domain_new = W3_Request::get_boolean('set_cookie_domain_new');
if ($set_cookie_domain_old != $set_cookie_domain_new) {
if ($set_cookie_domain_new) {
if (!$this->enable_cookie_domain()) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'enable_cookie_domain')));
}
} else {
if (!$this->disable_cookie_domain()) {
w3_admin_redirect(array_merge($params, array('w3tc_error' => 'disable_cookie_domain')));
}
}
}
break;
case 'w3tc_general':
break;
}
$notes[] = 'config_save';
if ($redirect_permalink_error) {
w3_admin_redirect(array('w3tc_error' => $redirect_permalink_error, 'w3tc_note' => 'config_save'));
}
w3_admin_redirect_with_custom_messages($params, null, $notes, true);
}
示例12: action_licensing_check_key
function action_licensing_check_key()
{
set_transient('w3tc_license_status', false, 1);
edd_w3edge_w3tc_activate_license($this->_config->get_string('plugin.license_key'));
w3_admin_redirect(array(), true);
}
示例13: action_flush_all_except_cf
/**
* Flsuh all caches except CloudFlare
*/
function action_flush_all_except_cf()
{
//$this->flush_all(false);
w3_admin_redirect(array('w3tc_note' => 'flush_all_except_cf'), true);
}
示例14: action_w3cache_flush_browser_cache
/**
* Flush browser cache action
*
* @return void
*/
function action_w3cache_flush_browser_cache()
{
$this->flush_browser_cache();
w3_admin_redirect(array('w3tc_note' => 'flush_browser_cache'), true);
}