本文整理汇总了PHP中CLog::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP CLog::debug方法的具体用法?PHP CLog::debug怎么用?PHP CLog::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLog
的用法示例。
在下文中一共展示了CLog::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: smarty_modifier_format_int
/**
*
*
* @file modifier.format_int.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_modifier_format_int($number)
{
$logArr['smarty_modifier'] = "modifier_format_int";
$status = 0;
$number = sprintf("%F", $number);
$logArr['number'] = $number;
$size = strlen($number);
for ($i = $size - 1, $j = 1; $i >= 0; $i--, $j++) {
$word = substr($number, $i, 1);
if ($word === ".") {
$result = "";
$j = 0;
continue;
}
if ($i < 3) {
$result = $word . $result;
} else {
$result = "0" . $result;
}
if ($j % 3 == 0 && $i != 0) {
$result = "," . $result;
}
}
$logArr['result'] = $result;
CLog::debug("success to call format_int", $status, $logArr, 1);
return $result;
}
示例3: 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;
}
示例4: smarty_modifier_string_display_len
/**
*
*
* @file modifier.limitlen.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:51
*/
function smarty_modifier_string_display_len($string)
{
$logArr['smarty_modifier'] = "modifier_string_display_len";
$status = 0;
$logArr['string'] = $string;
if (strlen($string) == 0) {
$result = 0;
return $result;
}
$result = hilight_stringDisplayLen($string);
$logArr['result'] = $result;
CLog::debug("success to call limitlen", $status, $logArr, 1);
return $result;
}
示例5: smarty_modifier_firstpart
/**
*
*
* @file modifier.firstpart.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:49
*/
function smarty_modifier_firstpart($string, $part)
{
$logArr['smarty_modifier'] = "modifier_firstpart";
$status = 0;
$logArr['string'] = $string;
$logArr['part'] = $part;
$pos = strrpos($string, $part);
$string_size = strlen($string);
$part_size = strlen($part);
$result = $string;
if ($pos !== false && $string_size === $part_size + $pos) {
$result = substr($string, 0, $string_size - $part_size);
}
$logArr['result'] = $result;
CLog::debug("success to call firstpart", $status, $logArr, 1);
return $result;
}
示例6: smarty_modifier_host
/**
*
*
* @file modifier.host.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:47
*/
function smarty_modifier_host($string)
{
/*
$status = 0;
$logArr['url'] = $string;
$url = parse_url($string);
$result = $url['host'];
if( empty($result) ) {
$length = strlen($string);
$i = strpos($string, ':');
$j = strpos($string, '/');
if( $i > 0 && $j > 0 ) {
$length = $i > $j ? $j : $i;
}elseif($i > 0) {
$length = $i;
}elseif($j > 0) {
$length = $j;
}
$result = substr($string, 0, $length);
}
$logArr['result'] = $result;
CLog::debug("success to call host", $status, $logArr, 1);
return $result;
*/
$logArr['smarty_modifier'] = "modifier_host";
$status = 0;
$logArr['url'] = $string;
$host = $string;
if (strncasecmp($host, "http://", 7) == 0) {
$host = substr($host, 7);
}
$pos1 = strpos($host, '/');
$pos2 = strpos($host, ':');
$pos = $pos1 === false || $pos2 !== false && $pos2 < $pos1 ? $pos2 : $pos1;
if ($pos === false) {
$result = $host;
} else {
$result = substr($host, 0, $pos);
}
$logArr['result'] = $result;
CLog::debug("success to call host", $status, $logArr, 1);
return $result;
}
示例7: smarty_modifier_wbrlimit
/**
*
*
* @file modifier.wbrlimit.php
* @package plugins
* @author lanrui@baidu.com
* @date 2013-01-05 20:16
*/
function smarty_modifier_wbrlimit($string, $mb_len)
{
//return $string;
$logArr['smarty_modifier'] = "modifier_wbrlimit";
$status = 0;
$logArr['string'] = $string;
$logArr['len'] = $mb_len;
if (strlen($string) == 0) {
$result = $string;
return $result;
}
$cur_pos = 0;
$cur_mb_len = 0;
$result = "";
$flag = 0;
$string_len = strlen($string);
while ($cur_pos < $string_len) {
$start = strpos($string, 1, $cur_pos);
if ($start !== false) {
$substring = mb_substr($string, $cur_pos, $start - $cur_pos);
if ($cur_mb_len + mb_strlen($substring) < $mb_len) {
$cur_mb_len = $cur_mb_len + mb_strlen($substring);
$result = $result . $substring;
$cur_pos = $start + 1;
} elseif (mb_strlen($substring) >= $mb_len) {
//in case a single word is longer than a line's length
$cur_mb_len = 0;
$cur_pos = $start + 1;
$result = $result . $substring . "<wbr>";
} else {
$result = $result . "<wbr>";
$cur_mb_len = 0;
}
} else {
$logArr['result'] = $result;
CLog::debug("wbrlimit succeed", $status, $logArr, 1);
break;
}
}
return $result;
}
示例8: 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;
}
}
示例9: 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;
}
示例10: 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;
}
示例11: smarty_modifier_endwith
/**
*
*
* @file modifier.endwith.php
* @package plugins
* @author liyudong@baidu.com
* @date 2011-11-03 10:49
*/
function smarty_modifier_endwith($string, $part)
{
$logArr['smarty_modifier'] = "modifier_endwith";
$status = 0;
$logArr['string'] = $string;
$logArr['part'] = $part;
if (strlen($part) == 0) {
$result = 1;
} elseif (strlen($string) == 0) {
$result = 0;
} else {
$pos = strrpos($string, $part);
$string_size = strlen($string);
$part_size = strlen($part);
$result = 0;
if ($pos !== false && $string_size === $part_size + $pos) {
$result = 1;
}
}
$logArr['result'] = $result;
CLog::debug("success to call endwith", $status, $logArr, 1);
return $result;
}
示例12: smarty_modifier_img_base64_parser
/**
*
* @param $strImgSrc unknown_type
* @return string "data-b64-id"
*
*/
function smarty_modifier_img_base64_parser($strImgSrc)
{
if (empty($strImgSrc)) {
return '';
}
$arrQueryInfo = CSmarty::getQueryInfo();
if (!isset($arrQueryInfo['base64']) || $arrQueryInfo['base64'] !== 'on') {
return '';
}
if (!isset($arrQueryInfo['base64_left_exp']) || $arrQueryInfo['base64_left_exp'] !== 'on') {
return '';
}
if (isset($arrQueryInfo['base64_img_sids_left']) && !empty($arrQueryInfo['base64_img_sids_left'][$strImgSrc])) {
return $arrQueryInfo['base64_img_sids_left'][$strImgSrc];
CLog::debug("get img base64 src id OK");
} else {
if (isset($arrQueryInfo['base64_img_sids']) && !empty($arrQueryInfo['base64_img_sids'][$strImgSrc])) {
return $arrQueryInfo['base64_img_sids'][$strImgSrc];
CLog::debug("get img base64 src id OK");
}
}
return '';
}
示例13: 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;
}
示例14: parse_image_conf
public static function parse_image_conf($arrResultData, &$arrImgList, $arrImgConf)
{
$cnt = count($arrImgConf);
$status = -1;
if (1 === $cnt) {
$paths = explode('.', $arrImgConf[0]);
$paths_count = count($paths);
switch ($paths_count) {
/**
*
* @example : @enc : tplData
*/
case 1:
$link = $arrResultData[$paths[0]];
if (!empty($link)) {
if (!is_array($link)) {
self::get_image_src($arrImgList, $link);
} else {
foreach ($link as $k => $v) {
self::get_image_src($arrImgList, $v);
}
}
} else {
$logArr['img'] = "data['resultData'][{$paths['0']}]";
CLog::debug("img src to get id is empty", $status, $logArr, 1);
return false;
}
break;
/**
*
* @example : @enc : tplData.loc
*/
/**
*
* @example : @enc : tplData.loc
*/
case 2:
$link = $arrResultData[$paths[0]][$paths[1]];
if (!empty($link)) {
if (!is_array($link)) {
self::get_image_src($arrImgList, $link);
} else {
foreach ($link as $k => $v) {
self::get_image_src($arrImgList, $v);
}
}
} else {
$logArr['img'] = "data['resultData'][{$paths['0']}][{$paths['1']}]";
CLog::debug("img src to get id is empty", $status, $logArr, 1);
return false;
}
break;
/**
*
* @example : tplData.moreprice.link
*/
/**
*
* @example : tplData.moreprice.link
*/
case 3:
$link = $arrResultData[$paths[0]][$paths[1]][$paths[2]];
if (!empty($link)) {
if (!is_array($link)) {
self::get_image_src($arrImgList, $link);
} else {
foreach ($link as $k => $v) {
self::get_image_src($arrImgList, $v);
}
}
} else {
$logArr['img'] = "data['resultData'][{$paths['0']}][{$paths['1']}][{$paths['2']}]";
CLog::debug("img src to get id is empty", $status, $logArr, 1);
return false;
}
break;
/**
*
* @example : tplData.moreprice.link.link
*/
/**
*
* @example : tplData.moreprice.link.link
*/
case 4:
$link = $arrResultData[$paths[0]][$paths[1]][$paths[2]][$paths[3]];
if (!empty($link)) {
if (!is_array($link)) {
self::get_image_src($arrImgList, $link);
} else {
foreach ($link as $k => $v) {
self::get_image_src($arrImgList, $v);
}
}
} else {
$logArr['img'] = "data['resultData'][{$paths['0']}][{$paths['1']}][{$paths['2']}][{$paths['3']}][{$k}]";
CLog::debug("img src to get id is empty", $status, $logArr, 1);
return false;
}
break;
//.........这里部分代码省略.........
示例15: strategy_function_3
function strategy_function_3(&$data, $index)
{
$tempnames = array();
$flag = 0;
$hasreplaceResult = 0;
$hasRealPSResult = 0;
$replaceLocation = -1;
$realResultPosiont = -1;
$fromStdstg = $GLOBALS['STRATEGY' . $index]['STRATEGY_CONF'][1];
$toStdstg = $GLOBALS['STRATEGY' . $index]['STRATEGY_CONF'][0];
if (empty($fromStdstg) || empty($toStdstg)) {
return 0;
}
// 19是时效性结果
if (!empty($data['uiData']['asResult']['item']) && is_array($data['uiData']['asResult']['item'])) {
// 知心结果都在第一个位置,如果第一个位置不存在知心结果,那么不处理
foreach ($data['uiData']['asResult']['item'] as $key => $value) {
if ($value['comeFrome'] == "SP") {
if (!empty($value['dispData'])) {
if ($value['dispData']['StdStg'] == $toStdstg) {
$replaceLocation = $key;
$hasreplaceResult = 1;
break;
}
}
}
}
// $hasreplaceResult = 0;
if ($hasreplaceResult == 1) {
foreach ($data['uiData']['asResult']['item'] as $key => &$value) {
if ($value['comeFrome'] == "SP") {
if (!empty($value['dispData'])) {
if ($value['dispData']['StdStg'] == $fromStdstg) {
$hasRealPSResult = 1;
$realResult =& $data['uiData']['asResult']['item'][$replaceLocation]['dispData']['resultData']['tplData'];
$hasRealResult = 0;
$realResultNum = 0;
$hasPhoto = 0;
if (empty($realResult['newssubject'])) {
$subject = array();
$subjectArray = array();
$subjectArray['subject'] = $data['uiData']['queryInfo']['wordNoSyntax'] . "的最新相关消息";
$subjectArray['link'] = $value['offsetInfo']['urlEncoded'];
}
$newsOld = $realResult['news'];
unset($realResult['news']);
for ($i = 0; $i < 10; $i++) {
CLog::debug("realResultNum {$realResultNum}");
$hasRealResult = 0;
if ($realResultNum == 0 && !empty($value['dispData']['ThumURL' . $i]) && !empty($value['dispData']['SubTitleUrl' . $i])) {
$realResult['news'][$realResultNum]['photo'] = $value['dispData']['ThumURL' . $i];
$realResult['news'][$realResultNum]['link'] = $value['dispData']['SubTitleUrl' . $i];
$realResultNum++;
$hasPhoto = 1;
}
if (!empty($value['dispData']['SubTitleUrl' . $i])) {
$realResult['news'][$realResultNum]['link'] = $value['dispData']['SubTitleUrl' . $i];
$hasRealResult++;
}
if (!empty($value['dispData']['SubTitle' . $i])) {
$realResult['news'][$realResultNum]['subject'] = $value['dispData']['SubTitle' . $i];
$hasRealResult++;
}
if (!empty($value['dispData']['SiteName' . $i])) {
$realResult['news'][$realResultNum]['from'] = $value['dispData']['SiteName' . $i];
$hasRealResult++;
}
if (!empty($value['dispData']['PostTime' . $i])) {
$realResult['news'][$realResultNum]['time'] = $value['dispData']['PostTime' . $i];
$hasRealResult++;
}
if (!empty($value['dispData']['SubAbs' . $i])) {
$realResult['news'][$realResultNum]['summary'] = $value['dispData']['SubAbs' . $i];
}
if ($hasRealResult > 3) {
$realResultNum++;
// PM要求最大结果条数为三
if ($hasPhoto == 1 && $realResultNum >= 4 || $hasPhoto == 0 && $realResultNum >= 3) {
break;
}
} else {
if ($hasRealResult == 0 && $realResultNum == 0 || $hasRealResult != 0) {
$realResult['news'] = $newsOld;
array_splice($data['uiData']['asResult']['item'], $key, 1);
$data['uiData']['asResult']['spResutlNum'] = $data['uiData']['asResult']['spResutlNum'] - 1;
break 2;
}
break;
}
}
$realResult['news#num#baidu'] = $realResultNum;
// unset($data['uiData']['asResult']['item'][$key]);
// unset($replaceLocation);
// unset($data['uiData']['asResult']['item'][$replaceLocation]['resultData']['tplData']['news']);
// $realResult =
// $data['uiData']['asResult']['item'][$key];
array_splice($data['uiData']['asResult']['item'], $key, 1);
$data['uiData']['asResult']['spResutlNum'] = $data['uiData']['asResult']['spResutlNum'] - 1;
break;
}
//.........这里部分代码省略.........