本文整理匯總了PHP中Varien_Profiler::_checkedEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Profiler::_checkedEnabled方法的具體用法?PHP Varien_Profiler::_checkedEnabled怎麽用?PHP Varien_Profiler::_checkedEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Profiler
的用法示例。
在下文中一共展示了Varien_Profiler::_checkedEnabled方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isEnabled
/**
* Check if profiler is enabled.
*
* @static
* @return bool
*/
public static function isEnabled()
{
if (!self::$_checkedEnabled) {
self::$_checkedEnabled = true;
if (isset($_GET['profile']) && $_GET['profile'] == true || isset($_COOKIE['profile']) && $_COOKIE['profile'] == true) {
self::enable();
}
}
return self::$_enabled;
}
示例2: isEnabled
/**
* Check if profiler is enabled.
*
* @static
* @return bool
*/
public static function isEnabled()
{
if (!self::$_checkedEnabled) {
self::$_checkedEnabled = true;
$conf = self::getConfiguration();
$enabled = false;
if (strtolower($conf->trigger) == 'always') {
$enabled = true;
} elseif (strtolower($conf->trigger) == 'parameter') {
if (isset($_GET['profile']) && $_GET['profile'] == true || isset($_COOKIE['profile']) && $_COOKIE['profile'] == true) {
$enabled = true;
}
}
// Process filters
if ($enabled && $conf->enableFilters) {
// sampling filter
if ($enabled && rand(0, 100000) > $conf->filters->sampling * 1000) {
$enabled = false;
}
// request uri whitelist/blacklist
$requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
// TODO: use script name instead for cli?
if ($enabled && $conf->filters->requestUriWhiteList && !preg_match($conf->filters->requestUriWhiteList, $requestUri)) {
$enabled = false;
}
if ($enabled && $conf->filters->requestUriBlackList && preg_match($conf->filters->requestUriBlackList, $requestUri)) {
$enabled = false;
}
// note: timeThreshold and memoryThreshold will be checked before persisting records. In these cases data will still be recorded during the request
}
if ($enabled) {
self::enable();
}
}
return self::$_enabled;
}