Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mage_Cms - DOC block update #694

Merged
merged 4 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/code/core/Mage/Cms/Block/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms block content block
*
* @method int getBlockId()
* @method $this setBlockId(int $int)
*
* @category Mage
* @package Mage_Cms
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
{

/**
* Initialize cache
*
Expand Down Expand Up @@ -63,7 +64,7 @@ protected function _toHtml()
->setStoreId(Mage::app()->getStore()->getId())
->load($blockId);
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
/* @var Mage_Cms_Helper_Data $helper */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$html = $processor->filter($block->getContent());
Expand Down
9 changes: 4 additions & 5 deletions app/code/core/Mage/Cms/Block/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms page content block
*
* @method int getPageId()
*
* @category Mage
* @package Mage_Cms
* @author Magento Core Team <core@magentocommerce.com>
Expand Down Expand Up @@ -56,9 +57,7 @@ public function getPage()
}

/**
* Prepare global layout
*
* @return $this
* @inheritDoc
*/
protected function _prepareLayout()
{
Expand Down Expand Up @@ -120,7 +119,7 @@ protected function _prepareLayout()
*/
protected function _toHtml()
{
/* @var $helper Mage_Cms_Helper_Data */
/* @var Mage_Cms_Helper_Data $helper */
$helper = Mage::helper('cms');
$processor = $helper->getPageTemplateProcessor();
$html = $processor->filter($this->getPage()->getContent());
Expand Down
5 changes: 3 additions & 2 deletions app/code/core/Mage/Cms/Block/Widget/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms Static Block Widget
*
* @category Mage
* @package Mage_Cms
* @author Magento Core Team <core@magentocommerce.com>
*
* @method int getBlockId()
* @method $this setText(string $value)
*/
class Mage_Cms_Block_Widget_Block extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
{
Expand Down Expand Up @@ -78,7 +80,6 @@ protected function _beforeToHtml()
->setStoreId(Mage::app()->getStore()->getId())
->load($blockId);
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$this->setText($processor->filter($block->getContent()));
Expand Down
18 changes: 8 additions & 10 deletions app/code/core/Mage/Cms/Block/Widget/Page/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
* @author Magento Core Team <core@magentocommerce.com>
*/

class Mage_Cms_Block_Widget_Page_Link
extends Mage_Core_Block_Html_Link
implements Mage_Widget_Block_Interface
class Mage_Cms_Block_Widget_Page_Link extends Mage_Core_Block_Html_Link implements Mage_Widget_Block_Interface
{
/**
* Prepared href attribute
*
* @var string
* @var string|null
*/
protected $_href;

Expand Down Expand Up @@ -69,7 +67,7 @@ public function getHref()
$this->_href = '';
if ($this->getData('href')) {
$this->_href = $this->getData('href');
} else if ($this->getData('page_id')) {
} elseif ($this->getData('page_id')) {
$this->_href = Mage::helper('cms/page')->getPageUrl($this->getData('page_id'));
}
}
Expand All @@ -90,9 +88,9 @@ public function getTitle()
if ($this->getData('title') !== null) {
// compare to null used here bc user can specify blank title
$this->_title = $this->getData('title');
} else if ($this->getData('page_id')) {
} elseif ($this->getData('page_id')) {
$this->_title = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getData('page_id'));
} else if ($this->getData('href')) {
} elseif ($this->getData('href')) {
$this->_title = Mage::getResourceSingleton('cms/page')->setStore(Mage::app()->getStore())
->getCmsPageTitleByIdentifier($this->getData('href'));
}
Expand All @@ -112,12 +110,12 @@ public function getAnchorText()
{
if ($this->getData('anchor_text')) {
$this->_anchorText = $this->getData('anchor_text');
} else if ($this->getTitle()) {
} elseif ($this->getTitle()) {
$this->_anchorText = $this->getTitle();
} else if ($this->getData('href')) {
} elseif ($this->getData('href')) {
$this->_anchorText = Mage::getResourceSingleton('cms/page')->setStore(Mage::app()->getStore())
->getCmsPageTitleByIdentifier($this->getData('href'));
} else if ($this->getData('page_id')) {
} elseif ($this->getData('page_id')) {
$this->_anchorText = Mage::getResourceSingleton('cms/page')->getCmsPageTitleById($this->getData('page_id'));
} else {
$this->_anchorText = $this->getData('href');
Expand Down
3 changes: 1 addition & 2 deletions app/code/core/Mage/Cms/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms Controller Router
*
Expand All @@ -41,7 +40,7 @@ class Mage_Cms_Controller_Router extends Mage_Core_Controller_Varien_Router_Abst
*/
public function initControllerRouters($observer)
{
/* @var $front Mage_Core_Controller_Varien_Front */
/* @var Mage_Core_Controller_Varien_Front $front */
$front = $observer->getEvent()->getFront();

$front->addRouter('cms', $this);
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Cms/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Mage_Cms_Helper_Data extends Mage_Core_Helper_Abstract
/**
* Retrieve Template processor for Page Content
*
* @return Varien_Filter_Template
* @return Mage_Core_Model_Abstract|Varien_Filter_Template
*/
public function getPageTemplateProcessor()
{
Expand All @@ -52,7 +52,7 @@ public function getPageTemplateProcessor()
/**
* Retrieve Template processor for Block Content
*
* @return Varien_Filter_Template
* @return Mage_Core_Model_Abstract|Varien_Filter_Template
*/
sreichel marked this conversation as resolved.
Show resolved Hide resolved
public function getBlockTemplateProcessor()
{
Expand Down
13 changes: 6 additions & 7 deletions app/code/core/Mage/Cms/Helper/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Mage_Cms_Helper_Page extends Mage_Core_Helper_Abstract
* Call from controller action
*
* @param Mage_Core_Controller_Front_Action $action
* @param integer $pageId
* @param string $pageId
* @return boolean
*/
public function renderPage(Mage_Core_Controller_Front_Action $action, $pageId = null)
Expand All @@ -55,14 +55,13 @@ public function renderPage(Mage_Core_Controller_Front_Action $action, $pageId =
/**
* Renders CMS page
*
* @param Mage_Core_Controller_Front_Action $action
* @param integer $pageId
* @param Mage_Core_Controller_Varien_Action $action
* @param string $pageId
* @param bool $renderLayout
* @return boolean
*/
protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
{

$page = Mage::getSingleton('cms/page');
if (!is_null($pageId) && $pageId!==$page->getId()) {
$delimeterPosition = strrpos($pageId, '|');
Expand Down Expand Up @@ -146,8 +145,8 @@ protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pag
* Also takes third parameter which allows not run renderLayout method.
*
* @param Mage_Core_Controller_Varien_Action $action
* @param $pageId
* @param $renderLayout
* @param string $pageId
* @param bool $renderLayout
* @return bool
*/
public function renderPageExtended(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
Expand All @@ -159,7 +158,7 @@ public function renderPageExtended(Mage_Core_Controller_Varien_Action $action, $
* Retrieve page direct URL
*
* @param string $pageId
* @return string
* @return string|null
*/
public function getPageUrl($pageId = null)
{
Expand Down
20 changes: 11 additions & 9 deletions app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
*/
class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract
{

/**
* Current directory path
* @var string
* @var string|false
*/
protected $_currentPath;

Expand All @@ -51,14 +50,15 @@ class Mage_Cms_Helper_Wysiwyg_Images extends Mage_Core_Helper_Abstract

/**
* Image Storage root directory
* @var string
* @var string|false
*/
protected $_storageRoot;

/**
* Set a specified store ID value
*
* @param <type> $store
* @param int $store
* @return $this
*/
public function setStoreId($store)
{
Expand Down Expand Up @@ -207,7 +207,7 @@ public function getImageHtmlDeclaration($filename, $renderAsTag = false)
* Try to create target directory if it doesn't exist
*
* @throws Mage_Core_Exception
* @return string
* @return string|false
*/
public function getCurrentPath()
{
Expand All @@ -222,8 +222,10 @@ public function getCurrentPath()
}
$io = new Varien_Io_File();
if (!$io->isWriteable($currentPath) && !$io->mkdir($currentPath)) {
$message = Mage::helper('cms')->__('The directory %s is not writable by server.',
$io->getFilteredPath($currentPath));
$message = Mage::helper('cms')->__(
'The directory %s is not writable by server.',
$io->getFilteredPath($currentPath)
);
Mage::throwException($message);
}
$this->_currentPath = $currentPath;
Expand Down Expand Up @@ -251,7 +253,7 @@ public function getCurrentUrl()
/**
* Storage model singleton
*
* @return Mage_Cms_Model_Page_Wysiwyg_Images_Storage
* @return Mage_Cms_Model_Wysiwyg_Images_Storage
*/
public function getStorage()
{
Expand All @@ -273,7 +275,7 @@ public function idEncode($string)
* Revert opration to idEncode
*
* @param string $string
* @return string
* @return string|false
*/
public function idDecode($string)
{
Expand Down
17 changes: 11 additions & 6 deletions app/code/core/Mage/Cms/Model/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@
*
* @method Mage_Cms_Model_Resource_Block _getResource()
* @method Mage_Cms_Model_Resource_Block getResource()
* @method Mage_Cms_Model_Resource_Block_Collection getCollection()
*
* @method string getTitle()
* @method Mage_Cms_Model_Block setTitle(string $value)
* @method $this setTitle(string $value)
* @method string getIdentifier()
* @method Mage_Cms_Model_Block setIdentifier(string $value)
* @method $this setIdentifier(string $value)
* @method string getContent()
* @method Mage_Cms_Model_Block setContent(string $value)
* @method $this setContent(string $value)
* @method string getCreationTime()
* @method Mage_Cms_Model_Block setCreationTime(string $value)
* @method $this setCreationTime(string $value)
* @method string getUpdateTime()
* @method Mage_Cms_Model_Block setUpdateTime(string $value)
* @method $this setUpdateTime(string $value)
* @method int getIsActive()
* @method Mage_Cms_Model_Block setIsActive(int $value)
* @method $this setIsActive(int $value)
* @method $this setStoreId(int $storeId)
* @method int getStoreId()
* @method int getBlockId()
*
* @category Mage
* @package Mage_Cms
Expand Down
3 changes: 1 addition & 2 deletions app/code/core/Mage/Cms/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public function noCookies(Varien_Event_Observer $observer)

if ($pageUrl) {
$redirect->setRedirectUrl($pageUrl);
}
else {
} else {
$redirect->setRedirect(true)
->setPath('cms/index/noCookies')
->setArguments(array());
Expand Down
Loading