本文整理汇总了PHP中startProfile函数的典型用法代码示例。如果您正苦于以下问题:PHP startProfile函数的具体用法?PHP startProfile怎么用?PHP startProfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startProfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_oxmultilang
/**
* Smarty function
* -------------------------------------------------------------
* Purpose: Output multilang string
* add [{ oxmultilang ident="..." }] where you want to display content
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_function_oxmultilang($params, &$smarty)
{
startProfile("smarty_function_oxmultilang");
$sIdent = isset($params['ident']) ? $params['ident'] : 'IDENT MISSING';
$iLang = null;
$blAdmin = isAdmin();
$oLang = oxLang::getInstance();
if ($blAdmin) {
$iLang = $oLang->getTplLanguage();
if (!isset($iLang)) {
$iLang = 0;
}
}
try {
$sTranslation = $oLang->translateString($sIdent, $iLang, $blAdmin);
} catch (oxLanguageException $oEx) {
// is thrown in debug mode and has to be caught here, as smarty hangs otherwise!
}
if ($blAdmin && $sTranslation == $sIdent && (!isset($params['noerror']) || !$params['noerror'])) {
$sTranslation = '<b>ERROR : Translation for ' . $sIdent . ' not found!</b>';
}
if ($sTranslation == $sIdent && isset($params['alternative'])) {
$sTranslation = $params['alternative'];
}
stopProfile("smarty_function_oxmultilang");
return $sTranslation;
}
示例2: _checkAuthorization
protected function _checkAuthorization()
{
startProfile('ChromePHP: ' . __CLASS__ . ' / ' . __FUNCTION__);
if ($this->_getAuthorization()->getAuthorization()) {
$this->_enableChrome();
}
stopProfile('ChromePHP: ' . __CLASS__ . ' / ' . __FUNCTION__);
}
示例3: autoload
/**
* Includes file, where given class is described.
*
* @param string $class Class Name
*/
public function autoload($class)
{
startProfile("ShopAutoload");
$class = strtolower(basename($class));
if ($classPath = $this->getClassPath($class)) {
include $classPath;
}
stopProfile("ShopAutoload");
}
示例4: buildActCatList
/**
* Fetches raw categories and does postprocessing for adding depth information.
*
* @param string $id
*/
public function buildActCatList($id)
{
$this->setActCat($id);
startProfile('buildCategoryList');
$this->_blForceFull = false;
$this->_blHideEmpty = false;
$sql = $this->_getSelectString(false);
$this->selectString($sql);
stopProfile('buildCategoryList');
}
示例5: _createArticleCategoryUri
/**
* Returns new seo url including the model no.
*
*
* @param oxArticle $oArticle article object
* @param oxCategory $oCategory category object
* @param int $iLang language to generate uri for
*
* @return string
*/
protected function _createArticleCategoryUri($oArticle, $oCategory, $iLang)
{
startProfile(__FUNCTION__);
$oArticle = $this->_getProductForLang($oArticle, $iLang);
// create title part for uri
$sTitle = $this->_prepareArticleTitle($oArticle);
$sTitle = str_replace($this->_getUrlExtension(), " " . $oArticle->oxarticles__oxartnum->value, $sTitle) . "." . $this->_getUrlExtension();
// writing category path
$sSeoUri = $this->_processSeoUrl($sTitle, $oArticle->getId(), $iLang);
$sCatId = $oCategory->getId();
$this->_saveToDb('oxarticle', $oArticle->getId(), oxUtilsUrl::getInstance()->appendUrl($oArticle->getBaseStdLink($iLang), array('cnid' => $sCatId)), $sSeoUri, $iLang, null, 0, $sCatId);
stopProfile(__FUNCTION__);
return $sSeoUri;
}
示例6: autoload
/**
* Tries to autoload given class. If class was not found in module files array,
* checks module extensions.
*
* @param string $class Class name.
*/
public function autoload($class)
{
startProfile("oxModuleAutoload");
$class = strtolower(basename($class));
if ($classPath = $this->getFilePath($class)) {
include $classPath;
} else {
$class = preg_replace('/_parent$/i', '', $class);
if (!in_array($class, $this->triedClasses)) {
$this->triedClasses[] = $class;
$this->createExtensionClassChain($class);
}
}
stopProfile("oxModuleAutoload");
}
示例7: smarty_function_oxmultilang
/**
* Smarty function
* -------------------------------------------------------------
* Purpose: Output multilang string
* add [{ oxmultilang ident="..." args=... }] where you want to display content
* ident - language constant
* args - array of argument that can be parsed to language constant threw %s
* -------------------------------------------------------------
*
* @param array $params params
* @param Smarty &$smarty clever simulation of a method
*
* @return string
*/
function smarty_function_oxmultilang($params, &$smarty)
{
startProfile("smarty_function_oxmultilang");
$oLang = oxRegistry::getLang();
$oConfig = oxRegistry::getConfig();
$oShop = $oConfig->getActiveShop();
$blAdmin = $oLang->isAdmin();
$sIdent = isset($params['ident']) ? $params['ident'] : 'IDENT MISSING';
$aArgs = isset($params['args']) ? $params['args'] : false;
$sSuffix = isset($params['suffix']) ? $params['suffix'] : 'NO_SUFFIX';
$blShowError = isset($params['noerror']) ? !$params['noerror'] : true;
$iLang = $oLang->getTplLanguage();
if (!$blAdmin && $oShop->isProductiveMode()) {
$blShowError = false;
}
try {
$sTranslation = $oLang->translateString($sIdent, $iLang, $blAdmin);
$blTranslationNotFound = !$oLang->isTranslated();
if ('NO_SUFFIX' != $sSuffix) {
$sSuffixTranslation = $oLang->translateString($sSuffix, $iLang, $blAdmin);
}
} catch (oxLanguageException $oEx) {
// is thrown in debug mode and has to be caught here, as smarty hangs otherwise!
}
if ($blTranslationNotFound && isset($params['alternative'])) {
$sTranslation = $params['alternative'];
$blTranslationNotFound = false;
}
if (!$blTranslationNotFound) {
if ($aArgs !== false) {
if (is_array($aArgs)) {
$sTranslation = vsprintf($sTranslation, $aArgs);
} else {
$sTranslation = sprintf($sTranslation, $aArgs);
}
}
if ('NO_SUFFIX' != $sSuffix) {
$sTranslation .= $sSuffixTranslation;
}
} elseif ($blShowError) {
$sTranslation = 'ERROR: Translation for ' . $sIdent . ' not found!';
}
stopProfile("smarty_function_oxmultilang");
return $sTranslation;
}
示例8: selectString
public function selectString($sSql, $values = array())
{
startProfile("loadinglists");
$this->clear();
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC);
if ($this->_aSqlLimit[0] || $this->_aSqlLimit[1]) {
$rs = $oDb->selectLimit($sSql, $this->_aSqlLimit[1], $this->_aSqlLimit[0], $values);
} else {
$rs = $oDb->select($sSql, $values);
}
if ($rs != false && $rs->recordCount() > 0) {
$oSaved = clone $this->getBaseObject();
while (!$rs->EOF) {
$oListObject = clone $oSaved;
$this->_assignElement($oListObject, $rs->fields);
$this->add($oListObject);
$rs->moveNext();
}
}
stopProfile("loadinglists");
}
示例9: getCategoryUri
/**
* Returns SEO uri for passed category
*
* @param oxCategory $oCat category object
* @param int $iLang language
* @param bool $blRegenerate if TRUE forces seo url regeneration
*
* @return string
*/
public function getCategoryUri($oCat, $iLang = null, $blRegenerate = false)
{
startProfile(__FUNCTION__);
$sCatId = $oCat->getId();
// skipping external category URLs
if ($oCat->oxcategories__oxextlink->value) {
$sSeoUrl = null;
} else {
// not found in cache, process it from the top
if (!isset($iLang)) {
$iLang = $oCat->getLanguage();
}
$aCacheMap = array();
$aStdLinks = array();
while ($oCat && !($sSeoUrl = $this->_categoryUrlLoader($oCat, $iLang))) {
if ($iLang != $oCat->getLanguage()) {
$sId = $oCat->getId();
$oCat = oxNew('oxCategory');
$oCat->loadInLang($iLang, $sId);
}
// prepare oCat title part
$sTitle = $this->_prepareTitle($oCat->oxcategories__oxtitle->value, false, $oCat->getLanguage());
foreach (array_keys($aCacheMap) as $id) {
$aCacheMap[$id] = $sTitle . '/' . $aCacheMap[$id];
}
$aCacheMap[$oCat->getId()] = $sTitle;
$aStdLinks[$oCat->getId()] = $oCat->getBaseStdLink($iLang);
// load parent
$oCat = $oCat->getParentCategory();
}
foreach ($aCacheMap as $sId => $sUri) {
$this->_aCatCache[$sId . '_' . $iLang] = $this->_processSeoUrl($sSeoUrl . $sUri . '/', $sId, $iLang);
$this->_saveToDb('oxcategory', $sId, $aStdLinks[$sId], $this->_aCatCache[$sId . '_' . $iLang], $iLang);
}
$sSeoUrl = $this->_aCatCache[$sCatId . '_' . $iLang];
}
stopProfile(__FUNCTION__);
return $sSeoUrl;
}
示例10: loadList
/**
* Fetches raw categories and does postprocessing for adding depth information
*/
public function loadList()
{
startProfile('buildCategoryList');
$this->setLoadFull(true);
$this->selectString($this->_getSelectString(false, null, 'oxparentid, oxsort, oxtitle'));
// build tree structure
$this->_ppBuildTree();
// PostProcessing
// add tree depth info
$this->_ppAddDepthInformation();
stopProfile('buildCategoryList');
}
示例11: getRecommListsByIds
/**
* get recommendation lists wich include given article ids
* also sort these lists by these criterias:
* 1. show lists, that has more requested articles first
* 2. show lists, that have more any articles
*
* @param array $aArticleIds Object IDs
*
* @return oxList
*/
public function getRecommListsByIds($aArticleIds)
{
if (count($aArticleIds)) {
startProfile(__FUNCTION__);
$sIds = implode(",", oxDb::getInstance()->quoteArray($aArticleIds));
$oRecommList = oxNew('oxlist');
$oRecommList->init('oxrecommlist');
$iShopId = $this->getConfig()->getShopId();
$iCnt = $this->getConfig()->getConfigParam('iNrofCrossellArticles');
$oRecommList->setSqlLimit(0, $iCnt);
$sSelect = "SELECT distinct lists.* FROM oxobject2list AS o2l_lists";
$sSelect .= " LEFT JOIN oxobject2list AS o2l_count ON o2l_lists.oxlistid = o2l_count.oxlistid";
$sSelect .= " LEFT JOIN oxrecommlists as lists ON o2l_lists.oxlistid = lists.oxid";
$sSelect .= " WHERE o2l_lists.oxobjectid IN ( {$sIds} ) and lists.oxshopid ='{$iShopId}'";
$sSelect .= " GROUP BY lists.oxid order by (";
$sSelect .= " SELECT count( order1.oxobjectid ) FROM oxobject2list AS order1";
$sSelect .= " WHERE order1.oxobjectid IN ( {$sIds} ) AND o2l_lists.oxlistid = order1.oxlistid";
$sSelect .= " ) DESC, count( lists.oxid ) DESC";
$oRecommList->selectString($sSelect);
stopProfile(__FUNCTION__);
if ($oRecommList->count()) {
startProfile('_loadFirstArticles');
$this->_loadFirstArticles($oRecommList, $aArticleIds);
stopProfile('_loadFirstArticles');
return $oRecommList;
}
}
}
示例12: _process
/**
* Initiates object (object::init()), executes passed function
* (oxShopControl::executeFunction(), if method returns some string - will
* redirect page and will call another function according to returned
* parameters), renders object (object::render()). Performs output processing
* oxOutput::ProcessViewArray(). Passes template variables to template
* engine witch generates output. Output is additionally processed
* (oxOutput::Process()), fixed links according search engines optimization
* rules (configurable in Admin area). Finally echoes the output.
*
* @param string $sClass Name of class
* @param string $sFunction Name of function
* @param array $aParams Parameters array
* @param array $aViewsChain Array of views names that should be initialized also
*/
protected function _process($sClass, $sFunction, $aParams = null, $aViewsChain = null)
{
startProfile('process');
$myConfig = $this->getConfig();
// executing maintenance tasks
$this->_executeMaintenanceTasks();
$oUtils = oxRegistry::getUtils();
$sViewID = null;
if (!$oUtils->isSearchEngine() && !($this->isAdmin() || !$myConfig->getConfigParam('blLogging'))) {
$this->_log($sClass, $sFunction);
}
// starting resource monitor
$this->_startMonitor();
// caching params ...
$sOutput = null;
$blIsCached = false;
// Initialize view object and it's components.
$oViewObject = $this->_initializeViewObject($sClass, $sFunction, $aParams, $aViewsChain);
if (!$this->_canExecuteFunction($oViewObject, $oViewObject->getFncName())) {
/** @var oxSystemComponentException $oException */
$oException = oxNew('oxSystemComponentException', 'Non public method cannot be accessed');
throw $oException;
}
// executing user defined function
$oViewObject->executeFunction($oViewObject->getFncName());
// if no cache was stored before we should generate it
if (!$blIsCached) {
$sOutput = $this->_render($oViewObject);
}
$oOutput = $this->_getOutputManager();
$oOutput->setCharset($oViewObject->getCharSet());
if (oxRegistry::getConfig()->getRequestParameter('renderPartial')) {
$oOutput->setOutputFormat(oxOutput::OUTPUT_FORMAT_JSON);
$oOutput->output('errors', $this->_getFormattedErrors($oViewObject->getClassName()));
}
$oOutput->sendHeaders();
$oOutput->output('content', $sOutput);
$myConfig->pageClose();
stopProfile('process');
// stopping resource monitor
$this->_stopMonitor($oViewObject->getIsCallForCache(), $blIsCached, $sViewID, $oViewObject->getViewData());
// flush output (finalize)
$oOutput->flushOutput();
}
示例13: _process
/**
* Initiates object (object::init()), executes passed function
* (oxShopControl::executeFunction(), if method returns some string - will
* redirect page and will call another function according to returned
* parameters), renders object (object::render()). Performs output processing
* oxOutput::ProcessViewArray(). Passes template variables to template
* engine witch generates output. Output is additionally processed
* (oxOutput::Process()), fixed links according search engines optimization
* rules (configurable in Admin area). Finally echoes the output.
*
* @param string $sClass Name of class
* @param string $sFunction Name of function
*
* @return null
*/
protected function _process($sClass, $sFunction)
{
startProfile('process');
$myConfig = $this->getConfig();
$myUtils = oxUtils::getInstance();
$sViewID = null;
if (!$myUtils->isSearchEngine() && !($this->isAdmin() || !$myConfig->getConfigParam('blLogging'))) {
$this->_log($sClass, $sFunction);
}
// starting resource monitor
$this->_startMonitor();
// caching params ...
$sOutput = null;
$blIsCached = false;
$oViewObject = $this->_initializeViewObject($sClass, $sFunction);
// executing user defined function
$oViewObject->executeFunction($oViewObject->getFncName());
// if no cache was stored before we should generate it
if (!$blIsCached) {
$sOutput = $this->_render($oViewObject);
}
$oOutput = $this->_getOutputManager();
$oOutput->setCharset($oViewObject->getCharSet());
if (oxConfig::getParameter('renderPartial')) {
$oOutput->setOutputFormat(oxOutput::OUTPUT_FORMAT_JSON);
$oOutput->output('errors', $this->_getFormattedErrors());
}
$oOutput->sendHeaders();
$oOutput->output('content', $sOutput);
$myConfig->pageClose();
stopProfile('process');
// stopping resource monitor
$this->_stopMonitor($oViewObject->getIsCallForCache(), $blIsCached, $sViewID, $oViewObject->getViewData());
// flush output (finalize)
$oOutput->flushOutput();
}
示例14: _resize
/**
* type dependant image resizing
*
* @param array $aImageInfo Contains information on image's type / width / height
* @param string $sSrc source image
* @param string $hDestinationImage Destination Image
* @param string $sTarget Resized Image target
* @param int $iNewWidth Resized Image's width
* @param int $iNewHeight Resized Image's height
* @param mixed $iGdVer used GDVersion, if null or false returns false
* @param bool $blDisableTouch false if "touch()" should be called for gif resizing
* @param string $iDefQuality quality for "imagejpeg" function
*
* @return bool
*/
protected function _resize($aImageInfo, $sSrc, $hDestinationImage, $sTarget, $iNewWidth, $iNewHeight, $iGdVer, $blDisableTouch, $iDefQuality)
{
startProfile("PICTURE_RESIZE");
$blSuccess = false;
switch ($aImageInfo[2]) {
//Image type
case $this->_aImageTypes["GIF"]:
//php does not process gifs until 7th July 2004 (see lzh licensing)
if (function_exists("imagegif")) {
$blSuccess = resizeGif($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo[0], $aImageInfo[1], $iGdVer);
}
break;
case $this->_aImageTypes["JPEG"]:
case $this->_aImageTypes["JPG"]:
$blSuccess = resizeJpeg($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo, $iGdVer, $hDestinationImage, $iDefQuality);
break;
case $this->_aImageTypes["PNG"]:
$blSuccess = resizePng($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo, $iGdVer, $hDestinationImage);
break;
}
if ($blSuccess && !$blDisableTouch) {
@touch($sTarget);
}
stopProfile("PICTURE_RESIZE");
return $blSuccess;
}
示例15: commitFileCache
/**
* Writes all cache contents to file at once. This method was introduced due to possible
* race conditions. Cache is cleaned up after commit
*/
public function commitFileCache()
{
if (!empty($this->_aLockedFileHandles[LOCK_EX])) {
startProfile("!__SAVING CACHE__! (warning)");
foreach ($this->_aLockedFileHandles[LOCK_EX] as $sKey => $rHandle) {
if ($rHandle !== false && isset($this->_aFileCacheContents[$sKey])) {
// #0002931A truncate file once more before writing
ftruncate($rHandle, 0);
// writing cache
fwrite($rHandle, $this->_processCache($sKey, $this->_aFileCacheContents[$sKey]));
// releasing locks
$this->_releaseFile($sKey);
}
}
stopProfile("!__SAVING CACHE__! (warning)");
//empty buffer
$this->_aFileCacheContents = array();
}
}