Skip to content

Commit

Permalink
Some DOC updates, PSR2
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Jun 23, 2019
1 parent 82f963f commit a15dee6
Show file tree
Hide file tree
Showing 22 changed files with 126 additions and 91 deletions.
2 changes: 2 additions & 0 deletions app/code/core/Mage/Cms/Block/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* @category Mage
* @package Mage_Cms
* @author Magento Core Team <core@magentocommerce.com>
*
* @method $this setBlockId(int $int)
*/
class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
{
Expand Down
2 changes: 0 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,7 +24,6 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms Static Block Widget
*
Expand Down Expand Up @@ -81,7 +80,6 @@ protected function _beforeToHtml()
->setStoreId(Mage::app()->getStore()->getId())
->load($blockId);
if ($block->getIsActive()) {
/* @var Mage_Cms_Helper_Data $helper */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$this->setText($processor->filter($block->getContent()));
Expand Down
16 changes: 7 additions & 9 deletions app/code/core/Mage/Cms/Block/Widget/Page/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
* @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
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
2 changes: 1 addition & 1 deletion app/code/core/Mage/Cms/Controller/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,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
2 changes: 1 addition & 1 deletion 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 Mage_Core_Model_Abstract
* @return Mage_Core_Model_Abstract|Varien_Filter_Template
*/
public function getPageTemplateProcessor()
{
Expand Down
6 changes: 4 additions & 2 deletions app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions app/code/core/Mage/Cms/Model/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
*
* @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 $this setTitle(string $value)
* @method string getIdentifier()
Expand Down
5 changes: 2 additions & 3 deletions app/code/core/Mage/Cms/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Mage_Cms_Model_Observer
/**
* Modify No Route Forward object
*
* @param Varien_Event_Observer|Mage_Core_Helper_Object_Observer_Controller_Action $observer
* @param Varien_Event_Observer $observer
* @return $this
*/
public function noRoute(Varien_Event_Observer $observer)
Expand Down 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
39 changes: 21 additions & 18 deletions app/code/core/Mage/Cms/Model/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,24 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Cms Page Model
*
* @method Mage_Cms_Model_Resource_Page _getResource()
* @method Mage_Cms_Model_Resource_Page getResource()
* @method string getTitle()
* @method $this setTitle(string $value)
* @method string getRootTemplate()
* @method $this setRootTemplate(string $value)
* @method string getMetaKeywords()
* @method $this setMetaKeywords(string $value)
* @method string getMetaDescription()
* @method $this setMetaDescription(string $value)
* @method string getIdentifier()
* @method $this setIdentifier(string $value)
* @method Mage_Cms_Model_Resource_Page_Collection getCollection()
*
* @method string getContentHeading()
* @method $this setContentHeading(string $value)
* @method string getContent()
* @method $this setContent(string $value)
* @method string getCreationTime()
* @method $this setCreationTime(string $value)
* @method string getUpdateTime()
* @method $this setUpdateTime(string $value)
* @method int getIsActive()
* @method $this setIsActive(int $value)
* @method int getSortOrder()
* @method $this setSortOrder(int $value)
* @method string getLayoutUpdateXml()
* @method $this setLayoutUpdateXml(string $value)
* @method bool hasCreationTime()
* @method string getCustomTheme()
* @method $this setCustomTheme(string $value)
* @method string getCustomRootTemplate()
Expand All @@ -64,11 +52,26 @@
* @method $this setCustomThemeFrom(string $value)
* @method string getCustomThemeTo()
* @method $this setCustomThemeTo(string $value)
* @method string getIdentifier()
* @method $this setIdentifier(string $value)
* @method string getMetaDescription()
* @method $this setMetaDescription(string $value)
* @method string getMetaKeywords()
* @method $this setMetaKeywords(string $value)
* @method string getPreviewUrl()
* @method string getRootTemplate()
* @method $this setRootTemplate(string $value)
* @method $this setStoreId(int $value)
* @method bool hasCreationTime()
* @method int getSortOrder()
* @method $this setSortOrder(int $value)
* @method bool hasStores()
* @method string getStoreId()
* @method array getStores()
* @method string getStoreCode()
* @method string getStoreId()
* @method string getTitle()
* @method $this setTitle(string $value)
* @method string getUpdateTime()
* @method $this setUpdateTime(string $value)
*
* @category Mage
* @package Mage_Cms
Expand Down Expand Up @@ -106,7 +109,7 @@ protected function _construct()
/**
* @inheritDoc
*/
public function load($id, $field=null)
public function load($id, $field = null)
{
if (is_null($id)) {
return $this->noRoutePage();
Expand Down
5 changes: 2 additions & 3 deletions app/code/core/Mage/Cms/Model/Resource/Block.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 block model
*
Expand Down Expand Up @@ -60,8 +59,9 @@ protected function _beforeDelete(Mage_Core_Model_Abstract $object)
/**
* Perform operations before object save
*
* @param Mage_Cms_Model_Block $object
* @param Mage_Core_Model_Abstract $object
* @return $this
* @throws Mage_Core_Exception
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
Expand Down Expand Up @@ -111,7 +111,6 @@ protected function _afterSave(Mage_Core_Model_Abstract $object)
}

return parent::_afterSave($object);

}

/**
Expand Down
2 changes: 0 additions & 2 deletions app/code/core/Mage/Cms/Model/Resource/Block/Collection.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 block model
*
Expand Down Expand Up @@ -114,5 +113,4 @@ protected function _renderFiltersBefore()
}
return parent::_renderFiltersBefore();
}

}
8 changes: 4 additions & 4 deletions app/code/core/Mage/Cms/Model/Resource/Page.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 page mysql resource
*
Expand Down Expand Up @@ -167,7 +166,6 @@ protected function _afterLoad(Mage_Core_Model_Abstract $object)
$stores = $this->lookupStoreIds($object->getId());

$object->setData('store_id', $stores);

}

return parent::_afterLoad($object);
Expand All @@ -190,7 +188,8 @@ protected function _getLoadSelect($field, $value, $object)
$select->join(
array('cms_page_store' => $this->getTable('cms/page_store')),
$this->getMainTable() . '.page_id = cms_page_store.page_id',
array())
array()
)
->where('is_active = ?', 1)
->where('cms_page_store.store_id IN (?)', $storeIds)
->order('cms_page_store.store_id DESC')
Expand All @@ -215,7 +214,8 @@ protected function _getLoadByIdentifierSelect($identifier, $store, $isActive = n
->join(
array('cps' => $this->getTable('cms/page_store')),
'cp.page_id = cps.page_id',
array())
array()
)
->where('cp.identifier = ?', $identifier)
->where('cps.store_id IN (?)', $store);

Expand Down
3 changes: 0 additions & 3 deletions app/code/core/Mage/Cms/Model/Resource/Page/Collection.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 page collection
*
Expand All @@ -41,7 +40,6 @@ class Mage_Cms_Model_Resource_Page_Collection extends Mage_Core_Model_Resource_D
*/
protected $_previewFlag;


/**
* Define resource model
*
Expand Down Expand Up @@ -186,7 +184,6 @@ protected function _renderFiltersBefore()
return parent::_renderFiltersBefore();
}


/**
* Get SQL for get record count.
* Extra GROUP BY strip added.
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Cms/Model/Wysiwyg/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
* @package Mage_Cms
* @author Magento Core Team <core@magentocommerce.com>
*
* @method int getStoreId()
* @method string getStoreId()
* @method $this setStoreId(string $value)
*/
class Mage_Cms_Model_Wysiwyg_Config extends Varien_Object
{
Expand Down
17 changes: 10 additions & 7 deletions app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getDirsCollection($path)
$subDirectories = Mage::getModel('core/file_storage_directory_database')->getSubdirectories($path);
foreach ($subDirectories as $directory) {
$fullPath = rtrim($path, DS) . DS . $directory['name'];
if (!file_exists($fullPath)) {
if (!file_exists($fullPath)) {
mkdir($fullPath, 0777, true);
}
}
Expand Down Expand Up @@ -140,9 +140,10 @@ public function getFilesCollection($path, $type = null)
if ($this->isImage($item->getBasename())) {
$thumbUrl = $this->getThumbnailUrl(
Mage_Core_Model_File_Uploader::getCorrectFileName($item->getFilename()),
true);
true
);
// generate thumbnail "on the fly" if it does not exists
if(! $thumbUrl) {
if (! $thumbUrl) {
$thumbUrl = Mage::getSingleton('adminhtml/url')->getUrl('*/*/thumbnail', array('file' => $item->getId()));
}

Expand Down Expand Up @@ -233,8 +234,10 @@ public function deleteDirectory($path)
$io = new Varien_Io_File();

if ($rootCmp == $pathCmp) {
Mage::throwException(Mage::helper('cms')->__('Cannot delete root directory %s.',
$io->getFilteredPath($path)));
Mage::throwException(Mage::helper('cms')->__(
'Cannot delete root directory %s.',
$io->getFilteredPath($path)
));
}

if (Mage::helper('core/file_storage_database')->checkDbUsage()) {
Expand Down Expand Up @@ -296,7 +299,7 @@ public function uploadFile($targetPath, $type = null)
$result = $uploader->save($targetPath);

if (!$result) {
Mage::throwException( Mage::helper('cms')->__('Cannot upload file.') );
Mage::throwException(Mage::helper('cms')->__('Cannot upload file.'));
}

// create thumbnail
Expand Down Expand Up @@ -486,7 +489,7 @@ public function getConfigAsArray()
* @param mixed $default
* @return mixed
*/
public function getConfigData($key, $default=false)
public function getConfigData($key, $default = false)
{
$configArray = $this->getConfigAsArray();
$key = (string) $key;
Expand Down
Loading

0 comments on commit a15dee6

Please sign in to comment.