本文整理汇总了PHP中Log::timingplus方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::timingplus方法的具体用法?PHP Log::timingplus怎么用?PHP Log::timingplus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::timingplus方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __autoload
function __autoload($className)
{
Log::timingplus('autoload');
require_once $className . '.php';
Log::timingplus('autoload');
Log::logHtml('class loaded [' . $className . ']');
}
示例2: query
public static function query($query)
{
Log::timingplus('query:' . $query);
if (!($r = self::getInstance()->query($query, PDO::FETCH_ASSOC))) {
throw new Exception($query . ' ', Error::E_QUERY);
}
Log::timingplus('query:' . $query);
return $r;
}
示例3: query
public static function query($query, $throwError = true) {
Log::timingplus('query:' . $query);
if (!$r = self::getInstance()->query($query, PDO::FETCH_ASSOC))
if ($throwError)
throw new Exception($query . ' ', Error::E_QUERY);
else
return false;
Log::timingplus('query:' . $query);
return $r;
}
示例4: getHTML
public function getHTML($xml) {
global $current_user;
Log::timingplus('XSLTProcessor');
$xslTemplate = new DOMDocument();
$xslProcessor = new XSLTProcessor();
$filename = Config::need('xslt_files_path') . DIRECTORY_SEPARATOR . $current_user->getTheme() . DIRECTORY_SEPARATOR . $this->xsltFileName;
$xslTemplate->load($filename, LIBXML_NOENT | LIBXML_DTDLOAD);
$xslProcessor->importStyleSheet($xslTemplate);
$html = $xslProcessor->transformToXML($xml);
Log::timingplus('XSLTProcessor');
return $html;
}
示例5: query
public static function query($query, $throwError = true)
{
Log::timingplus('query:' . $query);
if (!($r = self::getInstance()->query($query, PDO::FETCH_ASSOC))) {
if ($throwError) {
throw new Exception($query . "\n" . print_r(self::getInstance()->errorInfo(), 1));
} else {
return false;
}
}
Log::timingplus('query:' . $query);
return $r;
}
示例6: getResultXML
public function getResultXML()
{
if ($this->xmlPart !== false) {
return $this->xmlPart;
}
$this->xmlPart = XMLClass::createNodeFromObject(array('data' => $this->data, 'settings' => $this->settings), false, 'module');
if ($this->xHTMLCachingEnabled) {
Log::timingplus('BaseModule:xHTML generating #' . $this->moduleName);
// процессим кусок XML с шаблоном, чтобы получить xHTML
// шаблон, который отпроцессит только наш модуль - null.xsl
$XSLClass = new XSLClass(LibPages::$pages[Request::$pageName]['xslt'], $xHTML = true);
$arr = array($this->moduleName => $this->getXSLTFileName(true));
// и шаблон модуля
$XSLClass->setTemplates($arr);
// создаем документ
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->loadXML("<xml version=\"1.0\" encoding=\"utf-8\" >" . "<root></root></xml>");
$rootNode = $xml->getElementsByTagName("root")->item(0);
// нода page также нужна для корректной обработки шаблонаы
$pageNode = $xml->importNode(XMLClass::$pageNode);
$rootNode->appendChild($pageNode);
// вставляем в него ноду с данными модуля
$xHTMLnode = $xml->importNode($this->xmlPart, true);
$rootNode->appendChild($xHTMLnode);
$xHTMLnode->setAttribute('name', $this->moduleName);
// теперь полученный xml процессим с шаблоном
$xHTML = $XSLClass->getHTML($xml);
// полученный xHTML нужно вбить в XML ноду "module"
$xHTMLdoc = new DOMDocument('1.0', 'UTF-8');
$xHTMLdoc->loadHTML($xHTML);
$xpath = new DOMXPath($xHTMLdoc);
$part = $xpath->query('body')->item(0);
$part = $xHTMLdoc->importNode($part, true);
// в part лежит HTML код
// копируем его в новую ноду
$NewElement = XMLClass::$xml->createElement('module');
// Clone the attributes:
foreach ($part->attributes as $attribute) {
$NewElement->setAttribute($attribute->name, $attribute->value);
}
foreach ($part->childNodes as $child) {
$NewElement->appendChild(XMLClass::$xml->importNode($child, true));
}
$this->xmlPart = $NewElement;
Log::timingplus('BaseModule:xHTML generating #' . $this->moduleName);
}
$this->putInCache();
return $this->xmlPart;
}
示例7: getFromCache
protected function getFromCache()
{
if (!$this->cache_enabled) {
return false;
}
$cache_sec = isset($this->params['cache']) ? max(0, (int) $this->params['cache']) : 0;
if (!$cache_sec) {
return false;
}
if ($data = Cache::get($this->xml_cache_name, Cache::DATA_TYPE_XML, $cache_sec)) {
Log::timingplus($this->moduleName . ' : XML from cache');
$doc = new DOMDocument();
$doc->loadXML($data);
// говорим нашему дереву что этот кусок из кеша будет вставлен
$part = $doc->getElementsByTagName("module")->item(0);
$this->xmlPart = XMLClass::$xml->importNode($part, true);
Log::timingplus($this->moduleName . ' : XML from cache');
return $this->xmlPart;
}
return false;
}
示例8: set
public static function set($name, $value, $cache_seconds = false, $datatype = self::DATA_TYPE_VAR)
{
self::init();
Log::timingplus('cache:set');
if (!$cache_seconds) {
$cache_seconds = self::$max_cache_sec;
}
switch (self::$cacheType) {
case self::CACHE_TYPE_XCACHE:
self::set_xcache($name, $value, $datatype, $cache_seconds);
break;
case self::CACHE_TYPE_MEMCACHE:
break;
case self::CACHE_TYPE_FILE:
self::set_file($name, $value, $datatype);
break;
}
Log::timingplus('cache:set');
}
示例9: getHTML
public function getHTML($xml, $xslt = false)
{
Log::timingplus('XSLTProcessor');
$xslTemplate = new DOMDocument();
$xslProcessor = new XSLTProcessor();
$xslTemplate->loadXML($xslt ? $xslt : $this->getSplitedTemplate(), LIBXML_NOENT | LIBXML_DTDLOAD);
$xslProcessor->importStyleSheet($xslTemplate);
// кладем в кеш xslt
$html = $xslProcessor->transformToXML($xml);
Log::timingplus('XSLTProcessor');
return $html;
}
示例10: searchSeriesByString
public function searchSeriesByString($string, $offset = 0, $limit = 100)
{
if (Config::need('disable_solr')) {
$foundids = array_keys(Database::sql2array('SELECT `id` FROM `series` WHERE `title` LIKE \'%' . $string . '%\' LIMIT ' . $offset . ',' . $limit, 'id'));
$foundcnt = count($foundids);
return array($foundids, $foundcnt, array());
}
Log::timingplus('solr searchSeriesByString');
$series = self::$series;
$ids = array();
$count = 0;
/* @var $books Apache_Solr_Service */
// @text field - for bio including, @name- for 1,2,3name
$string = $string ? $string : '*';
$query = $string == '*' ? '*:*' : 'text:' . $series->escape($string);
// дубликаты убираем
$query .= ' AND books_count:true';
// удаленные убираем
$query .= ' AND is_s_duplicate:false';
$query .= ' AND is_deleted:false';
$res = $series->search($query, $offset, $limit, array('fl' => 'id', 'hl' => 'true', 'hl.fl' => '*', 'usePhraseHighlighter' => 'true'));
/* @var $res Apache_Solr_Response */
foreach ($res->response->docs as $document) {
$ids[$document->id] = $document->id;
}
$count = $res->response->numFound;
Log::timingplus('solr searchSeriesByString');
return array($ids, $count, $this->getHighlighted($res));
}
示例11: getHTML
public function getHTML($xml, $xslt = false)
{
$doc = new DOMDocument();
$xsl = new XSLTProcessor();
$doc->loadXML($xslt ? $xslt : $this->getSplitedTemplate());
$xsl->importStyleSheet($doc);
// кладем в кеш xslt
Log::timingplus('XSLTProcessor');
$res = $xsl->transformToXML($xml);
Log::timingplus('XSLTProcessor');
return $res;
}