Passed
Branch 1.1 (769591)
by Jason
08:05
created
code/Locator.php 1 patch
Spacing   +15 added lines, -19 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	    return $fields;
48 48
     }
49 49
 
50
-	public static function getLocations($filter = array(), $exclude = array()){
50
+	public static function getLocations($filter = array(), $exclude = array()) {
51 51
 		$filter['ShowInLocator'] = true;
52 52
 		return Location::get()
53 53
 			->exclude($exclude)
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 			->filter($filter);
56 56
 	}
57 57
 
58
-	public function getAreLocations(){
58
+	public function getAreLocations() {
59 59
 		return self::getLocations();
60 60
 	}
61 61
 
62
-    public static function getMultipleLocators(){
62
+    public static function getMultipleLocators() {
63 63
         return (Locator::get()->count() > 1) ? true : false;
64 64
     }
65 65
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$themeDir = SSViewer::get_theme_folder();
78 78
 
79 79
 		Requirements::javascript('framework/thirdparty/jquery/jquery.js');
80
-		if(Locator::getLocations()){
80
+		if (Locator::getLocations()) {
81 81
 			Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
82 82
 			Requirements::javascript('locator/thirdparty/handlebars/handlebars-v1.3.0.js');
83 83
 			Requirements::javascript('locator/thirdparty/jquery-store-locator/js/jquery.storelocator.js');
@@ -86,24 +86,20 @@  discard block
 block discarded – undo
86 86
 		Requirements::css('locator/css/map.css');
87 87
 
88 88
 		$featured = (Locator::getLocations(array('Featured' => 1))->count() > 0) ?
89
-			'featuredLocations: true' :
90
-			'featuredLocations: false';
89
+			'featuredLocations: true' : 'featuredLocations: false';
91 90
 
92 91
 		// map config based on user input in Settings tab
93 92
 		// AutoGeocode or Full Map
94 93
 		$load = ($this->data()->AutoGeocode) ?
95
-			'autoGeocode: true, fullMapStart: false,' :
96
-			'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
94
+			'autoGeocode: true, fullMapStart: false,' : 'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
97 95
 
98 96
 		$base = Director::baseFolder();
99
-		$themePath = $base."/".$themeDir;
97
+		$themePath = $base . "/" . $themeDir;
100 98
 
101 99
 		$listTemplatePath = (file_exists($themePath . '/templates/location-list-description.html')) ?
102
-			$themeDir . '/templates/location-list-description.html' :
103
-			'locator/templates/location-list-description.html';
100
+			$themeDir . '/templates/location-list-description.html' : 'locator/templates/location-list-description.html';
104 101
 		$infowindowTemplatePath = (file_exists($themePath . '/templates/infowindow-description.html')) ?
105
-			$themeDir . '/templates/infowindow-description.html' :
106
-			'locator/templates/infowindow-description.html';
102
+			$themeDir . '/templates/infowindow-description.html' : 'locator/templates/infowindow-description.html';
107 103
 
108 104
 		// in page or modal
109 105
 		$modal = ($this->data()->ModalWindow) ? 'modalWindow: true' : 'modalWindow: false';
@@ -111,10 +107,10 @@  discard block
 block discarded – undo
111 107
         $kilometer = ($this->data()->Unit == 'km') ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
112 108
 
113 109
         $link = $this->Link() . "xml.xml";
114
-        $link .= (Locator::getMultipleLocators()) ? "?locatorID=" . $this->data()->ID : "" ;
110
+        $link .= (Locator::getMultipleLocators()) ? "?locatorID=" . $this->data()->ID : "";
115 111
 
116 112
 		// init map
117
-        if(Locator::getLocations()) {
113
+        if (Locator::getLocations()) {
118 114
             Requirements::customScript("
119 115
                 $(function($) {
120 116
                   $('#map-container').storeLocator({
@@ -151,8 +147,8 @@  discard block
 block discarded – undo
151 147
 	 */
152 148
 	public function xml(SS_HTTPRequest $request) {
153 149
         $filter = array();
154
-        if(Locator::getMultipleLocators()){//only checks published locators
155
-            if($request->getVar('locatorID')){
150
+        if (Locator::getMultipleLocators()) {//only checks published locators
151
+            if ($request->getVar('locatorID')) {
156 152
                 $filter['LocatorID'] = $request->getVar('locatorID');
157 153
             }
158 154
         }
@@ -186,11 +182,11 @@  discard block
 block discarded – undo
186 182
 			//debug::show($locals);
187 183
 			$categories = ArrayList::create();
188 184
 
189
-			foreach($locals as $local){
185
+			foreach ($locals as $local) {
190 186
 				$categories->add($local->Category());
191 187
 			}
192 188
 
193
-			if($categories->count()>0){
189
+			if ($categories->count() > 0) {
194 190
 				$fields->push(
195 191
 					DropdownField::create(
196 192
 						'category',
Please login to merge, or discard this patch.
code/Location.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Location extends DataObject implements PermissionProvider{
3
+class Location extends DataObject implements PermissionProvider {
4 4
 
5 5
 	static $db = array(
6 6
 		'Title' => 'Varchar(255)',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function validate() {
123 123
         $result = parent::validate();
124
-        if(Locator::getMultipleLocators() && $this->LocatorID == 0) {
124
+        if (Locator::getMultipleLocators() && $this->LocatorID == 0) {
125 125
             $result->error('You must associate this location with a locator page. Add the location from the desired locator page.');
126 126
         }
127 127
         return $result;
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 		);
158 158
 	}
159 159
 
160
-    public function onBeforeWrite(){
160
+    public function onBeforeWrite() {
161 161
 
162
-        if(Locator::get()->count() == 1){
162
+        if (Locator::get()->count() == 1) {
163 163
             $this->LocatorID = Locator::get()->first()->ID;
164 164
         }
165 165
 
Please login to merge, or discard this patch.