本文整理汇总了PHP中Magento_Profiler::stop方法的典型用法代码示例。如果您正苦于以下问题:PHP Magento_Profiler::stop方法的具体用法?PHP Magento_Profiler::stop怎么用?PHP Magento_Profiler::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento_Profiler
的用法示例。
在下文中一共展示了Magento_Profiler::stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _toHtml
protected function _toHtml()
{
/* @var $template Mage_Newsletter_Model_Template */
$template = Mage::getModel('Mage_Newsletter_Model_Template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$queue = Mage::getModel('Mage_Newsletter_Model_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()->getDefaultStoreView()->getId();
}
Magento_Profiler::start("newsletter_queue_proccessing");
$vars = array();
$vars['subscriber'] = Mage::getModel('Mage_Newsletter_Model_Subscriber');
$template->emulateDesign($storeId);
$templateProcessed = $template->getProcessedTemplate($vars, true);
$template->revertDesign();
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("newsletter_queue_proccessing");
return $templateProcessed;
}
示例2: _beforeToHtml
protected function _beforeToHtml()
{
Magento_Profiler::start('customer/tabs');
/*
if (Mage::registry('current_customer')->getId()) {
$this->addTab('view', array(
'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Customer View'),
'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_View')->toHtml(),
'active' => true
));
}
*/
$this->addTab('account', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Account Information'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Account')->initForm()->toHtml(), 'active' => Mage::registry('current_customer')->getId() ? false : true));
$this->addTab('addresses', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Addresses'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses')->initForm()->toHtml()));
// load: Orders, Shopping Cart, Wishlist, Product Reviews, Product Tags - with ajax
if (Mage::registry('current_customer')->getId()) {
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Sales::actions_view')) {
$this->addTab('orders', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Orders'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/orders', array('_current' => true))));
}
$this->addTab('cart', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Shopping Cart'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/carts', array('_current' => true))));
$this->addTab('wishlist', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Wishlist'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/wishlist', array('_current' => true))));
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Newsletter::subscriber')) {
$this->addTab('newsletter', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Newsletter'), 'content' => $this->getLayout()->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter')->initForm()->toHtml()));
}
if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Review::reviews_ratings')) {
$this->addTab('reviews', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Product Reviews'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/productReviews', array('_current' => true))));
}
}
$this->_updateActiveTab();
Magento_Profiler::stop('customer/tabs');
return parent::_beforeToHtml();
}
示例3: init
/**
* Initialization session namespace
*
* @param string $namespace
*/
public function init($namespace)
{
if (!Zend_Session::sessionExists()) {
$this->start();
}
Magento_Profiler::start(__METHOD__ . '/init');
$this->_namespace = new Zend_Session_Namespace($namespace, Zend_Session_Namespace::SINGLE_INSTANCE);
Magento_Profiler::stop(__METHOD__ . '/init');
return $this;
}
示例4: __construct
/**
* @param string $definitionsFile
* @param Zend\Di\Di $diInstance
*/
public function __construct($definitionsFile = null, Zend\Di\Di $diInstance = null)
{
Magento_Profiler::start('di');
if (is_file($definitionsFile) && is_readable($definitionsFile)) {
$definition = new Magento_Di_Definition_ArrayDefinition_Zend(unserialize(file_get_contents($definitionsFile)));
} else {
$definition = new Magento_Di_Definition_RuntimeDefinition_Zend();
}
$this->_di = $diInstance ? $diInstance : new Magento_Di();
$this->_di->setDefinitionList(new Magento_Di_DefinitionList_Zend($definition));
$this->_di->instanceManager()->addSharedInstance($this, 'Magento_ObjectManager');
Magento_Profiler::stop('di');
}
示例5: dispatch
/**
* Dispatches an event to observer's callback
*
* @param Varien_Event $event
* @return Varien_Event_Observer
*/
public function dispatch(Varien_Event $event)
{
if (!$this->isValidFor($event)) {
return $this;
}
$callback = $this->getCallback();
$this->setEvent($event);
$_profilerKey = 'OBSERVER: ' . (is_object($callback[0]) ? get_class($callback[0]) : (string) $callback[0]) . ' -> ' . $callback[1];
Magento_Profiler::start($_profilerKey);
call_user_func($callback, $this);
Magento_Profiler::stop($_profilerKey);
return $this;
}
示例6: _toHtml
protected function _toHtml()
{
$template = Mage::getModel('Mage_Core_Model_Email_Template');
if ($id = (int) $this->getRequest()->getParam('id')) {
$template->load($id);
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
$template->setTemplateText($this->escapeHtml($template->getTemplateText()));
Magento_Profiler::start("email_template_proccessing");
$vars = array();
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("email_template_proccessing");
return $templateProcessed;
}
示例7: _toHtml
/**
* Prepare html output
*
* @return string
*/
protected function _toHtml()
{
/** @var $template Mage_Core_Model_Email_Template */
$template = Mage::getModel('Mage_Core_Model_Email_Template');
$id = (int) $this->getRequest()->getParam('id');
if ($id) {
$template->load($id);
} else {
$template->setTemplateType($this->getRequest()->getParam('type'));
$template->setTemplateText($this->getRequest()->getParam('text'));
$template->setTemplateStyles($this->getRequest()->getParam('styles'));
}
/* @var $filter Mage_Core_Model_Input_Filter_MaliciousCode */
$filter = Mage::getSingleton('Mage_Core_Model_Input_Filter_MaliciousCode');
$template->setTemplateText($filter->filter($template->getTemplateText()));
Magento_Profiler::start("email_template_proccessing");
$vars = array();
$templateProcessed = $template->getProcessedTemplate($vars, true);
if ($template->isPlain()) {
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
}
Magento_Profiler::stop("email_template_proccessing");
return $templateProcessed;
}
示例8: updateRuleProductData
/**
* Update products which are matched for rule
*
* @param Mage_CatalogRule_Model_Rule $rule
*
* @return Mage_CatalogRule_Model_Resource_Rule
*/
public function updateRuleProductData(Mage_CatalogRule_Model_Rule $rule)
{
$ruleId = $rule->getId();
$write = $this->_getWriteAdapter();
$write->beginTransaction();
if ($rule->getProductsFilter()) {
$write->delete($this->getTable('catalogrule_product'), array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter()));
} else {
$write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
}
if (!$rule->getIsActive()) {
$write->commit();
return $this;
}
$websiteIds = $rule->getWebsiteIds();
if (!is_array($websiteIds)) {
$websiteIds = explode(',', $websiteIds);
}
if (empty($websiteIds)) {
return $this;
}
Magento_Profiler::start('__MATCH_PRODUCTS__');
$productIds = $rule->getMatchingProductIds();
Magento_Profiler::stop('__MATCH_PRODUCTS__');
$customerGroupIds = $rule->getCustomerGroupIds();
$fromTime = strtotime($rule->getFromDate());
$toTime = strtotime($rule->getToDate());
$toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
$sortOrder = (int) $rule->getSortOrder();
$actionOperator = $rule->getSimpleAction();
$actionAmount = $rule->getDiscountAmount();
$subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
$subActionAmount = $rule->getSubDiscountAmount();
$actionStop = $rule->getStopRulesProcessing();
$rows = array();
try {
foreach ($productIds as $productId) {
foreach ($websiteIds as $websiteId) {
foreach ($customerGroupIds as $customerGroupId) {
$rows[] = array('rule_id' => $ruleId, 'from_time' => $fromTime, 'to_time' => $toTime, 'website_id' => $websiteId, 'customer_group_id' => $customerGroupId, 'product_id' => $productId, 'action_operator' => $actionOperator, 'action_amount' => $actionAmount, 'action_stop' => $actionStop, 'sort_order' => $sortOrder, 'sub_simple_action' => $subActionOperator, 'sub_discount_amount' => $subActionAmount);
if (count($rows) == 1000) {
$write->insertMultiple($this->getTable('catalogrule_product'), $rows);
$rows = array();
}
}
}
}
if (!empty($rows)) {
$write->insertMultiple($this->getTable('catalogrule_product'), $rows);
}
$write->commit();
} catch (Exception $e) {
$write->rollback();
throw $e;
}
return $this;
}
示例9: getCategoryIdUrl
/**
* Retrieve category id URL
*
* @return string
*/
public function getCategoryIdUrl()
{
Magento_Profiler::start('REGULAR: ' . __METHOD__, array('group' => 'REGULAR', 'method' => __METHOD__));
$urlKey = $this->getUrlKey() ? $this->getUrlKey() : $this->formatUrlKey($this->getName());
$url = $this->getUrlInstance()->getUrl('catalog/category/view', array('s' => $urlKey, 'id' => $this->getId()));
Magento_Profiler::stop('REGULAR: ' . __METHOD__);
return $url;
}
示例10: run
/**
* Front end main entry point
*
* @param string $code
* @param string $type
* @param string|array $options
*/
public static function run($code = '', $type = 'store', $options = array())
{
try {
Magento_Profiler::start('mage');
self::setRoot();
if (isset($options['edition'])) {
self::$_currentEdition = $options['edition'];
}
self::$_app = new Mage_Core_Model_App();
if (isset($options['request'])) {
self::$_app->setRequest($options['request']);
}
if (isset($options['response'])) {
self::$_app->setResponse($options['response']);
}
self::$_events = new Varien_Event_Collection();
self::_setIsInstalled($options);
self::_setConfigModel($options);
self::$_app->run(array('scope_code' => $code, 'scope_type' => $type, 'options' => $options));
Magento_Profiler::stop('mage');
} catch (Mage_Core_Model_Session_Exception $e) {
header('Location: ' . self::getBaseUrl());
} catch (Mage_Core_Model_Store_Exception $e) {
require_once self::getBaseDir() . '/pub/errors/404.php';
} catch (Exception $e) {
self::printException($e);
}
}
示例11: dispatchEvent
public function dispatchEvent($eventName, $args)
{
foreach ($this->_events as $area => $events) {
if (!isset($events[$eventName])) {
$eventConfig = $this->getConfig()->getEventConfig($area, $eventName);
if (!$eventConfig) {
$this->_events[$area][$eventName] = false;
continue;
}
$observers = array();
foreach ($eventConfig->observers->children() as $obsName => $obsConfig) {
$observers[$obsName] = array('type' => (string) $obsConfig->type, 'model' => $obsConfig->class ? (string) $obsConfig->class : $obsConfig->getClassName(), 'method' => (string) $obsConfig->method, 'args' => (array) $obsConfig->args);
}
$events[$eventName]['observers'] = $observers;
$this->_events[$area][$eventName]['observers'] = $observers;
}
if (false === $events[$eventName]) {
continue;
} else {
$event = new Varien_Event($args);
$event->setName($eventName);
$observer = new Varien_Event_Observer();
}
foreach ($events[$eventName]['observers'] as $obsName => $obs) {
$observer->setData(array('event' => $event));
Magento_Profiler::start('OBSERVER:' . $obsName);
switch ($obs['type']) {
case 'disabled':
break;
case 'object':
case 'model':
$method = $obs['method'];
$observer->addData($args);
$object = Mage::getModel($obs['model']);
$this->_callObserverMethod($object, $method, $observer);
break;
default:
$method = $obs['method'];
$observer->addData($args);
$object = Mage::getSingleton($obs['model']);
$this->_callObserverMethod($object, $method, $observer);
break;
}
Magento_Profiler::stop('OBSERVER:' . $obsName);
}
}
return $this;
}
示例12: _loadPart
/**
* Loading part of area
*
* @param string $part
* @return Mage_Core_Model_App_Area
*/
protected function _loadPart($part)
{
if (isset($this->_loadedParts[$part])) {
return $this;
}
Magento_Profiler::start('load_area:' . $this->_code . '.' . $part);
switch ($part) {
case self::PART_CONFIG:
$this->_initConfig();
break;
case self::PART_EVENTS:
$this->_initEvents();
break;
case self::PART_TRANSLATE:
$this->_initTranslate();
break;
case self::PART_DESIGN:
$this->_initDesign();
break;
}
$this->_loadedParts[$part] = true;
Magento_Profiler::stop('load_area:' . $this->_code . '.' . $part);
return $this;
}
示例13: _assignProducts
/**
* Add products to items and item options
*
* @return Mage_Sales_Model_Resource_Quote_Item_Collection
*/
protected function _assignProducts()
{
Magento_Profiler::start('QUOTE:' . __METHOD__);
$productIds = array();
foreach ($this as $item) {
$productIds[] = (int) $item->getProductId();
}
$this->_productIds = array_merge($this->_productIds, $productIds);
$productCollection = Mage::getModel('Mage_Catalog_Model_Product')->getCollection()->setStoreId($this->getStoreId())->addIdFilter($this->_productIds)->addAttributeToSelect(Mage::getSingleton('Mage_Sales_Model_Quote_Config')->getProductAttributes())->addOptionsToResult()->addStoreFilter()->addUrlRewrite()->addTierPriceData();
Mage::dispatchEvent('prepare_catalog_product_collection_prices', array('collection' => $productCollection, 'store_id' => $this->getStoreId()));
Mage::dispatchEvent('sales_quote_item_collection_products_after_load', array('product_collection' => $productCollection));
$recollectQuote = false;
foreach ($this as $item) {
$product = $productCollection->getItemById($item->getProductId());
if ($product) {
$product->setCustomOptions(array());
$qtyOptions = array();
$optionProductIds = array();
foreach ($item->getOptions() as $option) {
/**
* Call type-specific logic for product associated with quote item
*/
$product->getTypeInstance()->assignProductToOption($productCollection->getItemById($option->getProductId()), $option, $product);
if (is_object($option->getProduct()) && $option->getProduct()->getId() != $product->getId()) {
$optionProductIds[$option->getProduct()->getId()] = $option->getProduct()->getId();
}
}
if ($optionProductIds) {
foreach ($optionProductIds as $optionProductId) {
$qtyOption = $item->getOptionByCode('product_qty_' . $optionProductId);
if ($qtyOption) {
$qtyOptions[$optionProductId] = $qtyOption;
}
}
}
$item->setQtyOptions($qtyOptions)->setProduct($product);
} else {
$item->isDeleted(true);
$recollectQuote = true;
}
$item->checkData();
}
if ($recollectQuote && $this->_quote) {
$this->_quote->collectTotals();
}
Magento_Profiler::stop('QUOTE:' . __METHOD__);
return $this;
}
示例14: _afterLoad
/**
* After Load Entity process
*
* @param Varien_Object $object
* @return Mage_Eav_Model_Entity_Abstract
*/
protected function _afterLoad(Varien_Object $object)
{
Magento_Profiler::start('after_load');
$this->walkAttributes('backend/afterLoad', array($object));
Magento_Profiler::stop('after_load');
return $this;
}
示例15: getSelectedAttributesInfo
/**
* Retrieve Selected Attributes info
*
* @param Mage_Catalog_Model_Product $product
* @return array
*/
public function getSelectedAttributesInfo($product)
{
$attributes = array();
Magento_Profiler::start('CONFIGURABLE:' . __METHOD__);
if ($attributesOption = $product->getCustomOption('attributes')) {
$data = unserialize($attributesOption->getValue());
$this->getUsedProductAttributeIds($product);
$usedAttributes = $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()) {
$value = $value->getSource()->getOptionText($attributeValue);
} else {
$value = '';
}
$attributes[] = array('label' => $label, 'value' => $value);
}
}
}
Magento_Profiler::stop('CONFIGURABLE:' . __METHOD__);
return $attributes;
}