本文整理汇总了PHP中W3_Request::get_as_array方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Request::get_as_array方法的具体用法?PHP W3_Request::get_as_array怎么用?PHP W3_Request::get_as_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Request
的用法示例。
在下文中一共展示了W3_Request::get_as_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_settings
/**
* @param W3_Config $config
* @param $old
* @param $config_admin
* @return \W3_Config
*/
public function save_settings($config, $old, $config_admin)
{
w3_require_once(W3TC_CORE_EXTENSION_DIR . '/CloudFlare/CloudFlareAPI.php');
$this->cloudflareAPI = new CloudFlareAPI();
$this->cloudflareAPI->reset_settings_cache();
if ((bool) w3tc_get_extension_config('cloudflare', 'enabled') && $this->cloudflareAPI->minify_enabled() && $config->get_boolean('minify.enabled')) {
$config->set('minify.enabled', false);
}
/**
* Handle CloudFlare changes
*/
if (w3_get_blog_id() == 0 || w3_get_blog_id() != 0 && !w3_extension_is_sealed('cloudflare')) {
/**
* @var $this->cloudflareAPI W3_CloudFlare
*/
$cf_values = W3_Request::get_as_array('cloudflare_');
$this->cloudflareAPI->save_settings($cf_values);
}
return $config;
}
示例2: 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);
}
示例3: action_save_options
//.........这里部分代码省略.........
/**
* Auto expand wildcard domain to 10 subdomains
*/
$matches = null;
if (preg_match('~^\\*\\.(.*)$~', $cdn_cname, $matches)) {
$cdn_domains = array();
for ($i = 1; $i <= 10; $i++) {
$cdn_domains[] = sprintf('cdn%d.%s', $i, $matches[1]);
}
break;
}
if ($cdn_cname) {
$cdn_domains[] = $cdn_cname;
}
}
switch ($this->_config->get_string('cdn.engine')) {
case 'ftp':
$config->set('cdn.ftp.domain', $cdn_domains);
break;
case 's3':
$config->set('cdn.s3.cname', $cdn_domains);
break;
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;
}
}
$this->config_save($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()) {
$this->redirect(array_merge($params, array('w3tc_error' => 'enable_cookie_domain')));
}
} else {
if (!$this->disable_cookie_domain()) {
$this->redirect(array_merge($params, array('w3tc_error' => 'disable_cookie_domain')));
}
}
}
break;
case 'w3tc_general':
/**
* Handle CloudFlare changes
*/
if ($this->_config->get_boolean('cloudflare.enabled') && (w3_get_blog_id() == 0 || w3_get_blog_id() != 0 && !$this->is_sealed('cloudflare'))) {
/**
* @var $w3_cloudflare W3_CloudFlare
*/
$w3_cloudflare = w3_instance('W3_CloudFlare');
W3_CloudFlare::clear_last_error('');
$cf_values = W3_Request::get_as_array('cloudflare_');
if (!$w3_cloudflare->save_settings($cf_values)) {
$this->redirect(array_merge($params, array('w3tc_error' => 'cloudflare_api_request')));
}
}
break;
}
$this->_notes[] = 'config_save';
if ($redirect_permalink_error) {
$this->redirect(array('w3tc_error' => $redirect_permalink_error, 'w3tc_note' => 'config_save'));
}
$this->redirect_with_custom_messages($params);
}