本文整理汇总了PHP中CLog::warning方法的典型用法代码示例。如果您正苦于以下问题:PHP CLog::warning方法的具体用法?PHP CLog::warning怎么用?PHP CLog::warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLog
的用法示例。
在下文中一共展示了CLog::warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_url_limit
/**
*
*
* @file modifier.url_limit.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:40
*/
function smarty_modifier_url_limit($string, $length, $escaped = false)
{
$logArr['smarty_modifier'] = "modifier_url_limit";
$status = 0;
$logArr['url'] = $string;
$logArr['limit_len'] = $length;
$logArr['escaped'] = $escaped;
if (strlen($string) == 0) {
$result = $string;
return $result;
}
$result = trim(hilight_url_limit($string, $length, $escaped));
$resultTmp = explode(" ", $result);
$result = implode("", $resultTmp);
if (false === $result) {
$result = $string;
$status = -1;
$logArr['result'] = $result;
CLog::warning("fail to call hilight_url_limit", $status, $logArr, 1);
return $string;
}
$logArr['result'] = $result;
CLog::debug("success to call url_limit", $status, $logArr, 1);
return $result;
}
示例2: smarty_modifier_url_bold_html
/**
*
*
* @file modifier.url_bold_html.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:40
*/
function smarty_modifier_url_bold_html($string)
{
$logArr['smarty_modifier'] = "modifier_url_bold_html";
$status = 0;
$logArr['string'] = $string;
if (strlen($string) == 0) {
$result = $string;
return $result;
}
$prefix = $GLOBALS['DISPLAY']['BOLD_PREFIX'];
$suffix = $GLOBALS['DISPLAY']['BOLD_SUFFIX'];
$logArr['prefix'] = $prefix;
$logArr['suffix'] = $suffix;
$result = hilight_url_bold_html($string, $prefix, $suffix);
if (false === $result) {
$result = $string;
$status = -1;
$logArr['result'] = $result;
CLog::warning("fail to call hilight_url_bold_html", $status, $logArr, 1);
return $result;
}
$logArr['result'] = $result;
CLog::debug("success to call url_bold_html modifier", $status, $logArr, 1);
return $result;
}
示例3: smarty_modifier_strlen_character
/**
*
*
* @file modifier.strlen_character.php
* @package plugins
* @purpose: Calculate the number of characters of a string
* @author chenchen20@baidu.com
* @date 2014-03-07 14:02
*/
function smarty_modifier_strlen_character($string)
{
$logArr['smarty_modifier'] = "modifier_strlen_character";
$status = 0;
$intI = 0;
$intCount = 0;
$logArr['string'] = $string;
$intLength = strlen($string);
if ($intLength == 0) {
$status = -1;
CLog::warning("string is empty", $status, $logArr, 1);
return 0;
}
while ($intI < $intLength) {
$chrAscii = ord($string[$intI]);
//按字节转成ascii码
$intCount++;
$intI++;
if ($intI >= $intLength) {
break;
}
if ($chrAscii & 0x80) {
//汉字的两个字符ascii码都大于0x80,此处判断是否为汉字
$chrAscii <<= 1;
while ($chrAscii & 0x80) {
//判断为汉字,$intCount自增1.
$intI++;
$chrAscii <<= 1;
}
}
}
return $intCount;
}
示例4: smarty_function_widget
/**
*
*
* @file function.widget.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_function_widget($params, Smarty_Internal_Template $template)
{
$logArr['smarty_function'] = "function_widget";
$name = $params['name'];
$tpl_path = $params['path'];
$fn = 'smarty_template_function_' . $name;
$type = $template->smarty->getTemplateVars('_TEMPLATE_TYPE');
$logArr['widget_name'] = $name;
$logArr['widget_type'] = $type;
$logArr['widget_path'] = $tpl_path;
if (!function_exists($fn)) {
//$tpl_path = CSmarty::getWidgetPath($type, $name);
if (!$template->smarty->templateExists($tpl_path)) {
$log_str = "widget not found :{$tpl_path}";
CSmarty::addError($log_str);
CLog::warning($log_str, -1, $logArr, 1);
return false;
}
$template->smarty->fetch($tpl_path);
}
if (!function_exists($fn)) {
$log_str = "template function {$fn} not found";
CSmarty::addError($log_str);
CLog::warning($log_str, -1, $logArr, 1);
return false;
} else {
$result = $fn($template, $params);
}
return $result;
}
示例5: smarty_modifier_domain
/**
*
*
* @file modifier.domain.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_modifier_domain($string, $encodeURI = false)
{
$logArr['smarty_modifier'] = "modifier_domain";
$status = 0;
$logArr['url'] = $string;
$domain = $string;
if (strncasecmp($domain, "http://", 7) == 0) {
$domain = substr($domain, 7);
} elseif (strncasecmp($domain, "url:", 4) == 0) {
$pos = strspn($domain, " ", 4);
$domain = substr($domain, 4 + $pos);
if (strncasecmp($domain, "http://", 7) == 0) {
$domain = substr($domain, 7);
}
}
if (strlen($domain) == 0) {
$domain = $string;
}
if ($encodeURI) {
$result = hilight_encodeURI($domain);
$logArr['result'] = $result;
if (false === $result) {
$status = -1;
CLog::warning("fail to call hilight_domain", $status, $logArr, 1);
return $domain;
}
} else {
$result = $domain;
}
return $result;
}
示例6: setItem
public function setItem($key, $val, $expiration = 0)
{
//$val = implode(' ',$val);
$val = serialize($val);
$rc = $this->_cacheBase->set($key, $val, $expiration);
if (false === $rc) {
CLog::warning("ImgPredict setItem failed," . $this->_cacheBase->getErrMsg());
}
return $rc;
}
示例7: getCssJs
public static function getCssJs($type, $arrTplNames, $arrCSSUI)
{
$cssStr = '';
$jsStr = '';
$cssUI = '';
$strLog = '';
$uiArr = array();
// 必须去重
$arrTplNames = array_keys(array_flip($arrTplNames));
$arrSmartyConf = CSmarty::getConf();
// 预处理CSS、JS合并,读取文件
foreach ($arrTplNames as $tpl) {
$cssjsPath = CSmarty::getHeadCssFootJsPath(VUI_TEMPLATE_PATH, $arrSmartyConf['platform'], $arrSmartyConf['language'], $type, $tpl);
if (!file_exists($cssjsPath)) {
continue;
}
require "{$cssjsPath}";
$strLog .= $tpl . '(';
$className = 'CssJs_Util_' . $tpl;
if (class_exists($className) && method_exists($className, 'getHeadCss')) {
$cssStr .= call_user_func(array($className, 'getHeadCss'));
if (!empty($cssStr)) {
$strLog .= 'css,';
}
}
if (class_exists($className) && method_exists($className, 'getFootJs')) {
$jsStr .= call_user_func(array($className, 'getFootJs'));
if (!empty($jsStr)) {
$strLog .= 'js,';
}
}
if (class_exists($className) && method_exists($className, 'getCssUI')) {
$arrUis = call_user_func(array($className, 'getCssUI'));
if (!empty($arrUis) && is_array($arrUis)) {
$uiArr = array_merge($uiArr, $arrUis);
$strLog .= implode('_', $arrUis);
}
}
$strLog .= ')';
}
$uiArr = array_unique($uiArr);
if (!empty($uiArr)) {
// 通用组件的位置放在大搜索目录下
foreach ($uiArr as $ui) {
if (empty($arrCSSUI[$ui]['common'])) {
CLog::warning("Invalid UiCss:{$ui}");
} else {
$cssUI .= $arrCSSUI[$ui]['common'];
}
}
}
$GLOBALS['logArr']['merge'] = $strLog;
return array('cssMerge' => $cssUI . ' ' . $cssStr, 'jsMerge' => $jsStr);
}
示例8: init
public function init($tplTimeDictIncludeFile)
{
if (file_exists("{$tplTimeDictIncludeFile}")) {
require $tplTimeDictIncludeFile;
if (!isset($arrDictTplTime) || empty($arrDictTplTime) || !is_array($arrDictTplTime)) {
CLog::warning("get multi_render tplname dict is wrong, require tpl time err!");
return false;
}
if (empty(self::$Dict)) {
self::$Dict = $arrDictTplTime;
return true;
}
} else {
self::$Dict = array();
CLog::warning("get multi_render tplname dict is wrong, dict[{$tplTimeDictIncludeFile}] is not exist!");
return false;
}
}
示例9: smarty_modifier_encodeURI
/**
*
*
* @file modifier.encodeURI.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:50
*/
function smarty_modifier_encodeURI($uri)
{
$logArr['smarty_modifier'] = "modifier_encodeURI";
$status = 0;
$logArr['uri'] = $string;
if (strlen($uri) == 0) {
$status = -1;
CLog::warning("uri is empty", $status, $logArr, 1);
return $uri;
}
$result = hilight_encodeURI($uri);
if (false === $result) {
$status = -1;
CLog::warning("fail to call hilight_encodeURI", $status, $logArr, 1);
return $uri;
}
return $result;
}
示例10: smarty_modifier_urlsign
/**
* @file modifier.urlsign.php
* @author search(com@baidu.com)
* @date 2014/02/18 18:53:32
* @brief
*
**/
function smarty_modifier_urlsign($uri)
{
$logArr['smarty_modifier'] = "modifier_urlsign";
$status = 0;
$logArr['uri'] = $string;
if (strlen($uri) == 0) {
$status = -1;
CLog::warning("uri is empty", $status, $logArr, 1);
return $uri;
}
$result = hilight_url_sign($uri);
if (false === $result) {
$status = -1;
CLog::warning("fail to call url_sign_64", $status, $logArr, 1);
return $uri;
}
// result[0] : 站点签名
// result[1] : url签名
return $result[1];
}
示例11: smarty_modifier_img_base64_render
/**
*
* @param $strImgSrc unknown_type
* @return boolean unknown data-src={%$ls.src%} data-b64-id={%$ls.imgkey%}>
* <img src={%$ls.src%}>
*
*/
function smarty_modifier_img_base64_render($strImgSrc)
{
if (empty($strImgSrc)) {
CLog::warning("fail to get img base64 src id, src null");
return false;
}
$arrQueryInfo = CSmarty::getQueryInfo();
$strPage = "";
if (!isset($arrQueryInfo['base64']) || $arrQueryInfo['base64'] !== 'on') {
$strPage = 'src="' . $strImgSrc . '"';
return $strPage;
}
if (!isset($arrQueryInfo['base64_sids_for_plugin']) || empty($arrQueryInfo['base64_sids_for_plugin'][$strImgSrc])) {
$strPage = 'src="' . $strImgSrc . '"';
return $strPage;
} else {
$strPage = 'data-src="' . $strImgSrc . '" ' . 'data-b64-id="' . $arrQueryInfo['base64_sids_for_plugin'][$strImgSrc] . '"';
CLog::debug("get img base64 src id OK");
return $strPage;
}
}
示例12: smarty_modifier_real
/**
*
*
* @file modifier.real.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_modifier_real($string)
{
$logArr['smarty_modifier'] = "modifier_real";
$status = 0;
$logArr['string'] = $string;
if (strlen($string) == 0) {
$result = $string;
return $result;
}
$result = hilight_real($string);
if (false == $result) {
$result = $string;
$status = -1;
$logArr['result'] = $result;
CLog::warning("fail to call hilight_real", $status, $logArr, 1);
return $string;
}
$logArr['result'] = $result;
CLog::debug("success to call real modifier", $status, $logArr, 1);
return $result;
}
示例13: smarty_modifier_vui_escape
/**
*
*
* @file modifier.vui_escape.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:51
*/
function smarty_modifier_vui_escape($string, $type = "html")
{
$logArr['smarty_modifier'] = "modifier_vui_escape";
$type = strtolower($type);
$status = 0;
$logArr['string'] = $string;
$logArr['type'] = $type;
if (strlen($string) == 0) {
$result = $string;
$status = -1;
//CLog::warning("string is empty", $status, $logArr, 1);
return $result;
}
switch ($type) {
case "html":
$type = ":h";
break;
case "javascript":
$type = ":j";
break;
case "url":
$type = ":u";
break;
default:
$type = ":h";
break;
}
$result = hilight_escape($string, ":[utf8]" . $type);
if (false === $result) {
$result = $string;
$status = -1;
$logArr['result'] = $result;
CLog::warning("fail to call vui_escape", $status, $logArr, 1);
return $result;
}
$logArr['result'] = $result;
CLog::debug("success to call vui_escape", $status, $logArr, 1);
return $result;
}
示例14: smarty_modifier_zhidaoXmlTrans
/**
*
*
* @file modifier.zhidaoXmlTrans.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_modifier_zhidaoXmlTrans()
{
$logArr['smarty_modifier'] = "modifier_zhidaoXmlTrans";
/**
* hilight info
* @var array
*/
$hilight_info = CSmarty::getHilightInfo();
$hi_word = $hilight_info['hilightInfo']['hi_word'];
$hi_off = $hilight_info['hilightInfo']['hi_off'];
$hi_num = $hilight_info['hilightInfo']['hi_num'];
$status = 0;
if (isset($hi_off[0])) {
$hi_off[0] = 0;
}
$result = hilight_zhidaoXmlTrans($hi_word, $hi_off, $hi_num);
if (false == $result) {
$status = -1;
CLog::warning("fail to call hilight_zhidaoXmlTrans", $status, $logArr, 1);
return false;
}
CLog::debug("success to call zhidaoXmlTrans modifier", $status, $logArr, 1);
return $result;
}
示例15: get_sampling_template
/**
* @param unknown_type $arrData
* @return boolean
*/
public function get_sampling_template(&$arrData)
{
if ($arrData['uiControl']['templateSwitch'] == 2) {
$arrTplSample = Util::getConf('/sample_variable', 'sample_variable/FRONT_PAGE_INDEX');
} else {
$arrTplSample = Util::getConf('/sample_variable', 'sample_variable/RESULT_PAGE_INDEX');
}
if (!is_array($arrTplSample) || empty($arrTplSample)) {
//CLog::warning ( "tpl sampling conf is null" );
return false;
}
$arrSids = $arrData['uiData']['queryInfo']['samplingId'];
$arrSids = array_flip($arrSids);
$strTplName = "";
foreach ($arrTplSample['Contexted'] as $arrTemp) {
if (isset($arrSids[$arrTemp['sampling_id']])) {
$strTplName = $arrTemp['value'];
break;
}
}
if (!empty($strTplName)) {
//$arrTplTypes = Util::getConf ( '/tpl_type', 'TEMPLATE_TYPE' );
require VUI_TEMPLATE_PATH . PHP_TEMPLATES;
if (!isset($arrTplTypes)) {
CLog::warning("tpl sampling is wrong, require tpl type err!");
return false;
}
$arrControlInfo =& $arrData['uiControl'];
// 模板类型
$arrPlatForm = array();
$strType = "";
if (isset($arrTplTypes[$strTplName])) {
$strType = $arrTplTypes[$strTplName]['type'];
$arrPlatForm = $arrTplTypes[$strTplName]['platform'];
} else {
CLog::warning("tpl sampling is wrong, tpl type not existed!");
return false;
// $strType = trim ( $GLOBALS ['DEFAULT_TEMPLATE_TYPE'] );
// $arrPlatForm [] = trim ( $GLOBALS ['DEFAULT_PLATFORM'] );
}
// 平台检查
if (!in_array($arrControlInfo['platform'], $arrPlatForm)) {
CLog::warning("tpl platform is not matching");
return false;
}
//dsp参数处理
if (count($arrPlatForm) == 1 && strcasecmp($arrControlInfo['platform'], "pad") == 0) {
if (empty($arrData['uiData']['queryInfo']['dspName'])) {
$arrData['uiData']['queryInfo']['dspName'] = "ipad";
CLog::warning("dspName is not ipad when using pad template.");
}
}
// 检查模板配置
$bolFlag = false;
$strTplConfigPath = CSmarty::getTplFolderPath(VUI_TEMPLATE_PATH, $arrControlInfo['platform'], $arrControlInfo['language'], $strType) . $strTplName . '/' . $strTplName . '.cfg.php';
if (file_exists($strTplConfigPath)) {
$bolFlag = true;
} else {
$strTplConfigPath = CSmarty::getTplFolderPath(VUI_TEMPLATE_PATH, $arrControlInfo['platform'], $arrControlInfo['language'], $strType) . $strType . '.cfg.php';
if (file_exists($strTplConfigPath)) {
$bolFlag = true;
} else {
CLog::warning("tpl cfg is not existed, tplname : " . $strTplName);
return false;
}
}
if ($bolFlag === true) {
//补充
/* $objTemplateSelector = new TemplateSelector ();
$arrTplConfig = $objTemplateSelector->getTplConfig ( $strTplConfigPath );
if (! is_array ( $arrTplConfig ) || empty ( $arrTplConfig ) || count ( $arrTplConfig ) <= 0) {
// log
CLog::warning ( "tpl sampling is wrong, getting cfg err!" );
return false;
}
// 处理首页模板
if ($arrData ['uiControl'] ['templateSwitch'] == 2) {
$arrFrontPage = Util::getConf ( '/frontpage', 'FRONTPAGE/LOGO' );
if (! empty ( $arrFrontPage ) && is_array ( $arrFrontPage )) {
foreach ( $arrFrontPage as $key => $value ) {
$arrTplConfig [$key] = $value;
}
}
} */
$arrData['uiControl']['tplSamplingPath'] = $strTplConfigPath;
$arrControlInfo['templateName'] = $strTplName;
$arrControlInfo['templateType'] = $strType;
return true;
// 解析模板配置项
// $bolRet = $objTemplateSelector->parseTplConfig ( $arrData, $arrTplConfig );
// CLog::debug ( "tpl sampling tplname : " . $strTplName );
// return $bolRet;
}
}
return false;
//.........这里部分代码省略.........