本文整理汇总了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;
}