本文整理汇总了PHP中Varien_Profiler::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Profiler::start方法的具体用法?PHP Varien_Profiler::start怎么用?PHP Varien_Profiler::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Profiler
的用法示例。
在下文中一共展示了Varien_Profiler::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
public function sendMail()
{
// Set sender information
$senderName = Mage::helper('abandonedrecover/config')->getSenderName();
$senderEmail = Mage::helper('abandonedrecover/config')->getSenderEmail();
// Get Store ID
$storeId = Mage::app()->getStore()->getId();
$template = Mage::getModel('core/email_template');
$emailTemplateId = Mage::helper('abandonedrecover/config')->getEmailTemplateId();
$modelEmailTemplate = Mage::getModel('adminhtml/email_template')->load($emailTemplateId);
$template->setTemplateStyles($modelEmailTemplate->getTemplateStyles());
$template->setTemplateText($modelEmailTemplate->getTemplateText());
$host = Mage::helper('abandonedrecover/config')->getHost();
$subject = $modelEmailTemplate->getTemplateSubject();
$collection = Mage::getResourceModel('reports/quote_collection');
$storeIds = Mage::app()->getStore()->getId();
$collection->prepareForAbandonedReport($storeIds);
foreach ($collection as $item) {
$vars = array();
$reception = array();
$reception['fromemail'] = $senderEmail;
$reception['fromname'] = $senderName;
$reception['toemail'] = $item->getCustomerEmail();
$reception['toname'] = $item->getCustomerName();
$vars['order'] = $item;
$vars['abandoned_customer'] = $item;
$template->setDesignConfig(array('area' => 'frontend', 'store' => $storeId));
Varien_Profiler::start("email_template_proccessing");
$templateProcessed = $template->getProcessedTemplate($vars, true);
Varien_Profiler::stop("email_template_proccessing");
Mage::helper('abandonedrecover')->sendMail($host, $subject, $templateProcessed, $reception);
}
return true;
}
示例2: getSkinUrl
/**
* Get skin file url
* -- Mod: Add file modification time to URL for caching purposes
*
* @param string $file
* @param array $params
* @return string
*/
public function getSkinUrl($file = null, array $params = array())
{
Varien_Profiler::start(__METHOD__);
if (empty($params['_type'])) {
$params['_type'] = 'skin';
}
if (empty($params['_default'])) {
$params['_default'] = false;
}
$this->updateParamDefaults($params);
if (!empty($file)) {
$result = $this->_fallback($file, $params, array(array(), array('_theme' => $this->getFallbackTheme()), array('_theme' => self::DEFAULT_THEME)));
}
if (!empty($file)) {
$filename = $this->getFilename($file, array('_type' => 'skin'));
if (file_exists($filename)) {
$path = pathinfo($file);
if (array_key_exists('extension', $path) && in_array($path['extension'], array('css', 'js', 'png', 'jpg', 'gif'))) {
$mtime = filemtime($filename);
$file = ($path['dirname'] != '.' ? $path['dirname'] . DS : '') . $path['filename'] . '.' . $mtime . '.' . $path['extension'];
}
}
}
$result = $this->getSkinBaseUrl($params) . (empty($file) ? '' : $file);
Varien_Profiler::stop(__METHOD__);
return $result;
}
示例3: start
public function start($sessionName = null)
{
if (isset($_SESSION)) {
return $this;
}
Varien_Profiler::start(__METHOD__ . '/setOptions');
if (is_writable(Mage::getBaseDir('session'))) {
session_save_path(Mage::getBaseDir('session'));
}
Varien_Profiler::stop(__METHOD__ . '/setOptions');
session_module_name('files');
/*
$sessionResource = Mage::getResourceSingleton('core/session');
$sessionResource->setSaveHandler();
*/
if ($this->getCookieLifetime() !== null) {
ini_set('session.gc_maxlifetime', $this->getCookieLifetime());
}
if ($this->getCookiePath() !== null) {
ini_set('session.cookie_path', $this->getCookiePath());
}
if ($this->getCookieDomain() !== null) {
ini_set('session.cookie_domain', $this->getCookieDomain());
}
if (!empty($sessionName)) {
session_name($sessionName);
}
// potential custom logic for session id (ex. switching between hosts)
$this->setSessionId();
Varien_Profiler::start(__METHOD__ . '/start');
session_start();
Varien_Profiler::stop(__METHOD__ . '/start');
return $this;
}
示例4: prepareFeed
/**
* Prepare the feed file and returns its path
*
* @param array $productsData
* @param int $storeId
* @return string
*/
public function prepareFeed(array $productsData, $storeId)
{
$mId = $this->getVendorConfig('merchant_id', $storeId);
$company = $this->getVendorConfig('company', $storeId);
if (!$mId || !$company) {
Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID and Company Name must be set.'));
}
Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
$content = implode(self::DELIMITER, array('HDR', $mId, $company, Mage::getModel('core/date')->date('Y-m-d/H:i:s'))) . self::EOL;
foreach ($productsData as $row) {
$content .= $row . self::EOL;
}
$filename = $mId . '_nmerchandis' . Mage::getModel('core/date')->date('Ymd') . '.txt';
$filepath = $this->getFeedStorageDir() . $filename;
try {
$ioAdapter = new Varien_Io_File();
$ioAdapter->setAllowCreateFolders(true);
$ioAdapter->createDestinationDir($this->getFeedStorageDir());
$ioAdapter->cd($this->getFeedStorageDir());
$ioAdapter->streamOpen($filename);
$ioAdapter->streamWrite($content);
Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
return $filepath;
} catch (Exception $e) {
Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
}
}
示例5: run
/**
* Run script
*
* @return void
*/
public function run()
{
Mage::helper('ho_import/log')->setMode('cli');
$action = $this->getArg('action');
if (empty($action)) {
echo $this->usageHelp();
} else {
Varien_Profiler::start("shell-productimport" . $this->getArg('action'));
//disable the inline translator for the cli, breaks the import if it is enabled.
Mage::getConfig()->setNode('stores/admin/dev/translate_inline/active', 0);
//initialize the translations so that we are able to translate things.
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML, Mage_Core_Model_App_Area::PART_TRANSLATE);
$actionMethodName = $action . 'Action';
if (method_exists($this, $actionMethodName)) {
$this->{$actionMethodName}();
} else {
echo "Action {$action} not found!\n";
echo $this->usageHelp();
exit(1);
}
Varien_Profiler::stop("shell-productimport-" . $this->getArg('action'));
/** @var $profiler Aoe_Profiler_Helper_Data */
if (Mage::helper('core')->isModuleEnabled('aoe_profiler') && ($profiler = Mage::helper('aoe_profiler') && $this->getArg('profiler') == '1')) {
$profiler->renderProfilerOutputToFile();
}
}
}
示例6: mergeFiles
/**
* Merge specified files into one
*
* By default will not merge, if there is already merged file exists and it
* was modified after its components
* If target file is specified, will attempt to write merged contents into it,
* otherwise will return merged content
* May apply callback to each file contents. Callback gets parameters:
* (<existing system filename>, <file contents>)
* May filter files by specified extension(s)
* Returns false on error
*
* @param array $srcFiles
* @param string|false $targetFile - file path to be written
* @param bool $mustMerge
* @param callback $beforeMergeCallback
* @param array|string $extensionsFilter
* @return bool|string
*/
public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false, $beforeMergeCallback = null, $extensionsFilter = array())
{
$content_type = pathinfo($targetFile, PATHINFO_EXTENSION);
if (!Mage::getStoreConfig('minify/general/enabled') || $content_type != 'css' && $content_type != 'js') {
return parent::mergeFiles($srcFiles, $targetFile, $mustMerge, $beforeMergeCallback, $extensionsFilter);
}
if (!Mage::getStoreConfig('minify/general/' . $content_type)) {
return parent::mergeFiles($srcFiles, $targetFile, $mustMerge, $beforeMergeCallback, $extensionsFilter);
}
try {
$shouldMinify = $this->shouldMinify($mustMerge, $targetFile, $srcFiles);
if ($shouldMinify) {
$result = parent::mergeFiles($srcFiles, false, $mustMerge, $beforeMergeCallback, $extensionsFilter);
Varien_Profiler::start('minify_file_' . $targetFile);
switch ($content_type) {
case 'css':
$minifier = new MatthiasMullie\Minify\CSS($result);
break;
case 'js':
$minifier = new MatthiasMullie\Minify\JS($result);
break;
}
$minifier->minify($targetFile);
Varien_Profiler::stop('minify_file_' . $targetFile);
}
return true;
} catch (Exception $e) {
Mage::logException($e);
}
return false;
}
示例7: uploadFile
/**
*
* Upload file to CDN
* @param string $file
* @param string $uploadName
* @param string $content_type
* @return boolean
*/
public function uploadFile($file, $uploadName, $content_type = null)
{
Varien_Profiler::start('cdn_upload_file_' . $uploadName);
if ($content_type == null) {
$content_type = Mage::helper('mycdn')->detectFileMimeType($file);
}
$adapter = $this->getAdapter();
if ($adapter) {
$fileName = Mage::helper('mycdn')->getRelativeFile($uploadName);
Mage::helper('mycdn')->addLog('[UPLOAD] ' . $fileName . ' as type ' . $content_type);
$size = new Zend_Validate_File_Size(['min' => Mage::getStoreConfig('mycdn/general/min')]);
if (!$size->isValid($file)) {
return false;
}
$result = $adapter->uploadFile($file, $fileName, $content_type);
if ($result) {
Mage::helper('mycdn')->addLog('[UPLOADED] ' . $fileName);
//saving to cache
Mage::helper('mycdn')->savePathInCache($fileName, $this->getUrl($fileName));
return true;
}
Mage::helper('mycdn')->addLog('[NOT UPLOADED] ' . $fileName);
Varien_Profiler::stop('cdn_upload_file_' . $uploadName);
return false;
}
}
示例8: getSelectedAttributesInfo
public function getSelectedAttributesInfo($product = null)
{
$attributes = array();
Varien_Profiler::start('CONFIGURABLE:' . __METHOD__);
if ($attributesOption = $this->getProduct($product)->getCustomOption('attributes')) {
$data = unserialize($attributesOption->getValue());
$this->getUsedProductAttributeIds($product);
$usedAttributes = $this->getProduct($product)->getData($this->_usedAttributes);
foreach ($data as $attributeId => $attributeValue) {
if (isset($usedAttributes[$attributeId])) {
$attribute = $usedAttributes[$attributeId];
$label = $attribute->getLabel();
$value = $attribute->getProductAttribute();
if ($value->getSourceModel()) {
if (Mage::helper('adodis_ajaxcart')->isAjaxCartEnable() && Mage::getStoreConfig('adodis_ajaxcart/qty_settings/cart_page') && (Mage::helper('adodis_ajaxcart')->getIsCartPage() || Mage::helper('adodis_ajaxcart')->getChangeAttributeCart() || Mage::helper('adodis_ajaxcart')->getChangeQtyCart())) {
$attribute_values = $attribute->getPrices() ? $attribute->getPrices() : array();
foreach ($attribute_values as $_k => $_v) {
$attribute_values[$_k]['value'] = $_v['value_index'];
}
$select = Mage::getSingleton('core/layout')->createBlock('core/html_select')->setClass('glg_cart_attribute_' . $attributeId)->setExtraParams('onchange="AjaxCartConfig.attributeCartChange(this,' . $product->getId() . ')"')->setValue($attributeValue)->setOptions($attribute_values);
$value = $select->getHtml();
} else {
$value = $value->getSource()->getOptionText($attributeValue);
}
} else {
$value = '';
}
$attributes[] = array('label' => $label, 'value' => $value);
}
}
}
Varien_Profiler::stop('CONFIGURABLE:' . __METHOD__);
return $attributes;
}
示例9: getDistriRules
/**
* Calculates all the points being earned from distribution rules.
*
* @return array
*/
public function getDistriRules()
{
Varien_Profiler::start("TBT_Rewards::Fetching earnable points for product");
if (!$this->getId()) {
return array();
}
Varien_Profiler::start("TBT_Rewards::Fetching earnable points for product (get rule ids)");
$ruleIds = Mage::helper('rewards/transfer')->getCatalogRewardsRuleIdsForProduct($this->getId());
Varien_Profiler::stop("TBT_Rewards::Fetching earnable points for product (get rule ids)");
$rules = array();
if ($ruleIds) {
foreach ($ruleIds as $ruleId) {
Varien_Profiler::start("TBT_Rewards::Fetching earnable points for product (calculate catalog points for rule)");
$pointsEarned = Mage::helper('rewards/transfer')->calculateCatalogPoints($ruleId, $this, false);
Varien_Profiler::stop("TBT_Rewards::Fetching earnable points for product (calculate catalog points for rule)");
if ($pointsEarned['amount'] == 0) {
continue;
}
$crModel = Mage::helper('rewards/transfer')->getCatalogRule($ruleId);
if ($crModel->isDistributionAction()) {
$rules[] = array('rule_id' => $ruleId, 'caption' => $crModel->getName(), 'points' => $pointsEarned);
}
}
}
Varien_Profiler::stop("TBT_Rewards::Fetching earnable points for product");
return $rules;
}
示例10: _toHtml
protected function _toHtml()
{
/* @var $template Mage_Newsletter_Model_Template */
$template = Mage::getModel('newsletter/template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$queue = Mage::getModel('newsletter/queue');
$queue->load($id);
$template->setTemplateType($queue->getNewsletterType());
$template->setTemplateText($queue->getNewsletterText());
$template->setTemplateStyles($queue->getNewsletterStyles());
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
$storeId = (int) $this->getRequest()->getParam('store_id');
if (!$storeId) {
$storeId = Mage::app()->getAnyStoreView()->getId();
}
Varien_Profiler::start("newsletter_queue_proccessing");
$vars = array();
$vars['subscriber'] = Mage::getModel('newsletter/subscriber');
$template->emulateDesign($storeId);
$templateProcessed = $template->getProcessedTemplate($vars, true);
$template->revertDesign();
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Varien_Profiler::stop("newsletter_queue_proccessing");
return $templateProcessed;
}
示例11: fetchView
/**
* Retrieve block view from file (template)
*
* @param string $fileName
* @return string
*/
public function fetchView($fileName)
{
Varien_Profiler::start($fileName);
extract($this->_viewVars);
$do = $this->getDirectOutput();
if (!$do) {
ob_start();
}
if ($this->getShowTemplateHints()) {
echo '<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;"><div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial; text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'" onmouseout="this.style.zIndex=\'998\'" title="' . $fileName . '">' . $fileName . '</div>';
if (self::$_showTemplateHintsBlocks) {
$thisClass = get_class($this);
echo '<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial; text-align:left !important; z-index:998;" onmouseover="this.style.zIndex=\'999\'" onmouseout="this.style.zIndex=\'998\'" title="' . $thisClass . '">' . $thisClass . '</div>';
}
}
try {
$template = $this->_twig->loadTemplate($fileName);
echo $template->render($this->_viewVars);
} catch (Exception $e) {
ob_get_clean();
throw $e;
}
if ($this->getShowTemplateHints()) {
echo '</div>';
}
if (!$do) {
$html = ob_get_clean();
} else {
$html = '';
}
Varien_Profiler::stop($fileName);
return $html;
}
示例12: toStr
public function toStr()
{
Varien_Profiler::start(__CLASS__ . '::' . __FUNCTION__);
// try {
if ($this->getImageFile()) {
$this->_getModel()->setBaseFile($this->getImageFile());
} else {
$this->_getModel()->setBaseFile($this->getItem()->getData($this->_getModel()->getDestinationSubdir()));
}
if ($this->_getModel()->isCached()) {
return $this->_getModel()->getUrl();
} else {
if ($this->_scheduleRotate) {
$this->_getModel()->rotate($this->getAngle());
}
if ($this->_scheduleResize) {
$this->_getModel()->resize();
}
if ($this->_scheduleCrop) {
$this->_getModel()->crop();
}
if ($this->getWatermark()) {
$this->_getModel()->setWatermark($this->getWatermark());
}
$url = $this->_getModel()->saveFile()->getUrl();
}
// } catch (Mage_Exception $e) {
// $url = Mage::getDesign()->getSkinUrl($this->getPlaceholder());
// }
Varien_Profiler::stop(__CLASS__ . '::' . __FUNCTION__);
return $url;
}
示例13: _toHtml
protected function _toHtml()
{
$template = AO::getModel('newsletter/template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$template->load($id);
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
}
if (VPROF) {
Varien_Profiler::start("email_template_proccessing");
}
$vars = array();
if ($this->getRequest()->getParam('subscriber')) {
$vars['subscriber'] = AO::getModel('newsletter/subscriber')->load($this->getRequest()->getParam('subscriber'));
}
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
if (VPROF) {
Varien_Profiler::stop("email_template_proccessing");
}
return $templateProcessed;
}
示例14: getSelectedAttributesInfoId
/**
* Retrieve Selected Attributes info
*
* @param Mage_Catalog_Model_Product $product
* @return array
*/
public function getSelectedAttributesInfoId($product = null)
{
$attributes = array();
Varien_Profiler::start('CONFIGURABLE:' . __METHOD__);
if ($attributesOption = $this->getProduct($product)->getCustomOption('attributes')) {
$data = unserialize($attributesOption->getValue());
$this->getUsedProductAttributeIds($product);
$usedAttributes = $this->getProduct($product)->getData($this->_usedAttributes);
foreach ($data as $attributeId => $attributeValue) {
if (isset($usedAttributes[$attributeId])) {
$attribute = $usedAttributes[$attributeId];
//$label = $attribute->getLabel();
$label = $attribute->getAttributeId();
$value = $attribute->getProductAttribute();
if ($value->getSourceModel()) {
//$value = $value->getSource()->getOptionText($attributeValue);
$value = $value->getSource()->getOptionId($attributeValue);
} else {
$value = '';
}
//$attributes[] = array('label'=>$label, 'value'=>$value);
$attributes[$label] = $value;
}
}
}
Varien_Profiler::stop('CONFIGURABLE:' . __METHOD__);
return $attributes;
}
示例15: updateCatalogRulesHash
public function updateCatalogRulesHash($observer)
{
Varien_Profiler::start("TBT_Rewards:: Update rewards rule information on product(s)");
//Mage::log("Update rewards rule information on product(s)");
//@nelkaake Friday March 12, 2010 03:48:20 PM : Was this was a product save/delete/update request?
//@nelkaake Changed on Wednesday September 29, 2010: Some Magento stores dont parse the controller action properly so it applies all rules on save. Fixed by checking passed product
$target_product_id = null;
$action = $observer->getControllerAction();
if ($action) {
$request = $action->getRequest();
$target_product_id = $request->getParam("id");
if (!$target_product_id) {
$target_product_id = null;
}
//if no product id available, reset our assumption because this must be some other unrecognized request.
}
$product = $observer->getProduct();
if ($product) {
$target_product_id = $product->getEntityId();
if (!$target_product_id) {
$target_product_id = null;
}
//if no product id
//available, reset our assumption because this must be some other
//unrecognized request.
}
//@nelkaake Changed on Wednesday September 22, 2010:
$this->updateRulesHashForDay(Mage::helper('rewards/datetime')->yesterday(), $target_product_id);
$this->updateRulesHashForDay(Mage::helper('rewards/datetime')->now(), $target_product_id);
$this->updateRulesHashForDay(Mage::helper('rewards/datetime')->tomorrow(), $target_product_id);
Varien_Profiler::stop("TBT_Rewards:: Update rewards rule information on product(s)");
return $this;
}