diff --git a/.travis.yml b/.travis.yml index c482684..cf66b4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ # See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details -language: php -php: +language: php +php: - 5.3 env: @@ -18,5 +18,5 @@ before_script: - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss - cd ~/builds/ss -script: +script: - phpunit googlesitemaps/tests/ \ No newline at end of file diff --git a/code/GoogleShoppingFeed.php b/code/GoogleShoppingFeed.php index 95415f2..c6ab300 100644 --- a/code/GoogleShoppingFeed.php +++ b/code/GoogleShoppingFeed.php @@ -1,21 +1,21 @@ - * + * * @see http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=34609 - * + * * @package googlesitemaps */ class GoogleShoppingFeed @@ -59,11 +59,11 @@ public static function register_dataobject($className) { if (!self::is_registered($className)) { $className::add_extension('GoogleShoppingFeedExtension'); - + self::$dataobjects[] = $className; } } - + /** * Registers multiple dataobjects in a single line. See {@link register_dataobject} * for the heavy lifting @@ -83,14 +83,14 @@ public static function register_dataobjects($dataobjects) * Checks whether the given class name is already registered or not. * * @param string $className Name of DataObject to check - * + * * @return bool */ public static function is_registered($className) { return isset(self::$dataobjects[$className]); } - + /** * Unregisters a class from the sitemap. Mostly used for the test suite * @@ -110,7 +110,7 @@ public static function clear_registered_dataobjects() { self::$dataobjects = array(); } - + /** * Constructs the list of data to include in the rendered feed. Links @@ -129,7 +129,7 @@ public static function get_items() $disabled_filter = Config::inst()->get('GoogleShoppingFeed', 'use_disabled'); $filter = array(); - // todo migrate to extension hook or DI point for other modules to + // todo migrate to extension hook or DI point for other modules to // modify state filters if (class_exists('Translatable')) { Translatable::disable_locale_filter(); @@ -142,7 +142,7 @@ public static function get_items() $instances = Versioned::get_by_stage('SiteTree', 'Live', $search_filter); } elseif ($class == "Product") { $instances = $class::get(); - + if ($disabled_filter) { $instances->filter("Disabled", 0); } @@ -161,10 +161,10 @@ public static function get_items() return $output; } - + /** * Returns the string frequency of edits for a particular dataobject class. - * + * * Frequency for {@link SiteTree} objects can be determined from the version * history. * diff --git a/code/controllers/GoogleShoppingFeedController.php b/code/controllers/GoogleShoppingFeedController.php index ef1f996..dbdff3d 100644 --- a/code/controllers/GoogleShoppingFeedController.php +++ b/code/controllers/GoogleShoppingFeedController.php @@ -20,25 +20,25 @@ class GoogleShoppingFeedController extends Controller private static $allowed_actions = array( 'index' ); - + /** - * Specific controller action for displaying a particular list of links + * Specific controller action for displaying a particular list of links * for a class - * + * * @return mixed */ public function index() { if (GoogleShoppingFeed::enabled()) { Config::inst()->update('SSViewer', 'set_source_file_comments', false); - + $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"'); $this->getResponse()->addHeader('X-Robots-Tag', 'noindex'); $items = GoogleShoppingFeed::get_items(); - + $currency = new Zend_Currency(i18n::get_locale()); - + $this->extend('updateGoogleShoppingFeedItems', $items); return array( diff --git a/code/extensions/GoogleShoppingFeedExtension.php b/code/extensions/GoogleShoppingFeedExtension.php index 17b76b1..7b890ae 100644 --- a/code/extensions/GoogleShoppingFeedExtension.php +++ b/code/extensions/GoogleShoppingFeedExtension.php @@ -2,31 +2,31 @@ class GoogleShoppingFeedExtension extends DataExtension { - + /** * @var array */ private static $db = array( "RemoveFromShoppingFeed" => "Boolean" ); - - + + /** * @param FieldList */ public function updateSettingsFields(FieldList $fields) { $tabset = $fields->findOrMakeTab('Root.Settings'); - + $tabset->push(new HeaderField(_t( 'GoogleShoppingFeed.GoogleShoppingFeed', 'Google Shopping Feed' ))); - + $tabset->push(new CheckboxField("RemoveFromShoppingFeed")); } - - + + /** * @param FieldList */ @@ -34,20 +34,20 @@ public function updateCMSFields(FieldList $fields) { if (!method_exists($this->owner, "getSettingsFields")) { $tabset = $fields->findOrMakeTab('Root.Settings'); - + $tabset->push(new HeaderField(_t( 'GoogleShoppingFeed.GoogleShoppingFeed', 'Google Shopping Feed' ))); - + $tabset->push(new CheckboxField("RemoveFromShoppingFeed")); } } - - + + /** * Can we add this object to a shopping feed? - * + * * @return boolean */ public function canIncludeInGoogleShoppingFeed() @@ -66,17 +66,17 @@ public function canIncludeInGoogleShoppingFeed() } else { $can = false; } - + // If no price or title. if (!$this->owner->Title || !$this->owner->Price || !$this->owner->Condition || !$this->owner->Availability || !$this->owner->Brand || !$this->owner->MPN) { $can = false; } - + // Can any user view this item if ($can) { $can = $this->owner->canView(); } - + if ($can && $this->owner->RemoveFromShoppingFeed) { $can = false; } diff --git a/templates/GoogleShoppingFeedController.ss b/templates/GoogleShoppingFeedController.ss index 9985adc..f16cd3b 100644 --- a/templates/GoogleShoppingFeedController.ss +++ b/templates/GoogleShoppingFeedController.ss @@ -4,8 +4,8 @@