Passed
Pull Request — master (#253)
by Viruthagiri
15:37
created
geodirectory-functions/google_analytics.php 3 patches
Braces   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,22 +76,19 @@  discard block
 block discarded – undo
76 76
         if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
77 77
         if(!$ga_end){$ga_end = date('Y-m-d');}
78 78
         $dimensions = "&dimensions=ga:date,ga:nthDay";
79
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
79
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
80 80
         if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
81 81
         if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
82 82
         $dimensions = "&dimensions=ga:date,ga:nthDay";
83
-    }
84
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
83
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
85 84
         if(!$ga_start){$ga_start = date('Y')."-01-01";}
86 85
         if(!$ga_end){$ga_end = date('Y-m-d');}
87 86
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
88
-    }
89
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
87
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
90 88
         if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
91 89
         if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
92 90
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
93
-    }
94
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
91
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
95 92
         if(!$ga_start){$ga_start = "14daysAgo";}
96 93
         if(!$ga_end){$ga_end = "yesterday";}
97 94
         $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
@@ -144,7 +141,7 @@  discard block
 block discarded – undo
144 141
     if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
145 142
 
146 143
     return $at;
147
-    }else{//else get new access token
144
+    } else{//else get new access token
148 145
 
149 146
         $refresh_at = get_option('gd_ga_refresh_token');
150 147
         if(!$refresh_at){
@@ -167,7 +164,7 @@  discard block
 block discarded – undo
167 164
             update_option('gd_ga_access_token', $parts->access_token);
168 165
             return $parts->access_token;
169 166
 
170
-        }else{
167
+        } else{
171 168
             echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172 169
         }
173 170
 
Please login to merge, or discard this patch.
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -17,34 +17,34 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_sec2hms($sec, $padHours = false)
19 19
 {
20
-    // holds formatted string
21
-    $hms = "";
22
-    // there are 3600 seconds in an hour, so if we
23
-    // divide total seconds by 3600 and throw away
24
-    // the remainder, we've got the number of hours
25
-    $hours = intval(intval($sec) / 3600);
26
-
27
-    // add to $hms, with a leading 0 if asked for
28
-    $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
29
-
30
-    // dividing the total seconds by 60 will give us
31
-    // the number of minutes, but we're interested in
32
-    // minutes past the hour: to get that, we need to
33
-    // divide by 60 again and keep the remainder
34
-    $minutes = intval(($sec / 60) % 60);
35
-
36
-    // then add to $hms (with a leading 0 if needed)
37
-    $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':';
38
-
39
-    // seconds are simple - just divide the total
40
-    // seconds by 60 and keep the remainder
41
-    $seconds = intval($sec % 60);
42
-
43
-    // add to $hms, again with a leading 0 if needed
44
-    $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
45
-
46
-    // done!
47
-    return $hms;
20
+	// holds formatted string
21
+	$hms = "";
22
+	// there are 3600 seconds in an hour, so if we
23
+	// divide total seconds by 3600 and throw away
24
+	// the remainder, we've got the number of hours
25
+	$hours = intval(intval($sec) / 3600);
26
+
27
+	// add to $hms, with a leading 0 if asked for
28
+	$hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
29
+
30
+	// dividing the total seconds by 60 will give us
31
+	// the number of minutes, but we're interested in
32
+	// minutes past the hour: to get that, we need to
33
+	// divide by 60 again and keep the remainder
34
+	$minutes = intval(($sec / 60) % 60);
35
+
36
+	// then add to $hms (with a leading 0 if needed)
37
+	$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':';
38
+
39
+	// seconds are simple - just divide the total
40
+	// seconds by 60 and keep the remainder
41
+	$seconds = intval($sec % 60);
42
+
43
+	// add to $hms, again with a leading 0 if needed
44
+	$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
45
+
46
+	// done!
47
+	return $hms;
48 48
 }
49 49
 
50 50
 /**
@@ -61,117 +61,117 @@  discard block
 block discarded – undo
61 61
 {
62 62
 
63 63
 
64
-    // NOTE: the id is in the form ga:12345 and not just 12345
65
-    // if you do e.g. 12345 then no data will be returned
66
-    // read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface
67
-    // or load the accounts (see below) and get it from there
68
-    // if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message
69
-    $id = trim(get_option('geodir_ga_id'));
70
-
71
-    $at = geodir_ga_get_token();
72
-
73
-    $start_date = '';
74
-    $end_date = '';
75
-    $dimensions = "&filters=ga:pagePath==" . $page;
76
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
77
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
78
-        if(!$ga_end){$ga_end = date('Y-m-d');}
79
-        $dimensions = "&dimensions=ga:date,ga:nthDay";
80
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
81
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
82
-        if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
83
-        $dimensions = "&dimensions=ga:date,ga:nthDay";
84
-    }
85
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
86
-        if(!$ga_start){$ga_start = date('Y')."-01-01";}
87
-        if(!$ga_end){$ga_end = date('Y-m-d');}
88
-        $dimensions = "&dimensions=ga:month,ga:nthMonth";
89
-    }
90
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
91
-        if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
92
-        if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
93
-        $dimensions = "&dimensions=ga:month,ga:nthMonth";
94
-    }
95
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
96
-        if(!$ga_start){$ga_start = "14daysAgo";}
97
-        if(!$ga_end){$ga_end = "yesterday";}
98
-        $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
99
-    }
100
-
101
-    $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102
-    $ids = "ids=".$id;
103
-    if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
-    if(!$end_date){$end_date = "&end-date=".$ga_end;}
105
-    $metrics = "&metrics=ga:pageviews";
106
-    $filters = "&filters=ga:pagePath==".$page;
107
-    $access_token = "&access_token=".$at;
108
-
109
-    $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
110
-
111
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
112
-        $metrics = "&metrics=rt:activeUsers";
113
-        $dimensions = "&filters=ga:pagePath==".$page;
114
-
115
-        $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
116
-    }
117
-
118
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
119
-
120
-    // Make countries translatable
121
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
122
-        $c_arr = json_decode($response['body']);
123
-        if(is_array($c_arr->rows)){
124
-            $new_rows = array();
125
-            foreach($c_arr->rows as $wow){
126
-                $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
127
-            }
128
-            $c_arr->rows = $new_rows;
129
-        }
130
-        $response['body'] = json_encode($c_arr);
131
-    }
132
-
133
-    echo $response['body'];
134
-    exit;
64
+	// NOTE: the id is in the form ga:12345 and not just 12345
65
+	// if you do e.g. 12345 then no data will be returned
66
+	// read http://www.electrictoolbox.com/get-id-for-google-analytics-api/ for info about how to get this id from the GA web interface
67
+	// or load the accounts (see below) and get it from there
68
+	// if you don't specify an id here, then you'll get the "Badly formatted request to the Google Analytics API..." error message
69
+	$id = trim(get_option('geodir_ga_id'));
70
+
71
+	$at = geodir_ga_get_token();
72
+
73
+	$start_date = '';
74
+	$end_date = '';
75
+	$dimensions = "&filters=ga:pagePath==" . $page;
76
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
77
+		if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
78
+		if(!$ga_end){$ga_end = date('Y-m-d');}
79
+		$dimensions = "&dimensions=ga:date,ga:nthDay";
80
+	}elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
81
+		if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
82
+		if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
83
+		$dimensions = "&dimensions=ga:date,ga:nthDay";
84
+	}
85
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
86
+		if(!$ga_start){$ga_start = date('Y')."-01-01";}
87
+		if(!$ga_end){$ga_end = date('Y-m-d');}
88
+		$dimensions = "&dimensions=ga:month,ga:nthMonth";
89
+	}
90
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
91
+		if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
92
+		if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
93
+		$dimensions = "&dimensions=ga:month,ga:nthMonth";
94
+	}
95
+	elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
96
+		if(!$ga_start){$ga_start = "14daysAgo";}
97
+		if(!$ga_end){$ga_end = "yesterday";}
98
+		$dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
99
+	}
100
+
101
+	$APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102
+	$ids = "ids=".$id;
103
+	if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
+	if(!$end_date){$end_date = "&end-date=".$ga_end;}
105
+	$metrics = "&metrics=ga:pageviews";
106
+	$filters = "&filters=ga:pagePath==".$page;
107
+	$access_token = "&access_token=".$at;
108
+
109
+	$use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
110
+
111
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
112
+		$metrics = "&metrics=rt:activeUsers";
113
+		$dimensions = "&filters=ga:pagePath==".$page;
114
+
115
+		$use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
116
+	}
117
+
118
+	$response =  wp_remote_get($use_url,array('timeout' => 15));
119
+
120
+	// Make countries translatable
121
+	if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
122
+		$c_arr = json_decode($response['body']);
123
+		if(is_array($c_arr->rows)){
124
+			$new_rows = array();
125
+			foreach($c_arr->rows as $wow){
126
+				$new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
127
+			}
128
+			$c_arr->rows = $new_rows;
129
+		}
130
+		$response['body'] = json_encode($c_arr);
131
+	}
132
+
133
+	echo $response['body'];
134
+	exit;
135 135
 
136 136
 }// end GA function
137 137
 
138 138
 
139 139
 function geodir_ga_get_token(){
140
-    $at = get_option('gd_ga_access_token');
141
-    $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
140
+	$at = get_option('gd_ga_access_token');
141
+	$use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
+	$response =  wp_remote_get($use_url,array('timeout' => 15));
143 143
 
144
-    if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
144
+	if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
145 145
 
146
-    return $at;
147
-    }else{//else get new access token
146
+	return $at;
147
+	}else{//else get new access token
148 148
 
149
-        $refresh_at = get_option('gd_ga_refresh_token');
150
-        if(!$refresh_at){
151
-            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
152
-        }
149
+		$refresh_at = get_option('gd_ga_refresh_token');
150
+		if(!$refresh_at){
151
+			echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
152
+		}
153 153
 
154
-        $rat_url = "https://www.googleapis.com/oauth2/v3/token?";
155
-        $client_id = "client_id=".get_option('geodir_ga_client_id');
156
-        $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
157
-        $refresh_token = "&refresh_token=".$refresh_at;
158
-        $grant_type = "&grant_type=refresh_token";
154
+		$rat_url = "https://www.googleapis.com/oauth2/v3/token?";
155
+		$client_id = "client_id=".get_option('geodir_ga_client_id');
156
+		$client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
157
+		$refresh_token = "&refresh_token=".$refresh_at;
158
+		$grant_type = "&grant_type=refresh_token";
159 159
 
160
-        $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
160
+		$rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
161 161
 
162
-        $rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
-        if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
164
-            $parts = json_decode($rat_response['body']);
162
+		$rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
+		if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
164
+			$parts = json_decode($rat_response['body']);
165 165
 
166 166
 
167
-            update_option('gd_ga_access_token', $parts->access_token);
168
-            return $parts->access_token;
167
+			update_option('gd_ga_access_token', $parts->access_token);
168
+			return $parts->access_token;
169 169
 
170
-        }else{
171
-            echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172
-        }
170
+		}else{
171
+			echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
172
+		}
173 173
 
174 174
 
175
-    }
175
+	}
176 176
 
177 177
 }
178 178
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     $hours = intval(intval($sec) / 3600);
26 26
 
27 27
     // add to $hms, with a leading 0 if asked for
28
-    $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT) . ':' : $hours . ':';
28
+    $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT).':' : $hours.':';
29 29
 
30 30
     // dividing the total seconds by 60 will give us
31 31
     // the number of minutes, but we're interested in
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     $minutes = intval(($sec / 60) % 60);
35 35
 
36 36
     // then add to $hms (with a leading 0 if needed)
37
-    $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ':';
37
+    $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT).':';
38 38
 
39 39
     // seconds are simple - just divide the total
40 40
     // seconds by 60 and keep the remainder
@@ -72,58 +72,58 @@  discard block
 block discarded – undo
72 72
 
73 73
     $start_date = '';
74 74
     $end_date = '';
75
-    $dimensions = "&filters=ga:pagePath==" . $page;
76
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisweek'){
77
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
78
-        if(!$ga_end){$ga_end = date('Y-m-d');}
75
+    $dimensions = "&filters=ga:pagePath==".$page;
76
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisweek') {
77
+        if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-6 day")); }
78
+        if (!$ga_end) {$ga_end = date('Y-m-d'); }
79 79
         $dimensions = "&dimensions=ga:date,ga:nthDay";
80
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
81
-        if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
82
-        if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
80
+    }elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastweek') {
81
+        if (!$ga_start) {$ga_start = date('Y-m-d', strtotime("-13 day")); }
82
+        if (!$ga_end) {$ga_end = date('Y-m-d', strtotime("-7 day")); }
83 83
         $dimensions = "&dimensions=ga:date,ga:nthDay";
84 84
     }
85
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
86
-        if(!$ga_start){$ga_start = date('Y')."-01-01";}
87
-        if(!$ga_end){$ga_end = date('Y-m-d');}
85
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'thisyear') {
86
+        if (!$ga_start) {$ga_start = date('Y')."-01-01"; }
87
+        if (!$ga_end) {$ga_end = date('Y-m-d'); }
88 88
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
89 89
     }
90
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
91
-        if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
92
-        if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
90
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'lastyear') {
91
+        if (!$ga_start) {$ga_start = date('Y', strtotime("-1 year"))."-01-01"; }
92
+        if (!$ga_end) {$ga_end = date('Y', strtotime("-1 year"))."-12-31"; }
93 93
         $dimensions = "&dimensions=ga:month,ga:nthMonth";
94 94
     }
95
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
96
-        if(!$ga_start){$ga_start = "14daysAgo";}
97
-        if(!$ga_end){$ga_end = "yesterday";}
95
+    elseif (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
96
+        if (!$ga_start) {$ga_start = "14daysAgo"; }
97
+        if (!$ga_end) {$ga_end = "yesterday"; }
98 98
         $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5";
99 99
     }
100 100
 
101 101
     $APIURL = "https://www.googleapis.com/analytics/v3/data/ga?";
102 102
     $ids = "ids=".$id;
103
-    if(!$start_date){$start_date = "&start-date=".$ga_start;}
104
-    if(!$end_date){$end_date = "&end-date=".$ga_end;}
103
+    if (!$start_date) {$start_date = "&start-date=".$ga_start; }
104
+    if (!$end_date) {$end_date = "&end-date=".$ga_end; }
105 105
     $metrics = "&metrics=ga:pageviews";
106 106
     $filters = "&filters=ga:pagePath==".$page;
107 107
     $access_token = "&access_token=".$at;
108 108
 
109 109
     $use_url = $APIURL.$ids.$start_date.$end_date.$dimensions.$metrics.$filters.$access_token;
110 110
 
111
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
111
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'realtime') {
112 112
         $metrics = "&metrics=rt:activeUsers";
113 113
         $dimensions = "&filters=ga:pagePath==".$page;
114 114
 
115 115
         $use_url = "https://www.googleapis.com/analytics/v3/data/realtime?".$ids.$access_token.$metrics.$dimensions;
116 116
     }
117 117
 
118
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
118
+    $response = wp_remote_get($use_url, array('timeout' => 15));
119 119
 
120 120
     // Make countries translatable
121
-    if(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
121
+    if (isset($_REQUEST['ga_type']) && $_REQUEST['ga_type'] == 'country') {
122 122
         $c_arr = json_decode($response['body']);
123
-        if(is_array($c_arr->rows)){
123
+        if (is_array($c_arr->rows)) {
124 124
             $new_rows = array();
125
-            foreach($c_arr->rows as $wow){
126
-                $new_rows[] = array(__($wow[0],'geodirectory'),$wow[1]);
125
+            foreach ($c_arr->rows as $wow) {
126
+                $new_rows[] = array(__($wow[0], 'geodirectory'), $wow[1]);
127 127
             }
128 128
             $c_arr->rows = $new_rows;
129 129
         }
@@ -136,19 +136,19 @@  discard block
 block discarded – undo
136 136
 }// end GA function
137 137
 
138 138
 
139
-function geodir_ga_get_token(){
139
+function geodir_ga_get_token() {
140 140
     $at = get_option('gd_ga_access_token');
141 141
     $use_url = "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=".$at;
142
-    $response =  wp_remote_get($use_url,array('timeout' => 15));
142
+    $response = wp_remote_get($use_url, array('timeout' => 15));
143 143
 
144
-    if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
144
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {//access token is valid
145 145
 
146 146
     return $at;
147
-    }else{//else get new access token
147
+    } else {//else get new access token
148 148
 
149 149
         $refresh_at = get_option('gd_ga_refresh_token');
150
-        if(!$refresh_at){
151
-            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory')));exit;
150
+        if (!$refresh_at) {
151
+            echo json_encode(array('error'=>__('Not authorized, please click authorized in GD > Google analytic settings.', 'geodirectory'))); exit;
152 152
         }
153 153
 
154 154
         $rat_url = "https://www.googleapis.com/oauth2/v3/token?";
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 
160 160
         $rat_url_use = $rat_url.$client_id.$client_secret.$refresh_token.$grant_type;
161 161
 
162
-        $rat_response =  wp_remote_post($rat_url_use,array('timeout' => 15));
163
-        if(!empty($rat_response['response']['code']) && $rat_response['response']['code']==200) {
162
+        $rat_response = wp_remote_post($rat_url_use, array('timeout' => 15));
163
+        if (!empty($rat_response['response']['code']) && $rat_response['response']['code'] == 200) {
164 164
             $parts = json_decode($rat_response['body']);
165 165
 
166 166
 
167 167
             update_option('gd_ga_access_token', $parts->access_token);
168 168
             return $parts->access_token;
169 169
 
170
-        }else{
171
-            echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
170
+        } else {
171
+            echo json_encode(array('error'=>__('Login failed', 'geodirectory'))); exit;
172 172
         }
173 173
 
174 174
 
Please login to merge, or discard this patch.
geodirectory-functions/helper_functions.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $slug = $post->post_name;
154 154
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155 155
         $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
156
+    } else{
157 157
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
158 158
     }
159 159
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $slug = $post->post_name;
203 203
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204 204
         $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
205
+    } else{
206 206
         $info_url = trailingslashit($home_url);
207 207
     }
208 208
 
Please login to merge, or discard this patch.
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (function_exists('icl_object_id')) {
20
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (function_exists('icl_object_id')) {
37
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (function_exists('icl_object_id')) {
54
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (function_exists('icl_object_id')) {
71
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (function_exists('icl_object_id')) {
88
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (function_exists('icl_object_id')) {
105
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (function_exists('icl_object_id')) {
122
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,45 +134,45 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-    $home_url = get_home_url();
147
-    if (function_exists('geodir_location_geo_home_link')) {
148
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
-    }
150
-
151
-    if($gd_page_id){
152
-        $post = get_post($gd_page_id);
153
-        $slug = $post->post_name;
154
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
-        $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
157
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
158
-    }
159
-
160
-    if($args){
161
-        $login_url = add_query_arg($args,$login_url );
162
-    }
163
-
164
-    /**
165
-     * Filter the GeoDirectory login page url.
166
-     *
167
-     * This filter can be used to change the GeoDirectory page url.
168
-     *
169
-     * @since 1.5.3
170
-     * @package GeoDirectory
171
-     * @param string $login_url The url of the login page.
172
-     * @param array $args The array of query args used.
173
-     * @param int $gd_page_id The page id of the GD login page.
174
-     */
175
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (function_exists('icl_object_id')) {
140
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+	$home_url = get_home_url();
147
+	if (function_exists('geodir_location_geo_home_link')) {
148
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149
+	}
150
+
151
+	if($gd_page_id){
152
+		$post = get_post($gd_page_id);
153
+		$slug = $post->post_name;
154
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155
+		$login_url = trailingslashit($home_url)."$slug/";
156
+	}else{
157
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
158
+	}
159
+
160
+	if($args){
161
+		$login_url = add_query_arg($args,$login_url );
162
+	}
163
+
164
+	/**
165
+	 * Filter the GeoDirectory login page url.
166
+	 *
167
+	 * This filter can be used to change the GeoDirectory page url.
168
+	 *
169
+	 * @since 1.5.3
170
+	 * @package GeoDirectory
171
+	 * @param string $login_url The url of the login page.
172
+	 * @param array $args The array of query args used.
173
+	 * @param int $gd_page_id The page id of the GD login page.
174
+	 */
175
+	return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
176 176
 }
177 177
 
178 178
 /**
@@ -183,34 +183,34 @@  discard block
 block discarded – undo
183 183
  * @return string Info page url.
184 184
  */
185 185
 function geodir_info_url($args=array()){
186
-    $gd_page_id = get_option('geodir_info_page');
187
-
188
-    if (function_exists('icl_object_id')) {
189
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
-    }
191
-
192
-    if (function_exists('geodir_location_geo_home_link')) {
193
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
-    }
195
-    $home_url = get_home_url();
196
-    if (function_exists('geodir_location_geo_home_link')) {
197
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
-    }
199
-
200
-    if($gd_page_id){
201
-        $post = get_post($gd_page_id);
202
-        $slug = $post->post_name;
203
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
-        $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
206
-        $info_url = trailingslashit($home_url);
207
-    }
208
-
209
-    if($args){
210
-        $info_url = add_query_arg($args,$info_url );
211
-    }
212
-
213
-    return $info_url;
186
+	$gd_page_id = get_option('geodir_info_page');
187
+
188
+	if (function_exists('icl_object_id')) {
189
+		$gd_page_id =  icl_object_id($gd_page_id, 'page', true);
190
+	}
191
+
192
+	if (function_exists('geodir_location_geo_home_link')) {
193
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
194
+	}
195
+	$home_url = get_home_url();
196
+	if (function_exists('geodir_location_geo_home_link')) {
197
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198
+	}
199
+
200
+	if($gd_page_id){
201
+		$post = get_post($gd_page_id);
202
+		$slug = $post->post_name;
203
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204
+		$info_url = trailingslashit($home_url)."$slug/";
205
+	}else{
206
+		$info_url = trailingslashit($home_url);
207
+	}
208
+
209
+	if($args){
210
+		$info_url = add_query_arg($args,$info_url );
211
+	}
212
+
213
+	return $info_url;
214 214
 }
215 215
 
216 216
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  * @return string Returns converted string.
227 227
  */
228 228
 function geodir_ucwords($string, $charset='UTF-8') {
229
-    if (function_exists('mb_convert_case')) {
230
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
-    } else {
232
-        return ucwords($string);
233
-    }
229
+	if (function_exists('mb_convert_case')) {
230
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
231
+	} else {
232
+		return ucwords($string);
233
+	}
234 234
 }
235 235
 
236 236
 /**
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
  * @return string Returns converted string.
247 247
  */
248 248
 function geodir_strtolower($string, $charset='UTF-8') {
249
-    if (function_exists('mb_convert_case')) {
250
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
-    } else {
252
-        return strtolower($string);
253
-    }
249
+	if (function_exists('mb_convert_case')) {
250
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
251
+	} else {
252
+		return strtolower($string);
253
+	}
254 254
 }
255 255
 
256 256
 /**
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  * @return string Returns converted string.
267 267
  */
268 268
 function geodir_strtoupper($string, $charset='UTF-8') {
269
-    if (function_exists('mb_convert_case')) {
270
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
-    } else {
272
-        return strtoupper($string);
273
-    }
269
+	if (function_exists('mb_convert_case')) {
270
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
271
+	} else {
272
+		return strtoupper($string);
273
+	}
274 274
 }
275 275
 
276 276
 /**
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
  * @package GeoDirectory
450 450
  */
451 451
 function _gd_die_handler() {
452
-    if ( defined( 'GD_TESTING_MODE' ) ) {
453
-        return '_gd_die_handler';
454
-    } else {
455
-        die();
456
-    }
452
+	if ( defined( 'GD_TESTING_MODE' ) ) {
453
+		return '_gd_die_handler';
454
+	} else {
455
+		die();
456
+	}
457 457
 }
458 458
 
459 459
 /**
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
  * @param int $status     Optional. Status code.
469 469
  */
470 470
 function gd_die( $message = '', $title = '', $status = 400 ) {
471
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
-    wp_die( $message, $title, array( 'response' => $status ));
471
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
+	wp_die( $message, $title, array( 'response' => $status ));
474 474
 }
475 475
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (function_exists('icl_object_id')) {
20
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (function_exists('icl_object_id')) {
37
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (function_exists('icl_object_id')) {
54
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (function_exists('icl_object_id')) {
71
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (function_exists('icl_object_id')) {
88
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (function_exists('icl_object_id')) {
105
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (function_exists('icl_object_id')) {
122
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (function_exists('icl_object_id')) {
140
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
149 149
     }
150 150
 
151
-    if($gd_page_id){
151
+    if ($gd_page_id) {
152 152
         $post = get_post($gd_page_id);
153 153
         $slug = $post->post_name;
154 154
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
155 155
         $login_url = trailingslashit($home_url)."$slug/";
156
-    }else{
156
+    } else {
157 157
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
158 158
     }
159 159
 
160
-    if($args){
161
-        $login_url = add_query_arg($args,$login_url );
160
+    if ($args) {
161
+        $login_url = add_query_arg($args, $login_url);
162 162
     }
163 163
 
164 164
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param array $args The array of query args used.
173 173
      * @param int $gd_page_id The page id of the GD login page.
174 174
      */
175
-    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
175
+    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
176 176
 }
177 177
 
178 178
 /**
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
  * @since 1.5.4
183 183
  * @return string Info page url.
184 184
  */
185
-function geodir_info_url($args=array()){
185
+function geodir_info_url($args = array()) {
186 186
     $gd_page_id = get_option('geodir_info_page');
187 187
 
188 188
     if (function_exists('icl_object_id')) {
189
-        $gd_page_id =  icl_object_id($gd_page_id, 'page', true);
189
+        $gd_page_id = icl_object_id($gd_page_id, 'page', true);
190 190
     }
191 191
 
192 192
     if (function_exists('geodir_location_geo_home_link')) {
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
198 198
     }
199 199
 
200
-    if($gd_page_id){
200
+    if ($gd_page_id) {
201 201
         $post = get_post($gd_page_id);
202 202
         $slug = $post->post_name;
203 203
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
204 204
         $info_url = trailingslashit($home_url)."$slug/";
205
-    }else{
205
+    } else {
206 206
         $info_url = trailingslashit($home_url);
207 207
     }
208 208
 
209
-    if($args){
210
-        $info_url = add_query_arg($args,$info_url );
209
+    if ($args) {
210
+        $info_url = add_query_arg($args, $info_url);
211 211
     }
212 212
 
213 213
     return $info_url;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  * @param string $charset Character set to use for conversion.
226 226
  * @return string Returns converted string.
227 227
  */
228
-function geodir_ucwords($string, $charset='UTF-8') {
228
+function geodir_ucwords($string, $charset = 'UTF-8') {
229 229
     if (function_exists('mb_convert_case')) {
230 230
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
231 231
     } else {
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  * @param string $charset Character set to use for conversion.
246 246
  * @return string Returns converted string.
247 247
  */
248
-function geodir_strtolower($string, $charset='UTF-8') {
248
+function geodir_strtolower($string, $charset = 'UTF-8') {
249 249
     if (function_exists('mb_convert_case')) {
250 250
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
251 251
     } else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
  * @param string $charset Character set to use for conversion.
266 266
  * @return string Returns converted string.
267 267
  */
268
-function geodir_strtoupper($string, $charset='UTF-8') {
268
+function geodir_strtoupper($string, $charset = 'UTF-8') {
269 269
     if (function_exists('mb_convert_case')) {
270 270
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
271 271
     } else {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	
297 297
 	$url = trim($parts[0]);
298 298
 	if ($formatted && $url != '') {
299
-		$url = str_replace( ' ', '%20', $url );
299
+		$url = str_replace(' ', '%20', $url);
300 300
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
301 301
 		
302 302
 		if (0 !== stripos($url, 'mailto:')) {
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 		
307 307
 		$url = str_replace(';//', '://', $url);
308 308
 		
309
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
310
-			$url = 'http://' . $url;
309
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
310
+			$url = 'http://'.$url;
311 311
 		}
312 312
 		
313 313
 		$url = wp_kses_normalize_entities($url);
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
  * @package GeoDirectory
450 450
  */
451 451
 function _gd_die_handler() {
452
-    if ( defined( 'GD_TESTING_MODE' ) ) {
452
+    if (defined('GD_TESTING_MODE')) {
453 453
         return '_gd_die_handler';
454 454
     } else {
455 455
         die();
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
  * @param string $title   Optional. Error title.
468 468
  * @param int $status     Optional. Status code.
469 469
  */
470
-function gd_die( $message = '', $title = '', $status = 400 ) {
471
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
472
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
473
-    wp_die( $message, $title, array( 'response' => $status ));
470
+function gd_die($message = '', $title = '', $status = 400) {
471
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
472
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
473
+    wp_die($message, $title, array('response' => $status));
474 474
 }
475 475
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 3 patches
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,11 +107,13 @@  discard block
 block discarded – undo
107 107
         }
108 108
     }
109 109
 
110
-    if (!empty($field_default_cat))
111
-        $field_default_cat = '';
110
+    if (!empty($field_default_cat)) {
111
+            $field_default_cat = '';
112
+    }
112 113
 
113
-    if (!empty($cat_find_array))
114
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
114
+    if (!empty($cat_find_array)) {
115
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
116
+    }
115 117
 
116 118
     $main_query_array = $map_cat_ids_array;
117 119
   
@@ -143,8 +145,9 @@  discard block
 block discarded – undo
143 145
         $gd_posttype = " AND p.post_type = %s";
144 146
         $main_query_array[] = $_REQUEST['gd_posttype'];
145 147
 
146
-    } else
147
-        $table = $plugin_prefix . 'gd_place_detail';
148
+    } else {
149
+            $table = $plugin_prefix . 'gd_place_detail';
150
+    }
148 151
 
149 152
     $join = ", " . $table . " AS pd ";
150 153
 
@@ -309,8 +312,7 @@  discard block
 block discarded – undo
309 312
 
310 313
     if (!empty($cat_content_info)) {
311 314
 		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
-    }
313
-    else {
315
+    } else {
314 316
 		return '[{"totalcount":"0"}]';
315 317
 	}
316 318
 }
317 319
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11 11
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
12 12
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
13
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
14 14
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15 15
     die;
16 16
 }
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
     global $wpdb, $plugin_prefix, $gd_session;
31 31
 
32 32
     if ($_REQUEST['m_id'] != '') {
33
-        $pid = (int)$_REQUEST['m_id'];
33
+        $pid = (int) $_REQUEST['m_id'];
34 34
     } else {
35 35
         echo __('No marker data found', 'geodirectory');
36 36
         exit;
37 37
     }
38 38
 
39 39
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
-        $post = (object)$gd_ses_listing;
40
+        $post = (object) $gd_ses_listing;
41 41
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42 42
     } else {
43 43
         $geodir_post_type = get_post_type($pid);
44 44
 
45
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
45
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
46 46
 
47
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
47
+        $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
48 48
 
49 49
         $postinfo = $wpdb->get_results($sql);
50 50
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
89 89
 
90 90
     $map_cat_ids_array = array('0');
91
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
91
+    $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
92 92
 
93 93
 
94 94
     $field_default_cat = '';
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
         $map_cat_arr = trim($_REQUEST['cat_id'], ',');
97 97
 
98 98
         if (!empty($map_cat_arr)) {
99
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
99
+            $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
100 100
 
101 101
             $map_cat_ids_array = explode(',', $map_cat_arr);
102 102
             $cat_find_array = array();
103 103
             foreach ($map_cat_ids_array as $cat_id) {
104
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
105
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
104
+                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id ";
105
+                $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)";
106 106
                 $main_query_array[] = $cat_id;
107 107
             }
108 108
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
         $field_default_cat = '';
114 114
 
115 115
     if (!empty($cat_find_array))
116
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
116
+        $search .= "AND (".implode(' OR ', $cat_find_array).")";
117 117
 
118 118
     $main_query_array = $map_cat_ids_array;
119 119
   
120 120
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
121 121
         $search .= " AND p.post_title LIKE %s";
122
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
122
+        $main_query_array[] = "%".$_REQUEST['search']."%";
123 123
     }
124 124
 
125 125
     /**
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 
142 142
     $gd_posttype = '';
143 143
     if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
144
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
144
+        $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail';
145 145
         $gd_posttype = " AND p.post_type = %s";
146 146
         $main_query_array[] = $_REQUEST['gd_posttype'];
147 147
 
148 148
     } else
149
-        $table = $plugin_prefix . 'gd_place_detail';
149
+        $table = $plugin_prefix.'gd_place_detail';
150 150
 
151
-    $join = ", " . $table . " AS pd ";
151
+    $join = ", ".$table." AS pd ";
152 152
 
153 153
     /**
154 154
 	 * Filter the SQL JOIN clause for the markers data
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	$search = apply_filters('geodir_home_map_listing_where', $search);
170 170
     $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
171
-    $cat_type = $post_type . 'category';
171
+    $cat_type = $post_type.'category';
172 172
     if ($post_type == 'gd_event') {
173 173
         $event_select = ", pd.recurring_dates, pd.is_recurring";
174 174
     } else {
175 175
         $event_select = "";
176 176
     }
177 177
 
178
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
178
+    $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select;
179 179
     /**
180 180
 	 * Filter the SQL SELECT clause to retrive fields data
181 181
 	 *
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
197 197
 
198
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
198
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
199 199
     
200 200
 	/**
201 201
 	 * Filter the SQL query to retrive markers data
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                         $e = 0;
258 258
                         foreach ($recurring_dates as $date) {
259 259
                             if (strtotime($date) >= $today) {
260
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
260
+                                $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date));
261 261
                                 
262 262
                                 $e++;
263 263
                                 if ($e == 3) { // only show 3 event dates
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
                     $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
272 272
                 
273 273
                     if ($end_date != '' && strtotime($end_date) >= $today) {
274
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
274
+                        $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date));
275 275
                     }
276 276
                 }
277 277
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
                 $icon_size = array('w' => 36, 'h' => 45);
300 300
             }
301 301
 
302
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
302
+            $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$catinfo_obj->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
303 303
             $post_ids[] = $catinfo_obj->post_id;
304 304
         }
305 305
     }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     $totalcount = count(array_unique($post_ids));
324 324
 
325 325
     if (!empty($cat_content_info)) {
326
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
326
+        return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
327 327
     }
328 328
     else {
329 329
         return '[{"totalcount":"0"}]';
Please login to merge, or discard this patch.
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
10
-    global $gd_session;
11
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
16
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
-    die;
10
+	global $gd_session;
11
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
16
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
+	die;
18 18
 }
19 19
 
20 20
 // Send the content-type header with correct encoding
21 21
 header("Content-type: text/javascript; charset=utf-8");
22 22
 
23 23
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
24
-    echo get_markers();
25
-    exit;
24
+	echo get_markers();
25
+	exit;
26 26
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
27
-    /**
28
-     * @global object $wpdb WordPress Database object.
29
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
30
-     * @global object $gd_session GeoDirectory Session object.
31
-     */
32
-    global $wpdb, $plugin_prefix, $gd_session;
33
-
34
-    if ($_REQUEST['m_id'] != '') {
35
-        $pid = (int)$_REQUEST['m_id'];
36
-    } else {
37
-        echo __('No marker data found', 'geodirectory');
38
-        exit;
39
-    }
40
-
41
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
-        $post = (object)$gd_ses_listing;
43
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
-    } else {
45
-        $geodir_post_type = get_post_type($pid);
46
-
47
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
48
-
49
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
-
51
-        $postinfo = $wpdb->get_results($sql);
52
-
53
-        $data_arr = array();
54
-
55
-        if ($postinfo) {
56
-            $srcharr = array("'", "/", "-", '"', '\\');
57
-            $replarr = array("′", "⁄", "–", "“", '');
58
-
59
-            foreach ($postinfo as $postinfo_obj) {
60
-                echo geodir_get_infowindow_html($postinfo_obj);
61
-            }
62
-        }
63
-    }
64
-    exit;
27
+	/**
28
+	 * @global object $wpdb WordPress Database object.
29
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
30
+	 * @global object $gd_session GeoDirectory Session object.
31
+	 */
32
+	global $wpdb, $plugin_prefix, $gd_session;
33
+
34
+	if ($_REQUEST['m_id'] != '') {
35
+		$pid = (int)$_REQUEST['m_id'];
36
+	} else {
37
+		echo __('No marker data found', 'geodirectory');
38
+		exit;
39
+	}
40
+
41
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
+		$post = (object)$gd_ses_listing;
43
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
+	} else {
45
+		$geodir_post_type = get_post_type($pid);
46
+
47
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
48
+
49
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
+
51
+		$postinfo = $wpdb->get_results($sql);
52
+
53
+		$data_arr = array();
54
+
55
+		if ($postinfo) {
56
+			$srcharr = array("'", "/", "-", '"', '\\');
57
+			$replarr = array("′", "⁄", "–", "“", '');
58
+
59
+			foreach ($postinfo as $postinfo_obj) {
60
+				echo geodir_get_infowindow_html($postinfo_obj);
61
+			}
62
+		}
63
+	}
64
+	exit;
65 65
 }
66 66
 
67 67
 /**
@@ -79,80 +79,80 @@  discard block
 block discarded – undo
79 79
  * @return string
80 80
  */
81 81
 function get_markers() {
82
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes;
82
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes;
83 83
 
84
-    $search = '';
85
-    $main_query_array;
84
+	$search = '';
85
+	$main_query_array;
86 86
 
87
-    $srcharr = array("'", "/", "-", '"', '\\');
88
-    $replarr = array("′", "⁄", "–", "“", '');
87
+	$srcharr = array("'", "/", "-", '"', '\\');
88
+	$replarr = array("′", "⁄", "–", "“", '');
89 89
 
90
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
90
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
91 91
 
92
-    $map_cat_ids_array = array('0');
93
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
92
+	$map_cat_ids_array = array('0');
93
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
94 94
 
95 95
 
96
-    $field_default_cat = '';
97
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
98
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
96
+	$field_default_cat = '';
97
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
98
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
99 99
 
100
-        if (!empty($map_cat_arr)) {
101
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
100
+		if (!empty($map_cat_arr)) {
101
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
102 102
 
103
-            $map_cat_ids_array = explode(',', $map_cat_arr);
104
-            $cat_find_array = array();
105
-            foreach ($map_cat_ids_array as $cat_id) {
106
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
107
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
108
-                $main_query_array[] = $cat_id;
109
-            }
103
+			$map_cat_ids_array = explode(',', $map_cat_arr);
104
+			$cat_find_array = array();
105
+			foreach ($map_cat_ids_array as $cat_id) {
106
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
107
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
108
+				$main_query_array[] = $cat_id;
109
+			}
110 110
 
111
-        }
112
-    }
111
+		}
112
+	}
113 113
 
114
-    if (!empty($field_default_cat))
115
-        $field_default_cat = '';
114
+	if (!empty($field_default_cat))
115
+		$field_default_cat = '';
116 116
 
117
-    if (!empty($cat_find_array))
118
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
117
+	if (!empty($cat_find_array))
118
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
119 119
 
120
-    $main_query_array = $map_cat_ids_array;
120
+	$main_query_array = $map_cat_ids_array;
121 121
   
122
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
123
-        $search .= " AND p.post_title LIKE %s";
124
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
125
-    }
126
-
127
-    /**
128
-     * Filter the marker query search SQL, values are replaces with %s or %d.
129
-     *
130
-     * @since 1.5.3
131
-     *
132
-     * @param string $search The SQL query for search/where.
133
-     */
134
-    $search = apply_filters('geodir_marker_search', $search);
135
-    /**
136
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
137
-     *
138
-     * @since 1.5.3
139
-     *
140
-     * @param array $main_query_array The SQL query values for search/where.
141
-     */
142
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
143
-
144
-    $gd_posttype = '';
145
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
146
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
147
-        $gd_posttype = " AND p.post_type = %s";
148
-        $main_query_array[] = $_REQUEST['gd_posttype'];
149
-
150
-    } else
151
-        $table = $plugin_prefix . 'gd_place_detail';
152
-
153
-    $join = ", " . $table . " AS pd ";
154
-
155
-    /**
122
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
123
+		$search .= " AND p.post_title LIKE %s";
124
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
125
+	}
126
+
127
+	/**
128
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
129
+	 *
130
+	 * @since 1.5.3
131
+	 *
132
+	 * @param string $search The SQL query for search/where.
133
+	 */
134
+	$search = apply_filters('geodir_marker_search', $search);
135
+	/**
136
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
137
+	 *
138
+	 * @since 1.5.3
139
+	 *
140
+	 * @param array $main_query_array The SQL query values for search/where.
141
+	 */
142
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
143
+
144
+	$gd_posttype = '';
145
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
146
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
147
+		$gd_posttype = " AND p.post_type = %s";
148
+		$main_query_array[] = $_REQUEST['gd_posttype'];
149
+
150
+	} else
151
+		$table = $plugin_prefix . 'gd_place_detail';
152
+
153
+	$join = ", " . $table . " AS pd ";
154
+
155
+	/**
156 156
 	 * Filter the SQL JOIN clause for the markers data
157 157
 	 *
158 158
 	 * @since 1.0.0
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 	 * @param string $search Row of searched fields to use in WHERE clause.
170 170
 	 */
171 171
 	$search = apply_filters('geodir_home_map_listing_where', $search);
172
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
173
-    $cat_type = $post_type . 'category';
174
-    if ($post_type == 'gd_event') {
175
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
176
-    } else {
177
-        $event_select = "";
178
-    }
179
-
180
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
181
-    /**
172
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
173
+	$cat_type = $post_type . 'category';
174
+	if ($post_type == 'gd_event') {
175
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
176
+	} else {
177
+		$event_select = "";
178
+	}
179
+
180
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
181
+	/**
182 182
 	 * Filter the SQL SELECT clause to retrive fields data
183 183
 	 *
184 184
 	 * @since 1.0.0
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
199 199
 
200
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
200
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
201 201
     
202 202
 	/**
203 203
 	 * Filter the SQL query to retrive markers data
@@ -209,125 +209,125 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	$catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
211 211
 
212
-    $catinfo = $wpdb->get_results($catsql);
212
+	$catinfo = $wpdb->get_results($catsql);
213 213
 	
214
-    $cat_content_info = array();
215
-    $content_data = array();
216
-    $post_ids = array();
217
-
218
-    /**
219
-     * Called before marker data is processed into JSON.
220
-     *
221
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
222
-     *
223
-     * @since 1.5.3
224
-     * @param object $catinfo The posts object containing all marker data.
225
-     * @see 'geodir_after_marker_post_process'
226
-     */
227
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
228
-
229
-    /**
230
-     * Called before marker data is processed into JSON.
231
-     *
232
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
233
-     *
234
-     * @since 1.4.9
235
-     * @param object $catinfo The posts object containing all marker data.
236
-     * @see 'geodir_after_marker_post_process'
237
-     */
238
-    do_action('geodir_before_marker_post_process_action', $catinfo);
239
-
240
-    // Sort any posts into a ajax array
241
-    if (!empty($catinfo)) {
242
-        $geodir_cat_icons = geodir_get_term_icon();
243
-        global $geodir_date_format;
244
-
245
-        $today = strtotime(date_i18n('Y-m-d'));
214
+	$cat_content_info = array();
215
+	$content_data = array();
216
+	$post_ids = array();
217
+
218
+	/**
219
+	 * Called before marker data is processed into JSON.
220
+	 *
221
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
222
+	 *
223
+	 * @since 1.5.3
224
+	 * @param object $catinfo The posts object containing all marker data.
225
+	 * @see 'geodir_after_marker_post_process'
226
+	 */
227
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
228
+
229
+	/**
230
+	 * Called before marker data is processed into JSON.
231
+	 *
232
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
233
+	 *
234
+	 * @since 1.4.9
235
+	 * @param object $catinfo The posts object containing all marker data.
236
+	 * @see 'geodir_after_marker_post_process'
237
+	 */
238
+	do_action('geodir_before_marker_post_process_action', $catinfo);
239
+
240
+	// Sort any posts into a ajax array
241
+	if (!empty($catinfo)) {
242
+		$geodir_cat_icons = geodir_get_term_icon();
243
+		global $geodir_date_format;
244
+
245
+		$today = strtotime(date_i18n('Y-m-d'));
246 246
         
247
-        foreach ($catinfo as $catinfo_obj) {
248
-            $post_title = $catinfo_obj->post_title;
247
+		foreach ($catinfo as $catinfo_obj) {
248
+			$post_title = $catinfo_obj->post_title;
249 249
             
250
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
251
-                $event_dates = '';
252
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
250
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
251
+				$event_dates = '';
252
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
253 253
                 
254
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
255
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
256
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
254
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
255
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
256
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
257 257
                     
258
-                    if (!empty($recurring_dates)) {					
259
-                        $e = 0;
260
-                        foreach ($recurring_dates as $date) {
261
-                            if (strtotime($date) >= $today) {
262
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
258
+					if (!empty($recurring_dates)) {					
259
+						$e = 0;
260
+						foreach ($recurring_dates as $date) {
261
+							if (strtotime($date) >= $today) {
262
+								$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
263 263
                                 
264
-                                $e++;
265
-                                if ($e == 3) { // only show 3 event dates
266
-                                    break;
267
-                                }
268
-                            }
269
-                        }
270
-                    }
271
-                } else {
272
-                    $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
273
-                    $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
264
+								$e++;
265
+								if ($e == 3) { // only show 3 event dates
266
+									break;
267
+								}
268
+							}
269
+						}
270
+					}
271
+				} else {
272
+					$start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
273
+					$end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
274 274
                 
275
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
276
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
277
-                    }
278
-                }
279
-
280
-                if (empty($event_dates)) {
281
-                    continue;
282
-                }
275
+					if ($end_date != '' && strtotime($end_date) >= $today) {
276
+						$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
277
+					}
278
+				}
279
+
280
+				if (empty($event_dates)) {
281
+					continue;
282
+				}
283 283
                 
284
-                $post_title .= $event_dates;
285
-            }
284
+				$post_title .= $event_dates;
285
+			}
286 286
 
287
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
288
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
289
-            $title = str_replace($srcharr, $replarr, $post_title);
287
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
288
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
289
+			$title = str_replace($srcharr, $replarr, $post_title);
290 290
             
291
-            if ($icon != '') {
292
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
291
+			if ($icon != '') {
292
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
293 293
                 
294
-                if (isset($gd_marker_sizes[$icon])) {
295
-                    $icon_size = $gd_marker_sizes[$icon];
296
-                } else {
297
-                    $icon_size = geodir_get_marker_size($icon);
298
-                    $gd_marker_sizes[$icon] = $icon_size;
299
-                }               
300
-            } else {
301
-                $icon_size = array('w' => 36, 'h' => 45);
302
-            }
303
-
304
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
305
-            $post_ids[] = $catinfo_obj->post_id;
306
-        }
307
-    }
308
-
309
-    /**
310
-     * Called after marker data is processed into JSON.
311
-     *
312
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
313
-     *
314
-     * @since 1.4.9
315
-     * @param array $content_data The array containing all markers in JSON format.
316
-     * @param object $catinfo The posts object containing all marker data.
317
-     * @see 'geodir_before_marker_post_process'
318
-     */
319
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
320
-
321
-    if (!empty($content_data)) {
322
-        $cat_content_info[] = implode(',', $content_data);
323
-    }
324
-
325
-    $totalcount = count(array_unique($post_ids));
326
-
327
-    if (!empty($cat_content_info)) {
328
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
-    }
330
-    else {
331
-        return '[{"totalcount":"0"}]';
332
-    }
294
+				if (isset($gd_marker_sizes[$icon])) {
295
+					$icon_size = $gd_marker_sizes[$icon];
296
+				} else {
297
+					$icon_size = geodir_get_marker_size($icon);
298
+					$gd_marker_sizes[$icon] = $icon_size;
299
+				}               
300
+			} else {
301
+				$icon_size = array('w' => 36, 'h' => 45);
302
+			}
303
+
304
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
305
+			$post_ids[] = $catinfo_obj->post_id;
306
+		}
307
+	}
308
+
309
+	/**
310
+	 * Called after marker data is processed into JSON.
311
+	 *
312
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
313
+	 *
314
+	 * @since 1.4.9
315
+	 * @param array $content_data The array containing all markers in JSON format.
316
+	 * @param object $catinfo The posts object containing all marker data.
317
+	 * @see 'geodir_before_marker_post_process'
318
+	 */
319
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
320
+
321
+	if (!empty($content_data)) {
322
+		$cat_content_info[] = implode(',', $content_data);
323
+	}
324
+
325
+	$totalcount = count(array_unique($post_ids));
326
+
327
+	if (!empty($cat_content_info)) {
328
+		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
+	}
330
+	else {
331
+		return '[{"totalcount":"0"}]';
332
+	}
333 333
 }
334 334
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,9 +45,10 @@  discard block
 block discarded – undo
45 45
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
46 46
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
47 47
     $mapzoom = 4;
48
-    if (isset($_REQUEST['add_hood']))
49
-        $mapzoom = 10;
50
-}
48
+    if (isset($_REQUEST['add_hood'])) {
49
+            $mapzoom = 10;
50
+    }
51
+    }
51 52
 
52 53
 /**
53 54
  * Filter the auto change address fields values
@@ -641,8 +642,9 @@  discard block
 block discarded – undo
641 642
 </script>
642 643
 <?php
643 644
 $set_button_class = 'geodir_button';
644
-if (is_admin())
645
-    $set_button_class = 'button-primary';
645
+if (is_admin()) {
646
+    $set_button_class = 'button-primary';
647
+}
646 648
 ?>
647 649
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>"
648 650
        value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/>
Please login to merge, or discard this patch.
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
35 35
 $lat_lng_blank = false;
36 36
 if ($lat == '' && $lng == '') {
37
-    $lat_lng_blank = true;
38
-    $city = $defaultcity;
39
-    $region = isset($default_location->region) ? $default_location->region : '';
40
-    $country = isset($default_location->country) ? $default_location->country : '';
41
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
42
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
37
+	$lat_lng_blank = true;
38
+	$city = $defaultcity;
39
+	$region = isset($default_location->region) ? $default_location->region : '';
40
+	$country = isset($default_location->country) ? $default_location->country : '';
41
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
42
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
43 43
 }
44 44
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
45 45
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
46 46
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
47
-    $mapzoom = 4;
48
-    if (isset($_REQUEST['add_hood']))
49
-        $mapzoom = 10;
47
+	$mapzoom = 4;
48
+	if (isset($_REQUEST['add_hood']))
49
+		$mapzoom = 10;
50 50
 }
51 51
 
52 52
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * Fires at the start of the add javascript on the add lsitings map.
68 68
 	 *
69 69
 	 * @since 1.0.0
70
-     * @param string $prefix The prefix for all elements.
70
+	 * @param string $prefix The prefix for all elements.
71 71
 	 */
72 72
 	do_action('geodir_add_listing_js_start', $prefix);
73 73
 	?>
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
                 getZip = postal_code.long_name;
315 315
             }
316 316
             <?php 
317
-            /**
318
-             * Fires to add javascript variable to use in google map.
319
-             *
320
-             * @since 1.0.0
321
-             */
322
-            do_action('geodir_add_listing_geocode_js_vars');
323
-            ?>
317
+			/**
318
+			 * Fires to add javascript variable to use in google map.
319
+			 *
320
+			 * @since 1.0.0
321
+			 */
322
+			do_action('geodir_add_listing_geocode_js_vars');
323
+			?>
324 324
             <?php if ($is_map_restrict) { ?>
325 325
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
326 326
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
             }
401 401
         }
402 402
         <?php
403
-        /**
404
-         * Fires when marker address updated on map.
405
-         *
406
-         * @since 1.0.0
407
-         * @param string $prefix Identifier used as a prefix for field name
408
-         */
409
-        do_action('geodir_update_marker_address', $prefix);
410
-        echo $updateMarkerAddress = ob_get_clean();
411
-        ?>
403
+		/**
404
+		 * Fires when marker address updated on map.
405
+		 *
406
+		 * @since 1.0.0
407
+		 * @param string $prefix Identifier used as a prefix for field name
408
+		 */
409
+		do_action('geodir_update_marker_address', $prefix);
410
+		echo $updateMarkerAddress = ob_get_clean();
411
+		?>
412 412
     }
413 413
     function geodir_codeAddress(set_on_map) {
414 414
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
         }
436 436
         var is_restrict = '<?php echo $is_map_restrict; ?>';
437 437
         <?php ob_start();
438
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
439
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
440
-        ?>
438
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
439
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
440
+		?>
441 441
         if (set_on_map && is_restrict) {
442 442
             if (zip != '' && address != '') {
443 443
                 address = address + ',' + zip;
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
             if (typeof address === 'undefined')
447 447
                 address = '';
448 448
             <?php
449
-            if(is_admin() && isset($_REQUEST['tab'])){?>
449
+			if(is_admin() && isset($_REQUEST['tab'])){?>
450 450
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
451 451
                 address = '';
452 452
             }
453 453
             <?php
454
-               }?>
454
+			   }?>
455 455
 
456 456
             if (ISO2 == 'GB') {
457 457
                 address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions
@@ -460,15 +460,15 @@  discard block
 block discarded – undo
460 460
             }
461 461
         }
462 462
         <?php $codeAddress = ob_get_clean();
463
-        /**
464
-         * Filter the address variable
465
-         *
466
-         * @since 1.0.0
467
-         *
468
-         * @param string $codeAddress Row of address to use in google map.
469
-         */
470
-        echo apply_filters('geodir_codeaddress', $codeAddress);
471
-        ?>
463
+		/**
464
+		 * Filter the address variable
465
+		 *
466
+		 * @since 1.0.0
467
+		 *
468
+		 * @param string $codeAddress Row of address to use in google map.
469
+		 */
470
+		echo apply_filters('geodir_codeaddress', $codeAddress);
471
+		?>
472 472
         if (!window.gdMaps) { // No Google Map Loaded
473 473
             return;
474 474
         }
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
                         updateMarkerPosition(baseMarker.getPosition());
494 494
                         //if(set_on_map && is_restrict) {
495 495
                         <?php 
496
-                        /**
497
-                         * Fires before set geocode position.
498
-                         *
499
-                         * @since 1.0.0
500
-                         */
501
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
502
-                        ?>
496
+						/**
497
+						 * Fires before set geocode position.
498
+						 *
499
+						 * @since 1.0.0
500
+						 */
501
+						do_action('geodir_add_listing_codeaddress_before_geocode');
502
+						?>
503 503
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
504 504
                         //}
505 505
                     } else {
@@ -545,13 +545,13 @@  discard block
 block discarded – undo
545 545
                 updateMarkerPositionOSM(baseMarker.getLatLng());
546 546
             }
547 547
             <?php 
548
-            /**
549
-             * Fires to add javascript variable to use in google map.
550
-             *
551
-             * @since 1.0.0
552
-             */
553
-            do_action('geodir_add_listing_geocode_js_vars');
554
-            ?>
548
+			/**
549
+			 * Fires to add javascript variable to use in google map.
550
+			 *
551
+			 * @since 1.0.0
552
+			 */
553
+			do_action('geodir_add_listing_geocode_js_vars');
554
+			?>
555 555
             <?php if ($is_map_restrict) { ?>
556 556
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
557 557
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 <?php
700 700
 $set_button_class = 'geodir_button';
701 701
 if (is_admin())
702
-    $set_button_class = 'button-primary';
702
+	$set_button_class = 'button-primary';
703 703
 ?>
704 704
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
705 705
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
     window.gdMaps = window.gdMaps || gdMaps;
82 82
     
83 83
     user_address = false;
84
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
84
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
85 85
         user_address = true;
86 86
     });
87 87
 
88 88
     baseMarker = '';
89 89
     geocoder = '';
90
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
92
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
93
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
90
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
92
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
93
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
94 94
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
95 95
     var oldstr_address;
96 96
     var oldstr_zip;
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
             do_action('geodir_add_listing_geocode_js_vars');
323 323
             ?>
324 324
             <?php if ($is_map_restrict) { ?>
325
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
326
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
327
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
325
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
326
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
327
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
328 328
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
329 329
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
330 330
                 updateMarkerPosition(baseMarker.getPosition());
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
             <?php } ?>
334 334
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
335 335
         } else {
336
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
336
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
337 337
         }
338 338
     }
339 339
     function centerMap(latlng) {
340
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
340
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
341 341
         if (window.gdMaps == 'google') {
342 342
             jQuery.goMap.map.panTo(baseMarker.getPosition());
343 343
         } else if (window.gdMaps == 'osm') {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         }
347 347
     }
348 348
     function centerMarker() {
349
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
349
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
350 350
         var center = jQuery.goMap.map.getCenter();
351 351
         if (window.gdMaps == 'google') {
352 352
             baseMarker.setPosition(center);
@@ -355,47 +355,47 @@  discard block
 block discarded – undo
355 355
         }
356 356
     }
357 357
     function updateMapZoom(zoom) {
358
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
358
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
359 359
     }
360 360
     function updateMarkerPosition(markerlatLng) {
361
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
362
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
363
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
361
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
362
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
363
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
364 364
     }
365 365
     function updateMarkerPositionOSM(markerlatLng) {
366
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
367
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
366
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
367
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
368 368
     }
369 369
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
370
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
371
-        <?php ob_start();?>
372
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
373
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
370
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
371
+        <?php ob_start(); ?>
372
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
373
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
374 374
         
375
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
376
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
375
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
376
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
377 377
         }
378 378
         if (getAddress) {
379 379
             oldstr_address = getAddress;
380 380
         }
381 381
         
382
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
382
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
383 383
         if (getZip) {
384 384
             oldstr_zip = getZip;
385 385
         }
386 386
         if (set_map_val_in_fields) {
387 387
             if (getCountry) {
388
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
389
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
388
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
389
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
390 390
             }
391 391
             if (getState) {
392
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
393
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
392
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
393
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
394 394
                 }
395 395
             }
396 396
             if (getCity) {
397
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
398
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
397
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
398
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
399 399
                 }
400 400
             }
401 401
         }
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
         ?>
412 412
     }
413 413
     function geodir_codeAddress(set_on_map) {
414
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
415
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
416
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
417
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
418
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
419
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
414
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
415
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
416
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
417
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
418
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
419
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
420 420
         var ISO2 = country_selected.data('country_code');
421 421
         if (ISO2 == '--') {
422 422
             ISO2 = '';
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
             zip = '';
426 426
         }
427 427
         if (typeof city == "undefined") {
428
-            city = '<?php echo addslashes_gpc($city);?>';
428
+            city = '<?php echo addslashes_gpc($city); ?>';
429 429
         }
430 430
         if (typeof region == "undefined") {
431
-            region = '<?php echo addslashes_gpc($region);?>';
431
+            region = '<?php echo addslashes_gpc($region); ?>';
432 432
         }
433 433
         if (typeof country == "undefined") {
434
-            country = '<?php echo addslashes_gpc($country);?>';
434
+            country = '<?php echo addslashes_gpc($country); ?>';
435 435
         }
436 436
         var is_restrict = '<?php echo $is_map_restrict; ?>';
437 437
         <?php ob_start();
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             if (typeof address === 'undefined')
447 447
                 address = '';
448 448
             <?php
449
-            if(is_admin() && isset($_REQUEST['tab'])){?>
449
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
450 450
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
451 451
                 address = '';
452 452
             }
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
             geocoder.geocode({'address': address, 'country': ISO2},
487 487
                 function (results, status) {
488 488
                     console.log(status);
489
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
489
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
490 490
                     if (status == google.maps.GeocoderStatus.OK) {
491 491
                         baseMarker.setPosition(results[0].geometry.location);
492 492
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -503,21 +503,21 @@  discard block
 block discarded – undo
503 503
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
504 504
                         //}
505 505
                     } else {
506
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
506
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
507 507
                     }
508 508
                 });
509 509
         }
510 510
     }
511 511
     function gdMaxMap() {
512
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
512
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
513 513
 
514
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
514
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
515 515
         jQuery('.map_category').toggleClass('map_category_fullscreen');
516
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
516
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
517 517
         jQuery('body').toggleClass('body_fullscreen');
518
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
519
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
520
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
518
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
519
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
520
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
521 521
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
522 522
         window.setTimeout(function () {
523 523
             if (window.gdMaps == 'google') {
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
             do_action('geodir_add_listing_geocode_js_vars');
554 554
             ?>
555 555
             <?php if ($is_map_restrict) { ?>
556
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
557
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
558
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
556
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
557
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
558
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
559 559
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
560 560
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
561 561
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -564,39 +564,39 @@  discard block
 block discarded – undo
564 564
             <?php } ?>
565 565
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
566 566
         } else {
567
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
567
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
568 568
         }
569 569
     }
570 570
     
571 571
     jQuery(function ($) {
572
-        $("#<?php echo $prefix.'map';?>").goMap({
573
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
574
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
575
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
572
+        $("#<?php echo $prefix.'map'; ?>").goMap({
573
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
574
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
575
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
576 576
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
577 577
             streetViewControl: true,
578
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
578
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
579 579
         });
580 580
 
581 581
         if (window.gdMaps) {
582 582
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
583 583
 
584 584
             baseMarker = $.goMap.createMarker({
585
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
586
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
585
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
586
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
587 587
                 id: 'baseMarker',
588
-                icon: '<?php echo $marker_icon;?>',
588
+                icon: '<?php echo $marker_icon; ?>',
589 589
                 draggable: true,
590 590
                 addToMap: true, // For OSM
591
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
592
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
591
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
592
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
593 593
             });
594 594
         } else {
595
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
596
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
595
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
596
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
597 597
         }
598 598
         
599
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
599
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
600 600
             var set_on_map = true;
601 601
             geodir_codeAddress(set_on_map);
602 602
         });
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
                 updateMapZoom($.goMap.map.zoom);
631 631
             });
632 632
 
633
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
633
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
634 634
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
635 635
 
636 636
             <?php if ($is_map_restrict) { ?>
637
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
637
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
638 638
             geocoder.geocode({'address': CITY_ADDRESS},
639 639
                 function (results, status) {
640
-                    $("#<?php echo $prefix.'map';?>").goMap();
640
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
641 641
                     if (status == google.maps.GeocoderStatus.OK) {
642 642
                         // Bounds for North America
643 643
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
649 649
                         );
650 650
                     } else {
651
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
651
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
652 652
                     }
653 653
                 });
654 654
             <?php } ?>
655 655
             // Limit the zoom level
656 656
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
657
-                $("#<?php echo $prefix.'map';?>").goMap();
657
+                $("#<?php echo $prefix.'map'; ?>").goMap();
658 658
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
659 659
             });
660 660
         } else if (window.gdMaps == 'osm') {
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
                 updateMapZoom($.goMap.map.getZoom());
681 681
             });
682 682
 
683
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
683
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
684 684
 
685 685
             <?php if ($is_map_restrict) { ?>
686
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
686
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
687 687
             geocodePositionOSM('', CITY_ADDRESS);
688 688
             <?php } ?>
689 689
             // Limit the zoom level
@@ -706,14 +706,14 @@  discard block
 block discarded – undo
706 706
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
707 707
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
708 708
     <div class="TopRight"></div>
709
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
709
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
710 710
         <!-- new map start -->
711 711
         <div class="iprelative">
712
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
712
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
713 713
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
714 714
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
715 715
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
716
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
716
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
717 717
         </div>
718 718
         <!-- new map end -->
719 719
     </div>
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -223,10 +223,11 @@  discard block
 block discarded – undo
223 223
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
224 224
                 <?php }
225 225
 
226
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
227
-                    $show_entire_cat_panel = "none";
228
-                else
229
-                    $show_entire_cat_panel = "''";
226
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
227
+                                    $show_entire_cat_panel = "none";
228
+                } else {
229
+                                    $show_entire_cat_panel = "''";
230
+                }
230 231
                 ?>
231 232
 
232 233
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -288,8 +289,9 @@  discard block
 block discarded – undo
288 289
 				}
289 290
 				
290 291
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
291
-				if (empty($geodir_default_map_search_pt))
292
-					$geodir_default_map_search_pt = 'gd_place';
292
+				if (empty($geodir_default_map_search_pt)) {
293
+									$geodir_default_map_search_pt = 'gd_place';
294
+				}
293 295
 
294 296
 				/**
295 297
 				 * Filter the post type to retrive data for map
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 
130 130
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131 131
     } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
132
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
133 133
     }
134 134
 
135 135
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136 136
     } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
137
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
138 138
     }
139 139
 
140 140
     /**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
169
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
173 173
 
174 174
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190 190
         ?>
191
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
191
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
194
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
195
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
196
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
194
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
195
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
196
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
197 197
 
198 198
                 <div class="map_background">
199 199
                     <div class="top_banner_section_in clearfix">
200
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
202
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
203
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
200
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
202
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
203
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
204 204
                             <!-- new map start -->
205 205
                             <div class="iprelative">
206
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
207
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
208
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
209
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
206
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
207
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
208
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
209
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
210 210
                                 <!--<div id="home_map_counter"></div>        -->
211
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
211
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
212 212
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
213
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
213
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
214 214
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
215 215
                             </div>
216 216
                             <!-- new map end -->
217 217
                         </div>
218
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
218
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
219 219
                     </div>
220 220
                 </div>
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
222
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224 224
                     ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228 228
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                            onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/>
243 243
 
244 244
                     <script>
245
-                        <?php if(geodir_is_page('detail')){?>
245
+                        <?php if (geodir_is_page('detail')) {?>
246 246
                         jQuery(function () {
247 247
                             gd_initialize_ac();
248 248
                         });
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                 // Create the autocomplete object, restricting the search
254 254
                                 // to geographical location types.
255 255
                                 autocomplete = new google.maps.places.Autocomplete(
256
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
256
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
257 257
                                     {types: ['geocode']});
258 258
                                 // When the user selects an address from the dropdown,
259 259
                                 // populate the address fields in the form.
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				 */
308 308
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
309 309
 				?>
310
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
310
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
311 311
                     <?php
312 312
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
313 313
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 					}
318 318
                     ?>
319 319
                     <div
320
-                        class="map-category-listing<?php echo $map_cat_class;?>">
320
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
321 321
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
322
-                        <div id="<?php echo $map_canvas_name;?>_cat"
323
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
324
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
325
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
322
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
323
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
324
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
325
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
326 326
                             <input
327 327
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
328 328
                                 type="text"
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
335 335
                                 <?php } else {$child_collapse = "0";
336 336
                                     ?>
337
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
337
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
338 338
                                 <?php } ?>
339 339
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
340 340
                                 <div class="toggle">
341
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
341
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
342 342
                                     <script>jQuery( document ).ready(function() {
343 343
                                             geodir_show_sub_cat_collapse_button();
344 344
                                         });</script>
@@ -367,21 +367,21 @@  discard block
 block discarded – undo
367 367
 					$city = $country != 'me' ? $city : '';
368 368
                     $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
369 369
                     ?>
370
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
371
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
372
-                           value="<?php echo $country;?>"/>
373
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
374
-                           value="<?php echo $region;?>"/>
375
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
376
-                           value="<?php echo $city;?>"/>
377
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
378
-                           value="<?php echo $gd_neighbourhood;?>"/>
370
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
371
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
372
+                           value="<?php echo $country; ?>"/>
373
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
374
+                           value="<?php echo $region; ?>"/>
375
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
376
+                           value="<?php echo $city; ?>"/>
377
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
378
+                           value="<?php echo $gd_neighbourhood; ?>"/>
379 379
                 <?php } else { //end of location filter
380 380
                     ?>
381
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
381
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
382 382
                 <?php }?>
383 383
 
384
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
384
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
385 385
 
386 386
                 <input type="hidden" name="limitstart" value=""/>
387 387
 
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
 
390 390
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
391 391
                     $post_types = geodir_get_posttypes('object');
392
-                    if (count((array)($post_types)) > 1) {
392
+                    if (count((array) ($post_types)) > 1) {
393 393
                         ?>
394
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
395
-                             style="max-width:<?php echo $map_width;?>!important;">
394
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
395
+                             style="max-width:<?php echo $map_width; ?>!important;">
396 396
 
397 397
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
398 398
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
                                     foreach ($post_types as $post_type => $args) {
404 404
                                         if (!in_array($post_type, $exclude_post_types)) {
405 405
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
406
-											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
406
+											echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>';
407 407
                                         }
408 408
                                     }
409 409
                                     ?>
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
         <script type="text/javascript">
429 429
 
430 430
             jQuery(document).ready(function () {
431
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
432
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
433
-                map_sticky('<?php echo $map_canvas_name;?>');
431
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
432
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
433
+                map_sticky('<?php echo $map_canvas_name; ?>');
434 434
             });
435 435
 
436 436
         </script>
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
             <script>
442 442
                 (function () {
443 443
                     var screenH = jQuery(window).height();
444
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
444
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
445 445
 
446 446
                     var ptypeH = '';
447
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
448
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
447
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
448
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
449 449
                     }
450 450
 
451
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
452
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
453
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
454
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
455
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
451
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
452
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
453
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
454
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
455
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
456 456
 
457 457
                 }());
458 458
             </script>
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
             <script>
465 465
                 (function () {
466 466
                     var screenH = jQuery(window).height();
467
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
467
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
468 468
                     var ptypeH = '';
469
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
470
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
469
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
470
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
471 471
                     }
472 472
 
473
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
473
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
474 474
 
475 475
                 }());
476 476
             </script>
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
          * @param array $geodir_map_options Array of map settings.
486 486
          * @param string $map_canvas_name The canvas name and ID for the map.
487 487
          */
488
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
488
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
489 489
 
490 490
 
491 491
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -67,77 +67,77 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'maptype' => $maptype,
116
-        'showPreview' => '0',
117
-        'maxZoom' => 21,
118
-        'autozoom' => true,
119
-        'bubble_size' => 'small',
120
-        'token' => '68f48005e256696074e1da9bf9f67f06',
121
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
-    );
123
-
124
-    if (!empty($map_args)) {
125
-        foreach ($map_args as $map_option_key => $map_option_value) {
126
-            $geodir_map_options[$map_option_key] = $map_option_value;
127
-        }
128
-    }
129
-
130
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
-    } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
-    }
134
-
135
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
-    } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
-    }
139
-
140
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'maptype' => $maptype,
116
+		'showPreview' => '0',
117
+		'maxZoom' => 21,
118
+		'autozoom' => true,
119
+		'bubble_size' => 'small',
120
+		'token' => '68f48005e256696074e1da9bf9f67f06',
121
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
122
+	);
123
+
124
+	if (!empty($map_args)) {
125
+		foreach ($map_args as $map_option_key => $map_option_value) {
126
+			$geodir_map_options[$map_option_key] = $map_option_value;
127
+		}
128
+	}
129
+
130
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131
+	} else {
132
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
133
+	}
134
+
135
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136
+	} else {
137
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
138
+	}
139
+
140
+	/**
141 141
 	 * Filter the options to use in google map.
142 142
 	 *
143 143
 	 * @since 1.0.0
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
148 148
 
149
-    $map_canvas_arr[$map_canvas_name] = array();
149
+	$map_canvas_arr[$map_canvas_name] = array();
150 150
 
151
-    /**
151
+	/**
152 152
 	 * Filter the post types to display data on map.
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
-        // Set default map options
169
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170
+		// Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173 173
 
174
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
174
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
176
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
-            $map_width = '100%';
178
-        } else {
179
-            $map_width = $geodir_map_options['width'];
180
-        }
176
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
177
+			$map_width = '100%';
178
+		} else {
179
+			$map_width = $geodir_map_options['width'];
180
+		}
181 181
 
182
-        /**
182
+		/**
183 183
 		 * Filter the width of map.
184 184
 		 *
185 185
 		 * @since 1.0.0
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		 * @param int $map_width Width of map box, eg: gd_place.
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190
-        ?>
190
+		?>
191 191
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222 222
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224
-                    ?>
224
+					?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
232
-                ?>
228
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
+					$show_entire_cat_panel = "none";
230
+				else
231
+					$show_entire_cat_panel = "''";
232
+				?>
233 233
 
234 234
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
235 235
 
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
286 286
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
287 287
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
288
-                                echo 'selected="selected"';
289
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
288
+								echo 'selected="selected"';
289
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
290 290
                         </select>
291 291
                     </div>
292 292
 
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 				if (empty($geodir_default_map_search_pt))
299 299
 					$geodir_default_map_search_pt = 'gd_place';
300 300
 
301
-                global $gd_session;
302
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
301
+				global $gd_session;
302
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
303 303
 
304
-                if ($homemap_catlist_ptype) {
305
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
306
-                }
304
+				if ($homemap_catlist_ptype) {
305
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
306
+				}
307 307
 
308 308
 				/**
309 309
 				 * Filter the post type to retrive data for map
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 				?>
317 317
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
318 318
                     <?php
319
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
320
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
319
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
320
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
321 321
 					$map_cat_class = '';
322 322
 					if ($geodir_map_options['enable_post_type_filters']) {
323 323
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
324 324
 					}
325
-                    ?>
325
+					?>
326 326
                     <div
327 327
                         class="map-category-listing<?php echo $map_cat_class;?>">
328 328
                         <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
341 341
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
342 342
                                 <?php } else {$child_collapse = "0";
343
-                                    ?>
343
+									?>
344 344
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
345 345
                                 <?php } ?>
346 346
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -362,17 +362,17 @@  discard block
 block discarded – undo
362 362
                 <!-- map-category-listings-->
363 363
 
364 364
                 <?php
365
-                if ($geodir_map_options['enable_location_filters']) {
365
+				if ($geodir_map_options['enable_location_filters']) {
366 366
 					$country = get_query_var('gd_country');
367 367
 					$region = get_query_var('gd_region');
368 368
 					$city = get_query_var('gd_city');
369 369
                     
370
-                    //fix for location/me page
371
-                    $country = $country != 'me' ? $country : '';
370
+					//fix for location/me page
371
+					$country = $country != 'me' ? $country : '';
372 372
 					$region = $region != 'me' ? $region : '';
373 373
 					$city = $country != 'me' ? $city : '';
374
-                    $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
375
-                    ?>
374
+					$gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : '';
375
+					?>
376 376
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
377 377
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
378 378
                            value="<?php echo $country;?>"/>
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
384 384
                            value="<?php echo $gd_neighbourhood;?>"/>
385 385
                 <?php } else { //end of location filter
386
-                    ?>
386
+					?>
387 387
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
388 388
                 <?php }?>
389 389
 
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 
395 395
 
396 396
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
397
-                    $post_types = geodir_get_posttypes('object');
398
-                    if (count((array)($post_types)) > 1) {
399
-                        ?>
397
+					$post_types = geodir_get_posttypes('object');
398
+					if (count((array)($post_types)) > 1) {
399
+						?>
400 400
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
401 401
                              style="max-width:<?php echo $map_width;?>!important;">
402 402
 
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
                             <div class="geodir-map-posttype-list"><?php } ?>
405 405
                                 <ul class="clearfix place-list">
406 406
                                     <?php
407
-                                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
407
+									$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
408 408
 
409
-                                    foreach ($post_types as $post_type => $args) {
410
-                                        if (!in_array($post_type, $exclude_post_types)) {
411
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
409
+									foreach ($post_types as $post_type => $args) {
410
+										if (!in_array($post_type, $exclude_post_types)) {
411
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
412 412
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>';
413
-                                        }
414
-                                    }
415
-                                    ?>
413
+										}
414
+									}
415
+									?>
416 416
                                 </ul>
417 417
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
418 418
                             </div><?php } ?>
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 
427 427
                         </div> <!-- map-places-listings-->
428 428
                     <?php }
429
-                } // end of post type filter if
430
-                ?>
429
+				} // end of post type filter if
430
+				?>
431 431
 
432 432
             </div>
433 433
         </div> <!--end of stick trigger container-->
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
         </script>
443 443
         <?php
444 444
 
445
-        if (strpos($geodir_map_options['height'], 'vh')) {
446
-            ?>
445
+		if (strpos($geodir_map_options['height'], 'vh')) {
446
+			?>
447 447
             <script>
448 448
                 (function () {
449 449
                     var screenH = jQuery(window).height();
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 
466 466
         <?php
467 467
 
468
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
469
-            ?>
468
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
469
+			?>
470 470
             <script>
471 471
                 (function () {
472 472
                     var screenH = jQuery(window).height();
@@ -481,20 +481,20 @@  discard block
 block discarded – undo
481 481
                 }());
482 482
             </script>
483 483
         <?php
484
-        }
484
+		}
485 485
 
486
-        /**
487
-         * Action that runs after all the map code has been output;
488
-         *
489
-         * @since 1.5.3
490
-         *
491
-         * @param array $geodir_map_options Array of map settings.
492
-         * @param string $map_canvas_name The canvas name and ID for the map.
493
-         */
494
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
486
+		/**
487
+		 * Action that runs after all the map code has been output;
488
+		 *
489
+		 * @since 1.5.3
490
+		 *
491
+		 * @param array $geodir_map_options Array of map settings.
492
+		 * @param string $map_canvas_name The canvas name and ID for the map.
493
+		 */
494
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
495 495
 
496 496
 
497
-    endif; // Exclude posttypes if end
497
+	endif; // Exclude posttypes if end
498 498
 }
499 499
 
500 500
 ?>
501 501
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/reviews.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@
 block discarded – undo
16 16
  * the visitor has not yet entered the password we will
17 17
  * return early without loading the comments.
18 18
  */
19
-if (post_password_required())
20
-    return;
19
+if (post_password_required()) {
20
+    return;
21
+}
21 22
 ?>
22 23
 
23 24
 <div id="comments" class="comments-area">
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * return early without loading the comments.
18 18
  */
19 19
 if (post_password_required())
20
-    return;
20
+	return;
21 21
 ?>
22 22
 
23 23
 <div id="comments" class="comments-area">
@@ -25,35 +25,35 @@  discard block
 block discarded – undo
25 25
     <?php // You can start editing here -- including this comment! ?>
26 26
 
27 27
     <?php
28
-    /**
29
-     * Called before displaying reviews.
30
-     *
31
-     * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
32
-     *
33
-     * @since 1.5.7
34
-     */
35
-    do_action('geodir_before_review_list'); ?>
28
+	/**
29
+	 * Called before displaying reviews.
30
+	 *
31
+	 * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
32
+	 *
33
+	 * @since 1.5.7
34
+	 */
35
+	do_action('geodir_before_review_list'); ?>
36 36
 
37 37
     <?php if (have_comments()) : ?>
38 38
         <h2 class="comments-title">
39 39
             <?php
40
-            printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
41
-                number_format_i18n(get_comments_number()), get_the_title());
42
-            ?>
40
+			printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
41
+				number_format_i18n(get_comments_number()), get_the_title());
42
+			?>
43 43
         </h2>
44 44
 
45 45
         <?php
46
-        /**
47
-         * Called after displaying review listing title.
48
-         *
49
-         * @since 1.5.7
50
-         */
51
-        do_action('geodir_after_review_list_title'); ?>
46
+		/**
47
+		 * Called after displaying review listing title.
48
+		 *
49
+		 * @since 1.5.7
50
+		 */
51
+		do_action('geodir_after_review_list_title'); ?>
52 52
 
53 53
         <ol class="commentlist">
54 54
             <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
55 55
 			<?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
56
-            ?>
56
+			?>
57 57
         </ol><!-- .commentlist -->
58 58
 
59 59
         <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
@@ -68,51 +68,51 @@  discard block
 block discarded – undo
68 68
         <?php endif; // check for comment navigation ?>
69 69
 
70 70
         <?php
71
-        /* If there are no comments and comments are closed, let's leave a note.
71
+		/* If there are no comments and comments are closed, let's leave a note.
72 72
          * But we only want the note on posts and pages that had comments in the first place.
73 73
          */
74
-        if (!comments_open() && get_comments_number()) : ?>
74
+		if (!comments_open() && get_comments_number()) : ?>
75 75
             <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
76 76
         <?php endif; ?>
77 77
 
78 78
     <?php endif; // have_comments() ?>
79 79
 
80 80
     <?php
81
-    /**
82
-     * Called before displaying "Leave a review form".
83
-     *
84
-     * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
85
-     * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
86
-     *
87
-     * @since 1.5.7
88
-     */
89
-    do_action('geodir_before_review_form'); ?>
81
+	/**
82
+	 * Called before displaying "Leave a review form".
83
+	 *
84
+	 * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
85
+	 * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
86
+	 *
87
+	 * @since 1.5.7
88
+	 */
89
+	do_action('geodir_before_review_form'); ?>
90 90
 
91 91
     <?php
92
-    /**
93
-     * Filters comment form args
94
-     *
95
-     * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
96
-     *
97
-     * @since 1.0.0
98
-     */
99
-    $args = apply_filters('geodir_review_form_args', array(
100
-        'title_reply' => __('Leave a Review', 'geodirectory'),
101
-        'label_submit' => __('Post Review', 'geodirectory'),
102
-        'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
-        'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
104
-    ));
105
-    comment_form($args);
106
-    ?>
92
+	/**
93
+	 * Filters comment form args
94
+	 *
95
+	 * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
96
+	 *
97
+	 * @since 1.0.0
98
+	 */
99
+	$args = apply_filters('geodir_review_form_args', array(
100
+		'title_reply' => __('Leave a Review', 'geodirectory'),
101
+		'label_submit' => __('Post Review', 'geodirectory'),
102
+		'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
+		'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
104
+	));
105
+	comment_form($args);
106
+	?>
107 107
 
108 108
     <?php
109
-    /**
110
-     * Called after displaying "Leave a review form".
111
-     *
112
-     * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
113
-     *
114
-     * @since 1.5.7
115
-     */
116
-    do_action('geodir_after_review_form'); ?>
109
+	/**
110
+	 * Called after displaying "Leave a review form".
111
+	 *
112
+	 * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
113
+	 *
114
+	 * @since 1.5.7
115
+	 */
116
+	do_action('geodir_after_review_form'); ?>
117 117
 
118 118
 </div><!-- #comments .comments-area -->
119 119
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,8 @@
 block discarded – undo
99 99
     $args = apply_filters('geodir_review_form_args', array(
100 100
         'title_reply' => __('Leave a Review', 'geodirectory'),
101 101
         'label_submit' => __('Post Review', 'geodirectory'),
102
-        'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
-        'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
102
+        'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
103
+        'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>'
104 104
     ));
105 105
     comment_form($args);
106 106
     ?>
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/wp-session.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if (!defined('ABSPATH')) exit;
15 15
 
16 16
 /**
17 17
  * Return the current cache expire setting.
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @param string $data
38 38
  */
39
-function wp_session_decode( $data ) {
39
+function wp_session_decode($data) {
40 40
 	$wp_session = WP_Session::get_instance();
41 41
 
42
-	return $wp_session->json_in( $data );
42
+	return $wp_session->json_in($data);
43 43
 }
44 44
 
45 45
 /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return bool
62 62
  */
63
-function wp_session_regenerate_id( $delete_old_session = false ) {
63
+function wp_session_regenerate_id($delete_old_session = false) {
64 64
 	$wp_session = WP_Session::get_instance();
65 65
 
66
-	$wp_session->regenerate_id( $delete_old_session );
66
+	$wp_session->regenerate_id($delete_old_session);
67 67
 
68 68
 	return true;
69 69
 }
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function wp_session_start() {
79 79
 	$wp_session = WP_Session::get_instance();
80
-	do_action( 'wp_session_start' );
80
+	do_action('wp_session_start');
81 81
 
82 82
 	return $wp_session->session_started();
83 83
 }
84
-add_action( 'plugins_loaded', 'wp_session_start' );
84
+add_action('plugins_loaded', 'wp_session_start');
85 85
 
86 86
 /**
87 87
  * Return the current session status.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 function wp_session_status() {
92 92
 	$wp_session = WP_Session::get_instance();
93 93
 
94
-	if ( $wp_session->session_started() ) {
94
+	if ($wp_session->session_started()) {
95 95
 		return PHP_SESSION_ACTIVE;
96 96
 	}
97 97
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	$wp_session = WP_Session::get_instance();
115 115
 
116 116
 	$wp_session->write_data();
117
-	do_action( 'wp_session_commit' );
117
+	do_action('wp_session_commit');
118 118
 }
119
-add_action( 'shutdown', 'wp_session_write_close' );
119
+add_action('shutdown', 'wp_session_write_close');
120 120
 
121 121
 /**
122 122
  * Clean up expired sessions by removing data and their expiration entries from
@@ -128,51 +128,51 @@  discard block
 block discarded – undo
128 128
 function wp_session_cleanup() {
129 129
 	global $wpdb;
130 130
 
131
-	if ( defined( 'WP_SETUP_CONFIG' ) ) {
131
+	if (defined('WP_SETUP_CONFIG')) {
132 132
 		return;
133 133
 	}
134 134
 
135
-	if ( ! defined( 'WP_INSTALLING' ) ) {
136
-		$expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" );
135
+	if (!defined('WP_INSTALLING')) {
136
+		$expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'");
137 137
 
138
-		$now = current_time( 'timestamp' );
138
+		$now = current_time('timestamp');
139 139
 		$expired_sessions = array();
140 140
 
141
-		foreach( $expiration_keys as $expiration ) {
141
+		foreach ($expiration_keys as $expiration) {
142 142
 
143 143
 			// If the session has expired
144
-			if ( $now > intval( $expiration->option_value ) ) {
144
+			if ($now > intval($expiration->option_value)) {
145 145
 
146 146
 				// Get the session ID by parsing the option_name
147
-				$session_id = substr( $expiration->option_name, 20 );
147
+				$session_id = substr($expiration->option_name, 20);
148 148
 
149
-				if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) {
149
+				if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) {
150 150
 					continue;
151 151
 				}
152 152
 
153 153
 				$expired_sessions[] = $expiration->option_name;
154
-				$expired_sessions[] = esc_sql( "_wp_session_$session_id" );
154
+				$expired_sessions[] = esc_sql("_wp_session_$session_id");
155 155
 			}
156 156
 		}
157 157
 
158 158
 		// Delete all expired sessions in a single query
159
-		if ( ! empty( $expired_sessions ) ) {
160
-			$option_names = implode( "','", $expired_sessions );
161
-			$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"  );
159
+		if (!empty($expired_sessions)) {
160
+			$option_names = implode("','", $expired_sessions);
161
+			$wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')");
162 162
 		}
163 163
 	}
164 164
 
165 165
 	// Allow other plugins to hook in to the garbage collection process.
166
-	do_action( 'wp_session_cleanup' );
166
+	do_action('wp_session_cleanup');
167 167
 }
168
-add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' );
168
+add_action('wp_session_garbage_collection', 'wp_session_cleanup');
169 169
 
170 170
 /**
171 171
  * Register the garbage collector as a twice daily event.
172 172
  */
173 173
 function wp_session_register_garbage_collection() {
174
-	if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) {
175
-		wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' );
174
+	if (!wp_next_scheduled('wp_session_garbage_collection')) {
175
+		wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection');
176 176
 	}
177 177
 }
178
-add_action( 'wp', 'wp_session_register_garbage_collection' );
178
+add_action('wp', 'wp_session_register_garbage_collection');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if ( ! defined( 'ABSPATH' ) ) {
15
+	exit;
16
+}
15 17
 
16 18
 /**
17 19
  * Return the current cache expire setting.
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 3 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,16 +50,19 @@
 block discarded – undo
50 50
                 <?php
51 51
 
52 52
                 $default_search_for_text = SEARCH_FOR_TEXT;
53
-                if (get_option('geodir_search_field_default_text'))
54
-                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
53
+                if (get_option('geodir_search_field_default_text')) {
54
+                                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
55
+                }
55 56
 
56 57
                 $default_near_text = NEAR_TEXT;
57
-                if (get_option('geodir_near_field_default_text'))
58
-                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
58
+                if (get_option('geodir_near_field_default_text')) {
59
+                                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
60
+                }
59 61
 
60 62
                 $default_search_button_label = __('Search', 'geodirectory');
61
-                if (get_option('geodir_search_button_label'))
62
-                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
63
+                if (get_option('geodir_search_button_label')) {
64
+                                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
65
+                }
63 66
 
64 67
                 $post_types = geodir_get_posttypes('object');
65 68
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
                 $post_types = geodir_get_posttypes('object');
65 65
 
66
-                if (!empty($post_types) && count((array)$post_types) > 1):
66
+                if (!empty($post_types) && count((array) $post_types) > 1):
67 67
                     ?>
68 68
                     <select name="stype" class="search_by_post">
69 69
                         <?php foreach ($post_types as $post_type => $info):
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
                             }
76 76
                             ?>
77 77
 
78
-                            <option data-label="<?php echo get_post_type_archive_link($post_type);?>"
79
-                                    value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
78
+                            <option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
79
+                                    value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
80 80
                                 if ($post_type == $_REQUEST['stype']) {
81 81
                                     echo 'selected="selected"';
82 82
                                 }
83 83
                             } elseif ($curr_post_type == $post_type) {
84 84
                                 echo 'selected="selected"';
85
-                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
85
+                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option>
86 86
 
87 87
                         <?php endforeach; ?>
88 88
                     </select>
89 89
                 <?php elseif (!empty($post_types)):
90
-                    echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
90
+                    echo '<input type="hidden" name="stype" value="'.key($post_types).'"  />';
91 91
                 endif; ?>
92 92
 
93 93
                 <input class="search_text" name="s"
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                  * @since 1.5.5
158 158
                  * @param string $default_search_button_label The current search button text.
159 159
                  */
160
-                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
160
+                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); ?>
161 161
 				<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" />
162 162
                 <?php
163 163
                 /**
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
 $curr_post_type = geodir_get_current_posttype();
16 16
 if (function_exists('geodir_location_geo_home_link')) {
17
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
18 18
 }
19 19
 $search_url = trailingslashit(get_home_url());
20 20
 if (function_exists('geodir_location_geo_home_link')) {
21
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
21
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
22 22
 }
23 23
 ?>
24 24
 
@@ -37,104 +37,104 @@  discard block
 block discarded – undo
37 37
     <div class="geodir-loc-bar">
38 38
 
39 39
         <?php
40
-        /**
41
-         * Called inside the search form but before any of the fields.
42
-         *
43
-         * @since 1.0.0
44
-         */
45
-        do_action('geodir_before_search_form') ?>
40
+		/**
41
+		 * Called inside the search form but before any of the fields.
42
+		 *
43
+		 * @since 1.0.0
44
+		 */
45
+		do_action('geodir_before_search_form') ?>
46 46
 
47 47
         <div class="clearfix geodir-loc-bar-in">
48 48
             <div class="geodir-search">
49 49
 
50 50
                 <?php
51 51
 
52
-                $default_search_for_text = SEARCH_FOR_TEXT;
53
-                if (get_option('geodir_search_field_default_text'))
54
-                    $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
52
+				$default_search_for_text = SEARCH_FOR_TEXT;
53
+				if (get_option('geodir_search_field_default_text'))
54
+					$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
55 55
 
56
-                $default_near_text = NEAR_TEXT;
57
-                if (get_option('geodir_near_field_default_text'))
58
-                    $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
56
+				$default_near_text = NEAR_TEXT;
57
+				if (get_option('geodir_near_field_default_text'))
58
+					$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
59 59
 
60
-                $default_search_button_label = __('Search', 'geodirectory');
61
-                if (get_option('geodir_search_button_label'))
62
-                    $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
60
+				$default_search_button_label = __('Search', 'geodirectory');
61
+				if (get_option('geodir_search_button_label'))
62
+					$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
63 63
 
64
-                $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
64
+				$post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
65 65
 
66
-                if (!empty($post_types) && count((array)$post_types) > 1):
67
-                    ?>
66
+				if (!empty($post_types) && count((array)$post_types) > 1):
67
+					?>
68 68
                     <select name="stype" class="search_by_post">
69 69
                         <?php foreach ($post_types as $post_type => $info):
70
-                            global $wpdb;
71
-                            $has_posts = '';
72
-                            $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
73
-                            if (!$has_posts) {
74
-                                continue;
75
-                            }
76
-                            ?>
70
+							global $wpdb;
71
+							$has_posts = '';
72
+							$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
73
+							if (!$has_posts) {
74
+								continue;
75
+							}
76
+							?>
77 77
 
78 78
                             <option data-label="<?php echo get_post_type_archive_link($post_type);?>"
79 79
                                     value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
80
-                                if ($post_type == $_REQUEST['stype']) {
81
-                                    echo 'selected="selected"';
82
-                                }
83
-                            } elseif ($curr_post_type == $post_type) {
84
-                                echo 'selected="selected"';
85
-                            }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
80
+								if ($post_type == $_REQUEST['stype']) {
81
+									echo 'selected="selected"';
82
+								}
83
+							} elseif ($curr_post_type == $post_type) {
84
+								echo 'selected="selected"';
85
+							}?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option>
86 86
 
87 87
                         <?php endforeach; ?>
88 88
                     </select>
89 89
                 <?php elseif (!empty($post_types)):
90
-                    echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
91
-                endif; ?>
90
+					echo '<input type="hidden" name="stype" value="' . key($post_types) . '"  />';
91
+				endif; ?>
92 92
 
93 93
                 <input class="search_text" name="s"
94 94
                        value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
95
-                           echo esc_attr(stripslashes_deep($_REQUEST['s']));
96
-                       } else {
97
-                           echo $default_search_for_text;
98
-                       } ?>" type="text"
95
+						   echo esc_attr(stripslashes_deep($_REQUEST['s']));
96
+					   } else {
97
+						   echo $default_search_for_text;
98
+					   } ?>" type="text"
99 99
                        onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
100 100
                        onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
101 101
                        onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
102 102
 
103 103
 
104 104
                 <?php
105
-                if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
106
-                    $near = esc_attr(stripslashes_deep($_REQUEST['snear']));
107
-                } else {
108
-                    $near = $default_near_text;
109
-                }
110
-                /**
111
-                 * Filter the "Near" text value for the search form.
112
-                 *
113
-                 * This is the input "value" attribute and can change depending on what the user searches and is not always the default value.
114
-                 *
115
-                 * @since 1.0.0
116
-                 * @param string $near The current near value.
117
-                 * @param string $default_near_text The default near value.
118
-                 */
119
-                $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
120
-                /**
121
-                 * Filter the default "Near" text value for the search form.
122
-                 *
123
-                 * This is the default value if nothing has been searched.
124
-                 *
125
-                 * @since 1.0.0
126
-                 * @param string $near The current near value.
127
-                 * @param string $default_near_text The default near value.
128
-                 */
129
-                $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
130
-                /**
131
-                 * Filter the class for the near search input.
132
-                 *
133
-                 * @since 1.0.0
134
-                 * @param string $class The class for the HTML near input, default is blank.
135
-                 */
136
-                $near_class = apply_filters('geodir_search_near_class', '');
137
-                ?>
105
+				if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
106
+					$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
107
+				} else {
108
+					$near = $default_near_text;
109
+				}
110
+				/**
111
+				 * Filter the "Near" text value for the search form.
112
+				 *
113
+				 * This is the input "value" attribute and can change depending on what the user searches and is not always the default value.
114
+				 *
115
+				 * @since 1.0.0
116
+				 * @param string $near The current near value.
117
+				 * @param string $default_near_text The default near value.
118
+				 */
119
+				$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
120
+				/**
121
+				 * Filter the default "Near" text value for the search form.
122
+				 *
123
+				 * This is the default value if nothing has been searched.
124
+				 *
125
+				 * @since 1.0.0
126
+				 * @param string $near The current near value.
127
+				 * @param string $default_near_text The default near value.
128
+				 */
129
+				$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
130
+				/**
131
+				 * Filter the class for the near search input.
132
+				 *
133
+				 * @since 1.0.0
134
+				 * @param string $class The class for the HTML near input, default is blank.
135
+				 */
136
+				$near_class = apply_filters('geodir_search_near_class', '');
137
+				?>
138 138
 
139 139
                 <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
140 140
                        onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
@@ -142,42 +142,42 @@  discard block
 block discarded – undo
142 142
                        onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"/>
143 143
 
144 144
                 <?php
145
-                /**
146
-                 * Called on the GD search form just before the search button.
147
-                 *
148
-                 * @since 1.0.0
149
-                 */
150
-                do_action('geodir_before_search_button');
151
-
152
-                /**
153
-                 * Filter the default search button text value for the search form.
154
-                 *
155
-                 * This text can be changed via an option in settings, this is a last resort.
156
-                 *
157
-                 * @since 1.5.5
158
-                 * @param string $default_search_button_label The current search button text.
159
-                 */
160
-                $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
145
+				/**
146
+				 * Called on the GD search form just before the search button.
147
+				 *
148
+				 * @since 1.0.0
149
+				 */
150
+				do_action('geodir_before_search_button');
151
+
152
+				/**
153
+				 * Filter the default search button text value for the search form.
154
+				 *
155
+				 * This text can be changed via an option in settings, this is a last resort.
156
+				 *
157
+				 * @since 1.5.5
158
+				 * @param string $default_search_button_label The current search button text.
159
+				 */
160
+				$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
161 161
 				<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" />
162 162
                 <?php
163
-                /**
164
-                 * Called on the GD search form just after the search button.
165
-                 *
166
-                 * @since 1.0.0
167
-                 */
168
-                do_action('geodir_after_search_button'); ?>
163
+				/**
164
+				 * Called on the GD search form just after the search button.
165
+				 *
166
+				 * @since 1.0.0
167
+				 */
168
+				do_action('geodir_after_search_button'); ?>
169 169
             </div>
170 170
 
171 171
 
172 172
         </div>
173 173
 
174 174
         <?php
175
-        /**
176
-         * Called inside the search form but after all the input fields.
177
-         *
178
-         * @since 1.0.0
179
-         */
180
-        do_action('geodir_after_search_form') ?>
175
+		/**
176
+		 * Called inside the search form but after all the input fields.
177
+		 *
178
+		 * @since 1.0.0
179
+		 */
180
+		do_action('geodir_after_search_form') ?>
181 181
 
182 182
 
183 183
     </div>
Please login to merge, or discard this patch.
geodirectory-templates/login_frm.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
         echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55 55
     }
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') {
58
+            echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59
+    }
59 60
 
60 61
     ?>
61 62
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
13
-    $redirect_to = $_GET['redirect_to'];
13
+	$redirect_to = $_GET['redirect_to'];
14 14
 } else {
15
-    //echo $_SERVER['HTTP_HOST'] ;
16
-    $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
-    if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
-        $redirect_to = home_url();
19
-    }
15
+	//echo $_SERVER['HTTP_HOST'] ;
16
+	$redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
17
+	if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
18
+		$redirect_to = home_url();
19
+	}
20 20
 
21 21
 }
22 22
 
@@ -38,36 +38,36 @@  discard block
 block discarded – undo
38 38
     <h4>
39 39
         <?php
40 40
 
41
-            /**
42
-             * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
-             *
44
-             * @since 1.0.0
45
-             */
46
-            echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
41
+			/**
42
+			 * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template.
43
+			 *
44
+			 * @since 1.0.0
45
+			 */
46
+			echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
47 47
 
48
-        ?>
48
+		?>
49 49
     </h4>
50 50
     <?php
51
-    if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
-    } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
-    }
51
+	if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
+		echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
53
+	} elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
+		echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
55
+	}
56 56
 
57
-    if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
57
+	if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
+		echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
59 59
 
60
-    ?>
60
+	?>
61 61
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
62 62
           method="post">
63 63
 
64 64
         <div class="form_row clearfix">
65 65
             <input placeholder='<?php echo USERNAME_TEXT; ?>' type="text" name="log" id="user_login"
66 66
                    value="<?php global $user_login;
67
-                   if (!isset($user_login)) {
68
-                       $user_login = '';
69
-                   }
70
-                   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
67
+				   if (!isset($user_login)) {
68
+					   $user_login = '';
69
+				   }
70
+				   echo esc_attr($user_login); ?>" size="20" class="textfield"/>
71 71
             <span class="user_loginInfo"></span>
72 72
         </div>
73 73
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
         </div>
79 79
 
80 80
         <?php
81
-        /**
82
-         * This is a default WordPress action that calls any additional elements needed for any login forms.
83
-         *
84
-         * We use this action before the remember me checkbox on the sigin form.
85
-         *
86
-         * @since 1.0.0
87
-         */
88
-        do_action('login_form'); ?>
81
+		/**
82
+		 * This is a default WordPress action that calls any additional elements needed for any login forms.
83
+		 *
84
+		 * We use this action before the remember me checkbox on the sigin form.
85
+		 *
86
+		 * @since 1.0.0
87
+		 */
88
+		do_action('login_form'); ?>
89 89
         <p class="rember">
90 90
             <input name="rememberme" type="checkbox" id="rememberme" value="forever" class="fl"/>
91 91
             <?php echo REMEMBER_ON_COMPUTER_TEXT; ?>
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
                 <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?>' type="text" name="user_login"
110 110
                        value="<?php echo esc_attr($user_login); ?>" size="20" class="user_login1 textfield"/>
111 111
                 <?php
112
-                /**
113
-                 * Called before the get new password button in the login box template.
114
-                 *
115
-                 * @since 1.0.0
116
-                 */
117
-                do_action('lostpassword_form'); ?>
112
+				/**
113
+				 * Called before the get new password button in the login box template.
114
+				 *
115
+				 * @since 1.0.0
116
+				 */
117
+				do_action('lostpassword_form'); ?>
118 118
             </div>
119 119
             <input type="submit" name="get_new_password" value="<?php echo GET_NEW_PW_TEXT; ?>" class="geodir_button"/>
120 120
         </form>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
49 49
     </h4>
50 50
     <?php
51 51
     if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
52
-        echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>";
52
+        echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>";
53 53
     } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
54
-        echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>";
54
+        echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>";
55 55
     }
56 56
 
57 57
     if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm')
58
-        echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>';
58
+        echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>';
59 59
 
60 60
     ?>
61 61
     <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>"
Please login to merge, or discard this patch.