當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Event_Observer::getPage方法代碼示例

本文整理匯總了PHP中Varien_Event_Observer::getPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getPage方法的具體用法?PHP Varien_Event_Observer::getPage怎麽用?PHP Varien_Event_Observer::getPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Varien_Event_Observer的用法示例。


在下文中一共展示了Varien_Event_Observer::getPage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addPageTag

 /**
  * Add CMS page tag on all CMS pages except homepage
  *
  * @param Varien_Event_Observer $observer
  */
 public function addPageTag(Varien_Event_Observer $observer)
 {
     $pageId = $observer->getPage()->getIdentifier();
     $homePageId = Mage::getStoreConfig('web/default/cms_home_page');
     if ($pageId != $homePageId) {
         $observer->getControllerAction()->getLayout()->getUpdate()->addHandle('mbiz_trackingtags_page');
     }
 }
開發者ID:alexis-hermanns,項目名稱:Mbiz_TrackingTags,代碼行數:13,代碼來源:Observer.php

示例2: trackFiles

 /**
  * @param Varien_Event_Observer $event
  */
 public function trackFiles($event)
 {
     $page = $event->getPage();
     $storeId = $event->getStoreId();
     $pageId = $page->getId();
     $pageContent = $page->getContent();
     $links = array();
     $allowedFileTypes = $this->getAllowedFileTypesRegex();
     preg_match_all('/<a href=\\"\\/([^\\"]*)\\.' . $allowedFileTypes . '\\".*>.*<\\/a>/iU', $pageContent, $links);
     if (empty($links[0])) {
         // bail out if we didn't find any file links, save a couple CPU cycles
         return;
     }
     $foundFiles = array();
     $trackedFiles = $this->getTrackedFilesForPage($pageId);
     $numberOfFiles = count($links[0]);
     for ($i = 0; $i < $numberOfFiles; $i++) {
         $foundFiles[] = '/' . htmlspecialchars_decode($links[1][$i]) . '.' . $links[2][$i];
     }
     $addedFiles = array_diff($foundFiles, $trackedFiles);
     $removedFiles = array_diff($trackedFiles, $foundFiles);
     $this->addFilesToTracking($storeId, $pageId, $addedFiles);
     $this->removeFilesFromTracking($storeId, $pageId, $removedFiles);
 }
開發者ID:VadzimBelski-ScienceSoft,項目名稱:magento-MagSolr,代碼行數:27,代碼來源:Page.php

示例3: cmsPageRender

 /**
  * add CMSPAGE_{ID} handle to layout on cms page render
  *
  * @param Varien_Event_Observer $observer
  * @return Varien_Event_Observer
  */
 public function cmsPageRender(Varien_Event_Observer $observer)
 {
     $observer->getControllerAction()->getLayout()->getUpdate()->addHandle('CMSPAGE_' . $observer->getPage()->getId());
 }
開發者ID:OurLaborisJoy,項目名稱:FireGento_FlexCms,代碼行數:10,代碼來源:Observer.php

示例4: addBarcode

 /**
  * Adds a barcode representing the order number to the shipment if activated.
  *
  * @param  Varien_Event_Observer $observer observer which is passed by magento
  *
  * @return FireGento_Pdf_Model_Observer
  */
 public function addBarcode(Varien_Event_Observer $observer)
 {
     if (!Mage::getStoreConfigFlag('sales_pdf/shipment/order_id_as_barcode')) {
         return $this;
     }
     $page = $observer->getPage();
     $order = $observer->getOrder();
     $barcodeConfig = array('drawText' => false, 'orientation' => 90, 'text' => $order->getIncrementId());
     $rendererConfig = array('verticalPosition' => 'middle', 'moduleSize' => 0.9);
     // create dummy Zend_Pdf object, which just stores the current page, so that we can pass it in
     // Zend_Barcode_Renderer_Pdf->setResource()
     $pdf = new Zend_Pdf();
     $pdf->pages[] = $page;
     /** @var $renderer Zend_Barcode_Renderer_Pdf */
     $renderer = Zend_Barcode::factory('code128', 'pdf', $barcodeConfig, $rendererConfig)->setResource($pdf, 0);
     // calculate left offset so that barcode is printed on the right with a little margin
     $leftOffset = $page->getWidth() - $renderer->getBarcode()->getWidth(true) * $renderer->getModuleSize() - 10;
     $renderer->setLeftOffset($leftOffset);
     $renderer->draw();
     return $this;
 }
開發者ID:codedge,項目名稱:firegento-pdf,代碼行數:28,代碼來源:Observer.php


注:本文中的Varien_Event_Observer::getPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。