本文整理汇总了PHP中W3_Config::get_string方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config::get_string方法的具体用法?PHP W3_Config::get_string怎么用?PHP W3_Config::get_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Config
的用法示例。
在下文中一共展示了W3_Config::get_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix_on_event
/**
* Fixes environment once event occurs
*
* @param W3_Config $config
* @param string $event
* @param W3_Config|null $old_config
* @throws SelfTestExceptions
**/
public function fix_on_event($config, $event, $old_config = null)
{
if ($config->get_boolean('cdn.enabled') && !w3_is_cdn_mirror($config->get_string('cdn.engine'))) {
if ($old_config != null && $config->get_integer('cdn.queue.interval') != $old_config->get_integer('cdn.queue.interval')) {
$this->unschedule_queue_process();
}
if (!wp_next_scheduled('w3_cdn_cron_queue_process')) {
wp_schedule_event(current_time('timestamp'), 'w3_cdn_cron_queue_process', 'w3_cdn_cron_queue_process');
}
} else {
$this->unschedule_queue_process();
}
if ($config->get_boolean('cdn.enabled') && $config->get_boolean('cdn.autoupload.enabled') && !w3_is_cdn_mirror($config->get_string('cdn.engine'))) {
if ($old_config != null && $config->get_integer('cdn.autoupload.interval') != $old_config->get_integer('cdn.autoupload.interval')) {
$this->unschedule_upload();
}
if (!wp_next_scheduled('w3_cdn_cron_upload')) {
wp_schedule_event(current_time('timestamp'), 'w3_cdn_cron_upload', 'w3_cdn_cron_upload');
}
} else {
$this->unschedule_upload();
}
$exs = new SelfTestExceptions();
if ($config->get_boolean('cdn.enabled')) {
try {
$this->table_create($event == 'activate');
} catch (Exception $ex) {
$exs->push($ex);
}
}
if (count($exs->exceptions()) > 0) {
throw $exs;
}
}
示例2: get_wordpress_appname
/**
* @param W3_Config $config
* @param W3_Config $config_master
* @param bool $do_merge if to merge with network main site
* @return string
*/
public static function get_wordpress_appname($config, $config_master, $do_merge = true)
{
if (w3_is_network()) {
if ($config_master->get_boolean('newrelic.use_network_wide_id')) {
$appname = $config_master->get_string('newrelic.appname');
} else {
$merge = $config->get_boolean('newrelic.merge_with_network');
$merge_name = '';
if ($do_merge && $merge && w3_get_blog_id() != 0) {
$merge_name = ';' . $config_master->get_string('newrelic.appname');
}
if (w3_get_blog_id() != 0 && !$config->get_boolean('common.force_master')) {
$appname = $config->get_string('newrelic.appname', '');
if (empty($appname)) {
$prefix = $config->get_string('newrelic.appname_prefix');
$appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
}
} else {
if (w3_get_blog_id() != 0) {
$prefix = $config->get_string('newrelic.appname_prefix');
$appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
} else {
$appname = $config->get_string('newrelic.appname');
}
}
$appname = $appname . $merge_name;
}
} else {
$appname = $config->get_string('newrelic.appname');
}
return $appname;
}
示例3:
/**
* @param W3_Config $config
* @param W3_Config $old_config
*/
function possible_state_change($config, $old_config)
{
if ($old_config->get_string('plugin.license_key') != '' && $config->get_string('plugin.license_key') == '') {
$result = edd_w3edge_w3tc_deactivate_license($old_config->get_string('plugin.license_key'));
if ($result) {
$this->site_inactivated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') == '' && $config->get_string('plugin.license_key') != '') {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') != $config->get_string('plugin.license_key')) {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
}
}
}
}
示例4: array
/**
* PHP5-style constructor
*
* @param array $config
*/
function __construct($config = array())
{
$this->_config = w3_instance('W3_Config');
if (empty($config)) {
$this->_cf_config = array('email' => $this->_config->get_string('cloudflare.email'), 'key' => $this->_config->get_string('cloudflare.key'), 'zone' => $this->_config->get_string('cloudflare.zone'));
} else {
$this->_cf_config = array_merge(array('email' => '', 'key' => '', 'zone' => ''), $config);
}
}
示例5: 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;
}
示例6: _criteria_matched
private function _criteria_matched($criteria)
{
if (is_array($criteria)) {
$enabled = true;
$compare = '&&';
foreach ($criteria as $val) {
if (is_array($val)) {
if ($val[1] == '!=') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_string($val[0]) != $val[2], $compare);
} elseif ($val[1] == '==') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_string($val[0]) == $val[2], $compare);
} else {
$enabled = $enabled || $this->_criteria_matched($val);
}
} elseif ($val != '||' && $val != '&&') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_boolean($val), $compare);
} else {
$compare = $val;
}
}
} else {
$enabled = is_null($criteria) || $this->_config->get_boolean($criteria);
}
return $enabled;
}
示例7: array
/**
* Returns minify cache object
*
* @return object
*/
function &_get_cache()
{
static $cache = array();
if (!isset($cache[0])) {
switch ($this->_config->get_string('minify.engine')) {
case 'memcached':
require_once W3TC_LIB_W3_DIR . '/Cache/Memcached.php';
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/Memcache.php';
$this->_memcached =& new W3_Cache_Memcached(array('servers' => $this->_config->get_array('minify.memcached.servers'), 'persistant' => $this->_config->get_boolean('minify.memcached.persistant')));
$cache[0] =& new Minify_Cache_Memcache($this->_memcached);
break;
case 'apc':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/APC.php';
$cache[0] =& new Minify_Cache_APC();
break;
case 'eaccelerator':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/Eaccelerator.php';
$cache[0] =& new Minify_Cache_Eaccelerator();
break;
case 'xcache':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/XCache.php';
$cache[0] =& new Minify_Cache_XCache();
break;
case 'file':
default:
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/File.php';
if (!is_dir(W3TC_CACHE_FILE_MINIFY_DIR)) {
$this->log(sprintf('Cache directory %s does not exist', W3TC_CACHE_FILE_MINIFY_DIR));
}
$cache[0] =& new Minify_Cache_File(W3TC_CACHE_FILE_MINIFY_DIR, $this->_config->get_boolean('minify.file.locking'));
break;
}
}
return $cache[0];
}
示例8: run
public function run()
{
$this->_config = w3_instance('W3_Config');
$this->_config_admin = w3_instance('W3_ConfigAdmin');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
$this->_page = w3tc_get_current_page();
if (is_network_admin() || !w3_is_multisite()) {
$this->edge_notification();
}
if (is_w3tc_admin_page()) {
add_action('admin_head', array($this, 'admin_head'));
add_action('w3tc_hide_button_custom-edge_mode', array($this, 'hide_edge_mode_notification'));
$support_reminder = $this->_config->get_boolean('notes.support_us') && $this->_config_admin->get_integer('common.install') < time() - W3TC_SUPPORT_US_TIMEOUT && $this->_config->get_string('common.support') == '' && !$this->_config->get_boolean('common.tweeted');
if ($support_reminder || w3tc_show_notification('support_us_popup')) {
add_action('w3tc-dashboard-head', array($this, 'support_us_nag'));
}
add_action('w3tc-dashboard-head', array($this, 'edge_nag'));
}
}
示例9: explode
/**
* Create NetDNA/MaxCDN pullzone
*/
function action_cdn_create_netdna_maxcdn_pull_zone()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
$type = W3_Request::get_string('type');
$name = W3_Request::get_string('name');
$label = W3_Request::get_string('label');
$cdn_engine = $type;
$authorization_key = $this->_config->get_string("cdn.{$cdn_engine}.authorization_key");
$alias = $consumerkey = $consumersecret = '';
if ($authorization_key) {
$keys = explode('+', $authorization_key);
if (sizeof($keys) == 3) {
list($alias, $consumerkey, $consumersecret) = $keys;
}
}
$api = new NetDNA($alias, $consumerkey, $consumersecret);
$url = w3_get_home_url();
$zone = array();
$zone['name'] = $name;
$zone['label'] = $label;
$zone['url'] = $url;
$zone['use_stale'] = 1;
$zone['queries'] = 1;
$zone['compress'] = 1;
$zone['backend_compress'] = 1;
try {
$response = $api->create_pull_zone($zone);
try {
$temporary_url = "{$name}.{$alias}.netdna-cdn.com";
$test_result = -1;
if (!$this->_config->get_array("cdn.{$cdn_engine}.domain")) {
$test_result = $this->test_cdn_url($temporary_url) ? 1 : 0;
$this->_config->set("cdn.{$cdn_engine}.domain", array($temporary_url));
if ($test_result) {
$this->_config->set("cdn.enabled", true);
}
}
$this->_config->save();
$config_admin = w3_instance('W3_ConfigAdmin');
$zones = $api->get_pull_zones();
$zone_count = sizeof($zones);
w3tc_make_track_call(array('type' => 'cdn', 'data' => array('cdn' => $type, 'action' => 'zonecreation', 'creation' => 'manual', 'creationtime' => time(), 'signupclick' => $config_admin->get_integer('track.maxcdn_signup'), 'authorizeclick' => $config_admin->get_integer('track.maxcdn_authorize'), 'validationclick' => $config_admin->get_integer('track.maxcdn_validation'), 'total_zones' => $zone_count, 'test' => $test_result)));
} catch (Exception $ex) {
}
echo json_encode(array('status' => 'success', 'message' => 'Pull Zone created.', 'temporary_url' => "{$name}.{$alias}.netdna-cdn.com", 'data' => $response));
} catch (Exception $ex) {
echo json_encode(array('status' => 'error', 'message' => $ex->getMessage()));
}
}
示例10: array
/**
* Purge the CloudFlare cache
* @return void
*/
function flush_cloudflare()
{
$response = null;
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$email = $this->_config->get_string('email');
$key = $this->_config->get_string('key');
$zone = $this->_config->get_string('zone');
if ($email && $key && $zone) {
$config = array('email' => $email, 'key' => $key, 'zone' => $zone);
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
@($w3_cloudflare = new W3_CloudFlare($config));
$w3_cloudflare->purge();
}
}
示例11: should_browsercache_generate_rules_for_cdn
/**
* If BrowserCache should generate rules specific for CDN. Used with CDN FTP
* @return boolean;
*/
public function should_browsercache_generate_rules_for_cdn()
{
if ($this->_config->get_boolean('cdn.enabled') && $this->_config->get_string('cdn.engine') == 'ftp') {
if (is_null($this->_cdncommon)) {
$this->_cdncommon = w3_instance('W3_Plugin_CdnCommon');
}
$cdn = $this->_cdncommon->get_cdn();
$domain = $cdn->get_domain();
if ($domain) {
return true;
}
}
return false;
}
示例12: array
/**
* Returns minifier options
*
* @param string $engine
* @return array
*/
function get_options($engine)
{
$options = array();
switch ($engine) {
case 'js':
$options = array('preserveComments' => !$this->_config->get_boolean('minify.js.strip.comments'), 'stripCrlf' => $this->_config->get_boolean('minify.js.strip.crlf'));
break;
case 'css':
$options = array('preserveComments' => !$this->_config->get_boolean('minify.css.strip.comments'), 'stripCrlf' => $this->_config->get_boolean('minify.css.strip.crlf'));
$symlinks = $this->_config->get_array('minify.symlinks');
foreach ($symlinks as $link => $target) {
$link = str_replace('//', realpath($_SERVER['DOCUMENT_ROOT']), $link);
$link = strtr($link, '/', DIRECTORY_SEPARATOR);
$options['symlinks'][$link] = realpath($target);
}
break;
case 'yuijs':
$options = array('line-break' => $this->_config->get_integer('minify.yuijs.options.line-break'), 'nomunge' => $this->_config->get_boolean('minify.yuijs.options.nomunge'), 'preserve-semi' => $this->_config->get_boolean('minify.yuijs.options.preserve-semi'), 'disable-optimizations' => $this->_config->get_boolean('minify.yuijs.options.disable-optimizations'));
break;
case 'yuicss':
$options = array('line-break' => $this->_config->get_integer('minify.yuicss.options.line-break'));
break;
case 'ccjs':
$options = array('compilation_level' => $this->_config->get_string('minify.ccjs.options.compilation_level'), 'formatting' => $this->_config->get_string('minify.ccjs.options.formatting'));
break;
case 'csstidy':
$options = array('remove_bslash' => $this->_config->get_boolean('minify.csstidy.options.remove_bslash'), 'compress_colors' => $this->_config->get_boolean('minify.csstidy.options.compress_colors'), 'compress_font-weight' => $this->_config->get_boolean('minify.csstidy.options.compress_font-weight'), 'lowercase_s' => $this->_config->get_boolean('minify.csstidy.options.lowercase_s'), 'optimise_shorthands' => $this->_config->get_integer('minify.csstidy.options.optimise_shorthands'), 'remove_last_;' => $this->_config->get_boolean('minify.csstidy.options.remove_last_;'), 'case_properties' => $this->_config->get_integer('minify.csstidy.options.case_properties'), 'sort_properties' => $this->_config->get_boolean('minify.csstidy.options.sort_properties'), 'sort_selectors' => $this->_config->get_boolean('minify.csstidy.options.sort_selectors'), 'merge_selectors' => $this->_config->get_integer('minify.csstidy.options.merge_selectors'), 'discard_invalid_properties' => $this->_config->get_boolean('minify.csstidy.options.discard_invalid_properties'), 'css_level' => $this->_config->get_string('minify.csstidy.options.css_level'), 'preserve_css' => $this->_config->get_boolean('minify.csstidy.options.preserve_css'), 'timestamp' => $this->_config->get_boolean('minify.csstidy.options.timestamp'), 'template' => $this->_config->get_string('minify.csstidy.options.template'));
break;
case 'html':
case 'htmlxml':
$options = array('xhtml' => true, 'stripCrlf' => $this->_config->get_boolean('minify.html.strip.crlf'), 'ignoredComments' => $this->_config->get_array('minify.html.comments.ignore'));
break;
case 'htmltidy':
case 'htmltidyxml':
$options = array('clean' => $this->_config->get_boolean('minify.htmltidy.options.clean'), 'hide-comments' => $this->_config->get_boolean('minify.htmltidy.options.hide-comments'), 'wrap' => $this->_config->get_integer('minify.htmltidy.options.wrap'));
break;
}
if ($this->_config->get_boolean('browsercache.enabled') && ($this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.html.replace') || $this->_config->get_boolean('browsercache.other.replace'))) {
$w3_plugin_browsercache = w3_instance('W3_Plugin_BrowserCache');
$options = array_merge($options, array('browserCacheId' => $w3_plugin_browsercache->get_replace_id(), 'browserCacheExtensions' => $w3_plugin_browsercache->get_replace_extensions()));
}
if ($this->_config->get_boolean('cdn.enabled') && $this->_config->get_boolean('cdn.minify.enable')) {
$w3_plugin_cdn = w3_instance('W3_Plugin_CdnCommon');
$cdn = $w3_plugin_cdn->get_cdn();
$options = array_merge($options, array('prependAbsolutePathCallback' => array(&$cdn, 'get_prepend_path')));
}
return $options;
}
示例13: sprintf
/**
* Returns debug info
*
* @return string
*/
function _get_debug_info()
{
$debug_info = "<!-- W3 Total Cache: Object Cache debug info:\r\n";
$debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('objectcache.engine')));
$debug_info .= sprintf("%s%d\r\n", str_pad('Total calls: ', 20), $this->cache_total);
$debug_info .= sprintf("%s%d\r\n", str_pad('Cache hits: ', 20), $this->cache_hits);
$debug_info .= sprintf("%s%d\r\n", str_pad('Cache misses: ', 20), $this->cache_misses);
$debug_info .= sprintf("%s%.4f\r\n", str_pad('Total time: ', 20), $this->time_total);
$debug_info .= "W3TC Object Cache info:\r\n";
$debug_info .= sprintf("%s | %s | %s | %s | %s | %s | %s\r\n", str_pad('#', 5, ' ', STR_PAD_LEFT), str_pad('Caching (Reject reason)', 30, ' ', STR_PAD_BOTH), str_pad('Status', 15, ' ', STR_PAD_BOTH), str_pad('Source', 15, ' ', STR_PAD_BOTH), str_pad('Data size (b)', 13, ' ', STR_PAD_LEFT), str_pad('Query time (s)', 14, ' ', STR_PAD_LEFT), 'ID:Group');
foreach ($this->debug_info as $index => $debug) {
$debug_info .= sprintf("%s | %s | %s | %s | %s | %s | %s\r\n", str_pad($index + 1, 5, ' ', STR_PAD_LEFT), str_pad($debug['caching'] ? 'enabled' : sprintf('disabled (%s)', $debug['reason']), 30, ' ', STR_PAD_BOTH), str_pad($debug['cached'] ? 'cached' : 'not cached', 15, ' ', STR_PAD_BOTH), str_pad($debug['internal'] ? 'internal' : 'persistent', 15, ' ', STR_PAD_BOTH), str_pad($debug['data_size'], 13, ' ', STR_PAD_LEFT), str_pad(round($debug['time'], 4), 14, ' ', STR_PAD_LEFT), sprintf('%s:%s', $debug['id'], $debug['group']));
}
$debug_info .= '-->';
return $debug_info;
}
示例14: foreach
/**
* Generates file ID
*
* @param array $sources
* @param string $type
* @return string
*/
function _generate_id($sources, $type)
{
$values = $sources;
foreach ($sources as $source) {
if (file_exists($source)) {
$data = @file_get_contents($source);
if ($data !== false) {
$values[] = md5($data);
} else {
return false;
}
}
}
$keys = array('minify.debug', 'minify.engine', 'minify.options', 'minify.symlinks');
if ($type == 'js') {
$engine = $this->_config->get_string('minify.js.engine');
switch ($engine) {
case 'js':
$keys = array_merge($keys, array('minify.js.combine.header', 'minify.js.combine.body', 'minify.js.combine.footer', 'minify.js.strip.comments', 'minify.js.strip.crlf'));
break;
case 'yuijs':
$keys = array_merge($keys, array('minify.yuijs.options.line-break', 'minify.yuijs.options.nomunge', 'minify.yuijs.options.preserve-semi', 'minify.yuijs.options.disable-optimizations'));
break;
case 'ccjs':
$keys = array_merge($keys, array('minify.ccjs.options.compilation_level', 'minify.ccjs.options.formatting'));
break;
}
} elseif ($type == 'css') {
$engine = $this->_config->get_string('minify.css.engine');
switch ($engine) {
case 'css':
$keys = array_merge($keys, array('minify.css.combine', 'minify.css.strip.comments', 'minify.css.strip.crlf', 'minify.css.imports'));
break;
case 'yuicss':
$keys = array_merge($keys, array('minify.yuicss.options.line-break'));
break;
case 'csstidy':
$keys = array_merge($keys, array('minify.csstidy.options.remove_bslash', 'minify.csstidy.options.compress_colors', 'minify.csstidy.options.compress_font-weight', 'minify.csstidy.options.lowercase_s', 'minify.csstidy.options.optimise_shorthands', 'minify.csstidy.options.remove_last_;', 'minify.csstidy.options.case_properties', 'minify.csstidy.options.sort_properties', 'minify.csstidy.options.sort_selectors', 'minify.csstidy.options.merge_selectors', 'minify.csstidy.options.discard_invalid_properties', 'minify.csstidy.options.css_level', 'minify.csstidy.options.preserve_css', 'minify.csstidy.options.timestamp', 'minify.csstidy.options.template'));
break;
}
}
foreach ($keys as $key) {
$values[] = $this->_config->get($key);
}
$id = substr(md5(implode('', $values)), 0, 6);
return $id;
}
示例15: sprintf
/**
* Returns debug info
*
* @return string
*/
function _get_debug_info()
{
$debug_info = "<!-- W3 Total Cache: Db cache debug info:\r\n";
$debug_info .= sprintf("%s%s\r\n", str_pad('Engine: ', 20), w3_get_engine_name($this->_config->get_string('dbcache.engine')));
$debug_info .= sprintf("%s%d\r\n", str_pad('Total queries: ', 20), $this->query_total);
$debug_info .= sprintf("%s%d\r\n", str_pad('Cached queries: ', 20), $this->query_hits);
$debug_info .= sprintf("%s%.4f\r\n", str_pad('Total query time: ', 20), $this->time_total);
if (count($this->query_stats)) {
$debug_info .= "SQL info:\r\n";
$debug_info .= sprintf("%s | %s | %s | % s | %s | %s\r\n", str_pad('#', 5, ' ', STR_PAD_LEFT), str_pad('Time (s)', 8, ' ', STR_PAD_LEFT), str_pad('Caching (Reject reason)', 30, ' ', STR_PAD_BOTH), str_pad('Status', 10, ' ', STR_PAD_BOTH), str_pad('Data size (b)', 13, ' ', STR_PAD_LEFT), 'Query');
foreach ($this->query_stats as $index => $query) {
$debug_info .= sprintf("%s | %s | %s | %s | %s | %s\r\n", str_pad($index + 1, 5, ' ', STR_PAD_LEFT), str_pad(round($query['time_total'], 4), 8, ' ', STR_PAD_LEFT), str_pad($query['caching'] ? 'enabled' : sprintf('disabled (%s)', $query['reason']), 30, ' ', STR_PAD_BOTH), str_pad($query['cached'] ? 'cached' : 'not cached', 10, ' ', STR_PAD_BOTH), str_pad($query['data_size'], 13, ' ', STR_PAD_LEFT), w3_escape_comment(trim($query['query'])));
}
}
$debug_info .= '-->';
return $debug_info;
}