当前位置: 首页>>代码示例>>PHP>>正文


PHP Magento_Profiler类代码示例

本文整理汇总了PHP中Magento_Profiler的典型用法代码示例。如果您正苦于以下问题:PHP Magento_Profiler类的具体用法?PHP Magento_Profiler怎么用?PHP Magento_Profiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Magento_Profiler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _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();
 }
开发者ID:nemphys,项目名称:magento2,代码行数:32,代码来源:Tabs.php

示例2: _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;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:Preview.php

示例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;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:15,代码来源:Zend.php

示例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');
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:17,代码来源:Zend.php

示例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;
 }
开发者ID:relue,项目名称:magento2,代码行数:19,代码来源:Observer.php

示例6: _aggregateTimerValues

 /**
  * Calculate metric value from set of timer names
  *
  * @param array $timerNames
  * @param string $fetchKey
  * @return int
  */
 protected function _aggregateTimerValues(array $timerNames, $fetchKey = Magento_Profiler::FETCH_AVG)
 {
     /* Prepare pattern that matches timers with deepest nesting level only */
     $nestingSep = preg_quote(Magento_Profiler::NESTING_SEPARATOR, '/');
     array_map('preg_quote', $timerNames, array('/'));
     $pattern = '/(?<=' . $nestingSep . '|^)(?:' . implode('|', $timerNames) . ')$/';
     /* Sum profiler values for matched timers */
     $result = 0;
     foreach ($this->_getTimers() as $timerId) {
         if (preg_match($pattern, $timerId)) {
             $result += Magento_Profiler::fetch($timerId, $fetchKey);
         }
     }
     /* Convert seconds -> milliseconds */
     $result = round($result * 1000);
     return $result;
 }
开发者ID:relue,项目名称:magento2,代码行数:24,代码来源:OutputBamboo.php

示例7: _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;
 }
开发者ID:relue,项目名称:magento2,代码行数:20,代码来源:Preview.php

示例8: _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;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:29,代码来源:Preview.php

示例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;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:13,代码来源:Category.php

示例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);
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:35,代码来源:Mage.php

示例11: start

 /**
  * Configure session handler and start session
  *
  * @param string $sessionName
  * @return Mage_Core_Model_Session_Abstract
  */
 public function start($sessionName = null)
 {
     if (isset($_SESSION) && !$this->getSkipEmptySessionCheck()) {
         return $this;
     }
     switch ($this->getSessionSaveMethod()) {
         case 'db':
             ini_set('session.save_handler', 'user');
             $sessionResource = Mage::getResourceSingleton('Mage_Core_Model_Resource_Session');
             /* @var $sessionResource Mage_Core_Model_Resource_Session */
             $sessionResource->setSaveHandler();
             break;
         case 'memcache':
             ini_set('session.save_handler', 'memcache');
             session_save_path($this->getSessionSavePath());
             break;
         case 'memcached':
             ini_set('session.save_handler', 'memcached');
             session_save_path($this->getSessionSavePath());
             break;
         case 'eaccelerator':
             ini_set('session.save_handler', 'eaccelerator');
             break;
         default:
             session_module_name($this->getSessionSaveMethod());
             if (is_writable($this->getSessionSavePath())) {
                 session_save_path($this->getSessionSavePath());
             }
             break;
     }
     $cookie = $this->getCookie();
     // session cookie params
     $cookieParams = array('lifetime' => 0, 'path' => $cookie->getPath(), 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), 'httponly' => $cookie->getHttponly());
     if (!$cookieParams['httponly']) {
         unset($cookieParams['httponly']);
         if (!$cookieParams['secure']) {
             unset($cookieParams['secure']);
             if (!$cookieParams['domain']) {
                 unset($cookieParams['domain']);
             }
         }
     }
     if (isset($cookieParams['domain'])) {
         $cookieParams['domain'] = $cookie->getDomain();
     }
     call_user_func_array('session_set_cookie_params', $cookieParams);
     if (!empty($sessionName)) {
         $this->setSessionName($sessionName);
     }
     // potential custom logic for session id (ex. switching between hosts)
     $this->setSessionId();
     Magento_Profiler::start('session_start');
     $sessionCacheLimiter = Mage::getConfig()->getNode('global/session_cache_limiter');
     if ($sessionCacheLimiter) {
         session_cache_limiter((string) $sessionCacheLimiter);
     }
     session_start();
     Magento_Profiler::stop('session_start');
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:66,代码来源:Abstract.php

示例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;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:30,代码来源:Area.php

示例13: _getTimers

 /**
  * Retrieve the list of timer Ids
  *
  * @return array
  */
 protected function _getTimers()
 {
     $pattern = $this->_filter;
     $timerIds = $this->_getSortedTimers();
     $result = array();
     foreach ($timerIds as $timerId) {
         /* Filter by timer id pattern */
         if ($pattern && !preg_match($pattern, $timerId)) {
             continue;
         }
         /* Filter by column value thresholds */
         $skip = false;
         foreach ($this->_thresholds as $fetchKey => $minAllowedValue) {
             $skip = Magento_Profiler::fetch($timerId, $fetchKey) < $minAllowedValue;
             /* First value not less than the allowed one forces to include timer to the result */
             if (!$skip) {
                 break;
             }
         }
         if (!$skip) {
             $result[] = $timerId;
         }
     }
     return $result;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:30,代码来源:OutputAbstract.php

示例14: _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;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:53,代码来源:Collection.php

示例15: endTest

 /**
  * A test ended.
  * Method signature is implied by implemented interface, not all parameters are needed.
  *
  * @param  PHPUnit_Framework_Test $test
  * @param  float                  $time
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_Warning) {
         return;
     }
     $this->_notifyObservers('endTest', true);
     $this->_currentTest = null;
     Magento_Profiler::stop('integration_test');
 }
开发者ID:natxetee,项目名称:magento2,代码行数:18,代码来源:Listener.php


注:本文中的Magento_Profiler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。