本文整理汇总了PHP中w3_require_once函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_require_once函数的具体用法?PHP w3_require_once怎么用?PHP w3_require_once使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_require_once函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Extensions view
*
* @return void
*/
function view()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/compat.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/extensions.php');
$extension = '';
$extension_status = 'all';
if (isset($_GET['extension_status'])) {
if (in_array($_GET['extension_status'], array('all', 'active', 'inactive', 'core'))) {
$extension_status = $_GET['extension_status'];
}
}
if (isset($_GET['extension'])) {
$extension = $_GET['extension'];
}
$extensions_active = w3_get_active_extensions($this->_config);
if ($extension) {
$all_settings = $this->_config->get_array('extensions.settings');
$extensions_active = w3_get_active_extensions($this->_config);
$meta = $extensions_active[$extension];
$sub_view = 'settings';
} else {
$extensions_all = w3_get_extensions($this->_config);
$extensions_inactive = w3_get_inactive_extensions($this->_config);
$var = "extensions_{$extension_status}";
$extensions = ${$var};
$sub_view = 'list';
$page = 1;
}
include W3TC_INC_OPTIONS_DIR . '/extensions.php';
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:36,代码来源:ExtensionsAdminView.php
示例2: activate
/**
* Activate plugin action
*
* @return void
*/
function activate($network_wide)
{
w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
if (w3_is_network()) {
if ($network_wide) {
// we are in network activation
} else {
if ($_GET['action'] == 'error_scrape' && strpos($_SERVER['REQUEST_URI'], '/network/') !== false) {
// workaround for error_scrape page called after error
// really we are in network activation and going to throw some error
} else {
echo 'Please <a href="' . network_admin_url('plugins.php') . '">network activate</a> W3 Total Cache when using WordPress Multisite.';
die;
}
}
}
/**
* Create cache folder and extension files
*/
try {
w3_activation_create_required_files();
if (!$this->_config->own_config_exists()) {
$this->_config->save();
}
// save admin config
$admin_config = w3_instance('W3_ConfigAdmin');
if (!$admin_config->own_config_exists()) {
$admin_config->save();
}
} catch (Exception $e) {
w3_activation_error_on_exception($e);
}
delete_option('w3tc_request_data');
add_option('w3tc_request_data', '', null, 'no');
}
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:40,代码来源:TotalCacheActivation.php
示例3: run
function run()
{
add_action('w3tc_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
add_action('w3tc_network_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
// Configure authorize and have_zone
$this->_setup($this->_config);
/**
* Retry setup with main blog
*/
if (w3_is_network() && is_network_admin() && !$this->authorized) {
$this->_config = new W3_Config(false, 1);
$this->_setup($this->_config);
}
if (w3_is_network()) {
$conig_admin = w3_instance('W3_ConfigAdmin');
$this->_sealed = $conig_admin->get_boolean('cdn.configuration_sealed');
}
if ($this->have_zone && $this->authorized && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_dashboard') !== false) {
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php');
$authorization_key = $this->_config->get_string('cdn.netdna.authorization_key');
$alias = $consumerkey = $consumersecret = '';
$keys = explode('+', $authorization_key);
if (sizeof($keys) == 3) {
list($alias, $consumerkey, $consumersecret) = $keys;
}
$this->api = new NetDNA($alias, $consumerkey, $consumersecret);
add_action('admin_head', array(&$this, 'admin_head'));
}
}
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:30,代码来源:NetDNA.php
示例4: minify
/**
* Add line numbers in C-style comments
*
* This uses a very basic parser easily fooled by comment tokens inside
* strings or regexes, but, otherwise, generally clean code will not be
* mangled. URI rewriting can also be performed.
*
* @param string $content
*
* @param array $options available options:
*
* 'id': (optional) string to identify file. E.g. file name/path
*
* 'currentDir': (default null) if given, this is assumed to be the
* directory of the current CSS file. Using this, minify will rewrite
* all relative URIs in import/url declarations to correctly point to
* the desired files, and prepend a comment with debugging information about
* this process.
*
* @return string
*/
public static function minify($content, $options = array())
{
$id = isset($options['id']) && $options['id'] ? $options['id'] : '';
$content = str_replace("\r\n", "\n", $content);
$lines = explode("\n", $content);
$numLines = count($lines);
// determine left padding
$padTo = strlen($numLines);
$inComment = false;
$i = 0;
$newLines = array();
while (null !== ($line = array_shift($lines))) {
if ('' !== $id && 0 == $i % 50) {
array_push($newLines, '', "/* {$id} */", '');
}
++$i;
$newLines[] = self::_addNote($line, $i, $inComment, $padTo);
$inComment = self::_eolInComment($line, $inComment);
}
$content = implode("\n", $newLines) . "\n";
// check for desired URI rewriting
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php');
$content = Minify_CSS_UriRewriter::rewrite($content, $options);
return $content;
}
开发者ID:beetleskin,项目名称:kathen,代码行数:46,代码来源:Lines.php
示例5: minifyCss
public static function minifyCss($css, $options = array())
{
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php');
$css = self::_minify('css', $css, $options);
$css = Minify_CSS_UriRewriter::rewrite($css, $options);
return $css;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:7,代码来源:YUICompressor.php
示例6: 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
示例7: view
/**
* Dashboard tab
*/
function view()
{
w3_require_once(W3TC_INC_DIR . '/functions/widgets.php');
/**
* @var $module_status W3_ModuleStatus
*/
$module_status = w3_instance('W3_ModuleStatus');
w3tc_dashboard_setup();
global $current_user;
$config_master = $this->_config_master;
$browsercache_enabled = $module_status->is_enabled('browsercache');
$cloudflare_enabled = $module_status->is_enabled('cloudflare');
$enabled = $module_status->plugin_is_enabled();
$can_empty_memcache = $module_status->can_empty_memcache();
$can_empty_opcode = $module_status->can_empty_opcode();
$can_empty_apc_system = $module_status->can_empty_apc_system();
$can_empty_file = $module_status->can_empty_file();
$can_empty_varnish = $module_status->can_empty_varnish();
$cdn_enabled = $module_status->is_enabled('cdn');
$cdn_mirror_purge = w3_cdn_can_purge_all($module_status->get_module_engine('cdn'));
if ($cloudflare_enabled && $this->_config->get_string('cloudflare.email') && $this->_config->get_string('cloudflare.key')) {
$can_empty_cloudflare = true;
} else {
$can_empty_cloudflare = false;
}
// Required for Update Media Query String button
$browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace');
include W3TC_INC_DIR . '/options/dashboard.php';
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:32,代码来源:DashboardAdminView.php
示例8: 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
示例9: view
/**
* General tab
*
* @return void
*/
function view()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
global $current_user;
$config_master = $this->_config_master;
/**
* @var $modules W3_ModuleStatus
*/
$modules = w3_instance('W3_ModuleStatus');
$pgcache_enabled = $modules->is_enabled('pgcache');
$dbcache_enabled = $modules->is_enabled('dbcache');
$objectcache_enabled = $modules->is_enabled('objectcache');
$browsercache_enabled = $modules->is_enabled('browsercache');
$minify_enabled = $modules->is_enabled('minify');
$cdn_enabled = $modules->is_enabled('cdn');
$varnish_enabled = $modules->is_enabled('varnish');
$fragmentcache_enabled = $modules->is_enabled('fragmentcache');
$enabled = $modules->plugin_is_enabled();
$enabled_checkbox = $modules->all_modules_enabled();
$check_rules = w3_can_check_rules();
$check_apc = function_exists('apc_store');
$check_eaccelerator = function_exists('eaccelerator_put');
$check_xcache = function_exists('xcache_set');
$check_wincache = function_exists('wincache_ucache_set');
$check_curl = function_exists('curl_init');
$check_memcached = class_exists('Memcache');
$check_ftp = function_exists('ftp_connect');
$check_tidy = class_exists('tidy');
$disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $config_master->get_string('pgcache.engine') != 'file_generic');
$can_empty_file = $modules->can_empty_file();
$can_empty_varnish = $modules->can_empty_varnish();
$cdn_mirror_purge = w3_cdn_can_purge_all($modules->get_module_engine('cdn'));
$file_nfs = $this->_config->get_boolean('pgcache.file.nfs') || $this->_config->get_boolean('minify.file.nfs');
$file_locking = $this->_config->get_boolean('dbcache.file.locking') || $this->_config->get_boolean('objectcache.file.locking') || $this->_config->get_boolean('pgcache.file.locking') || $this->_config->get_boolean('minify.file.locking');
w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php');
$newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false);
$newrelic_applications = array();
$nerser = w3_instance('W3_NewRelicService');
$new_relic_installed = $nerser->module_is_enabled();
$new_relic_running = true;
if ($this->_config->get_boolean('newrelic.enabled')) {
$new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id');
$newrelic_prefix = '';
if ($new_relic_configured) {
if (w3_is_network()) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
try {
$newrelic_applications = $nerser->get_applications();
} catch (Exception $ex) {
}
$newrelic_application = $this->_config->get_string('newrelic.application_id');
}
}
$licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
$custom_areas = apply_filters("{$this->_page}_anchors", array());
include W3TC_INC_DIR . '/options/general.php';
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:63,代码来源:GeneralAdminView.php
示例10: 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
示例11: 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
示例12: w3_run_legacy_update
/**
* Updates the plugin from older version.
*/
function w3_run_legacy_update()
{
w3_require_once(W3TC_LIB_W3_DIR . '/ConfigWriter.php');
$writer = new W3_ConfigWriter(w3_get_blog_id(), w3_is_preview_mode());
$writer->import_legacy_config_and_save();
// Only remove folders when master blog is running.
if (w3_get_blog_id() == 0) {
w3_remove_old_folders();
}
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:13,代码来源:update.php
示例13: cleanup
function cleanup()
{
$engine = $this->_config->get_string('fragmentcache.engine');
switch ($engine) {
case 'file':
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Cleaner.php');
$w3_cache_file_cleaner = new W3_Cache_File_Cleaner(array('cache_dir' => w3_cache_blog_dir('fragment'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
$w3_cache_file_cleaner->clean();
break;
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:11,代码来源:FragmentCacheAdmin.php
示例14: 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
示例15: loadMinifier
/**
* @see Minify_Controller_Base::loadMinifier()
*/
public function loadMinifier($minifierCallback)
{
if ($this->_loadCssJsMinifiers) {
// Minify will not call for these so we must manually load
// them when Minify/HTML.php is called for.
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CSS.php');
w3_require_once(W3TC_LIB_MINIFY_DIR . '/JSMin.php');
}
parent::loadMinifier($minifierCallback);
// load Minify/HTML.php
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:14,代码来源:Page.php
示例16: _request
/**
* Make API request
*
* @param string $url
* @return string
*/
function _request($url)
{
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
w3_require_once(W3TC_INC_DIR . '/functions/url.php');
$request_url = w3_url_format(W3TC_PAGESPEED_API_URL, array('url' => $url, 'key' => $this->key));
$response = w3_http_get($request_url);
if (!is_wp_error($response) && $response['response']['code'] == 200) {
return $response['body'];
}
return false;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:17,代码来源:PageSpeed.php
示例17: 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
示例18: minify
/**
* Minify a CSS string
*
* @param string $css
*
* @param array $options available options:
*
* 'preserveComments': (default true) multi-line comments that begin
* with "/*!" will be preserved with newlines before and after to
* enhance readability.
*
* 'prependRelativePath': (default null) if given, this string will be
* prepended to all relative URIs in import/url declarations
*
* 'currentDir': (default null) if given, this is assumed to be the
* directory of the current CSS file. Using this, minify will rewrite
* all relative URIs in import/url declarations to correctly point to
* the desired files. For this to work, the files *must* exist and be
* visible by the PHP process.
*
* 'symlinks': (default = array()) If the CSS file is stored in
* a symlink-ed directory, provide an array of link paths to
* target paths, where the link paths are within the document root. Because
* paths need to be normalized for this to work, use "//" to substitute
* the doc root in the link paths (the array keys). E.g.:
* <code>
* array('//symlink' => '/real/target/path') // unix
* array('//static' => 'D:\\staticStorage') // Windows
* </code>
*
* @return string
*/
public static function minify($css, $options = array())
{
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CSS/Compressor.php');
if (isset($options['preserveComments']) && $options['preserveComments']) {
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CommentPreserver.php');
$css = Minify_CommentPreserver::process($css, array('Minify_CSS_Compressor', 'process'), array($options));
} else {
$css = Minify_CSS_Compressor::process($css, $options);
}
w3_require_once(W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php');
$css = Minify_CSS_UriRewriter::rewrite($css, $options);
return $css;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:45,代码来源:CSS.php
示例19: instance
/**
* Returns cache engine instance
*
* @param string $engine
* @param array $config
* @return W3_Cache_Base
*/
static function instance($engine, $config = array())
{
static $instances = array();
// common configuration data
if (!isset($config['blog_id'])) {
$config['blog_id'] = w3_get_blog_id();
}
$instance_key = sprintf('%s_%s', $engine, md5(serialize($config)));
if (!isset($instances[$instance_key])) {
switch ($engine) {
case W3TC_CACHE_MEMCACHED:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Memcached.php');
$instances[$instance_key] = new W3_Cache_Memcached($config);
break;
case W3TC_CACHE_APC:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Apc.php');
$instances[$instance_key] = new W3_Cache_Apc($config);
break;
case W3TC_CACHE_EACCELERATOR:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Eaccelerator.php');
$instances[$instance_key] = new W3_Cache_Eaccelerator($config);
break;
case W3TC_CACHE_XCACHE:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Xcache.php');
$instances[$instance_key] = new W3_Cache_Xcache($config);
break;
case W3TC_CACHE_WINCACHE:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Wincache.php');
$instances[$instance_key] = new W3_Cache_Wincache($config);
break;
case W3TC_CACHE_FILE:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File.php');
$instances[$instance_key] = new W3_Cache_File($config);
break;
case W3TC_CACHE_FILE_GENERIC:
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File/Generic.php');
$instances[$instance_key] = new W3_Cache_File_Generic($config);
break;
default:
trigger_error('Incorrect cache engine', E_USER_WARNING);
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Base.php');
$instances[$instance_key] = new W3_Cache_Base($config);
break;
}
if (!$instances[$instance_key]->available()) {
w3_require_once(W3TC_LIB_W3_DIR . '/Cache/Base.php');
$instances[$instance_key] = new W3_Cache_Base($config);
}
}
return $instances[$instance_key];
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:58,代码来源:Cache.php
示例20: purge
/**
* Purges remote files
*
* @param array $files
* @param array $results
* @return boolean
*/
function purge($files, &$results)
{
if (empty($this->_config['username'])) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, __('Empty username.', 'w3-total-cache'));
return false;
}
if (empty($this->_config['password'])) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, __('Empty password.', 'w3-total-cache'));
return false;
}
w3_require_once(W3TC_LIB_NUSOAP_DIR . '/nusoap.php');
$client = new nusoap_client(W3TC_CDN_MIRROR_AKAMAI_WSDL, 'wsdl');
$error = $client->getError();
if ($error) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, sprintf(__('Constructor error (%s).', 'w3-total-cache'), $error));
return false;
}
$zone = $this->_config['zone'];
$expressions = array();
foreach ($files as $file) {
$remote_path = $file['remote_path'];
$expressions[] = $this->_format_url($remote_path);
}
$action = $this->_config['action'];
$email = $this->_config['email_notification'];
$email = implode(',', $email);
$options = array('action=' . $action, 'domain=' . $zone, 'type=arl');
if ($email) {
$options[] = 'email-notification=' . $email;
}
$params = array($this->_config['username'], $this->_config['password'], '', $options, $expressions);
$result = $client->call('purgeRequest', $params, W3TC_CDN_MIRROR_AKAMAI_NAMESPACE);
if ($client->fault) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, __('Invalid response.', 'w3-total-cache'));
return false;
}
$result_code = $result['resultCode'];
$result_message = $result['resultMsg'];
$error = $client->getError();
if ($error) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, sprintf(__('Unable to purge (%s).', 'w3-total-cache'), $error));
return false;
}
if ($result_code >= 300) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, sprintf(__('Unable to purge (%s).', 'w3-total-cache'), $result_message));
return false;
}
$results = $this->_get_results($files, W3TC_CDN_RESULT_OK, __('OK', 'w3-total-cache'));
return true;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:57,代码来源:Akamai.php
注:本文中的w3_require_once函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论