本文整理汇总了PHP中w3_require_once函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_require_once函数的具体用法?PHP w3_require_once怎么用?PHP w3_require_once使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_require_once函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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';
}
示例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');
}
示例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'));
}
}
示例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;
}
示例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;
}
示例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';
}
示例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';
}
示例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);
}
示例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';
}
示例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'));
}
示例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';
}
示例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();
}
}
示例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;
}
}
示例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;
}
示例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
}