本文整理汇总了PHP中W3_Request类的典型用法代码示例。如果您正苦于以下问题:PHP W3_Request类的具体用法?PHP W3_Request怎么用?PHP W3_Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了W3_Request类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: view
/**
* New Relic tab
*/
function view()
{
$applications = array();
$dashboard = '';
/**
* @var $nerser W3_NewRelicService
*/
$nerser = w3_instance('W3_NewRelicService');
$new_relic_configured = $this->_config->get_string('newrelic.account_id') && $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.application_id');
$view_application = $this->_config->get_string('newrelic.application_id');
$new_relic_enabled = $this->_config->get_boolean('newrelic.enabled');
$verify_running = $nerser->verify_running();
$application_settings = array();
if (!is_array($verify_running)) {
try {
$application_settings = $nerser->get_application_settings();
} catch (Exception $ex) {
$application_settings = array();
}
}
if ($view_metric = W3_Request::get_boolean('view_metric', false)) {
$metric_names = $nerser->get_metric_names(W3_Request::get_string('regex', ''));
}
include W3TC_INC_DIR . '/options/new_relic.php';
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:28,代码来源:MonitoringAdminView.php
示例2: view
/**
* Support tab
*
* @return void
*/
function view()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$request_type = W3_Request::get_string('request_type');
$payment = W3_Request::get_boolean('payment');
include W3TC_INC_DIR . '/options/support.php';
}
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:12,代码来源:SupportAdminView.php
示例3: w3tc_cancel_button
function w3tc_cancel_button($note, $classes = '', $custom_method = 'w3tc_default_hide_note')
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page', 'w3tc_dashboard');
$url = sprintf('admin.php?page=%s&%s¬e=%s', $page, $custom_method, $note);
$url = wp_nonce_url($url, 'w3tc');
return w3_button_link(__('Cancel'), $url, false, $classes);
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:8,代码来源:admin_ui.php
示例4: 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'));
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:12,代码来源:ExtensionsActionsAdmin.php
示例5: widget_pagespeed_control
/**
* Latest widget control
*
* @param integer $widget_id
* @param array $form_inputs
* @return void
*/
function widget_pagespeed_control($widget_id, $form_inputs = array())
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$this->_config->set('widget.pagespeed.key', W3_Request::get_string('w3tc_widget_pagespeed_key'));
$this->_config->save();
}
include W3TC_INC_DIR . '/widget/pagespeed_control.php';
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:16,代码来源:PageSpeed.php
示例6: action_new_relic_view_new_relic_app
/**
* New Relic tab
*/
function action_new_relic_view_new_relic_app()
{
$nerser = w3_instance('W3_NewRelicService');
$view_application = W3_Request::get_integer('view_application', 0);
$dashboard = '';
if ($view_application) {
$dashboard = $nerser->get_dashboard($view_application);
}
echo $dashboard;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:13,代码来源:NewRelicActionsAdmin.php
示例7: get_array
/**
* Returns array value
*
* @param string $key
* @param array $default
* @return array
*/
function get_array($key, $default = array())
{
$value = W3_Request::get($key);
if (is_array($value)) {
return $value;
} elseif ($value != '') {
return preg_split("/[\r\n,;]+/", trim($value));
}
return $default;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:17,代码来源:Request.php
示例8: action_payment_code
function action_payment_code()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$request_type = W3_Request::get_string('request_type');
$request_id = date('YmdHi');
$return_url = admin_url('admin.php?page=w3tc_support&request_type=' . $request_type . '&payment=1&request_id=' . $request_id);
$cancel_url = admin_url('admin.php?page=w3tc_dashboard');
$form_values = array("cmd" => "_xclick", "business" => W3TC_PAYPAL_BUSINESS, "item_name" => esc_attr(sprintf('%s: %s (#%s)', ucfirst(w3_get_host()), $this->_json_request_types[$request_type], $request_id)), "amount" => sprintf('%.2f', $this->_request_prices[$request_type]), "currency_code" => "USD", "no_shipping" => "1", "rm" => "2", "return" => esc_attr($return_url), "cancel_return" => esc_attr($cancel_url));
echo json_encode($form_values);
die;
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:11,代码来源:Services.php
示例9: action_widget_link_support
function action_widget_link_support()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$value = W3_Request::get_string('w3tc_common_support_us');
$this->_config->set('common.support', $value);
$this->_config->save();
if ($value) {
_e('Thank you for linking to us!', 'w3-total-cache');
} else {
_e('You are no longer linking to us. Please support us in other ways instead.', 'w3-total-cache');
}
die;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:13,代码来源:SpreadTheWord.php
示例10: notifications
/**
* @param W3_Config $config
* @param W3_ConfigAdmin|null $config_admin
* @return array
*/
function notifications($config, $config_admin)
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page');
$notes = array();
if (!w3_is_cdn_mirror($config->get_string('cdn.engine'))) {
/**
* Show notification after theme change
*/
if ($config->get_boolean('notes.theme_changed')) {
$notes[] = sprintf(__('The active theme has changed, please %s now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup(__('upload active theme files', 'w3-total-cache'), 'cdn_export', 'cdn_export_type=theme'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'theme_changed'));
}
/**
* Show notification after WP upgrade
*/
if ($config->get_boolean('notes.wp_upgraded')) {
$notes[] = sprintf(__('Upgraded WordPress? Please %s files now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_upgraded'));
}
/**
* Show notification after CDN enable
*/
if ($config->get_boolean('notes.cdn_upload') || $config->get_boolean('notes.cdn_reupload')) {
$cdn_upload_buttons = array();
if ($config->get_boolean('cdn.includes.enable')) {
$cdn_upload_buttons[] = w3_button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
}
if ($config->get_boolean('cdn.theme.enable')) {
$cdn_upload_buttons[] = w3_button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
}
if ($config->get_boolean('minify.enabled') && $config->get_boolean('cdn.minify.enable') && !$config->get_boolean('minify.auto')) {
$cdn_upload_buttons[] = w3_button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
}
if ($config->get_boolean('cdn.custom.enable')) {
$cdn_upload_buttons[] = w3_button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
}
if ($config->get_boolean('notes.cdn_upload')) {
$notes[] = sprintf(__('Make sure to %s and upload the %s, files to the <acronym title="Content Delivery Network">CDN</acronym> to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note('Hide this message', 'cdn_upload'));
}
if ($config->get_boolean('notes.cdn_reupload')) {
$notes[] = sprintf(__('Settings that affect Browser Cache settings for files hosted by the CDN have been changed. To apply the new settings %s and %s. %s', 'w3-total-cache'), w3_button_popup(__('export the media library', 'w3-total-cache'), 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'cdn_reupload'));
}
}
}
if (in_array($config->get_string('cdn.engine'), array('netdna', 'maxcdn')) && $config_admin->get_boolean('notes.maxcdn_whitelist_ip') && $config_admin->get_integer('track.maxcdn_authorize') == 0 && $config->get_string('cdn.' . $config->get_string('cdn.engine') . '.authorization_key')) {
$notes[] = sprintf(__('Make sure to whitelist your servers IPs. Follow the instructions on %s. The IP for this server is %s. %s', 'w3-total-cache'), '<a href="http://support.maxcdn.com/tutorials/how-to-whitelist-your-server-ip-to-use-the-api/">MaxCDN</a>', $_SERVER['SERVER_ADDR'], w3_button_hide_note('Hide this message', 'maxcdn_whitelist_ip', '', true));
}
return $notes;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:53,代码来源:CdnNotes.php
示例11: w3_button_hide_note
/**
* Returns hide note button html
*
* @param string $text
* @param string $note
* @param string $redirect
* @param boolean $admin if to use config admin
* @param string $page
* @return string
*/
function w3_button_hide_note($text, $note, $redirect = '', $admin = false, $page = '')
{
if ($page == '') {
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page', 'w3tc_dashboard');
}
$url = sprintf('admin.php?page=%s&w3tc_default_hide_note¬e=%s', $page, $note);
if ($admin) {
$url .= '&admin=1';
}
if ($redirect != '') {
$url .= '&redirect=' . urlencode($redirect);
}
$url = wp_nonce_url($url, 'w3tc');
return w3_button_link($text, $url);
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:26,代码来源:admin_ui.php
示例12: recommendations
function recommendations()
{
$themes = w3_get_themes();
$current_theme = w3tc_get_current_theme_name();
$current_theme_key = array_search($current_theme, $themes);
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$theme_key = W3_Request::get_string('theme_key', $current_theme_key);
$theme_name = isset($themes[$theme_key]) ? $themes[$theme_key] : $current_theme;
$templates = w3_get_theme_templates($theme_name);
$recommendations = $this->get_theme_recommendations($theme_name);
list($js_groups, $css_groups) = $recommendations;
$minify_js_groups = $this->_config->get_array('minify.js.groups');
$minify_css_groups = $this->_config->get_array('minify.css.groups');
$checked_js = array();
$checked_css = array();
$locations_js = array();
if (isset($minify_js_groups[$theme_key])) {
foreach ((array) $minify_js_groups[$theme_key] as $template => $locations) {
foreach ((array) $locations as $location => $config) {
if (isset($config['files'])) {
foreach ((array) $config['files'] as $file) {
if (!isset($js_groups[$template]) || !in_array($file, $js_groups[$template])) {
$js_groups[$template][] = $file;
}
$checked_js[$template][$file] = true;
$locations_js[$template][$file] = $location;
}
}
}
}
}
if (isset($minify_css_groups[$theme_key])) {
foreach ((array) $minify_css_groups[$theme_key] as $template => $locations) {
foreach ((array) $locations as $location => $config) {
if (isset($config['files'])) {
foreach ((array) $config['files'] as $file) {
if (!isset($css_groups[$template]) || !in_array($file, $css_groups[$template])) {
$css_groups[$template][] = $file;
}
$checked_css[$template][$file] = true;
}
}
}
}
}
include W3TC_INC_DIR . '/lightbox/minify_recommendations.php';
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:47,代码来源:MinifyAdminView.php
示例13: action_cloudflare_api_request
/**
* Send CloudFlare API request
*
* @return void
*/
function action_cloudflare_api_request()
{
$result = false;
$response = null;
$actions = array('devmode', 'sec_lvl', 'fpurge_ts');
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$email = W3_Request::get_string('email');
$key = W3_Request::get_string('key');
$zone = W3_Request::get_string('zone');
$action = W3_Request::get_string('command');
$value = W3_Request::get_string('value');
$nonce = W3_Request::get_string('_wpnonce');
if (!wp_verify_nonce($nonce, 'w3tc')) {
$error = 'Access denied.';
} elseif (!$email) {
$error = 'Empty email.';
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = 'Invalid email.';
} elseif (!$key) {
$error = 'Empty key.';
} elseif (!$zone) {
$error = 'Empty zone.';
} elseif (strpos($zone, '.') === false) {
$error = 'Invalid domain.';
} elseif (!in_array($action, $actions)) {
$error = 'Invalid action.';
} else {
$config = array('email' => $email, 'key' => $key, 'zone' => $zone);
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
@($w3_cloudflare = new W3_CloudFlare($config));
@set_time_limit($this->_config->get_integer('timelimit.cloudflare_api_request'));
$response = $w3_cloudflare->api_request($action, $value);
if ($response) {
if ($response->result == 'success') {
$result = true;
$error = 'OK';
} else {
$error = $response->msg;
}
} else {
$error = 'Unable to make CloudFlare API request.';
}
}
$return = array('result' => $result, 'error' => $error, 'response' => $response);
echo json_encode($return);
exit;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:52,代码来源:CloudFlareAdmin.php
示例14: 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'));
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:20,代码来源:AwsActionsAdmin.php
示例15: change_filename_length
function change_filename_length()
{
try {
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$new = W3_Request::get_integer('maxlength');
$this->_config->set('minify.auto.filename_length', $new);
set_transient('w3tc_minify_tested_filename_length', true, 3600 * 24);
$this->_config->save();
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/Cache/File.php');
$cache = new Minify_Cache_File(w3_cache_blog_dir('minify'), array('.htaccess', 'index.php', '*.old'), $this->_config->get_boolean('minify.file.locking'), $this->_config->get_integer('timelimit.cache_flush'), w3_get_blog_id() == 0 ? W3TC_CACHE_MINIFY_DIR : null);
$cache->flush();
echo 1;
} catch (Exception $ex) {
echo $ex->getMessage();
}
exit;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:17,代码来源:MinifyAdmin.php
示例16: w3_admin_redirect
/**
* Redirects when in WP Admin
* @param array $params
* @param bool $check_referrer
* @param string $page
*/
function w3_admin_redirect($params = array(), $check_referrer = false, $page = '')
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$url = W3_Request::get_string('redirect');
$page_url = W3_Request::get_string('page');
if ($url == '') {
if ($check_referrer && !empty($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
} else {
$url = 'admin.php';
if (empty($page)) {
$page = $page_url;
}
$params = array_merge(array('page' => $page), $params);
}
}
w3_redirect($url, $params);
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:24,代码来源:admin.php
示例17: notifications
/**
* @param W3_Config $config
* @return array
*/
function notifications($config)
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page');
$notes = array();
/**
* Show notification after theme change
*/
if ($config->get_boolean('notes.theme_changed')) {
$notes[] = sprintf(__('The active theme has changed, please %s now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup(__('upload active theme files', 'w3-total-cache'), 'cdn_export', 'cdn_export_type=theme'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'theme_changed'));
}
/**
* Show notification after WP upgrade
*/
if ($config->get_boolean('notes.wp_upgraded')) {
$notes[] = sprintf(__('Upgraded WordPress? Please %s files now to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('upload wp-includes', 'cdn_export', 'cdn_export_type=includes'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_upgraded'));
}
/**
* Show notification after CDN enable
*/
if ($config->get_boolean('notes.cdn_upload') || $config->get_boolean('notes.cdn_reupload')) {
$cdn_upload_buttons = array();
if ($config->get_boolean('cdn.includes.enable')) {
$cdn_upload_buttons[] = w3_button_popup('wp-includes', 'cdn_export', 'cdn_export_type=includes');
}
if ($config->get_boolean('cdn.theme.enable')) {
$cdn_upload_buttons[] = w3_button_popup('theme files', 'cdn_export', 'cdn_export_type=theme');
}
if ($config->get_boolean('minify.enabled') && $config->get_boolean('cdn.minify.enable') && !$config->get_boolean('minify.auto')) {
$cdn_upload_buttons[] = w3_button_popup('minify files', 'cdn_export', 'cdn_export_type=minify');
}
if ($config->get_boolean('cdn.custom.enable')) {
$cdn_upload_buttons[] = w3_button_popup('custom files', 'cdn_export', 'cdn_export_type=custom');
}
if ($config->get_boolean('notes.cdn_upload')) {
$notes[] = sprintf(__('Make sure to %s and upload the %s, files to the <acronym title="Content Delivery Network">CDN</acronym> to ensure proper operation. %s', 'w3-total-cache'), w3_button_popup('export the media library', 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note('Hide this message', 'cdn_upload'));
}
if ($config->get_boolean('notes.cdn_reupload')) {
$notes[] = sprintf(__('Settings that affect Browser Cache settings for files hosted by the CDN have been changed. To apply the new settings %s and %s. %s', 'w3-total-cache'), w3_button_popup(__('export the media library', 'w3-total-cache'), 'cdn_export_library'), implode(', ', $cdn_upload_buttons), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'cdn_reupload'));
}
}
return $notes;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:47,代码来源:CdnNotes.php
示例18: get_newrelic_applications
/**
* Retrieves applications. Used in AJAX requests.
* Requires request param api_key with the API key and account_id with the Account id.
*/
function get_newrelic_applications()
{
w3_require_once(W3TC_LIB_W3_DIR . '/NewRelicService.php');
$api_key = W3_Request::get_string('api_key');
$account_id = W3_Request::get_string('account_id');
if ($api_key == '0') {
$config_master = new W3_Config(true);
$api_key = $config_master->get_string('newrelic.api_key');
}
$nerser = new W3_NewRelicService($api_key);
$newrelic_applications = array();
try {
if (empty($account_id) || $account_id == '') {
$account_id = $nerser->get_account_id();
}
$newrelic_applications = $nerser->get_applications($account_id);
} catch (Exception $ex) {
}
echo json_encode($newrelic_applications);
die;
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:25,代码来源:NewRelicAdmin.php
示例19: get_api_keys
/**
* Returns the API credentials for the CDN.
* Exists application and prints message on WP_Error.
*
* @return array
*/
public function get_api_keys()
{
$token = W3_Request::get_string('token');
$token_secret = W3_Request::get_string('token_secret');
$consumer = new OAuthConsumer($this->key, $this->secret, NULL);
$auth_token = new OAuthConsumer($token, $token_secret);
$access_token_req = new OAuthRequest('GET', $this->access_token_url);
$access_token_req = $access_token_req->from_consumer_and_token($consumer, $auth_token, 'GET', $this->access_token);
$access_token_req->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, $auth_token);
$after_access_request = wp_remote_get($access_token_req->to_url());
parse_str($after_access_request['body'], $access_tokens);
$access_token = new OAuthConsumer($access_tokens['oauth_token'], $access_tokens['oauth_token_secret']);
$api_request = $access_token_req->from_consumer_and_token($consumer, $access_token, 'GET', $this->create_api_user_url, array('user_id' => $access_tokens['user_id']));
$api_request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, $access_token);
$page = wp_remote_get($api_request->to_url());
if (is_wp_error($page)) {
$this->handle_error($page);
}
//Get API ID and API key
parse_str($page['body'], $credentials);
return $credentials;
}
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:28,代码来源:NetDNAOAuthClient.php
示例20: admin_notices
/**
* Admin notices action
*
* @return void
*/
function admin_notices()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
$cookie_domain = w3_get_cookie_domain();
$error_messages = array('fancy_permalinks_disabled_pgcache' => sprintf(__('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling enhanced disk mode.', 'w3-total-cache'), w3_button_link('enable', 'options-permalink.php')), 'fancy_permalinks_disabled_browsercache' => sprintf(__('Fancy permalinks are disabled. Please %s it first, then re-attempt to enabling the \'Do not process 404 errors for static objects with WordPress\'.', 'w3-total-cache'), w3_button_link('enable', 'options-permalink.php')), 'support_request_type' => __('Please select request type.', 'w3-total-cache'), 'support_request_url' => __('Please enter the address of the site in the site <acronym title="Uniform Resource Locator">URL</acronym> field.', 'w3-total-cache'), 'support_request_name' => __('Please enter your name in the Name field', 'w3-total-cache'), 'support_request_email' => __('Please enter valid email address in the E-Mail field.', 'w3-total-cache'), 'support_request_phone' => __('Please enter your phone in the phone field.', 'w3-total-cache'), 'support_request_subject' => __('Please enter subject in the subject field.', 'w3-total-cache'), 'support_request_description' => __('Please describe the issue in the issue description field.', 'w3-total-cache'), 'support_request_wp_login' => __('Please enter an administrator login. Create a temporary one just for this support case if needed.', 'w3-total-cache'), 'support_request_wp_password' => __('Please enter WP Admin password, be sure it\'s spelled correctly.', 'w3-total-cache'), 'support_request_ftp_host' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> host for the site.', 'w3-total-cache'), 'support_request_ftp_login' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> login for the server. Create a temporary one just for this support case if needed.', 'w3-total-cache'), 'support_request_ftp_password' => __('Please enter <acronym title="Secure Shell">SSH</acronym> or <acronym title="File Transfer Protocol">FTP</acronym> password for the <acronym title="File Transfer Protocol">FTP</acronym> account.', 'w3-total-cache'), 'support_request' => __('Unable to send the support request.', 'w3-total-cache'), 'config_import_no_file' => __('Please select config file.', 'w3-total-cache'), 'config_import_upload' => __('Unable to upload config file.', 'w3-total-cache'), 'config_import_import' => __('Configuration file could not be imported.', 'w3-total-cache'), 'config_reset' => sprintf(__('Default settings could not be restored. Please run <strong>chmod 777 %s</strong> to make the configuration file write-able, then try again.', 'w3-total-cache'), W3TC_CONFIG_DIR), 'cdn_purge_attachment' => __('Unable to purge attachment.', 'w3-total-cache'), 'pgcache_purge_post' => __('Unable to purge post.', 'w3-total-cache'), 'pgcache_purge_page' => __('Unable to purge page.', 'w3-total-cache'), 'enable_cookie_domain' => sprintf(__('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'COOKIE_DOMAIN\', \'%s\');</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong>.', 'w3-total-cache'), ABSPATH, addslashes($cookie_domain)), 'disable_cookie_domain' => sprintf(__('<strong>%swp-config.php</strong> could not be written, please edit config and add:<br /><strong style="color:#f00;">define(\'COOKIE_DOMAIN\', false);</strong> before <strong style="color:#f00;">require_once(ABSPATH . \'wp-settings.php\');</strong>.', 'w3-total-cache'), ABSPATH), 'cloudflare_api_request' => __('Unable to make CloudFlare API request.', 'w3-total-cache'));
$note_messages = array('config_save' => __('Plugin configuration successfully updated.', 'w3-total-cache'), 'flush_all' => __('All caches successfully emptied.', 'w3-total-cache'), 'flush_all_except_cf' => __('All caches except CloudFlare successfully emptied.', 'w3-total-cache'), 'flush_memcached' => __('Memcached cache(s) successfully emptied.', 'w3-total-cache'), 'flush_opcode' => __('Opcode cache(s) successfully emptied.', 'w3-total-cache'), 'flush_apc_system' => __('APC system cache successfully emptied', 'w3-total-cache'), 'flush_file' => __('Disk cache(s) successfully emptied.', 'w3-total-cache'), 'flush_pgcache' => __('Page cache successfully emptied.', 'w3-total-cache'), 'flush_dbcache' => __('Database cache successfully emptied.', 'w3-total-cache'), 'flush_objectcache' => __('Object cache successfully emptied.', 'w3-total-cache'), 'flush_fragmentcache' => __('Fragment cache successfully emptied.', 'w3-total-cache'), 'flush_minify' => __('Minify cache successfully emptied.', 'w3-total-cache'), 'flush_browser_cache' => __('Media Query string has been successfully updated.', 'w3-total-cache'), 'flush_varnish' => __('Varnish servers successfully purged.', 'w3-total-cache'), 'flush_cdn' => __('CDN was successfully purged.', 'w3-total-cache'), 'support_request' => __('The support request has been successfully sent.', 'w3-total-cache'), 'config_import' => __('Settings successfully imported.', 'w3-total-cache'), 'config_reset' => __('Settings successfully restored.', 'w3-total-cache'), 'preview_enable' => __('Preview mode was successfully enabled', 'w3-total-cache'), 'preview_disable' => __('Preview mode was successfully disabled', 'w3-total-cache'), 'preview_deploy' => __('Preview settings successfully deployed. Preview mode remains enabled until it\'s disabled. Continue testing new settings or disable preview mode if done.', 'w3-total-cache'), 'cdn_purge_attachment' => __('Attachment successfully purged.', 'w3-total-cache'), 'pgcache_purge_post' => __('Post successfully purged.', 'w3-total-cache'), 'pgcache_purge_page' => __('Page successfully purged.', 'w3-total-cache'), 'new_relic_save' => __('New relic settings have been updated.', 'w3-total-cache'), 'add_in_removed' => __('The add-in has been removed.', 'w3-total-cache'));
$errors = array();
$notes = array();
$environment_error_present = false;
// print errors happened during last request execution,
// when we decided to redirect with error message instead of
// printing it directly (to avoid reexecution on refresh)
$message_id = W3_Request::get_string('w3tc_message');
if ($message_id) {
$v = get_transient('w3tc_message.' . $message_id);
set_transient('w3tc_message.' . $message_id, null);
if (isset($v['errors']) && is_array($v['errors'])) {
foreach ($v['errors'] as $error) {
if (isset($error_messages[$error])) {
$errors[] = $error_messages[$error];
} else {
$errors[] = $error;
}
}
}
if (isset($v['notes']) && is_array($v['notes'])) {
foreach ($v['notes'] as $note) {
if (isset($note_messages[$note])) {
$notes[] = $note_messages[$note];
} else {
$notes[] = $note;
}
}
}
}
/*
* Filesystem environment fix, if needed
*/
try {
global $pagenow;
if ($pagenow == 'plugins.php' || substr(W3_Request::get_string('page'), 0, 5) == 'w3tc_') {
$environment = w3_instance('W3_AdminEnvironment');
$environment->fix_in_wpadmin($this->_config);
if (isset($_REQUEST['upgrade'])) {
$notes[] = __('Required files and directories have been automatically created', 'w3-total-cache');
}
}
} catch (SelfTestExceptions $exs) {
$r = w3_parse_selftest_exceptions($exs);
foreach ($r['before_errors'] as $e) {
$errors[] = $e;
}
if (strlen($r['required_changes']) > 0) {
$changes_style = 'border: 1px solid black; ' . 'background: white; ' . 'margin: 10px 30px 10px 30px; ' . 'padding: 10px; display: none';
$ftp_style = 'border: 1px solid black; background: white; ' . 'margin: 10px 30px 10px 30px; ' . 'padding: 10px; display: none';
$ftp_form = str_replace('class="wrap"', '', $exs->credentials_form());
$ftp_form = str_replace('<form ', '<form name="w3tc_ftp_form" ', $ftp_form);
$ftp_form = str_replace('<fieldset>', '', $ftp_form);
$ftp_form = str_replace('</fieldset>', '', $ftp_form);
$ftp_form = str_replace('id="upgrade" class="button"', 'id="upgrade" class="button w3tc-button-save"', $ftp_form);
$error = '<strong>W3 Total Cache Error:</strong> ' . 'Files and directories could not be automatically ' . 'created to complete the installation. ' . '<table>' . '<tr>' . '<td>Please execute commands manually</td>' . '<td>' . w3_button('View required changes', '', 'w3tc-show-required-changes') . '</td>' . '</tr>' . '<tr>' . '<td>or use FTP form to allow ' . '<strong>W3 Total Cache</strong> make it automatically.' . '</td>' . '<td>' . w3_button('Update via FTP', '', 'w3tc-show-ftp-form') . '</td>' . '</tr></table>' . '<div class="w3tc-required-changes" style="' . $changes_style . '">' . $r['required_changes'] . '</div>' . '<div class="w3tc-ftp-form" style="' . $ftp_style . '">' . $ftp_form . '</div>';
$environment_error_present = true;
$errors[] = $error;
}
foreach ($r['later_errors'] as $e) {
$errors[] = $e;
}
}
/**
* CloudFlare notifications
* @var $w3_cloudflare W3_CloudFlare
*/
$w3_cloudflare = w3_instance('W3_CloudFlare');
if ($error = $w3_cloudflare->check_lasterror()) {
$this->_errors[] = $error;
}
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$error = W3_Request::get_string('w3tc_error');
$note = W3_Request::get_string('w3tc_note');
/**
* Handle messages from reqeust
*/
if ($error == 'cloudflare_api_request' && $w3_cloudflare->get_fault_signaled()) {
// dont complain twice on cloudflare
} elseif (isset($error_messages[$error])) {
$errors[] = $error_messages[$error];
}
if (isset($note_messages[$note])) {
$notes[] = $note_messages[$note];
}
/**
* CDN notifications
*/
if ($this->_config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
//.........这里部分代码省略.........
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:101,代码来源:TotalCacheAdmin.php
注:本文中的W3_Request类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论