Skip to content

Commit

Permalink
Use namespaces in renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryd committed Mar 7, 2014
1 parent d325087 commit 67d1b81
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Classes/Generator/AbstractSitemapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace DmitryDulepov\DdGooglesitemap\Generator;

use DmitryDulepov\DdGooglesitemap\Renderers\AbstractSitemapRenderer;
use \TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -56,7 +57,7 @@ abstract class AbstractSitemapGenerator {
/**
* A sitemap renderer
*
* @var \tx_ddgooglesitemap_abstract_renderer
* @var AbstractSitemapRenderer
*/
protected $renderer;

Expand All @@ -65,7 +66,7 @@ abstract class AbstractSitemapGenerator {
*
* @var string
*/
protected $rendererClass = 'tx_ddgooglesitemap_normal_renderer';
protected $rendererClass = 'DmitryDulepov\\DdGooglesitemap\\Renderers\\StandardSitemapRenderer';

/**
* Initializes the instance of this class. This constructir sets starting
Expand Down
5 changes: 3 additions & 2 deletions Classes/Generator/NewsSitemapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ class NewsSitemapGenerator extends AbstractSitemapGenerator {
*/
public function __construct() {
$this->isNewsSitemap = (GeneralUtility::_GET('type') === 'news');
$this->rendererClass = ($this->isNewsSitemap ?
'tx_ddgooglesitemap_news_renderer' : 'tx_ddgooglesitemap_normal_renderer');
if ($this->isNewsSitemap) {
$this->rendererClass = 'DmitryDulepov\\DdGooglesitemap\\Renderers\\NewsSitemapRenderer';
}

parent::__construct();

Expand Down
5 changes: 3 additions & 2 deletions Classes/Generator/PagesSitemapGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

namespace DmitryDulepov\DdGooglesitemap\Generator;

use DmitryDulepov\DdGooglesitemap\Renderers\AbstractSitemapRenderer;
use \TYPO3\CMS\Core\Utility\GeneralUtility;

/**
Expand Down Expand Up @@ -53,7 +54,7 @@ class PagesSitemapGenerator extends AbstractSitemapGenerator {
/**
* A sitemap renderer
*
* @var \tx_ddgooglesitemap_normal_renderer
* @var AbstractSitemapRenderer
*/
protected $renderer;

Expand Down Expand Up @@ -100,7 +101,7 @@ public function __construct() {
);
}

$this->renderer = GeneralUtility::makeInstance('tx_ddgooglesitemap_normal_renderer');
$this->renderer = GeneralUtility::makeInstance('DmitryDulepov\\DdGooglesitemap\\Renderers\\StandardSitemapRenderer');

// Prepare user defined objects (if any)
$this->hookObjects = array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

namespace DmitryDulepov\DdGooglesitemap\Renderers;

/**
* This class contains an abstract renderer for sitemaps.
*
Expand All @@ -32,7 +34,7 @@
* @package TYPO3
* @subpackage tx_ddgooglesitemap
*/
abstract class tx_ddgooglesitemap_abstract_renderer {
abstract class AbstractSitemapRenderer {

/**
* Creates start XML tags (including XML prologue) for the sitemap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

namespace DmitryDulepov\DdGooglesitemap\Renderers;

/**
* This class contains a renderer for the 'news' sitemap.
*
* @author Dmitry Dulepov <dmitry.dulepov@gmail.com>
* @package TYPO3
* @subpackage tx_ddgooglesitemap
*/
class tx_ddgooglesitemap_news_renderer extends tx_ddgooglesitemap_abstract_renderer {
class NewsSitemapRenderer extends AbstractSitemapRenderer {

/**
* Contains google news site name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

namespace DmitryDulepov\DdGooglesitemap\Renderers;

/**
* This class contains a renderer for the 'normal' (not 'news') sitemap.
*
* @author Dmitry Dulepov <dmitry.dulepov@gmail.com>
* @package TYPO3
* @subpackage tx_ddgooglesitemap
*/
class tx_ddgooglesitemap_normal_renderer extends tx_ddgooglesitemap_abstract_renderer {
class StandardSitemapRenderer extends AbstractSitemapRenderer {

/**
* Creates end tags for this sitemap.
Expand Down

0 comments on commit 67d1b81

Please sign in to comment.