From 93e1cec500f259f262308ede11c7b3d2092f3937 Mon Sep 17 00:00:00 2001 From: spekulatius Date: Tue, 1 Mar 2016 13:51:37 +1300 Subject: [PATCH] Remove trailing spaces in the source code --- .travis.yml | 6 +-- code/GoogleShoppingFeed.php | 40 +++++++++---------- .../GoogleShoppingFeedController.php | 12 +++--- .../GoogleShoppingFeedExtension.php | 30 +++++++------- templates/GoogleShoppingFeedController.ss | 8 ++-- tests/GoogleShoppingFeedTest.php | 22 +++++----- tests/GoogleShoppingFeedTest.yml | 2 +- 7 files changed, 60 insertions(+), 60 deletions(-) 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 @@ $SiteConfig.Title $BaseHref $SiteConfig.Tagline - - <% loop $Items %> + + <% loop $Items %> <% if $StockID %>$StockID<% else %>$ID<% end_if %> $Title @@ -18,7 +18,7 @@ $Availability $Brand $MPN - + <% loop $Shipping %> $Country @@ -28,6 +28,6 @@ <% end_loop %> <% end_loop %> - + diff --git a/tests/GoogleShoppingFeedTest.php b/tests/GoogleShoppingFeedTest.php index a3d4f62..3ee36a3 100644 --- a/tests/GoogleShoppingFeedTest.php +++ b/tests/GoogleShoppingFeedTest.php @@ -18,7 +18,7 @@ class GoogleShoppingFeedTest extends FunctionalTest public function setUp() { parent::setUp(); - + GoogleShoppingFeed::clear_registered_dataobjects(); } @@ -48,7 +48,7 @@ public function testAccessingXMLFile() // dataobject as it hasn't been registered $expected = "ip-123"; $this->assertEquals(1, substr_count($body, $expected), 'Product with code ip-123 exists'); - + $expected = "cb-123"; $this->assertEquals(1, substr_count($body, $expected), 'Product with code cb-123 exists'); @@ -59,12 +59,12 @@ public function testAccessingXMLFile() public function testAccess() { Config::inst()->update('GoogleShoppingFeed', 'enabled', true); - + $response = $this->get('shoppingfeed.xml'); $this->assertEquals(200, $response->getStatusCode(), 'Feed returns a 200 success when enabled'); $this->assertEquals('application/xml; charset="utf-8"', $response->getHeader('Content-Type')); - + GoogleShoppingFeed::register_dataobject("GoogleShoppingFeedTest_Product"); $response = $this->get('shoppingfeed.xml'); $this->assertEquals(200, $response->getStatusCode(), 'Feed returns a 200 success when enabled with products'); @@ -72,15 +72,15 @@ public function testAccess() Config::inst()->remove('GoogleShoppingFeed', 'enabled'); Config::inst()->update('GoogleShoppingFeed', 'enabled', false); - + $response = $this->get('shoppingfeed.xml'); $this->assertEquals(404, $response->getStatusCode(), 'Feed returns a 404 when disabled'); } - + public function testRemoveFromFeed() { Config::inst()->update('GoogleShoppingFeed', 'enabled', true); - + $response = $this->get('shoppingfeed.xml'); $body = $response->getBody(); @@ -97,7 +97,7 @@ public function testRemoveFromFeed() */ class GoogleShoppingFeedTest_Product extends DataObject implements TestOnly { - + public static $db = array( "Title" => "Varchar", "Price" => "Currency", @@ -110,11 +110,11 @@ class GoogleShoppingFeedTest_Product extends DataObject implements TestOnly "MPN" => "Varchar", "RemoveFromShoppingFeed" => "Boolean" ); - + public static $has_one = array( "Image" => "Image" ); - + public static $many_many = array( "Shipping" => "GoogleShoppingFeedTest_Shipping" ); @@ -142,7 +142,7 @@ class GoogleShoppingFeedTest_Shipping extends DataObject implements TestOnly 'Price' => 'Currency', 'Country' => 'Varchar(2)' ); - + public static $belongs_many_many = array( "Products" => "GoogleShoppingFeedTest_Product" ); diff --git a/tests/GoogleShoppingFeedTest.yml b/tests/GoogleShoppingFeedTest.yml index ef84932..42dcfbf 100644 --- a/tests/GoogleShoppingFeedTest.yml +++ b/tests/GoogleShoppingFeedTest.yml @@ -23,7 +23,7 @@ GoogleShoppingFeedTest_Shipping: Price: 5.99 Country: US -GoogleShoppingFeedTest_Product: +GoogleShoppingFeedTest_Product: iphone: Title: "iPhone" Price: 400.00