本文整理汇总了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');
}
}
示例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);
}
示例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());
}
示例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;
}