本文整理汇总了PHP中W3_Request::get_string方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Request::get_string方法的具体用法?PHP W3_Request::get_string怎么用?PHP W3_Request::get_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Request
的用法示例。
在下文中一共展示了W3_Request::get_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
示例2: 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';
}
示例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);
}
示例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'));
}
示例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';
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: run
function run()
{
if (!$this->_config->get_boolean('minify.auto.disable_filename_length_test', false)) {
if (!is_network_admin() && $this->_config->get_boolean('minify.auto') && false === get_transient('w3tc_minify_tested_filename_length')) {
add_action('wp_ajax_w3tc_minify_disable_filename_test', array($this, 'disable_filename_test'));
add_action('wp_ajax_w3tc_minify_change_filename_length', array($this, 'change_filename_length'));
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$page = W3_Request::get_string('page');
if (strpos($page, 'w3tc_') === 0) {
add_action('admin_print_scripts', array($this, 'print_script'), 10000);
add_action('admin_print_scripts', array($this, 'print_test_once_script'), 10000);
add_action('admin_notices', array(&$this, 'admin_notices_minify_auto_test'));
}
}
}
}
示例10: 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);
}
示例11: 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;
}
示例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';
}
示例13: 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'));
}
示例14: 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);
}
示例15: 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;
}