Test Failed
Pull Request — master (#473)
by Kiran
12:54
created
geodirectory-functions/compatibility/Divi.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_divi_signup_body_class($classes)
21 21
 {
22
-    if (geodir_is_page('login')) {
23
-        $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes);
24
-        $classes[] = 'divi-gd-signup';
25
-    } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) {
26
-        $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
27
-    }
28
-    return $classes;
22
+	if (geodir_is_page('login')) {
23
+		$classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes);
24
+		$classes[] = 'divi-gd-signup';
25
+	} else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) {
26
+		$classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
27
+	}
28
+	return $classes;
29 29
 }
30 30
 
31 31
 add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11);
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function geodir_divi_action_wrapper_close()
39 39
 {
40
-    if (geodir_is_page('login')) {
41
-        // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page
42
-        echo '</div></div>';
43
-    }
40
+	if (geodir_is_page('login')) {
41
+		// We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page
42
+		echo '</div></div>';
43
+	}
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     if (geodir_is_page('login')) {
23 23
         $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes);
24 24
         $classes[] = 'divi-gd-signup';
25
-    } else if ( geodir_is_page( 'detail' ) || geodir_is_page( 'preview' ) ) {
25
+    } else if (geodir_is_page('detail') || geodir_is_page('preview')) {
26 26
         $classes[] = is_rtl() ? 'et_left_sidebar' : 'et_right_sidebar';
27 27
     }
28 28
     return $classes;
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Genesis.php 2 patches
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -17,26 +17,26 @@  discard block
 block discarded – undo
17 17
 function gd_compat_php_genesis()
18 18
 {
19 19
 // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS
20
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
-    remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
20
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
21
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
22
+	remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20);
23
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
24
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
25
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
26 26
 
27 27
 
28
-    // make top section wide
29
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
30
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
31
-    remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
32
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
33
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
34
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
28
+	// make top section wide
29
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
30
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
31
+	remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10);
32
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
33
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
34
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
35 35
 
36
-    // REMOVE PAGE TITLES
37
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
38
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
39
-    remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
36
+	// REMOVE PAGE TITLES
37
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
38
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
39
+	remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10);
40 40
 
41 41
 
42 42
 }
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
 function gd_genesis_compat_left_sidebars()
54 54
 {
55 55
 
56
-    if (is_page_geodir_home()) {
57
-        remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10);
58
-        add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11);
59
-    } elseif (geodir_is_page('location')) {
60
-        remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10);
61
-        add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11);
62
-    } elseif (geodir_is_page('listing')) {
63
-        remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10);
64
-        add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11);
65
-    } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) {
66
-        //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 );
67
-        //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 );
68
-    } elseif (geodir_is_page('search')) {
69
-        remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10);
70
-        add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11);
71
-    } elseif (geodir_is_page('author')) {
72
-        remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10);
73
-        add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11);
74
-    }
56
+	if (is_page_geodir_home()) {
57
+		remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10);
58
+		add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11);
59
+	} elseif (geodir_is_page('location')) {
60
+		remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10);
61
+		add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11);
62
+	} elseif (geodir_is_page('listing')) {
63
+		remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10);
64
+		add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11);
65
+	} elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) {
66
+		//remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 );
67
+		//add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 );
68
+	} elseif (geodir_is_page('search')) {
69
+		remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10);
70
+		add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11);
71
+	} elseif (geodir_is_page('author')) {
72
+		remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10);
73
+		add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11);
74
+	}
75 75
 
76 76
 
77 77
 }
@@ -88,68 +88,68 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function geodir_set_body_scs($classes)
90 90
 {
91
-    $remove_class = false;
92
-    $new_class = '';
93
-    if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
94
-        $remove_class = true;
95
-        if (get_option('geodir_show_home_left_section')) {
96
-            $new_class .= 'sidebar-';
97
-        }
98
-        if (get_option('geodir_show_home_contant_section')) {
99
-            $new_class .= 'content';
100
-        }
101
-        if (get_option('geodir_show_home_right_section')) {
102
-            $new_class .= '-sidebar';
103
-        }
104
-    } elseif (geodir_is_page('listing')) {
105
-        $remove_class = true;
106
-        if (get_option('geodir_show_listing_left_section')) {
107
-            $new_class .= 'sidebar-';
108
-        }
109
-        $new_class .= 'content';
110
-        if (get_option('geodir_show_listing_right_section')) {
111
-            $new_class .= '-sidebar';
112
-        }
113
-    } elseif (geodir_is_page('detail')) {
114
-        $remove_class = true;
115
-        if (get_option('geodir_detail_sidebar_left_section')) {
116
-            $new_class .= 'sidebar-content gd-details-sidebar-left';
117
-        } else {
118
-            $new_class .= 'content-sidebar';
119
-        }
120
-    } elseif (geodir_is_page('search')) {
121
-        $remove_class = true;
122
-        if (get_option('geodir_show_search_left_section')) {
123
-            $new_class .= 'sidebar-';
124
-        }
125
-        $new_class .= 'content';
126
-        if (get_option('geodir_show_search_right_section')) {
127
-            $new_class .= '-sidebar';
128
-        }
129
-    } elseif (geodir_is_page('author')) {
130
-        $remove_class = true;
131
-        if (get_option('geodir_show_author_left_section')) {
132
-            $new_class .= 'sidebar-';
133
-        }
134
-        $new_class .= 'content';
135
-        if (get_option('geodir_show_author_right_section')) {
136
-            $new_class .= '-sidebar';
137
-        }
138
-    } elseif (geodir_is_page('add-listing')) {
139
-        $remove_class = true;
140
-        $new_class .= 'content-sidebar';
141
-    }
142
-
143
-    if ($remove_class) {
144
-        $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content'));
145
-        if ( $new_class == 'content' ) {
146
-            $new_class = 'content-no-sidebar';
147
-            $classes[] = 'full-width-content';
148
-        }
149
-        $classes[] = $new_class;
150
-    }
151
-
152
-    return $classes;
91
+	$remove_class = false;
92
+	$new_class = '';
93
+	if (is_page_geodir_home() || geodir_is_page('location') || geodir_is_page('home')) {
94
+		$remove_class = true;
95
+		if (get_option('geodir_show_home_left_section')) {
96
+			$new_class .= 'sidebar-';
97
+		}
98
+		if (get_option('geodir_show_home_contant_section')) {
99
+			$new_class .= 'content';
100
+		}
101
+		if (get_option('geodir_show_home_right_section')) {
102
+			$new_class .= '-sidebar';
103
+		}
104
+	} elseif (geodir_is_page('listing')) {
105
+		$remove_class = true;
106
+		if (get_option('geodir_show_listing_left_section')) {
107
+			$new_class .= 'sidebar-';
108
+		}
109
+		$new_class .= 'content';
110
+		if (get_option('geodir_show_listing_right_section')) {
111
+			$new_class .= '-sidebar';
112
+		}
113
+	} elseif (geodir_is_page('detail')) {
114
+		$remove_class = true;
115
+		if (get_option('geodir_detail_sidebar_left_section')) {
116
+			$new_class .= 'sidebar-content gd-details-sidebar-left';
117
+		} else {
118
+			$new_class .= 'content-sidebar';
119
+		}
120
+	} elseif (geodir_is_page('search')) {
121
+		$remove_class = true;
122
+		if (get_option('geodir_show_search_left_section')) {
123
+			$new_class .= 'sidebar-';
124
+		}
125
+		$new_class .= 'content';
126
+		if (get_option('geodir_show_search_right_section')) {
127
+			$new_class .= '-sidebar';
128
+		}
129
+	} elseif (geodir_is_page('author')) {
130
+		$remove_class = true;
131
+		if (get_option('geodir_show_author_left_section')) {
132
+			$new_class .= 'sidebar-';
133
+		}
134
+		$new_class .= 'content';
135
+		if (get_option('geodir_show_author_right_section')) {
136
+			$new_class .= '-sidebar';
137
+		}
138
+	} elseif (geodir_is_page('add-listing')) {
139
+		$remove_class = true;
140
+		$new_class .= 'content-sidebar';
141
+	}
142
+
143
+	if ($remove_class) {
144
+		$classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content'));
145
+		if ( $new_class == 'content' ) {
146
+			$new_class = 'content-no-sidebar';
147
+			$classes[] = 'full-width-content';
148
+		}
149
+		$classes[] = $new_class;
150
+	}
151
+
152
+	return $classes;
153 153
 }
154 154
 
155 155
 add_action('genesis_after_header', 'gd_genesis_compat_add_top_section_back', 11);
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 function gd_genesis_compat_add_top_section_back()
163 163
 {
164 164
 
165
-    if (is_page_geodir_home() || geodir_is_page('location')) {
166
-        geodir_action_geodir_sidebar_home_top();
167
-    } elseif (geodir_is_page('listing')) {
168
-        geodir_action_geodir_sidebar_listings_top();
169
-    } elseif (geodir_is_page('detail')) {
170
-        geodir_action_geodir_sidebar_detail_top();
171
-    } elseif (geodir_is_page('search')) {
172
-        geodir_action_geodir_sidebar_search_top();
173
-    } elseif (geodir_is_page('author')) {
174
-        geodir_action_geodir_sidebar_author_top();
175
-    }
165
+	if (is_page_geodir_home() || geodir_is_page('location')) {
166
+		geodir_action_geodir_sidebar_home_top();
167
+	} elseif (geodir_is_page('listing')) {
168
+		geodir_action_geodir_sidebar_listings_top();
169
+	} elseif (geodir_is_page('detail')) {
170
+		geodir_action_geodir_sidebar_detail_top();
171
+	} elseif (geodir_is_page('search')) {
172
+		geodir_action_geodir_sidebar_search_top();
173
+	} elseif (geodir_is_page('author')) {
174
+		geodir_action_geodir_sidebar_author_top();
175
+	}
176 176
 
177 177
 
178 178
 }
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
  */
186 186
 function geodir_replace_breadcrumb()
187 187
 {
188
-    if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) {
189
-    } else {
190
-        echo '<div class="geodir-breadcrumb-bar"><div class="wrap">';
191
-        geodir_breadcrumb();
192
-        echo '</div></div>';
193
-    }
188
+	if (is_front_page() && geodir_is_page('home') && !geodir_is_page('login')) {
189
+	} else {
190
+		echo '<div class="geodir-breadcrumb-bar"><div class="wrap">';
191
+		geodir_breadcrumb();
192
+		echo '</div></div>';
193
+	}
194 194
 }
195 195
 
196 196
 // Force Full Width on signup page
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
  */
204 204
 function geodir_genesis_meta()
205 205
 {
206
-    if (geodir_is_page('login')) {
207
-        add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
208
-    }
206
+	if (geodir_is_page('login')) {
207
+		add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
208
+	}
209 209
 }
210 210
 
211 211
 add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 function geodir_add_listing_page_title_genesis_before()
219 219
 {
220 220
 
221
-    echo "<div class='entry' >";
221
+	echo "<div class='entry' >";
222 222
 }
223 223
 
224 224
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 function geodir_add_listing_form_genesis_after()
233 233
 {
234 234
 
235
-    echo "</div>";
235
+	echo "</div>";
236 236
 }
237 237
 
238 238
 
@@ -251,38 +251,38 @@  discard block
 block discarded – undo
251 251
 {
252 252
 
253 253
 
254
-    $title = '';
255
-    $subtitle = '';
256
-
257
-    if (geodir_is_page('listing')) {
258
-        echo '<div class="wrap gd-title-wrap">';
259
-        geodir_action_listings_title();
260
-        echo '</div>';
261
-    }
262
-
263
-    if (geodir_is_page('add-listing')) {
264
-        echo '<div class="wrap gd-title-wrap">';
265
-        geodir_action_add_listing_page_title();
266
-        echo '</div>';
267
-    }
268
-
269
-    if (geodir_is_page('author')) {
270
-        echo '<div class="wrap gd-title-wrap">';
271
-        geodir_action_author_page_title();
272
-        echo '</div>';
273
-    }
274
-
275
-    if (geodir_is_page('detail') || geodir_is_page('preview')) {
276
-        echo '<div class="wrap gd-title-wrap">';
277
-        echo get_the_title();
278
-        echo '</div>';
279
-    }
280
-
281
-    if (geodir_is_page('search')) {
282
-        echo '<div class="wrap gd-title-wrap">';
283
-        geodir_action_search_page_title();
284
-        echo '</div>';
285
-    }
254
+	$title = '';
255
+	$subtitle = '';
256
+
257
+	if (geodir_is_page('listing')) {
258
+		echo '<div class="wrap gd-title-wrap">';
259
+		geodir_action_listings_title();
260
+		echo '</div>';
261
+	}
262
+
263
+	if (geodir_is_page('add-listing')) {
264
+		echo '<div class="wrap gd-title-wrap">';
265
+		geodir_action_add_listing_page_title();
266
+		echo '</div>';
267
+	}
268
+
269
+	if (geodir_is_page('author')) {
270
+		echo '<div class="wrap gd-title-wrap">';
271
+		geodir_action_author_page_title();
272
+		echo '</div>';
273
+	}
274
+
275
+	if (geodir_is_page('detail') || geodir_is_page('preview')) {
276
+		echo '<div class="wrap gd-title-wrap">';
277
+		echo get_the_title();
278
+		echo '</div>';
279
+	}
280
+
281
+	if (geodir_is_page('search')) {
282
+		echo '<div class="wrap gd-title-wrap">';
283
+		geodir_action_search_page_title();
284
+		echo '</div>';
285
+	}
286 286
 }
287 287
 
288 288
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
  */
296 296
 function gd_genesis_listing_page_title_bar()
297 297
 {
298
-    geodir_action_listings_title();
299
-    //geodir_action_listings_description();
298
+	geodir_action_listings_title();
299
+	//geodir_action_listings_description();
300 300
 }
301 301
 
302 302
 
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function gd_compat_php_genesis_geo_1280_fix()
311 311
 {
312
-    if (function_exists('geo1280_search_bar')) {
313
-        remove_action('genesis_after_header', 'geo1280_search_bar', 20);
314
-        add_action('genesis_after_header', 'geo1280_search_bar_fix', 4);
312
+	if (function_exists('geo1280_search_bar')) {
313
+		remove_action('genesis_after_header', 'geo1280_search_bar', 20);
314
+		add_action('genesis_after_header', 'geo1280_search_bar_fix', 4);
315 315
 
316
-        //
316
+		//
317 317
 
318
-        remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20);
319
-        remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20);
320
-        add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105);
318
+		remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20);
319
+		remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20);
320
+		add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105);
321 321
 
322
-        remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10);
323
-        add_action('geodir_wrapper_open', 'geo1280_page_title', 101);
324
-    }
322
+		remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10);
323
+		add_action('geodir_wrapper_open', 'geo1280_page_title', 101);
324
+	}
325 325
 }
326 326
 
327 327
 /**
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 function geo1280_search_bar_fix()
334 334
 {
335 335
 
336
-    echo '<div class="geo1280-placeholder"></div>';
337
-    if (is_active_sidebar('search-bar')) {
338
-        genesis_widget_area('search-bar', array(
339
-            'before' => '<div class="search-bar widget-area"><div class="wrap">',
340
-            'after' => '</div></div>',
341
-        ));
342
-    }
336
+	echo '<div class="geo1280-placeholder"></div>';
337
+	if (is_active_sidebar('search-bar')) {
338
+		genesis_widget_area('search-bar', array(
339
+			'before' => '<div class="search-bar widget-area"><div class="wrap">',
340
+			'after' => '</div></div>',
341
+		));
342
+	}
343 343
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
 
143 143
     if ($remove_class) {
144 144
         $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content'));
145
-        if ( $new_class == 'content' ) {
145
+        if ($new_class == 'content') {
146 146
             $new_class = 'content-no-sidebar';
147 147
             $classes[] = 'full-width-content';
148 148
         }
Please login to merge, or discard this patch.
geodirectory-functions/user_functions.php 2 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -13,34 +13,34 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function geodir_user_favourite_listing_count($user_id=false)
15 15
 {
16
-    global $wpdb, $plugin_prefix, $current_user;
16
+	global $wpdb, $plugin_prefix, $current_user;
17 17
 
18
-    if(!$user_id){$user_id = $current_user->ID;}
19
-    if(!$user_id){return array();}
18
+	if(!$user_id){$user_id = $current_user->ID;}
19
+	if(!$user_id){return array();}
20 20
 
21
-    $site_id = '';
22
-    if ( is_multisite() ) {
23
-        $blog_id = get_current_blog_id();
24
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
25
-    }
21
+	$site_id = '';
22
+	if ( is_multisite() ) {
23
+		$blog_id = get_current_blog_id();
24
+		if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
25
+	}
26 26
 
27
-    $user_favorites = geodir_get_user_favourites($user_id);
28
-    $all_posts = get_option('geodir_favorite_link_user_dashboard');
27
+	$user_favorites = geodir_get_user_favourites($user_id);
28
+	$all_posts = get_option('geodir_favorite_link_user_dashboard');
29 29
 
30
-    $user_listing = array();
31
-    if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
30
+	$user_listing = array();
31
+	if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
+		$user_favorites = "'" . implode("','", $user_favorites) . "'";
33 33
 
34
-        foreach ($all_posts as $ptype) {
35
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
34
+		foreach ($all_posts as $ptype) {
35
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
36 36
 
37
-            if ($total_posts > 0) {
38
-                $user_listing[$ptype] = $total_posts;
39
-            }
40
-        }
41
-    }
37
+			if ($total_posts > 0) {
38
+				$user_listing[$ptype] = $total_posts;
39
+			}
40
+		}
41
+	}
42 42
 
43
-    return $user_listing;
43
+	return $user_listing;
44 44
 }
45 45
 
46 46
 /**
@@ -50,48 +50,48 @@  discard block
 block discarded – undo
50 50
  * @package GeoDirectory
51 51
  */
52 52
 function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) {
53
-    // My Favourites in Dashboard
54
-    $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
55
-    $user_favourite = geodir_user_favourite_listing_count( $user_id );
56
-
57
-    if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
58
-        $favourite_links = $output_type == 'link' ? array() : '';
59
-        $post_types = geodir_get_posttypes( 'object' );
60
-
61
-        $author_link = get_author_posts_url( $user_id );
62
-        $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
63
-
64
-        foreach ( $post_types as $key => $postobj ) {
65
-            if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
66
-                $name = __( $postobj->labels->name, 'geodirectory' );
67
-                $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false );
68
-
69
-                /**
70
-                 * Filter favorite listing link.
71
-                 *
72
-                 * @since 1.0.0
73
-                 * @param string $post_type_link Favorite listing link.
74
-                 * @param string $key Favorite listing array key.
75
-                 * @param int $current_user->ID Current user ID.
76
-                 */
77
-                $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id );
78
-
79
-                if ( $output_type == 'select' ) {
80
-                    $selected = '';
81
-                    if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
82
-                        $selected = 'selected="selected"';
83
-                    }
84
-
85
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>';
86
-                } elseif ( $output_type == 'link' ) {
87
-                    $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>';
88
-                }
89
-            }
90
-        }
91
-
92
-        if ( ! empty( $favourite_links ) ) {
93
-            if ( $output_type == 'select' ) {
94
-                ?>
53
+	// My Favourites in Dashboard
54
+	$show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
55
+	$user_favourite = geodir_user_favourite_listing_count( $user_id );
56
+
57
+	if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
58
+		$favourite_links = $output_type == 'link' ? array() : '';
59
+		$post_types = geodir_get_posttypes( 'object' );
60
+
61
+		$author_link = get_author_posts_url( $user_id );
62
+		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
63
+
64
+		foreach ( $post_types as $key => $postobj ) {
65
+			if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
66
+				$name = __( $postobj->labels->name, 'geodirectory' );
67
+				$post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false );
68
+
69
+				/**
70
+				 * Filter favorite listing link.
71
+				 *
72
+				 * @since 1.0.0
73
+				 * @param string $post_type_link Favorite listing link.
74
+				 * @param string $key Favorite listing array key.
75
+				 * @param int $current_user->ID Current user ID.
76
+				 */
77
+				$post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id );
78
+
79
+				if ( $output_type == 'select' ) {
80
+					$selected = '';
81
+					if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
82
+						$selected = 'selected="selected"';
83
+					}
84
+
85
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>';
86
+				} elseif ( $output_type == 'link' ) {
87
+					$favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>';
88
+				}
89
+			}
90
+		}
91
+
92
+		if ( ! empty( $favourite_links ) ) {
93
+			if ( $output_type == 'select' ) {
94
+				?>
95 95
                 <li>
96 96
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>">
97 97
                         <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option>
@@ -99,55 +99,55 @@  discard block
 block discarded – undo
99 99
                     </select>
100 100
                 </li>
101 101
             <?php
102
-            } elseif ( $output_type == 'link' ) {
103
-                echo implode( " | ", $favourite_links );
104
-            }
105
-        }
106
-    }
102
+			} elseif ( $output_type == 'link' ) {
103
+				echo implode( " | ", $favourite_links );
104
+			}
105
+		}
106
+	}
107 107
 }
108 108
 
109 109
 function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) {
110
-    $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
111
-    $user_listing = geodir_user_post_listing_count( $user_id );
112
-
113
-    if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
114
-        $listing_links = $output_type == 'link' ? array() : '';
115
-
116
-        $post_types = geodir_get_posttypes( 'object' );
117
-
118
-        $author_link = get_author_posts_url( $user_id );
119
-        $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
120
-
121
-        foreach ( $post_types as $key => $postobj ) {
122
-            if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
123
-                $name = __( $postobj->labels->name, 'geodirectory' );
124
-                $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
125
-
126
-                /**
127
-                 * Filter my listing link.
128
-                 *
129
-                 * @since 1.0.0
130
-                 * @param string $listing_link My listing link.
131
-                 * @param string $key My listing array key.
132
-                 * @param int $current_user->ID Current user ID.
133
-                 */
134
-                $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id );
135
-                if ( $output_type == 'select' ) {
136
-                    $selected = '';
137
-                    if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
138
-                        $selected = 'selected="selected"';
139
-                    }
140
-
141
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>';
142
-                } elseif ( $output_type == 'link' ) {
143
-                    $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>';
144
-                }
145
-            }
146
-        }
147
-
148
-        if ( ! empty( $listing_links ) ) {
149
-            if ( $output_type == 'select' ) {
150
-                ?>
110
+	$show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
111
+	$user_listing = geodir_user_post_listing_count( $user_id );
112
+
113
+	if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
114
+		$listing_links = $output_type == 'link' ? array() : '';
115
+
116
+		$post_types = geodir_get_posttypes( 'object' );
117
+
118
+		$author_link = get_author_posts_url( $user_id );
119
+		$author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
120
+
121
+		foreach ( $post_types as $key => $postobj ) {
122
+			if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
123
+				$name = __( $postobj->labels->name, 'geodirectory' );
124
+				$listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
125
+
126
+				/**
127
+				 * Filter my listing link.
128
+				 *
129
+				 * @since 1.0.0
130
+				 * @param string $listing_link My listing link.
131
+				 * @param string $key My listing array key.
132
+				 * @param int $current_user->ID Current user ID.
133
+				 */
134
+				$listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id );
135
+				if ( $output_type == 'select' ) {
136
+					$selected = '';
137
+					if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
138
+						$selected = 'selected="selected"';
139
+					}
140
+
141
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>';
142
+				} elseif ( $output_type == 'link' ) {
143
+					$listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>';
144
+				}
145
+			}
146
+		}
147
+
148
+		if ( ! empty( $listing_links ) ) {
149
+			if ( $output_type == 'select' ) {
150
+				?>
151 151
                 <li>
152 152
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>">
153 153
                         <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option>
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
                     </select>
156 156
                 </li>
157 157
             <?php
158
-            } elseif ( $output_type == 'link' ) {
159
-                echo implode( " | ", $listing_links );
160
-            }
161
-        }
162
-    }
158
+			} elseif ( $output_type == 'link' ) {
159
+				echo implode( " | ", $listing_links );
160
+			}
161
+		}
162
+	}
163 163
 }
164 164
 
165 165
 /**
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
  * @return mixed
171 171
  */
172 172
 function geodir_get_user_favourites($user_id=''){
173
-    if(!$user_id){$user_id = get_current_user_id();}
174
-    $site_id = '';
175
-    if ( is_multisite() ) {
176
-        $blog_id = get_current_blog_id();
177
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
178
-    }
179
-
180
-    return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
173
+	if(!$user_id){$user_id = get_current_user_id();}
174
+	$site_id = '';
175
+	if ( is_multisite() ) {
176
+		$blog_id = get_current_blog_id();
177
+		if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
178
+	}
179
+
180
+	return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
181 181
 }
182 182
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
  * @global string $plugin_prefix Geodirectory plugin table prefix.
12 12
  * @return array User listing count for each post type.
13 13
  */
14
-function geodir_user_favourite_listing_count($user_id=false)
14
+function geodir_user_favourite_listing_count($user_id = false)
15 15
 {
16 16
     global $wpdb, $plugin_prefix, $current_user;
17 17
 
18
-    if(!$user_id){$user_id = $current_user->ID;}
19
-    if(!$user_id){return array();}
18
+    if (!$user_id) {$user_id = $current_user->ID; }
19
+    if (!$user_id) {return array(); }
20 20
 
21 21
     $site_id = '';
22
-    if ( is_multisite() ) {
22
+    if (is_multisite()) {
23 23
         $blog_id = get_current_blog_id();
24
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
24
+        if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; }
25 25
     }
26 26
 
27 27
     $user_favorites = geodir_get_user_favourites($user_id);
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
     $user_listing = array();
31 31
     if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
32
+        $user_favorites = "'".implode("','", $user_favorites)."'";
33 33
 
34 34
         foreach ($all_posts as $ptype) {
35
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
35
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE  post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")");
36 36
 
37 37
             if ($total_posts > 0) {
38 38
                 $user_listing[$ptype] = $total_posts;
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
  * @since 1.5.9
50 50
  * @package GeoDirectory
51 51
  */
52
-function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) {
52
+function geodir_user_show_favourites($user_id = '', $output_type = 'select') {
53 53
     // My Favourites in Dashboard
54
-    $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' );
55
-    $user_favourite = geodir_user_favourite_listing_count( $user_id );
54
+    $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
55
+    $user_favourite = geodir_user_favourite_listing_count($user_id);
56 56
 
57
-    if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
57
+    if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
58 58
         $favourite_links = $output_type == 'link' ? array() : '';
59
-        $post_types = geodir_get_posttypes( 'object' );
59
+        $post_types = geodir_get_posttypes('object');
60 60
 
61
-        $author_link = get_author_posts_url( $user_id );
62
-        $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
61
+        $author_link = get_author_posts_url($user_id);
62
+        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
63 63
 
64
-        foreach ( $post_types as $key => $postobj ) {
65
-            if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
66
-                $name = __( $postobj->labels->name, 'geodirectory' );
67
-                $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false );
64
+        foreach ($post_types as $key => $postobj) {
65
+            if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
66
+                $name = __($postobj->labels->name, 'geodirectory');
67
+                $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
68 68
 
69 69
                 /**
70 70
                  * Filter favorite listing link.
@@ -74,54 +74,54 @@  discard block
 block discarded – undo
74 74
                  * @param string $key Favorite listing array key.
75 75
                  * @param int $current_user->ID Current user ID.
76 76
                  */
77
-                $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id );
77
+                $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
78 78
 
79
-                if ( $output_type == 'select' ) {
79
+                if ($output_type == 'select') {
80 80
                     $selected = '';
81
-                    if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
81
+                    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
82 82
                         $selected = 'selected="selected"';
83 83
                     }
84 84
 
85
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>';
86
-                } elseif ( $output_type == 'link' ) {
87
-                    $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>';
85
+                    $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>';
86
+                } elseif ($output_type == 'link') {
87
+                    $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>';
88 88
                 }
89 89
             }
90 90
         }
91 91
 
92
-        if ( ! empty( $favourite_links ) ) {
93
-            if ( $output_type == 'select' ) {
92
+        if (!empty($favourite_links)) {
93
+            if ($output_type == 'select') {
94 94
                 ?>
95 95
                 <li>
96
-                    <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>">
97
-                        <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option>
96
+                    <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>">
97
+                        <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option>
98 98
                         <?php echo $favourite_links; ?>
99 99
                     </select>
100 100
                 </li>
101 101
             <?php
102
-            } elseif ( $output_type == 'link' ) {
103
-                echo implode( " | ", $favourite_links );
102
+            } elseif ($output_type == 'link') {
103
+                echo implode(" | ", $favourite_links);
104 104
             }
105 105
         }
106 106
     }
107 107
 }
108 108
 
109
-function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) {
110
-    $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' );
111
-    $user_listing = geodir_user_post_listing_count( $user_id );
109
+function geodir_user_show_listings($user_id = '', $output_type = 'select') {
110
+    $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
111
+    $user_listing = geodir_user_post_listing_count($user_id);
112 112
 
113
-    if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
113
+    if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
114 114
         $listing_links = $output_type == 'link' ? array() : '';
115 115
 
116
-        $post_types = geodir_get_posttypes( 'object' );
116
+        $post_types = geodir_get_posttypes('object');
117 117
 
118
-        $author_link = get_author_posts_url( $user_id );
119
-        $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false );
118
+        $author_link = get_author_posts_url($user_id);
119
+        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
120 120
 
121
-        foreach ( $post_types as $key => $postobj ) {
122
-            if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
123
-                $name = __( $postobj->labels->name, 'geodirectory' );
124
-                $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false );
121
+        foreach ($post_types as $key => $postobj) {
122
+            if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
123
+                $name = __($postobj->labels->name, 'geodirectory');
124
+                $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
125 125
 
126 126
                 /**
127 127
                  * Filter my listing link.
@@ -131,32 +131,32 @@  discard block
 block discarded – undo
131 131
                  * @param string $key My listing array key.
132 132
                  * @param int $current_user->ID Current user ID.
133 133
                  */
134
-                $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id );
135
-                if ( $output_type == 'select' ) {
134
+                $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
135
+                if ($output_type == 'select') {
136 136
                     $selected = '';
137
-                    if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
137
+                    if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
138 138
                         $selected = 'selected="selected"';
139 139
                     }
140 140
 
141
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>';
142
-                } elseif ( $output_type == 'link' ) {
143
-                    $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>';
141
+                    $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>';
142
+                } elseif ($output_type == 'link') {
143
+                    $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>';
144 144
                 }
145 145
             }
146 146
         }
147 147
 
148
-        if ( ! empty( $listing_links ) ) {
149
-            if ( $output_type == 'select' ) {
148
+        if (!empty($listing_links)) {
149
+            if ($output_type == 'select') {
150 150
                 ?>
151 151
                 <li>
152
-                    <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>">
153
-                        <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option>
152
+                    <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>">
153
+                        <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option>
154 154
                         <?php echo $listing_links; ?>
155 155
                     </select>
156 156
                 </li>
157 157
             <?php
158
-            } elseif ( $output_type == 'link' ) {
159
-                echo implode( " | ", $listing_links );
158
+            } elseif ($output_type == 'link') {
159
+                echo implode(" | ", $listing_links);
160 160
             }
161 161
         }
162 162
     }
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
  * @since 1.6.24
170 170
  * @return mixed
171 171
  */
172
-function geodir_get_user_favourites($user_id=''){
173
-    if(!$user_id){$user_id = get_current_user_id();}
172
+function geodir_get_user_favourites($user_id = '') {
173
+    if (!$user_id) {$user_id = get_current_user_id(); }
174 174
     $site_id = '';
175
-    if ( is_multisite() ) {
175
+    if (is_multisite()) {
176 176
         $blog_id = get_current_blog_id();
177
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
177
+        if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; }
178 178
     }
179 179
 
180 180
     return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+	$field_admin_title = $field_info->admin_title;
52 52
 
53 53
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 54
 
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 //print_r($field_info);
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72 72
 }elseif(isset($cf['icon']) && $cf['icon']){
73
-    $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
73
+	$field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
74 74
 }else{
75
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
75
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78 78
 if(isset($cf['name']) && $cf['name']){
79
-    $field_type_name = $cf['name'];
79
+	$field_type_name = $cf['name'];
80 80
 }else{
81
-    $field_type_name = $field_type;
81
+	$field_type_name = $field_type;
82 82
 }
83 83
 
84 84
 if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
85
-    $field_info->data_type = 'XVARCHAR';
85
+	$field_info->data_type = 'XVARCHAR';
86 86
 }
87 87
 
88 88
 ?>
@@ -92,45 +92,45 @@  discard block
 block discarded – undo
92 92
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" >
93 93
         <?php
94 94
 
95
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
96
-        ?>
95
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
96
+		?>
97 97
 
98 98
         <?php if (!$default): ?>
99 99
             <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
100 100
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
101 101
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
102 102
         <?php endif;
103
-        if ($field_type == 'fieldset') {
104
-            ?>
103
+		if ($field_type == 'fieldset') {
104
+			?>
105 105
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
106 106
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
107 107
             <b style="cursor:pointer;"
108 108
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
109 109
         <?php
110
-        } else {echo $field_icon;
111
-            ?>
110
+		} else {echo $field_icon;
111
+			?>
112 112
             <b style="cursor:pointer;"
113 113
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
114 114
         <?php
115
-        }
116
-        ?>
115
+		}
116
+		?>
117 117
     </div>
118 118
 
119 119
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
120 120
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
121 121
          style="display:<?php if ($field_ins_upd == 'submit') {
122
-             echo 'block;';
123
-         } else {
124
-             echo 'none;';
125
-         } ?>">
122
+			 echo 'block;';
123
+		 } else {
124
+			 echo 'none;';
125
+		 } ?>">
126 126
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
127 127
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
128 128
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
129 129
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
130 130
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
131 131
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
132
-            echo $field_info->data_type;
133
-        } ?>"/>
132
+			echo $field_info->data_type;
133
+		} ?>"/>
134 134
         <input type="hidden" name="is_active" id="is_active" value="1"/>
135 135
 
136 136
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -142,37 +142,37 @@  discard block
 block discarded – undo
142 142
 
143 143
             <?php
144 144
 
145
-            // data_type
146
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
145
+			// data_type
146
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
147 147
 
148
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
148
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
149 149
 
150
-            }else{
151
-                $value = '';
152
-                if (isset($field_info->data_type)) {
153
-                    $value = esc_attr($field_info->data_type);
154
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
155
-                    $value = $cf['defaults']['data_type'];
156
-                }
157
-                ?>
150
+			}else{
151
+				$value = '';
152
+				if (isset($field_info->data_type)) {
153
+					$value = esc_attr($field_info->data_type);
154
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
155
+					$value = $cf['defaults']['data_type'];
156
+				}
157
+				?>
158 158
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
159 159
             <?php
160
-            }
160
+			}
161 161
 
162 162
 
163
-            // admin_title
164
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
163
+			// admin_title
164
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
165 165
 
166
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
166
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
167 167
 
168
-            }else{
169
-                $value = '';
170
-                if (isset($field_info->admin_title)) {
171
-                    $value = esc_attr($field_info->admin_title);
172
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
173
-                    $value = $cf['defaults']['admin_title'];
174
-                }
175
-                ?>
168
+			}else{
169
+				$value = '';
170
+				if (isset($field_info->admin_title)) {
171
+					$value = esc_attr($field_info->admin_title);
172
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
173
+					$value = $cf['defaults']['admin_title'];
174
+				}
175
+				?>
176 176
                 <li>
177 177
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
178 178
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
                     </div>
187 187
                 </li>
188 188
                 <?php
189
-            }
189
+			}
190 190
 
191 191
 
192
-            // site_title
193
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
192
+			// site_title
193
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
194 194
 
195
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
195
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
196 196
 
197
-            }else{
198
-                $value = '';
199
-                if (isset($field_info->site_title)) {
200
-                    $value = esc_attr($field_info->site_title);
201
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
202
-                    $value = $cf['defaults']['site_title'];
203
-                }
204
-                ?>
197
+			}else{
198
+				$value = '';
199
+				if (isset($field_info->site_title)) {
200
+					$value = esc_attr($field_info->site_title);
201
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
202
+					$value = $cf['defaults']['site_title'];
203
+				}
204
+				?>
205 205
                 <li>
206 206
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
207 207
                         <div class="gdcf-tooltip">
@@ -214,22 +214,22 @@  discard block
 block discarded – undo
214 214
                     </div>
215 215
                 </li>
216 216
                 <?php
217
-            }
217
+			}
218 218
 
219 219
 
220
-            // admin_desc
221
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
220
+			// admin_desc
221
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
222 222
 
223
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
223
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
224 224
 
225
-            }else{
226
-                $value = '';
227
-                if (isset($field_info->admin_desc)) {
228
-                    $value = esc_attr($field_info->admin_desc);
229
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
230
-                    $value = $cf['defaults']['admin_desc'];
231
-                }
232
-                ?>
225
+			}else{
226
+				$value = '';
227
+				if (isset($field_info->admin_desc)) {
228
+					$value = esc_attr($field_info->admin_desc);
229
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
230
+					$value = $cf['defaults']['admin_desc'];
231
+				}
232
+				?>
233 233
                 <li>
234 234
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
235 235
                         <div class="gdcf-tooltip">
@@ -241,23 +241,23 @@  discard block
 block discarded – undo
241 241
                     </div>
242 242
                 </li>
243 243
                 <?php
244
-            }
244
+			}
245 245
 
246 246
 
247 247
 
248
-            // htmlvar_name
249
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
248
+			// htmlvar_name
249
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
250 250
 
251
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
251
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
252 252
 
253
-            }else{
254
-                $value = '';
255
-                if (isset($field_info->htmlvar_name)) {
256
-                    $value = esc_attr($field_info->htmlvar_name);
257
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
258
-                    $value = $cf['defaults']['htmlvar_name'];
259
-                }
260
-                ?>
253
+			}else{
254
+				$value = '';
255
+				if (isset($field_info->htmlvar_name)) {
256
+					$value = esc_attr($field_info->htmlvar_name);
257
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
258
+					$value = $cf['defaults']['htmlvar_name'];
259
+				}
260
+				?>
261 261
                 <li>
262 262
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
263 263
                         <div class="gdcf-tooltip">
@@ -267,29 +267,29 @@  discard block
 block discarded – undo
267 267
                     <div class="gd-cf-input-wrap">
268 268
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
269 269
                                value="<?php if ($value) {
270
-                                   echo preg_replace('/geodir_/', '', $value, 1);
271
-                               }?>" <?php if ($default) {
272
-                            echo 'readonly="readonly"';
273
-                        }?> />
270
+								   echo preg_replace('/geodir_/', '', $value, 1);
271
+							   }?>" <?php if ($default) {
272
+							echo 'readonly="readonly"';
273
+						}?> />
274 274
                     </div>
275 275
                 </li>
276 276
                 <?php
277
-            }
277
+			}
278 278
 
279 279
 
280
-            // is_active
281
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
280
+			// is_active
281
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
282 282
 
283
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
283
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
284 284
 
285
-            }else{
286
-                $value = '';
287
-                if (isset($field_info->is_active)) {
288
-                    $value = esc_attr($field_info->is_active);
289
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
290
-                    $value = $cf['defaults']['is_active'];
291
-                }
292
-                ?>
285
+			}else{
286
+				$value = '';
287
+				if (isset($field_info->is_active)) {
288
+					$value = esc_attr($field_info->is_active);
289
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
290
+					$value = $cf['defaults']['is_active'];
291
+				}
292
+				?>
293 293
                 <li <?php echo $field_display; ?>>
294 294
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
295 295
                         <div class="gdcf-tooltip">
@@ -300,35 +300,35 @@  discard block
 block discarded – undo
300 300
 
301 301
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
302 302
                             <?php if ($value == '1') {
303
-                                echo 'checked';
304
-                            } ?>/>
303
+								echo 'checked';
304
+							} ?>/>
305 305
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
306 306
 
307 307
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
308 308
                             <?php if ($value == '0' || !$value) {
309
-                                echo 'checked';
310
-                            } ?>/>
309
+								echo 'checked';
310
+							} ?>/>
311 311
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
312 312
 
313 313
                     </div>
314 314
                 </li>
315 315
                 <?php
316
-            }
316
+			}
317 317
 
318 318
 
319
-            // for_admin_use
320
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
319
+			// for_admin_use
320
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
321 321
 
322
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
322
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
323 323
 
324
-            }else{
325
-                $value = '';
326
-                if (isset($field_info->for_admin_use)) {
327
-                    $value = esc_attr($field_info->for_admin_use);
328
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
329
-                    $value = $cf['defaults']['for_admin_use'];
330
-                }
331
-                ?>
324
+			}else{
325
+				$value = '';
326
+				if (isset($field_info->for_admin_use)) {
327
+					$value = esc_attr($field_info->for_admin_use);
328
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
329
+					$value = $cf['defaults']['for_admin_use'];
330
+				}
331
+				?>
332 332
                 <li>
333 333
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
334 334
                         <div class="gdcf-tooltip">
@@ -339,47 +339,47 @@  discard block
 block discarded – undo
339 339
 
340 340
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
341 341
                             <?php if ($value == '1') {
342
-                                echo 'checked';
343
-                            } ?>/>
342
+								echo 'checked';
343
+							} ?>/>
344 344
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
345 345
 
346 346
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
347 347
                             <?php if ($value == '0' || !$value) {
348
-                                echo 'checked';
349
-                            } ?>/>
348
+								echo 'checked';
349
+							} ?>/>
350 350
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
351 351
 
352 352
                     </div>
353 353
                 </li>
354 354
                 <?php
355
-            }
355
+			}
356 356
 
357 357
 
358
-            // default_value
359
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
358
+			// default_value
359
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
360 360
 
361
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
361
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
362 362
 
363
-            }else{
364
-                $value = '';
365
-                if (isset($field_info->default_value)) {
366
-                    $value = esc_attr($field_info->default_value);
367
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
368
-                    $value = $cf['defaults']['default_value'];
369
-                }
370
-                ?>
363
+			}else{
364
+				$value = '';
365
+				if (isset($field_info->default_value)) {
366
+					$value = esc_attr($field_info->default_value);
367
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
368
+					$value = $cf['defaults']['default_value'];
369
+				}
370
+				?>
371 371
                 <li>
372 372
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
373 373
                         <div class="gdcf-tooltip">
374 374
                             <?php
375
-                            if ($field_type == 'checkbox') {
376
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
377
-                            } else if ($field_type == 'email') {
378
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
379
-                            } else {
380
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
381
-                            }
382
-                            ?>
375
+							if ($field_type == 'checkbox') {
376
+								_e('Should the checkbox be checked by default?', 'geodirectory');
377
+							} else if ($field_type == 'email') {
378
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
379
+							} else {
380
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
381
+							}
382
+							?>
383 383
                         </div>
384 384
                     </label>
385 385
                     <div class="gd-cf-input-wrap">
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
                     </div>
397 397
                 </li>
398 398
                 <?php
399
-            }
399
+			}
400 400
 
401 401
 
402
-            // show_in
403
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
402
+			// show_in
403
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
404 404
 
405
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
405
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
406 406
 
407
-            }else{
408
-                $value = '';
409
-                if (isset($field_info->show_in)) {
410
-                    $value = esc_attr($field_info->show_in);
411
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
412
-                    $value = esc_attr($cf['defaults']['show_in']);
413
-                }
414
-                ?>
407
+			}else{
408
+				$value = '';
409
+				if (isset($field_info->show_in)) {
410
+					$value = esc_attr($field_info->show_in);
411
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
412
+					$value = esc_attr($cf['defaults']['show_in']);
413
+				}
414
+				?>
415 415
                 <li>
416 416
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
417 417
                         <div class="gdcf-tooltip">
@@ -422,41 +422,41 @@  discard block
 block discarded – undo
422 422
 
423 423
                         <?php
424 424
 
425
-                        /*
425
+						/*
426 426
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
427 427
 						 */
428
-                        $show_in_locations = array(
429
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
430
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
431
-                            "[listing]" => __("Listings page", 'geodirectory'),
432
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
433
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
434
-                        );
435
-
436
-                        /**
437
-                         * Filter the locations array for where to display custom fields.
438
-                         *
439
-                         * @since 1.6.6
440
-                         * @param array $show_in_locations The array of locations and descriptions.
441
-                         * @param object $field_info The field being displayed info.
442
-                         * @param string $field_info The type of field.
443
-                         */
444
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
445
-
446
-
447
-                        // remove some locations for some field types
448
-
449
-                        // don't show new tab option for some types
450
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
451
-                        }else{
452
-                            unset($show_in_locations['[owntab]']);
453
-                        }
454
-
455
-                        if(!$display_on_listing){
456
-                            unset($show_in_locations['[listings]']);
457
-                        }
458
-
459
-                        ?>
428
+						$show_in_locations = array(
429
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
430
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
431
+							"[listing]" => __("Listings page", 'geodirectory'),
432
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
433
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
434
+						);
435
+
436
+						/**
437
+						 * Filter the locations array for where to display custom fields.
438
+						 *
439
+						 * @since 1.6.6
440
+						 * @param array $show_in_locations The array of locations and descriptions.
441
+						 * @param object $field_info The field being displayed info.
442
+						 * @param string $field_info The type of field.
443
+						 */
444
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
445
+
446
+
447
+						// remove some locations for some field types
448
+
449
+						// don't show new tab option for some types
450
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
451
+						}else{
452
+							unset($show_in_locations['[owntab]']);
453
+						}
454
+
455
+						if(!$display_on_listing){
456
+							unset($show_in_locations['[listings]']);
457
+						}
458
+
459
+						?>
460 460
 
461 461
                         <select multiple="multiple" name="show_in[]"
462 462
                                 id="show_in"
@@ -466,38 +466,38 @@  discard block
 block discarded – undo
466 466
                                 option-ajaxchosen="false">
467 467
                             <?php
468 468
 
469
-                            $show_in_values = explode(',',$value);
469
+							$show_in_values = explode(',',$value);
470 470
 
471
-                            foreach( $show_in_locations as $key => $val){
472
-                                $selected = '';
471
+							foreach( $show_in_locations as $key => $val){
472
+								$selected = '';
473 473
 
474
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
475
-                                    $selected = 'selected';
476
-                                }
474
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
475
+									$selected = 'selected';
476
+								}
477 477
 
478
-                                ?>
478
+								?>
479 479
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
480 480
                                 <?php
481
-                            }
482
-                            ?>
481
+							}
482
+							?>
483 483
                         </select>
484 484
                     </div>
485 485
                 </li>
486 486
                 <?php
487
-            }
487
+			}
488 488
 
489 489
 
490
-            // advanced_editor
491
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
490
+			// advanced_editor
491
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
492 492
 
493
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
493
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
494 494
 
495
-            }
495
+			}
496 496
 
497 497
 
498 498
 
499 499
 
500
-            ?>
500
+			?>
501 501
 
502 502
 
503 503
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -510,38 +510,38 @@  discard block
 block discarded – undo
510 510
 
511 511
             <?php
512 512
 
513
-            $pricearr = array();
514
-            if (isset($field_info->packages) && $field_info->packages != '') {
515
-                $pricearr = explode(',', trim($field_info->packages, ','));
516
-            } else {
517
-                $package_info = array();
513
+			$pricearr = array();
514
+			if (isset($field_info->packages) && $field_info->packages != '') {
515
+				$pricearr = explode(',', trim($field_info->packages, ','));
516
+			} else {
517
+				$package_info = array();
518 518
 
519
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
520
-                $pricearr[] = $package_info->pid;
521
-            }
519
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
520
+				$pricearr[] = $package_info->pid;
521
+			}
522 522
 
523
-            ob_start()
524
-            ?>
523
+			ob_start()
524
+			?>
525 525
 
526 526
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
527 527
                 <?php
528
-                if (!empty($pricearr)) {
529
-                    foreach ($pricearr as $val) {
530
-                        ?>
528
+				if (!empty($pricearr)) {
529
+					foreach ($pricearr as $val) {
530
+						?>
531 531
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
532
-                    }
533
-                }
534
-                ?>
532
+					}
533
+				}
534
+				?>
535 535
             </select>
536 536
 
537 537
             <?php
538
-            $html = ob_get_clean();
538
+			$html = ob_get_clean();
539 539
 
540 540
 			/**
541 541
 			 * Filter the price packages list.
542 542
 			 *
543 543
 			 * Filter the price packages list in custom field form in admin
544
-             * custom fields settings.
544
+			 * custom fields settings.
545 545
 			 *
546 546
 			 * @since 1.0.0
547 547
 			 *
@@ -550,25 +550,25 @@  discard block
 block discarded – undo
550 550
 			 */
551 551
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
552 552
 
553
-            ?>
553
+			?>
554 554
 
555 555
 
556 556
 
557 557
             <?php
558 558
 
559
-            // is_required
560
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
559
+			// is_required
560
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
561 561
 
562
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
562
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
563 563
 
564
-            }else{
565
-                $value = '';
566
-                if (isset($field_info->is_required)) {
567
-                    $value = esc_attr($field_info->is_required);
568
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
569
-                    $value = $cf['defaults']['is_required'];
570
-                }
571
-                ?>
564
+			}else{
565
+				$value = '';
566
+				if (isset($field_info->is_required)) {
567
+					$value = esc_attr($field_info->is_required);
568
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
569
+					$value = $cf['defaults']['is_required'];
570
+				}
571
+				?>
572 572
                 <li>
573 573
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
574 574
                         <div class="gdcf-tooltip">
@@ -580,14 +580,14 @@  discard block
 block discarded – undo
580 580
 
581 581
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
582 582
                             <?php if ($value == '1') {
583
-                                echo 'checked';
584
-                            } ?>/>
583
+								echo 'checked';
584
+							} ?>/>
585 585
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
586 586
 
587 587
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
588 588
                             <?php if ($value == '0' || !$value) {
589
-                                echo 'checked';
590
-                            } ?>/>
589
+								echo 'checked';
590
+							} ?>/>
591 591
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
592 592
 
593 593
                     </div>
@@ -595,21 +595,21 @@  discard block
 block discarded – undo
595 595
                 </li>
596 596
 
597 597
                 <?php
598
-            }
598
+			}
599 599
 
600
-            // required_msg
601
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
600
+			// required_msg
601
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
602 602
 
603
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
603
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
604 604
 
605
-            }else{
606
-                $value = '';
607
-                if (isset($field_info->required_msg)) {
608
-                    $value = esc_attr($field_info->required_msg);
609
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
610
-                    $value = $cf['defaults']['required_msg'];
611
-                }
612
-                ?>
605
+			}else{
606
+				$value = '';
607
+				if (isset($field_info->required_msg)) {
608
+					$value = esc_attr($field_info->required_msg);
609
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
610
+					$value = $cf['defaults']['required_msg'];
611
+				}
612
+				?>
613 613
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
614 614
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
615 615
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -623,38 +623,38 @@  discard block
 block discarded – undo
623 623
                     </div>
624 624
                 </li>
625 625
                 <?php
626
-            }
626
+			}
627 627
 
628 628
 
629
-            // required_msg
630
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
629
+			// required_msg
630
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
631 631
 
632
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
632
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
633 633
 
634
-            }
634
+			}
635 635
 
636 636
 
637
-            // extra_fields
638
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
637
+			// extra_fields
638
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
639 639
 
640
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
640
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
641 641
 
642
-            }
642
+			}
643 643
 
644 644
 
645
-            // field_icon
646
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
645
+			// field_icon
646
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
647 647
 
648
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
648
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
649 649
 
650
-            }else{
651
-                $value = '';
652
-                if (isset($field_info->field_icon)) {
653
-                    $value = esc_attr($field_info->field_icon);
654
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
655
-                    $value = $cf['defaults']['field_icon'];
656
-                }
657
-                ?>
650
+			}else{
651
+				$value = '';
652
+				if (isset($field_info->field_icon)) {
653
+					$value = esc_attr($field_info->field_icon);
654
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
655
+					$value = $cf['defaults']['field_icon'];
656
+				}
657
+				?>
658 658
                 <li>
659 659
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
660 660
 
@@ -672,22 +672,22 @@  discard block
 block discarded – undo
672 672
 
673 673
                 </li>
674 674
                 <?php
675
-            }
675
+			}
676 676
 
677 677
 
678
-            // css_class
679
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
678
+			// css_class
679
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
680 680
 
681
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
681
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
682 682
 
683
-            }else{
684
-                $value = '';
685
-                if (isset($field_info->css_class)) {
686
-                    $value = esc_attr($field_info->css_class);
687
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
688
-                    $value = $cf['defaults']['css_class'];
689
-                }
690
-                ?>
683
+			}else{
684
+				$value = '';
685
+				if (isset($field_info->css_class)) {
686
+					$value = esc_attr($field_info->css_class);
687
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
688
+					$value = $cf['defaults']['css_class'];
689
+				}
690
+				?>
691 691
                 <li>
692 692
 
693 693
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -700,47 +700,47 @@  discard block
 block discarded – undo
700 700
                     <div class="gd-cf-input-wrap">
701 701
                         <input type="text" name="css_class" id="css_class"
702 702
                                value="<?php if (isset($field_info->css_class)) {
703
-                                   echo esc_attr($field_info->css_class);
704
-                               }?>"/>
703
+								   echo esc_attr($field_info->css_class);
704
+							   }?>"/>
705 705
                     </div>
706 706
                 </li>
707 707
                 <?php
708
-            }
708
+			}
709 709
 
710 710
 
711
-            // cat_sort
712
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
711
+			// cat_sort
712
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
713 713
 
714
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
714
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
715 715
 
716
-            }else{
717
-                $value = '';
718
-                $hide_cat_sort  ='';
719
-                if (isset($field_info->cat_sort)) {
720
-                    $value = esc_attr($field_info->cat_sort);
721
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
722
-                    $value = $cf['defaults']['cat_sort'];
723
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
724
-                }
716
+			}else{
717
+				$value = '';
718
+				$hide_cat_sort  ='';
719
+				if (isset($field_info->cat_sort)) {
720
+					$value = esc_attr($field_info->cat_sort);
721
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
722
+					$value = $cf['defaults']['cat_sort'];
723
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
724
+				}
725 725
 
726
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
727
-                ?>
726
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
727
+				?>
728 728
                 <li <?php echo $hide_cat_sort ;?>>
729 729
                     <h3><?php
730
-                        /**
731
-                         * Filter the section title.
732
-                         *
733
-                         * Filter the section title in custom field form in admin
734
-                         * custom fields settings.
735
-                         *
736
-                         * @since 1.0.0
737
-                         *
738
-                         * @param string $title Title of the section.
739
-                         * @param string $field_type Current field type.
740
-                         */
741
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
742
-
743
-                        ?></h3>
730
+						/**
731
+						 * Filter the section title.
732
+						 *
733
+						 * Filter the section title in custom field form in admin
734
+						 * custom fields settings.
735
+						 *
736
+						 * @since 1.0.0
737
+						 *
738
+						 * @param string $title Title of the section.
739
+						 * @param string $field_type Current field type.
740
+						 */
741
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
742
+
743
+						?></h3>
744 744
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
745 745
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
746 746
                         <div class="gdcf-tooltip">
@@ -752,42 +752,42 @@  discard block
 block discarded – undo
752 752
 
753 753
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
754 754
                             <?php if ($value == '1') {
755
-                                echo 'checked';
756
-                            } ?>/>
755
+								echo 'checked';
756
+							} ?>/>
757 757
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
758 758
 
759 759
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
760 760
                             <?php if (!$value) {
761
-                                echo 'checked';
762
-                            } ?>/>
761
+								echo 'checked';
762
+							} ?>/>
763 763
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
764 764
 
765 765
                     </div>
766 766
                 </li>
767 767
                 <?php
768
-            }
769
-
770
-
771
-
772
-            switch ($field_type):
773
-                case 'html':
774
-                case 'file':
775
-                case 'url':
776
-                case 'fieldset':
777
-                    break;
778
-                default:
779
-
780
-                    /**
781
-                     * Called at the end of the advanced custom fields settings page loop.
782
-                     *
783
-                     * Can be used to add or deal with different settings types.
784
-                     *
785
-                     * @since 1.0.0
786
-                     * @since 1.6.6 $cf param added.
787
-                     * @param object $field_info The current fields info.
788
-                     * @param array $cf The custom field settings
789
-                     */
790
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
768
+			}
769
+
770
+
771
+
772
+			switch ($field_type):
773
+				case 'html':
774
+				case 'file':
775
+				case 'url':
776
+				case 'fieldset':
777
+					break;
778
+				default:
779
+
780
+					/**
781
+					 * Called at the end of the advanced custom fields settings page loop.
782
+					 *
783
+					 * Can be used to add or deal with different settings types.
784
+					 *
785
+					 * @since 1.0.0
786
+					 * @since 1.6.6 $cf param added.
787
+					 * @param object $field_info The current fields info.
788
+					 * @param array $cf The custom field settings
789
+					 */
790
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
791 791
 
792 792
 
793 793
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
40 40
 
41 41
 
42
-if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
42
+if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
43 43
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
44
-if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
44
+if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
45 45
 
46 46
 
47
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
47
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 71
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
72
+}elseif (isset($cf['icon']) && $cf['icon']) {
73 73
     $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
74
-}else{
74
+} else {
75 75
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78
-if(isset($cf['name']) && $cf['name']){
78
+if (isset($cf['name']) && $cf['name']) {
79 79
     $field_type_name = $cf['name'];
80
-}else{
80
+} else {
81 81
     $field_type_name = $field_type;
82 82
 }
83 83
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" >
93 93
         <?php
94 94
 
95
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
95
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
96 96
         ?>
97 97
 
98 98
         <?php if (!$default): ?>
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
106 106
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
107 107
             <b style="cursor:pointer;"
108
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
108
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
109 109
         <?php
110 110
         } else {echo $field_icon;
111 111
             ?>
112 112
             <b style="cursor:pointer;"
113
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
113
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
114 114
         <?php
115 115
         }
116 116
         ?>
@@ -133,43 +133,43 @@  discard block
 block discarded – undo
133 133
         } ?>"/>
134 134
         <input type="hidden" name="is_active" id="is_active" value="1"/>
135 135
 
136
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
137
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
138
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
139
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
136
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
137
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
138
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
139
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
140 140
 
141 141
         <ul class="widefat post fixed" border="0" style="width:100%;">
142 142
 
143 143
             <?php
144 144
 
145 145
             // data_type
146
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
146
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
147 147
 
148
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
148
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
149 149
 
150
-            }else{
150
+            } else {
151 151
                 $value = '';
152 152
                 if (isset($field_info->data_type)) {
153 153
                     $value = esc_attr($field_info->data_type);
154
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
154
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
155 155
                     $value = $cf['defaults']['data_type'];
156 156
                 }
157 157
                 ?>
158
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
158
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
159 159
             <?php
160 160
             }
161 161
 
162 162
 
163 163
             // admin_title
164
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
164
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
165 165
 
166
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
166
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
167 167
 
168
-            }else{
168
+            } else {
169 169
                 $value = '';
170 170
                 if (isset($field_info->admin_title)) {
171 171
                     $value = esc_attr($field_info->admin_title);
172
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
172
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
173 173
                     $value = $cf['defaults']['admin_title'];
174 174
                 }
175 175
                 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                     </label>
183 183
                     <div class="gd-cf-input-wrap">
184 184
                         <input type="text" name="admin_title" id="admin_title"
185
-                               value="<?php echo $value;?>"/>
185
+                               value="<?php echo $value; ?>"/>
186 186
                     </div>
187 187
                 </li>
188 188
                 <?php
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 
191 191
 
192 192
             // site_title
193
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
193
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
194 194
 
195
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
195
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
196 196
 
197
-            }else{
197
+            } else {
198 198
                 $value = '';
199 199
                 if (isset($field_info->site_title)) {
200 200
                     $value = esc_attr($field_info->site_title);
201
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
201
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
202 202
                     $value = $cf['defaults']['site_title'];
203 203
                 }
204 204
                 ?>
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
             // admin_desc
221
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
221
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
222 222
 
223
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
223
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
224 224
 
225
-            }else{
225
+            } else {
226 226
                 $value = '';
227 227
                 if (isset($field_info->admin_desc)) {
228 228
                     $value = esc_attr($field_info->admin_desc);
229
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
229
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
230 230
                     $value = $cf['defaults']['admin_desc'];
231 231
                 }
232 232
                 ?>
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                         </div>
238 238
                     </label>
239 239
                     <div class="gd-cf-input-wrap">
240
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
240
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
241 241
                     </div>
242 242
                 </li>
243 243
                 <?php
@@ -246,26 +246,26 @@  discard block
 block discarded – undo
246 246
 
247 247
 
248 248
             // htmlvar_name
249
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
249
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
250 250
 
251
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
251
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
252 252
 
253
-            }else{
253
+            } else {
254 254
                 $value = '';
255 255
                 if (isset($field_info->htmlvar_name)) {
256 256
                     $value = esc_attr($field_info->htmlvar_name);
257
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
257
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
258 258
                     $value = $cf['defaults']['htmlvar_name'];
259 259
                 }
260 260
                 ?>
261 261
                 <li>
262
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
262
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
263 263
                         <div class="gdcf-tooltip">
264 264
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
265 265
                         </div>
266 266
                     </label>
267 267
                     <div class="gd-cf-input-wrap">
268
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
268
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
269 269
                                value="<?php if ($value) {
270 270
                                    echo preg_replace('/geodir_/', '', $value, 1);
271 271
                                }?>" <?php if ($default) {
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
 
279 279
 
280 280
             // is_active
281
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
281
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
282 282
 
283
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
283
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
284 284
 
285
-            }else{
285
+            } else {
286 286
                 $value = '';
287 287
                 if (isset($field_info->is_active)) {
288 288
                     $value = esc_attr($field_info->is_active);
289
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
289
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
290 290
                     $value = $cf['defaults']['is_active'];
291 291
                 }
292 292
                 ?>
@@ -298,17 +298,17 @@  discard block
 block discarded – undo
298 298
                     </label>
299 299
                     <div class="gd-cf-input-wrap gd-switch">
300 300
 
301
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
301
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
302 302
                             <?php if ($value == '1') {
303 303
                                 echo 'checked';
304 304
                             } ?>/>
305
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
305
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
306 306
 
307
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
307
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
308 308
                             <?php if ($value == '0' || !$value) {
309 309
                                 echo 'checked';
310 310
                             } ?>/>
311
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
311
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
312 312
 
313 313
                     </div>
314 314
                 </li>
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 
318 318
 
319 319
             // for_admin_use
320
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
320
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
321 321
 
322
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
322
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
323 323
 
324
-            }else{
324
+            } else {
325 325
                 $value = '';
326 326
                 if (isset($field_info->for_admin_use)) {
327 327
                     $value = esc_attr($field_info->for_admin_use);
328
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
328
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
329 329
                     $value = $cf['defaults']['for_admin_use'];
330 330
                 }
331 331
                 ?>
@@ -337,17 +337,17 @@  discard block
 block discarded – undo
337 337
                     </label>
338 338
                     <div class="gd-cf-input-wrap gd-switch">
339 339
 
340
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
340
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
341 341
                             <?php if ($value == '1') {
342 342
                                 echo 'checked';
343 343
                             } ?>/>
344
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
344
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
345 345
 
346
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
346
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
347 347
                             <?php if ($value == '0' || !$value) {
348 348
                                 echo 'checked';
349 349
                             } ?>/>
350
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
350
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
351 351
 
352 352
                     </div>
353 353
                 </li>
@@ -356,20 +356,20 @@  discard block
 block discarded – undo
356 356
 
357 357
 
358 358
             // default_value
359
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
359
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
360 360
 
361
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
361
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
362 362
 
363
-            }else{
363
+            } else {
364 364
                 $value = '';
365 365
                 if (isset($field_info->default_value)) {
366 366
                     $value = esc_attr($field_info->default_value);
367
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
367
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
368 368
                     $value = $cf['defaults']['default_value'];
369 369
                 }
370 370
                 ?>
371 371
                 <li>
372
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
372
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
373 373
                         <div class="gdcf-tooltip">
374 374
                             <?php
375 375
                             if ($field_type == 'checkbox') {
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
                         <?php if ($field_type == 'checkbox') { ?>
387 387
                             <select name="default_value" id="default_value">
388 388
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
389
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
389
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
390 390
                             </select>
391 391
                         <?php } else if ($field_type == 'email') { ?>
392
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
392
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
393 393
                         <?php } else { ?>
394
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
394
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
395 395
                         <?php } ?>
396 396
                     </div>
397 397
                 </li>
@@ -400,15 +400,15 @@  discard block
 block discarded – undo
400 400
 
401 401
 
402 402
             // show_in
403
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
403
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
404 404
 
405
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
405
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
406 406
 
407
-            }else{
407
+            } else {
408 408
                 $value = '';
409 409
                 if (isset($field_info->show_in)) {
410 410
                     $value = esc_attr($field_info->show_in);
411
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
411
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
412 412
                     $value = esc_attr($cf['defaults']['show_in']);
413 413
                 }
414 414
                 ?>
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
                          * @param object $field_info The field being displayed info.
442 442
                          * @param string $field_info The type of field.
443 443
                          */
444
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
444
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
445 445
 
446 446
 
447 447
                         // remove some locations for some field types
448 448
 
449 449
                         // don't show new tab option for some types
450
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
451
-                        }else{
450
+                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
451
+                        } else {
452 452
                             unset($show_in_locations['[owntab]']);
453 453
                         }
454 454
 
455
-                        if(!$display_on_listing){
455
+                        if (!$display_on_listing) {
456 456
                             unset($show_in_locations['[listings]']);
457 457
                         }
458 458
 
@@ -466,17 +466,17 @@  discard block
 block discarded – undo
466 466
                                 option-ajaxchosen="false">
467 467
                             <?php
468 468
 
469
-                            $show_in_values = explode(',',$value);
469
+                            $show_in_values = explode(',', $value);
470 470
 
471
-                            foreach( $show_in_locations as $key => $val){
471
+                            foreach ($show_in_locations as $key => $val) {
472 472
                                 $selected = '';
473 473
 
474
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
474
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
475 475
                                     $selected = 'selected';
476 476
                                 }
477 477
 
478 478
                                 ?>
479
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
479
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
480 480
                                 <?php
481 481
                             }
482 482
                             ?>
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 
489 489
 
490 490
             // advanced_editor
491
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
491
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
492 492
 
493
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
493
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
494 494
 
495 495
             }
496 496
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 
502 502
 
503 503
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
504
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
504
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
505 505
 
506 506
             <?php // we dont need to show the sort order ?>
507
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
507
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
508 508
 
509 509
 
510 510
 
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
             <?php
558 558
 
559 559
             // is_required
560
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
560
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
561 561
 
562
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
562
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
563 563
 
564
-            }else{
564
+            } else {
565 565
                 $value = '';
566 566
                 if (isset($field_info->is_required)) {
567 567
                     $value = esc_attr($field_info->is_required);
568
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
568
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
569 569
                     $value = $cf['defaults']['is_required'];
570 570
                 }
571 571
                 ?>
@@ -578,17 +578,17 @@  discard block
 block discarded – undo
578 578
 
579 579
                     <div class="gd-cf-input-wrap gd-switch">
580 580
 
581
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
581
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
582 582
                             <?php if ($value == '1') {
583 583
                                 echo 'checked';
584 584
                             } ?>/>
585
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
585
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
586 586
 
587
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
587
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
588 588
                             <?php if ($value == '0' || !$value) {
589 589
                                 echo 'checked';
590 590
                             } ?>/>
591
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
591
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
592 592
 
593 593
                     </div>
594 594
 
@@ -598,19 +598,19 @@  discard block
 block discarded – undo
598 598
             }
599 599
 
600 600
             // required_msg
601
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
601
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
602 602
 
603
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
603
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
604 604
 
605
-            }else{
605
+            } else {
606 606
                 $value = '';
607 607
                 if (isset($field_info->required_msg)) {
608 608
                     $value = esc_attr($field_info->required_msg);
609
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
609
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
610 610
                     $value = $cf['defaults']['required_msg'];
611 611
                 }
612 612
                 ?>
613
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
613
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
614 614
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
615 615
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
616 616
                         <div class="gdcf-tooltip">
@@ -627,31 +627,31 @@  discard block
 block discarded – undo
627 627
 
628 628
 
629 629
             // required_msg
630
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
630
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
631 631
 
632
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
632
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
633 633
 
634 634
             }
635 635
 
636 636
 
637 637
             // extra_fields
638
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
638
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
639 639
 
640
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
640
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
641 641
 
642 642
             }
643 643
 
644 644
 
645 645
             // field_icon
646
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
646
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
647 647
 
648
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
648
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
649 649
 
650
-            }else{
650
+            } else {
651 651
                 $value = '';
652 652
                 if (isset($field_info->field_icon)) {
653 653
                     $value = esc_attr($field_info->field_icon);
654
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
654
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
655 655
                     $value = $cf['defaults']['field_icon'];
656 656
                 }
657 657
                 ?>
@@ -662,12 +662,12 @@  discard block
 block discarded – undo
662 662
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
663 663
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
664 664
                         <div class="gdcf-tooltip">
665
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
665
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
666 666
                         </div>
667 667
                     </label>
668 668
                     <div class="gd-cf-input-wrap">
669 669
                         <input type="text" name="field_icon" id="field_icon"
670
-                               value="<?php echo $value;?>"/>
670
+                               value="<?php echo $value; ?>"/>
671 671
                     </div>
672 672
 
673 673
                 </li>
@@ -676,15 +676,15 @@  discard block
 block discarded – undo
676 676
 
677 677
 
678 678
             // css_class
679
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
679
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
680 680
 
681
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
681
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
682 682
 
683
-            }else{
683
+            } else {
684 684
                 $value = '';
685 685
                 if (isset($field_info->css_class)) {
686 686
                     $value = esc_attr($field_info->css_class);
687
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
687
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
688 688
                     $value = $cf['defaults']['css_class'];
689 689
                 }
690 690
                 ?>
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
                     <label for="css_class" class="gd-cf-tooltip-wrap">
694 694
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
695 695
                         <div class="gdcf-tooltip">
696
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
697
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
696
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
697
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
698 698
                         </div>
699 699
                     </label>
700 700
                     <div class="gd-cf-input-wrap">
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 
710 710
 
711 711
             // cat_sort
712
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
712
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
713 713
 
714
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
714
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
715 715
 
716
-            }else{
716
+            } else {
717 717
                 $value = '';
718
-                $hide_cat_sort  ='';
718
+                $hide_cat_sort = '';
719 719
                 if (isset($field_info->cat_sort)) {
720 720
                     $value = esc_attr($field_info->cat_sort);
721
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
721
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
722 722
                     $value = $cf['defaults']['cat_sort'];
723
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
723
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
724 724
                 }
725 725
 
726
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
726
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
727 727
                 ?>
728
-                <li <?php echo $hide_cat_sort ;?>>
728
+                <li <?php echo $hide_cat_sort; ?>>
729 729
                     <h3><?php
730 730
                         /**
731 731
                          * Filter the section title.
@@ -744,23 +744,23 @@  discard block
 block discarded – undo
744 744
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
745 745
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
746 746
                         <div class="gdcf-tooltip">
747
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
747
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
748 748
                         </div>
749 749
                     </label>
750 750
 
751 751
                     <div class="gd-cf-input-wrap gd-switch">
752 752
 
753
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
753
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
754 754
                             <?php if ($value == '1') {
755 755
                                 echo 'checked';
756 756
                             } ?>/>
757
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
757
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
758 758
 
759
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
759
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
760 760
                             <?php if (!$value) {
761 761
                                 echo 'checked';
762 762
                             } ?>/>
763
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
763
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
764 764
 
765 765
                     </div>
766 766
                 </li>
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
                      * @param object $field_info The current fields info.
788 788
                      * @param array $cf The custom field settings
789 789
                      */
790
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
790
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
791 791
 
792 792
 
793 793
                 <?php endswitch; ?>
@@ -799,10 +799,10 @@  discard block
 block discarded – undo
799 799
                     <h3></h3>
800 800
                 </label>
801 801
                 <div class="gd-cf-input-wrap">
802
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
802
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
803 803
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
804 804
                     <?php if (!$default): ?>
805
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
805
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
806 806
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
807 807
                                                             class="button"/></a>
808 808
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +38 added lines, -36 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
48 49
 
49 50
 $field_admin_title = '';
50
-if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+if (isset($field_info->admin_title)) {
52
+    $field_admin_title = $field_info->admin_title;
53
+}
52 54
 
53 55
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 56
 
@@ -69,15 +71,15 @@  discard block
 block discarded – undo
69 71
 
70 72
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 73
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
74
+} elseif(isset($cf['icon']) && $cf['icon']){
73 75
     $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>';
74
-}else{
76
+} else{
75 77
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 78
 }
77 79
 
78 80
 if(isset($cf['name']) && $cf['name']){
79 81
     $field_type_name = $cf['name'];
80
-}else{
82
+} else{
81 83
     $field_type_name = $field_type;
82 84
 }
83 85
 
@@ -147,11 +149,11 @@  discard block
 block discarded – undo
147 149
 
148 150
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
149 151
 
150
-            }else{
152
+            } else{
151 153
                 $value = '';
152 154
                 if (isset($field_info->data_type)) {
153 155
                     $value = esc_attr($field_info->data_type);
154
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
156
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
155 157
                     $value = $cf['defaults']['data_type'];
156 158
                 }
157 159
                 ?>
@@ -165,11 +167,11 @@  discard block
 block discarded – undo
165 167
 
166 168
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
167 169
 
168
-            }else{
170
+            } else{
169 171
                 $value = '';
170 172
                 if (isset($field_info->admin_title)) {
171 173
                     $value = esc_attr($field_info->admin_title);
172
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
174
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
173 175
                     $value = $cf['defaults']['admin_title'];
174 176
                 }
175 177
                 ?>
@@ -194,11 +196,11 @@  discard block
 block discarded – undo
194 196
 
195 197
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
196 198
 
197
-            }else{
199
+            } else{
198 200
                 $value = '';
199 201
                 if (isset($field_info->site_title)) {
200 202
                     $value = esc_attr($field_info->site_title);
201
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
203
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
202 204
                     $value = $cf['defaults']['site_title'];
203 205
                 }
204 206
                 ?>
@@ -222,11 +224,11 @@  discard block
 block discarded – undo
222 224
 
223 225
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
224 226
 
225
-            }else{
227
+            } else{
226 228
                 $value = '';
227 229
                 if (isset($field_info->admin_desc)) {
228 230
                     $value = esc_attr($field_info->admin_desc);
229
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
231
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
230 232
                     $value = $cf['defaults']['admin_desc'];
231 233
                 }
232 234
                 ?>
@@ -250,11 +252,11 @@  discard block
 block discarded – undo
250 252
 
251 253
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
252 254
 
253
-            }else{
255
+            } else{
254 256
                 $value = '';
255 257
                 if (isset($field_info->htmlvar_name)) {
256 258
                     $value = esc_attr($field_info->htmlvar_name);
257
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
259
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
258 260
                     $value = $cf['defaults']['htmlvar_name'];
259 261
                 }
260 262
                 ?>
@@ -282,11 +284,11 @@  discard block
 block discarded – undo
282 284
 
283 285
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
284 286
 
285
-            }else{
287
+            } else{
286 288
                 $value = '';
287 289
                 if (isset($field_info->is_active)) {
288 290
                     $value = esc_attr($field_info->is_active);
289
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
291
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
290 292
                     $value = $cf['defaults']['is_active'];
291 293
                 }
292 294
                 ?>
@@ -321,11 +323,11 @@  discard block
 block discarded – undo
321 323
 
322 324
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
323 325
 
324
-            }else{
326
+            } else{
325 327
                 $value = '';
326 328
                 if (isset($field_info->for_admin_use)) {
327 329
                     $value = esc_attr($field_info->for_admin_use);
328
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
330
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
329 331
                     $value = $cf['defaults']['for_admin_use'];
330 332
                 }
331 333
                 ?>
@@ -360,11 +362,11 @@  discard block
 block discarded – undo
360 362
 
361 363
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
362 364
 
363
-            }else{
365
+            } else{
364 366
                 $value = '';
365 367
                 if (isset($field_info->default_value)) {
366 368
                     $value = esc_attr($field_info->default_value);
367
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
369
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
368 370
                     $value = $cf['defaults']['default_value'];
369 371
                 }
370 372
                 ?>
@@ -404,11 +406,11 @@  discard block
 block discarded – undo
404 406
 
405 407
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
406 408
 
407
-            }else{
409
+            } else{
408 410
                 $value = '';
409 411
                 if (isset($field_info->show_in)) {
410 412
                     $value = esc_attr($field_info->show_in);
411
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
413
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
412 414
                     $value = esc_attr($cf['defaults']['show_in']);
413 415
                 }
414 416
                 ?>
@@ -448,7 +450,7 @@  discard block
 block discarded – undo
448 450
 
449 451
                         // don't show new tab option for some types
450 452
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
451
-                        }else{
453
+                        } else{
452 454
                             unset($show_in_locations['[owntab]']);
453 455
                         }
454 456
 
@@ -561,11 +563,11 @@  discard block
 block discarded – undo
561 563
 
562 564
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
563 565
 
564
-            }else{
566
+            } else{
565 567
                 $value = '';
566 568
                 if (isset($field_info->is_required)) {
567 569
                     $value = esc_attr($field_info->is_required);
568
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
570
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
569 571
                     $value = $cf['defaults']['is_required'];
570 572
                 }
571 573
                 ?>
@@ -602,11 +604,11 @@  discard block
 block discarded – undo
602 604
 
603 605
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
604 606
 
605
-            }else{
607
+            } else{
606 608
                 $value = '';
607 609
                 if (isset($field_info->required_msg)) {
608 610
                     $value = esc_attr($field_info->required_msg);
609
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
611
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
610 612
                     $value = $cf['defaults']['required_msg'];
611 613
                 }
612 614
                 ?>
@@ -647,11 +649,11 @@  discard block
 block discarded – undo
647 649
 
648 650
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
649 651
 
650
-            }else{
652
+            } else{
651 653
                 $value = '';
652 654
                 if (isset($field_info->field_icon)) {
653 655
                     $value = esc_attr($field_info->field_icon);
654
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
656
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
655 657
                     $value = $cf['defaults']['field_icon'];
656 658
                 }
657 659
                 ?>
@@ -680,11 +682,11 @@  discard block
 block discarded – undo
680 682
 
681 683
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
682 684
 
683
-            }else{
685
+            } else{
684 686
                 $value = '';
685 687
                 if (isset($field_info->css_class)) {
686 688
                     $value = esc_attr($field_info->css_class);
687
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
689
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
688 690
                     $value = $cf['defaults']['css_class'];
689 691
                 }
690 692
                 ?>
@@ -713,12 +715,12 @@  discard block
 block discarded – undo
713 715
 
714 716
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
715 717
 
716
-            }else{
718
+            } else{
717 719
                 $value = '';
718 720
                 $hide_cat_sort  ='';
719 721
                 if (isset($field_info->cat_sort)) {
720 722
                     $value = esc_attr($field_info->cat_sort);
721
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
723
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
722 724
                     $value = $cf['defaults']['cat_sort'];
723 725
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
724 726
                 }
Please login to merge, or discard this patch.
geodirectory-widgets/listing_map_widget.php 3 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function init_listing_map_script()
20 20
 {
21
-    global $list_map_json;
21
+	global $list_map_json;
22 22
 
23
-    $list_map_json = array();
23
+	$list_map_json = array();
24 24
 
25 25
 }
26 26
 
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function create_list_jsondata($post)
37 37
 {
38
-    global $wpdb, $list_map_json, $add_post_in_marker_array;
39
-
40
-    if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
-        /**
42
-         * Filter the json data for search listing map.
43
-         *
44
-         * @since 1.5.7
45
-         * @param string $post->marker_json JSON representation of the post marker info.
46
-         * @param object $post The post object.
47
-         */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
-    }
38
+	global $wpdb, $list_map_json, $add_post_in_marker_array;
39
+
40
+	if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
41
+		/**
42
+		 * Filter the json data for search listing map.
43
+		 *
44
+		 * @since 1.5.7
45
+		 * @param string $post->marker_json JSON representation of the post marker info.
46
+		 * @param object $post The post object.
47
+		 */
48
+		$list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
49
+	}
50 50
 
51 51
 }
52 52
 
@@ -59,29 +59,29 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function show_listing_widget_map()
61 61
 {
62
-    global $list_map_json;
62
+	global $list_map_json;
63 63
 
64
-    if (!empty($list_map_json)) {
65
-        $list_map_json = array_unique($list_map_json);
66
-        $cat_content_info[] = implode(',', $list_map_json);
67
-    }
64
+	if (!empty($list_map_json)) {
65
+		$list_map_json = array_unique($list_map_json);
66
+		$cat_content_info[] = implode(',', $list_map_json);
67
+	}
68 68
 
69
-    $totalcount = count(array_unique($list_map_json));
69
+	$totalcount = count(array_unique($list_map_json));
70 70
 
71 71
 
72
-    if (!empty($cat_content_info)) {
73
-        $json_content = substr(implode(',', $cat_content_info), 1);
74
-        $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
-        $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
-    } else {
78
-        $list_json = '[{"totalcount":"0"}]';
79
-    }
72
+	if (!empty($cat_content_info)) {
73
+		$json_content = substr(implode(',', $cat_content_info), 1);
74
+		$json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75
+		$json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
+		$list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
77
+	} else {
78
+		$list_json = '[{"totalcount":"0"}]';
79
+	}
80 80
 
81
-    $listing_map_args = array('list_json' => $list_json);
81
+	$listing_map_args = array('list_json' => $list_json);
82 82
 
83
-    // Pass the json data in listing map script
84
-    wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
83
+	// Pass the json data in listing map script
84
+	wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
85 85
 
86 86
 }
87 87
 
@@ -93,110 +93,110 @@  discard block
 block discarded – undo
93 93
 class geodir_map_listingpage extends WP_Widget
94 94
 {
95 95
 
96
-    /**
96
+	/**
97 97
 	 * Register the listing page map widget.
98 98
 	 *
99 99
 	 * @since 1.0.0
100
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
100
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
101 101
 	 */
102
-    public function __construct() {
103
-        $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
104
-        parent::__construct(
105
-            'geodir_map_v3_listing_map', // Base ID
106
-            __('GD > GMap - Listing page', 'geodirectory'), // Name
107
-            $widget_ops// Args
108
-        );
102
+	public function __construct() {
103
+		$widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
104
+		parent::__construct(
105
+			'geodir_map_v3_listing_map', // Base ID
106
+			__('GD > GMap - Listing page', 'geodirectory'), // Name
107
+			$widget_ops// Args
108
+		);
109 109
 
110
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
110
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
111 111
 
112
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
112
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
113 113
 
114
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
-    }
114
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
115
+	}
116 116
 
117 117
 	/**
118 118
 	 * Front-end display content for listing page map widget.
119 119
 	 *
120 120
 	 * @since 1.0.0
121
-     * @since 1.5.1 Declare function public.
121
+	 * @since 1.5.1 Declare function public.
122
+	 *
123
+	 * @global object $post The current post object.
122 124
 	 *
123
-     * @global object $post The current post object.
124
-     *
125 125
 	 * @param array $args     Widget arguments.
126 126
 	 * @param array $instance Saved values from database.
127 127
 	 */
128
-    public function widget($args, $instance)
129
-    {
130
-
131
-        if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
-            || geodir_is_page('detail')
133
-        ) :
134
-
135
-            extract($args, EXTR_SKIP);
136
-            /** This action is documented in geodirectory_shortcodes.php */
137
-            $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
-            /** This action is documented in geodirectory_shortcodes.php */
139
-            $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
-            /** This action is documented in geodirectory_shortcodes.php */
141
-            $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
-            /** This action is documented in geodirectory_shortcodes.php */
143
-            $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
-            /** This action is documented in geodirectory_shortcodes.php */
145
-            $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
-            /**
147
-             * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
-             *
149
-             * @since 1.0.0
150
-             * @param bool $sticky True if should be sticky, false if not
151
-             */
152
-            $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
-            /** This action is documented in geodirectory_shortcodes.php */
154
-            $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
-            $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
128
+	public function widget($args, $instance)
129
+	{
130
+
131
+		if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
132
+			|| geodir_is_page('detail')
133
+		) :
134
+
135
+			extract($args, EXTR_SKIP);
136
+			/** This action is documented in geodirectory_shortcodes.php */
137
+			$width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
138
+			/** This action is documented in geodirectory_shortcodes.php */
139
+			$height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
140
+			/** This action is documented in geodirectory_shortcodes.php */
141
+			$maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
142
+			/** This action is documented in geodirectory_shortcodes.php */
143
+			$zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
144
+			/** This action is documented in geodirectory_shortcodes.php */
145
+			$autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
146
+			/**
147
+			 * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page).
148
+			 *
149
+			 * @since 1.0.0
150
+			 * @param bool $sticky True if should be sticky, false if not
151
+			 */
152
+			$sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
153
+			/** This action is documented in geodirectory_shortcodes.php */
154
+			$scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
155
+			$showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
156 156
 			
157 157
 			/**
158
-             * Filter the listing map should to be displayed or not.
159
-             *
160
-             * @since 1.4.6
158
+			 * Filter the listing map should to be displayed or not.
161 159
 			 *
162
-             * @param bool $display true if map should be displayed, false if not.
163
-             */
160
+			 * @since 1.4.6
161
+			 *
162
+			 * @param bool $display true if map should be displayed, false if not.
163
+			 */
164 164
 			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165 165
 			if ( !$show_map ) {
166 166
 				return;
167 167
 			}
168 168
 
169
-            $map_args = array();
170
-            $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
-            $map_args['width'] = $width;
172
-            $map_args['height'] = $height;
173
-
174
-            $map_args['scrollwheel'] = $scrollwheel;
175
-            $map_args['showall'] = $showall;
176
-            $map_args['child_collapse'] = '0';
177
-            $map_args['sticky'] = $sticky;
178
-            $map_args['enable_cat_filters'] = false;
179
-            $map_args['enable_text_search'] = false;
180
-            $map_args['enable_post_type_filters'] = false;
181
-            $map_args['enable_location_filters'] = false;
182
-            $map_args['enable_jason_on_load'] = true;
169
+			$map_args = array();
170
+			$map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
171
+			$map_args['width'] = $width;
172
+			$map_args['height'] = $height;
173
+
174
+			$map_args['scrollwheel'] = $scrollwheel;
175
+			$map_args['showall'] = $showall;
176
+			$map_args['child_collapse'] = '0';
177
+			$map_args['sticky'] = $sticky;
178
+			$map_args['enable_cat_filters'] = false;
179
+			$map_args['enable_text_search'] = false;
180
+			$map_args['enable_post_type_filters'] = false;
181
+			$map_args['enable_location_filters'] = false;
182
+			$map_args['enable_jason_on_load'] = true;
183 183
 			
184
-            if (is_single()) {
184
+			if (is_single()) {
185 185
 
186
-                global $post;
187
-                $map_default_lat = $address_latitude = $post->post_latitude;
188
-                $map_default_lng = $address_longitude = $post->post_longitude;
189
-                $mapview = $post->post_mapview;
190
-                $mapzoom = $post->post_mapzoom;
191
-                $map_args['map_class_name'] = 'geodir-map-listing-page-single';
186
+				global $post;
187
+				$map_default_lat = $address_latitude = $post->post_latitude;
188
+				$map_default_lng = $address_longitude = $post->post_longitude;
189
+				$mapview = $post->post_mapview;
190
+				$mapzoom = $post->post_mapzoom;
191
+				$map_args['map_class_name'] = 'geodir-map-listing-page-single';
192 192
 
193
-            } else {
194
-                $default_location = geodir_get_default_location();
193
+			} else {
194
+				$default_location = geodir_get_default_location();
195 195
 
196
-                $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
-                $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
-                $map_args['map_class_name'] = 'geodir-map-listing-page';
199
-                $mapview = $maptype;
196
+				$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
197
+				$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
198
+				$map_args['map_class_name'] = 'geodir-map-listing-page';
199
+				$mapview = $maptype;
200 200
 
201 201
 				if ( geodir_is_page( 'search' ) ) {
202 202
 					$map_default_lat = '';
@@ -213,83 +213,83 @@  discard block
 block discarded – undo
213 213
 						}
214 214
 					}
215 215
 				}
216
-            }
217
-
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
219
-
220
-            // Set default map options
221
-            $map_args['ajax_url'] = geodir_get_ajax_url();
222
-            $map_args['latitude'] = $map_default_lat;
223
-            $map_args['longitude'] = $map_default_lng;
224
-            $map_args['zoom'] = $zoom;
225
-            //$map_args['scrollwheel'] = true;
226
-            $map_args['scrollwheel'] = $scrollwheel;
227
-            $map_args['showall'] = $showall;
228
-            $map_args['streetViewControl'] = true;
229
-            $map_args['maptype'] = $maptype;
230
-            $map_args['showPreview'] = '0';
231
-            $map_args['maxZoom'] = 21;
232
-            $map_args['autozoom'] = $autozoom;
233
-            $map_args['bubble_size'] = 'small';
216
+			}
217
+
218
+			if (empty($mapzoom)) $mapzoom = $zoom;
219
+
220
+			// Set default map options
221
+			$map_args['ajax_url'] = geodir_get_ajax_url();
222
+			$map_args['latitude'] = $map_default_lat;
223
+			$map_args['longitude'] = $map_default_lng;
224
+			$map_args['zoom'] = $zoom;
225
+			//$map_args['scrollwheel'] = true;
226
+			$map_args['scrollwheel'] = $scrollwheel;
227
+			$map_args['showall'] = $showall;
228
+			$map_args['streetViewControl'] = true;
229
+			$map_args['maptype'] = $maptype;
230
+			$map_args['showPreview'] = '0';
231
+			$map_args['maxZoom'] = 21;
232
+			$map_args['autozoom'] = $autozoom;
233
+			$map_args['bubble_size'] = 'small';
234 234
             
235
-            $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
235
+			$map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
236 236
 
237
-            echo $before_widget;
238
-            geodir_draw_map($map_args);
239
-            echo $after_widget;
237
+			echo $before_widget;
238
+			geodir_draw_map($map_args);
239
+			echo $after_widget;
240 240
 
241
-        endif;
242
-    }
241
+		endif;
242
+	}
243 243
 
244 244
 	/**
245 245
 	 * Sanitize listing page map widget form values as they are saved.
246 246
 	 *
247 247
 	 * @since 1.0.0
248
-     * @since 1.5.1 Declare function public.
248
+	 * @since 1.5.1 Declare function public.
249 249
 	 *
250 250
 	 * @param array $new_instance Values just sent to be saved.
251 251
 	 * @param array $old_instance Previously saved values from database.
252 252
 	 *
253 253
 	 * @return array Updated safe values to be saved.
254 254
 	 */
255
-    public function update($new_instance, $old_instance) {
256
-        //save the widget
257
-        $instance = $old_instance;
258
-        $instance['width'] = strip_tags($new_instance['width']);
259
-        $instance['heigh'] = ($new_instance['heigh']);
260
-        $instance['maptype'] = ($new_instance['maptype']);
261
-        $instance['zoom'] = ($new_instance['zoom']);
262
-        $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
-        $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
-        $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
-        $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
-        $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
-
268
-        return $instance;
269
-    }
255
+	public function update($new_instance, $old_instance) {
256
+		//save the widget
257
+		$instance = $old_instance;
258
+		$instance['width'] = strip_tags($new_instance['width']);
259
+		$instance['heigh'] = ($new_instance['heigh']);
260
+		$instance['maptype'] = ($new_instance['maptype']);
261
+		$instance['zoom'] = ($new_instance['zoom']);
262
+		$instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : '';
263
+		$instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : '';
264
+		$instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : '';
265
+		$instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : '';
266
+		$instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
267
+
268
+		return $instance;
269
+	}
270 270
 
271 271
 	/**
272 272
 	 * Back-end listing page map widget settings form.
273 273
 	 *
274 274
 	 * @since 1.0.0
275
-     * @since 1.5.1 Declare function public.
275
+	 * @since 1.5.1 Declare function public.
276 276
 	 *
277 277
 	 * @param array $instance Previously saved values from database.
278 278
 	 */
279
-    public function form($instance) {
280
-        // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
279
+	public function form($instance) {
280
+		// widget form in backend
281
+		$instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283
-        $width = strip_tags($instance['width']);
284
-        $heigh = strip_tags($instance['heigh']);
285
-        $maptype = strip_tags($instance['maptype']);
286
-        $zoom = strip_tags($instance['zoom']);
287
-        $autozoom = strip_tags($instance['autozoom']);
288
-        $sticky = strip_tags($instance['sticky']);
289
-        $scrollwheel = strip_tags($instance['scrollwheel']);
290
-        $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
292
-        ?>
283
+		$width = strip_tags($instance['width']);
284
+		$heigh = strip_tags($instance['heigh']);
285
+		$maptype = strip_tags($instance['maptype']);
286
+		$zoom = strip_tags($instance['zoom']);
287
+		$autozoom = strip_tags($instance['autozoom']);
288
+		$sticky = strip_tags($instance['sticky']);
289
+		$scrollwheel = strip_tags($instance['scrollwheel']);
290
+		$showall = strip_tags($instance['showall']);
291
+		$marker_cluster = (int)$instance['marker_cluster'];
292
+		?>
293 293
         <p>
294 294
             <label
295 295
                 for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
                         name="<?php echo $this->get_field_name('maptype'); ?>">
319 319
 
320 320
                     <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
321
-                        echo 'selected="selected"';
322
-                    } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
321
+						echo 'selected="selected"';
322
+					} ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
323 323
                     <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
324
-                        echo 'selected="selected"';
325
-                    } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
324
+						echo 'selected="selected"';
325
+					} ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327
-                        echo 'selected="selected"';
328
-                    } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
327
+						echo 'selected="selected"';
328
+					} ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329 329
 					<option <?php selected($maptype, 'TERRAIN');?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
         </p>
334 334
 
335 335
         <?php
336
-        $map_zoom_level = geodir_map_zoom_level();
337
-        ?>
336
+		$map_zoom_level = geodir_map_zoom_level();
337
+		?>
338 338
 
339 339
         <p>
340 340
             <label
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
                 <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
345 345
                         name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
346 346
 
347
-                    foreach ($map_zoom_level as $level) {
348
-                        $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
347
+					foreach ($map_zoom_level as $level) {
348
+						$selected = '';
349
+						if ($level == $zoom)
350
+							$selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+						echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 353
 
354
-                    } ?>
354
+					} ?>
355 355
 
356 356
                 </select>
357 357
 
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
                 for="<?php echo $this->get_field_id('autozoom'); ?>">
364 364
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
365 365
                        name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
366
-                    echo 'checked="checked"';
367
-                } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
366
+					echo 'checked="checked"';
367
+				} ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
368 368
         </p>
369 369
 
370 370
         <p>
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
                 for="<?php echo $this->get_field_id('sticky'); ?>">
373 373
                 <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
374 374
                        name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
375
-                    echo 'checked="checked"';
376
-                } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
375
+					echo 'checked="checked"';
376
+				} ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
377 377
             </label>
378 378
         </p>
379 379
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     </p> -->
400 400
 
401 401
     <?php
402
-    }
402
+	}
403 403
 } // class geodir_map_listingpage
404 404
 
405 405
 register_widget('geodir_map_listingpage');
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
          * @param string $post->marker_json JSON representation of the post marker info.
46 46
          * @param object $post The post object.
47 47
          */
48
-        $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
48
+        $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
49 49
     }
50 50
 
51 51
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $json_content = substr(implode(',', $cat_content_info), 1);
74 74
         $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
75 75
         $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08
76
-        $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
76
+        $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
77 77
     } else {
78 78
         $list_json = '[{"totalcount":"0"}]';
79 79
     }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 			 *
162 162
              * @param bool $display true if map should be displayed, false if not.
163 163
              */
164
-			$show_map = apply_filters( 'geodir_show_map_listing', $display = true );
165
-			if ( !$show_map ) {
164
+			$show_map = apply_filters('geodir_show_map_listing', $display = true);
165
+			if (!$show_map) {
166 166
 				return;
167 167
 			}
168 168
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
                 $map_args['map_class_name'] = 'geodir-map-listing-page';
199 199
                 $mapview = $maptype;
200 200
 
201
-				if ( geodir_is_page( 'search' ) ) {
201
+				if (geodir_is_page('search')) {
202 202
 					$map_default_lat = '';
203 203
 					$map_default_lng = '';
204
-					if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) {
205
-						$map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] );
206
-						$map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] );
204
+					if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) {
205
+						$map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']);
206
+						$map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']);
207 207
 					}
208
-					if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) {
209
-						$location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] );
210
-						if ( ! empty( $location ) ) {
208
+					if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) {
209
+						$location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']);
210
+						if (!empty($location)) {
211 211
 							$map_default_lat = $location->city_latitude;
212 212
 							$map_default_lng = $location->city_longitude;
213 213
 						}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
     public function form($instance) {
280 280
         // widget form in backend
281
-        $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
281
+        $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
282 282
         
283 283
         $width = strip_tags($instance['width']);
284 284
         $heigh = strip_tags($instance['heigh']);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         $sticky = strip_tags($instance['sticky']);
289 289
         $scrollwheel = strip_tags($instance['scrollwheel']);
290 290
         $showall = strip_tags($instance['showall']);
291
-        $marker_cluster = (int)$instance['marker_cluster'];
291
+        $marker_cluster = (int) $instance['marker_cluster'];
292 292
         ?>
293 293
         <p>
294 294
             <label
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                     <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
327 327
                         echo 'selected="selected"';
328 328
                     } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
329
-					<option <?php selected($maptype, 'TERRAIN');?> 
329
+					<option <?php selected($maptype, 'TERRAIN'); ?> 
330 330
 							value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
331 331
                 </select>
332 332
             </label>
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                         if ($level == $zoom)
350 350
                             $selected = 'selected="selected"';
351 351
 
352
-                        echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
352
+                        echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>';
353 353
 
354 354
                     } ?>
355 355
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                 for="<?php echo $this->get_field_id('scrollwheel'); ?>">
383 383
                 <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
384 384
                        name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
385
-                       <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
385
+                       <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
386 386
             </label>
387 387
         </p>
388 388
         <?php if (defined('GDCLUSTER_VERSION')) { ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -215,7 +215,9 @@  discard block
 block discarded – undo
215 215
 				}
216 216
             }
217 217
 
218
-            if (empty($mapzoom)) $mapzoom = $zoom;
218
+            if (empty($mapzoom)) {
219
+            	$mapzoom = $zoom;
220
+            }
219 221
 
220 222
             // Set default map options
221 223
             $map_args['ajax_url'] = geodir_get_ajax_url();
@@ -346,8 +348,9 @@  discard block
 block discarded – undo
346 348
 
347 349
                     foreach ($map_zoom_level as $level) {
348 350
                         $selected = '';
349
-                        if ($level == $zoom)
350
-                            $selected = 'selected="selected"';
351
+                        if ($level == $zoom) {
352
+                                                    $selected = 'selected="selected"';
353
+                        }
351 354
 
352 355
                         echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>';
353 356
 
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-exporters.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -316,6 +316,10 @@
 block discarded – undo
316 316
 		return $personal_data;
317 317
 	}
318 318
 
319
+	/**
320
+	 * @param string $email_address
321
+	 * @param integer $page
322
+	 */
319 323
 	public static function posts_by_author( $email_address, $post_type, $page ) {
320 324
 		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
321 325
 			return array();
Please login to merge, or discard this patch.
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy_Exporters Class.
@@ -23,32 +23,32 @@  discard block
 block discarded – undo
23 23
 	 * @param int    $page  Page.
24 24
 	 * @return array An array of personal data in name value pairs
25 25
 	 */
26
-	public static function post_data_exporter( $email_address, $page ) {
27
-		$post_type 		= GeoDir_Privacy::exporter_post_type();
26
+	public static function post_data_exporter($email_address, $page) {
27
+		$post_type = GeoDir_Privacy::exporter_post_type();
28 28
 
29 29
 		$done           = false;
30 30
 		$page           = (int) $page;
31 31
 		$data_to_export = array();
32 32
 
33
-		$posts 			= self::posts_by_author( $email_address, $post_type, $page );
33
+		$posts = self::posts_by_author($email_address, $post_type, $page);
34 34
 
35
-		if ( 0 < count( $posts ) ) {
36
-			$obj_post_type = get_post_type_object( $post_type );
35
+		if (0 < count($posts)) {
36
+			$obj_post_type = get_post_type_object($post_type);
37 37
 
38
-			foreach ( $posts as $post_ID ) {
39
-				$gd_post = geodir_get_post_info( $post_ID );
40
-				if ( empty( $gd_post ) ) {
38
+			foreach ($posts as $post_ID) {
39
+				$gd_post = geodir_get_post_info($post_ID);
40
+				if (empty($gd_post)) {
41 41
 					continue;
42 42
 				}
43 43
 
44 44
 				$data_to_export[] = array(
45
-					'group_id'    => 'geodirectory-post-' . $post_type,
46
-					'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ),
47
-					'item_id'     => 'post-' . $post_ID,
48
-					'data'        => self::get_post_personal_data( $gd_post ),
45
+					'group_id'    => 'geodirectory-post-'.$post_type,
46
+					'group_label' => __($obj_post_type->labels->name, 'geodirectory'),
47
+					'item_id'     => 'post-'.$post_ID,
48
+					'data'        => self::get_post_personal_data($gd_post),
49 49
 				);
50 50
 			}
51
-			$done = 10 > count( $posts );
51
+			$done = 10 > count($posts);
52 52
 		} else {
53 53
 			$done = true;
54 54
 		}
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 	 * @param WP_Post $gd_post The post object.
67 67
 	 * @return array
68 68
 	 */
69
-	protected static function get_post_personal_data( $gd_post ) {
69
+	protected static function get_post_personal_data($gd_post) {
70 70
 		$post_categories = array();
71 71
 		$post_tags = array();
72 72
 		$default_category = '';
73 73
 
74
-		$cat_taxonomy = $gd_post->post_type . 'category';
75
-		$tag_taxonomy = $gd_post->post_type . '_tags';
74
+		$cat_taxonomy = $gd_post->post_type.'category';
75
+		$tag_taxonomy = $gd_post->post_type.'_tags';
76 76
 
77
-		$post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) );
78
-		if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
79
-			foreach ( $post_terms as $term ) {
80
-				if ( $term->taxonomy == $cat_taxonomy ) {
77
+		$post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy));
78
+		if (!empty($post_terms) && !is_wp_error($post_terms)) {
79
+			foreach ($post_terms as $term) {
80
+				if ($term->taxonomy == $cat_taxonomy) {
81 81
 					$post_categories[] = $term->name;
82 82
 				} else {
83 83
 					$post_tags[] = $term->name;
84 84
 				}
85 85
 
86
-				if ( $gd_post->default_category == $term->term_id ) {
86
+				if ($gd_post->default_category == $term->term_id) {
87 87
 					$default_category = $term->name;
88 88
 				}
89 89
 			}
@@ -91,189 +91,189 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$personal_data = array();
93 93
 		$personal_data[] = array(
94
-			'name'  => __( 'Post ID', 'geodirectory' ),
94
+			'name'  => __('Post ID', 'geodirectory'),
95 95
 			'value' => $gd_post->ID,
96 96
 		);
97 97
 		$personal_data[] = array(
98
-			'name'  => __( 'Post Title', 'geodirectory' ),
98
+			'name'  => __('Post Title', 'geodirectory'),
99 99
 			'value' => $gd_post->post_title,
100 100
 		);
101 101
 		$personal_data[] = array(
102
-			'name'  => __( 'Post Description', 'geodirectory' ),
102
+			'name'  => __('Post Description', 'geodirectory'),
103 103
 			'value' => $gd_post->post_content,
104 104
 		);
105 105
 		$personal_data[] = array(
106
-			'name'  => __( 'Post Date', 'geodirectory' ),
106
+			'name'  => __('Post Date', 'geodirectory'),
107 107
 			'value' => $gd_post->post_date,
108 108
 		);
109
-		if ( ! empty( $gd_post->post_modified ) && $gd_post->post_modified != '0000-00-00 00:00:00' ) {
109
+		if (!empty($gd_post->post_modified) && $gd_post->post_modified != '0000-00-00 00:00:00') {
110 110
 		$personal_data[] = array(
111
-			'name'  => __( 'Post Modified Date', 'geodirectory' ),
111
+			'name'  => __('Post Modified Date', 'geodirectory'),
112 112
 			'value' => $gd_post->post_modified,
113 113
 		);
114 114
 		}
115 115
 		$personal_data[] = array(
116
-			'name'  => __( 'Post Status', 'geodirectory' ),
116
+			'name'  => __('Post Status', 'geodirectory'),
117 117
 			'value' => $gd_post->post_status,
118 118
 		);
119
-		if ( ! empty( $gd_post->submit_ip ) ) {
119
+		if (!empty($gd_post->submit_ip)) {
120 120
 			$personal_data[] = array(
121
-				'name'  => __( 'Submit IP', 'geodirectory' ),
121
+				'name'  => __('Submit IP', 'geodirectory'),
122 122
 				'value' => $gd_post->submit_ip,
123 123
 			);
124 124
 		}
125 125
 		$personal_data[] = array(
126
-			'name'  => __( 'Post Categories', 'geodirectory' ),
127
-			'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ),
126
+			'name'  => __('Post Categories', 'geodirectory'),
127
+			'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''),
128 128
 		);
129
-		if ( $default_category ) {
129
+		if ($default_category) {
130 130
 			$personal_data[] = array(
131
-				'name'  => __( 'Default Category', 'geodirectory' ),
131
+				'name'  => __('Default Category', 'geodirectory'),
132 132
 				'value' => $default_category,
133 133
 			);
134 134
 		}
135
-		if ( ! empty( $post_tags ) ) {
135
+		if (!empty($post_tags)) {
136 136
 			$personal_data[] = array(
137
-				'name'  => __( 'Post Tags', 'geodirectory' ),
138
-				'value' => implode( ', ', $post_tags ),
137
+				'name'  => __('Post Tags', 'geodirectory'),
138
+				'value' => implode(', ', $post_tags),
139 139
 			);
140 140
 		}
141 141
 		$personal_data[] = array(
142
-			'name'  => __( 'Post URL', 'geodirectory' ),
143
-			'value' => get_permalink( $gd_post->ID ),
142
+			'name'  => __('Post URL', 'geodirectory'),
143
+			'value' => get_permalink($gd_post->ID),
144 144
 		);
145 145
 
146 146
 		// Post Images
147
-		$post_images = geodir_get_images( $gd_post->ID );
148
-		if ( ! empty( $post_images ) ) {
147
+		$post_images = geodir_get_images($gd_post->ID);
148
+		if (!empty($post_images)) {
149 149
 			$images = array();
150
-			foreach ( $post_images as $key => $post_image ) {
151
-				if ( ! empty( $post_image->src ) ) {
150
+			foreach ($post_images as $key => $post_image) {
151
+				if (!empty($post_image->src)) {
152 152
 					$images[] = $post_image->src;
153 153
 				}
154 154
 			}
155 155
 
156
-			if ( ! empty( $images ) ) {
156
+			if (!empty($images)) {
157 157
 				$personal_data[] = array(
158
-					'name'  => __( 'Post Images', 'geodirectory' ),
159
-					'value' => self::parse_files_value( $images ),
158
+					'name'  => __('Post Images', 'geodirectory'),
159
+					'value' => self::parse_files_value($images),
160 160
 				);
161 161
 			}
162 162
 		}
163 163
 
164 164
 		// Post Rating
165
-		$post_rating = geodir_get_post_rating( $gd_post->ID );
166
-		if ( $post_rating > 0 ) {
167
-			$post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating;
165
+		$post_rating = geodir_get_post_rating($gd_post->ID);
166
+		if ($post_rating > 0) {
167
+			$post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating;
168 168
 			$personal_data[] = array(
169
-				'name'  => __( 'Post Rating', 'geodirectory' ),
170
-				'value' => $post_rating . ' / 5',
169
+				'name'  => __('Post Rating', 'geodirectory'),
170
+				'value' => $post_rating.' / 5',
171 171
 			);
172 172
 		}
173 173
 
174 174
 		// Post Reviews
175
-		$post_reviews = geodir_get_review_count_total( $gd_post->ID );
176
-		if ( $post_reviews > 0 ) {
175
+		$post_reviews = geodir_get_review_count_total($gd_post->ID);
176
+		if ($post_reviews > 0) {
177 177
 			$personal_data[] = array(
178
-				'name'  => __( 'Post Reviews', 'geodirectory' ),
178
+				'name'  => __('Post Reviews', 'geodirectory'),
179 179
 				'value' => $post_reviews,
180 180
 			);
181 181
 		}
182 182
 
183
-		if ( ! empty( $gd_post->is_featured ) ) {
183
+		if (!empty($gd_post->is_featured)) {
184 184
 			$personal_data[] = array(
185
-				'name'  => __( 'Post Featured', 'geodirectory' ),
186
-				'value' => __( 'Yes', 'geodirectory' ),
185
+				'name'  => __('Post Featured', 'geodirectory'),
186
+				'value' => __('Yes', 'geodirectory'),
187 187
 			);
188 188
 		}
189 189
 
190
-		$custom_fields 	= geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type );
191
-		$post_fields 	= array_keys( (array) $gd_post );
190
+		$custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type);
191
+		$post_fields = array_keys((array) $gd_post);
192 192
 
193
-		foreach ( $custom_fields as $key => $field ) {
194
-			$field_name 			= ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : '';
195
-			if ( empty( $field_name ) ) {
193
+		foreach ($custom_fields as $key => $field) {
194
+			$field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : '';
195
+			if (empty($field_name)) {
196 196
 				continue;
197 197
 			}
198 198
 
199
-			$field 					= stripslashes_deep( $field );
199
+			$field = stripslashes_deep($field);
200 200
 
201
-			$extra_fields 			= ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array();
201
+			$extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array();
202 202
 			$data_type              = $field['data_type'];
203 203
 			$field_type             = $field['field_type'];
204
-			$field_title			= $field['site_title'];
205
-			if ( $field_name == 'post' ) {
204
+			$field_title = $field['site_title'];
205
+			if ($field_name == 'post') {
206 206
 				$field_name = 'post_address';
207 207
 			}
208 208
 
209
-			if ( ! in_array( $field_name, $post_fields ) ) {
209
+			if (!in_array($field_name, $post_fields)) {
210 210
 				continue;
211 211
 			}
212 212
 
213 213
 			$name = $field_title;
214 214
 			$value = '';
215
-			switch ( $field_type ) {
215
+			switch ($field_type) {
216 216
 				case 'address':
217
-					$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true;
218
-					if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) {
217
+					$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true;
218
+					if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) {
219 219
 						$personal_data[] = array(
220
-							'name'  => __( 'Post Address', 'geodirectory' ),
220
+							'name'  => __('Post Address', 'geodirectory'),
221 221
 							'value' => $gd_post->post_address,
222 222
 						);
223 223
 						$personal_data[] = array(
224
-							'name'  => __( 'Post City', 'geodirectory' ),
224
+							'name'  => __('Post City', 'geodirectory'),
225 225
 							'value' => $gd_post->post_city,
226 226
 						);
227 227
 						$personal_data[] = array(
228
-							'name'  => __( 'Post Region', 'geodirectory' ),
228
+							'name'  => __('Post Region', 'geodirectory'),
229 229
 							'value' => $gd_post->post_region,
230 230
 						);
231 231
 						$personal_data[] = array(
232
-							'name'  => __( 'Post Country', 'geodirectory' ),
232
+							'name'  => __('Post Country', 'geodirectory'),
233 233
 							'value' => $gd_post->post_country,
234 234
 						);
235 235
 						$personal_data[] = array(
236
-							'name'  => __( 'Post Zip', 'geodirectory' ),
236
+							'name'  => __('Post Zip', 'geodirectory'),
237 237
 							'value' => $gd_post->post_zip,
238 238
 						);
239 239
 						$personal_data[] = array(
240
-							'name'  => __( 'Post Latitude', 'geodirectory' ),
240
+							'name'  => __('Post Latitude', 'geodirectory'),
241 241
 							'value' => $gd_post->post_latitude,
242 242
 						);
243 243
 						$personal_data[] = array(
244
-							'name'  => __( 'Post Longitude', 'geodirectory' ),
244
+							'name'  => __('Post Longitude', 'geodirectory'),
245 245
 							'value' => $gd_post->post_longitude,
246 246
 						);
247
-						if ( ! empty( $gd_post->post_neighbourhood ) ) {
247
+						if (!empty($gd_post->post_neighbourhood)) {
248 248
 							$personal_data[] = array(
249
-								'name'  => __( 'Post Neighbourhood', 'geodirectory' ),
249
+								'name'  => __('Post Neighbourhood', 'geodirectory'),
250 250
 								'value' => $gd_post->post_neighbourhood,
251 251
 							);
252 252
 						}
253 253
 					}
254 254
 				break;
255 255
 				case 'checkbox':
256
-					if ( ! empty( $gd_post->{$field_name} ) ) {
257
-						$value = __( 'Yes', 'geodirectory' );
256
+					if (!empty($gd_post->{$field_name} )) {
257
+						$value = __('Yes', 'geodirectory');
258 258
 					} else {
259
-						$value = __( 'No', 'geodirectory' );
259
+						$value = __('No', 'geodirectory');
260 260
 					}
261 261
 					break;
262 262
 				case 'datepicker':
263 263
 					$value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : '';
264 264
 					break;
265 265
 				case 'radio':
266
-					if ( $gd_post->{$field_name} !== '' ) {
267
-						if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
268
-							$value = __( 'No', 'geodirectory' );
269
-						} else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
270
-							$value = __( 'Yes', 'geodirectory' );
266
+					if ($gd_post->{$field_name} !== '') {
267
+						if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
268
+							$value = __('No', 'geodirectory');
269
+						} else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
270
+							$value = __('Yes', 'geodirectory');
271 271
 						} else {
272
-							if ( !empty( $field['option_values'] ) ) {
273
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
274
-								if ( ! empty( $cf_option_values ) ) {
275
-									foreach ( $cf_option_values as $cf_option_value ) {
276
-										if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
272
+							if (!empty($field['option_values'])) {
273
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
274
+								if (!empty($cf_option_values)) {
275
+									foreach ($cf_option_values as $cf_option_value) {
276
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
277 277
 											$value = $cf_option_value['label'];
278 278
 										}
279 279
 									}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 					}
284 284
 					break;
285 285
 				case 'select':
286
-					$value = __( $gd_post->{$field_name}, 'geodirectory');
287
-					if ( !empty( $field['option_values'] ) ) {
288
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
289
-						if ( ! empty( $cf_option_values ) ) {
290
-							foreach ( $cf_option_values as $cf_option_value ) {
291
-								if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
286
+					$value = __($gd_post->{$field_name}, 'geodirectory');
287
+					if (!empty($field['option_values'])) {
288
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
289
+						if (!empty($cf_option_values)) {
290
+							foreach ($cf_option_values as $cf_option_value) {
291
+								if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
292 292
 									$value = $cf_option_value['label'];
293 293
 								}
294 294
 							}
@@ -296,23 +296,23 @@  discard block
 block discarded – undo
296 296
 					}
297 297
 					break;
298 298
 				case 'multiselect':
299
-					$field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) );
300
-					if ( is_array( $field_values ) ) {
301
-						$field_values = array_map( 'trim', $field_values );
299
+					$field_values = explode(',', trim($gd_post->{$field_name}, ","));
300
+					if (is_array($field_values)) {
301
+						$field_values = array_map('trim', $field_values);
302 302
 					}
303 303
 					$values = array();
304
-					if ( ! empty( $field['option_values'] ) ) {
305
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
304
+					if (!empty($field['option_values'])) {
305
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
306 306
 
307
-						if ( ! empty( $cf_option_values ) ) {
308
-							foreach ( $cf_option_values as $cf_option_value ) {
309
-								if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) {
307
+						if (!empty($cf_option_values)) {
308
+							foreach ($cf_option_values as $cf_option_value) {
309
+								if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
310 310
 									$values[] = $cf_option_value['label'];
311 311
 								}
312 312
 							}
313 313
 						}
314 314
 					}
315
-					$value = ! empty( $values ) ? implode( ', ', $values ) : '';
315
+					$value = !empty($values) ? implode(', ', $values) : '';
316 316
 					break;
317 317
 				case 'time':
318 318
 					$value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : '';
@@ -326,70 +326,70 @@  discard block
 block discarded – undo
326 326
 					$value = $gd_post->{$field_name} ? $gd_post->{$field_name} : '';
327 327
 					break;
328 328
 				case 'file':
329
-					$files = explode( ",", $gd_post->{$field_name} );
330
-					if ( ! empty( $files ) ) {
331
-						$allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
329
+					$files = explode(",", $gd_post->{$field_name} );
330
+					if (!empty($files)) {
331
+						$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
332 332
 
333 333
 						$file_urls = array();
334
-						foreach ( $files as $file ) {
335
-							if ( ! empty( $file ) ) {
336
-								$image_name_arr = explode( '/', $file );
337
-								$curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2];
334
+						foreach ($files as $file) {
335
+							if (!empty($file)) {
336
+								$image_name_arr = explode('/', $file);
337
+								$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
338 338
 								$filename = end($image_name_arr);
339 339
 								$img_name_arr = explode('.', $filename);
340 340
 
341
-								$arr_file_type = wp_check_filetype( $filename );
342
-								if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) {
341
+								$arr_file_type = wp_check_filetype($filename);
342
+								if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
343 343
 									continue;
344 344
 								}
345 345
 
346 346
 								$uploaded_file_type = $arr_file_type['type'];
347 347
 								$uploaded_file_ext = $arr_file_type['ext'];
348 348
 
349
-								if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) {
349
+								if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
350 350
 									continue; // Invalid file type.
351 351
 								}
352
-								$image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' );
353
-								$audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' );
352
+								$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
353
+								$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
354 354
 
355 355
 								// If the uploaded file is image
356
-								if ( in_array( $uploaded_file_type, $image_file_types ) ) {
356
+								if (in_array($uploaded_file_type, $image_file_types)) {
357 357
 									$file_urls[] = $file;
358 358
 								}
359 359
 							}
360 360
 						}
361
-						$value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : '';
361
+						$value = !empty($file_urls) ? self::parse_files_value($file_urls) : '';
362 362
 					}
363 363
 					break;
364 364
 			}
365 365
 
366
-			if ( ! empty( $name ) && $value !== '' ) {
366
+			if (!empty($name) && $value !== '') {
367 367
 				$personal_data[] = array(
368
-					'name'  => __( $name, 'geodirectory' ),
368
+					'name'  => __($name, 'geodirectory'),
369 369
 					'value' => $value,
370 370
 				);
371 371
 			}
372 372
 		}
373 373
 
374
-		if ( ! empty( $gd_post->geodir_link_business ) && ( $post_type = get_post_type( (int)$gd_post->geodir_link_business ) ) ) {
374
+		if (!empty($gd_post->geodir_link_business) && ($post_type = get_post_type((int) $gd_post->geodir_link_business))) {
375 375
 			$personal_data[] = array(
376
-				'name'  => __( 'Link Business Title', 'geodirectory' ),
377
-				'value' => get_the_title( (int)$gd_post->geodir_link_business ),
376
+				'name'  => __('Link Business Title', 'geodirectory'),
377
+				'value' => get_the_title((int) $gd_post->geodir_link_business),
378 378
 			);
379 379
 			$personal_data[] = array(
380
-				'name'  => __( 'Link Business URL', 'geodirectory' ),
381
-				'value' => get_permalink( (int)$gd_post->geodir_link_business ),
380
+				'name'  => __('Link Business URL', 'geodirectory'),
381
+				'value' => get_permalink((int) $gd_post->geodir_link_business),
382 382
 			);
383 383
 		}
384
-		if ( defined( 'GEODIR_FRANCHISE_VERSION' ) ) {
385
-			if ( ! empty( $gd_post->franchise ) && ( $post_type = get_post_type( (int)$gd_post->franchise ) ) ) {
384
+		if (defined('GEODIR_FRANCHISE_VERSION')) {
385
+			if (!empty($gd_post->franchise) && ($post_type = get_post_type((int) $gd_post->franchise))) {
386 386
 				$personal_data[] = array(
387
-					'name'  => __( 'Main Listing Title', 'geodirectory' ),
388
-					'value' => get_the_title( (int)$gd_post->franchise ),
387
+					'name'  => __('Main Listing Title', 'geodirectory'),
388
+					'value' => get_the_title((int) $gd_post->franchise),
389 389
 				);
390 390
 				$personal_data[] = array(
391
-					'name'  => __( 'Main Listing URL', 'geodirectory' ),
392
-					'value' => get_permalink( (int)$gd_post->franchise ),
391
+					'name'  => __('Main Listing URL', 'geodirectory'),
392
+					'value' => get_permalink((int) $gd_post->franchise),
393 393
 				);
394 394
 			}
395 395
 		}
@@ -401,28 +401,28 @@  discard block
 block discarded – undo
401 401
 		 * @param array    $personal_data Array of name value pairs to expose in the export.
402 402
 		 * @param WP_Post $gd_post The post object.
403 403
 		 */
404
-		$personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post );
404
+		$personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post);
405 405
 
406 406
 		return $personal_data;
407 407
 	}
408 408
 
409
-	public static function posts_by_author( $email_address, $post_type, $page ) {
410
-		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
409
+	public static function posts_by_author($email_address, $post_type, $page) {
410
+		if (empty($email_address) || empty($post_type) || empty($page)) {
411 411
 			return array();
412 412
 		}
413 413
 
414
-		$user = get_user_by( 'email', $email_address );
415
-		if ( empty( $user ) ) {
414
+		$user = get_user_by('email', $email_address);
415
+		if (empty($user)) {
416 416
 			return array();
417 417
 		}
418 418
 
419
-		$statuses = array_keys( get_post_statuses() );
419
+		$statuses = array_keys(get_post_statuses());
420 420
 		$skip_statuses = geodir_imex_export_skip_statuses();
421
-		if ( ! empty( $skip_statuses ) ) {
422
-			$statuses = array_diff( $statuses, $skip_statuses );
421
+		if (!empty($skip_statuses)) {
422
+			$statuses = array_diff($statuses, $skip_statuses);
423 423
 		}
424 424
 
425
-		$query_args    = array(
425
+		$query_args = array(
426 426
 			'post_type'			=> $post_type,
427 427
 			'post_status'		=> $statuses,
428 428
 			'fields'			=> 'ids',
@@ -433,66 +433,66 @@  discard block
 block discarded – undo
433 433
 			'order'	   			=> 'ASC'
434 434
 		);
435 435
 
436
-		$query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page );
436
+		$query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page);
437 437
 
438
-		$posts = get_posts( $query_args );
438
+		$posts = get_posts($query_args);
439 439
 
440
-		return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page );
440
+		return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page);
441 441
 	}
442 442
 
443
-	public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) {
443
+	public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) {
444 444
 		global $wpdb;
445 445
 
446 446
 		$exporter_key = GeoDir_Privacy::personal_data_exporter_key();
447 447
 
448
-		if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) {
449
-			foreach ( $response['data'] as $key => $item ) {
450
-				$comment_id = str_replace( 'comment-', '', $item['item_id'] );
448
+		if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) {
449
+			foreach ($response['data'] as $key => $item) {
450
+				$comment_id = str_replace('comment-', '', $item['item_id']);
451 451
 				$data = $item['data'];
452 452
 
453
-				$review = geodir_get_review( $comment_id );
454
-				if ( ! empty( $review ) ) {
455
-					if ( ! empty( $review->overall_rating ) ) {
453
+				$review = geodir_get_review($comment_id);
454
+				if (!empty($review)) {
455
+					if (!empty($review->overall_rating)) {
456 456
 						$data[] = array(
457
-							'name'  => __( 'Rating (Overall)', 'geodirectory' ),
458
-							'value' => (float)$review->overall_rating . ' / 5',
457
+							'name'  => __('Rating (Overall)', 'geodirectory'),
458
+							'value' => (float) $review->overall_rating.' / 5',
459 459
 						);
460 460
 					}
461
-					if ( ! empty( $review->post_city ) ) {
461
+					if (!empty($review->post_city)) {
462 462
 						$data[] = array(
463
-							'name'  => __( 'Review City', 'geodirectory' ),
463
+							'name'  => __('Review City', 'geodirectory'),
464 464
 							'value' => $review->post_city,
465 465
 						);
466 466
 					}
467
-					if ( ! empty( $review->post_region ) ) {
467
+					if (!empty($review->post_region)) {
468 468
 						$data[] = array(
469
-							'name'  => __( 'Review Region', 'geodirectory' ),
469
+							'name'  => __('Review Region', 'geodirectory'),
470 470
 							'value' => $review->post_region,
471 471
 						);
472 472
 					}
473
-					if ( ! empty( $review->post_country ) ) {
473
+					if (!empty($review->post_country)) {
474 474
 						$data[] = array(
475
-							'name'  => __( 'Review Country', 'geodirectory' ),
475
+							'name'  => __('Review Country', 'geodirectory'),
476 476
 							'value' => $review->post_country,
477 477
 						);
478 478
 					}
479
-					if ( ! empty( $review->post_latitude ) ) {
479
+					if (!empty($review->post_latitude)) {
480 480
 						$data[] = array(
481
-							'name'  => __( 'Review Latitude', 'geodirectory' ),
481
+							'name'  => __('Review Latitude', 'geodirectory'),
482 482
 							'value' => $review->post_latitude,
483 483
 						);
484 484
 					}
485
-					if ( ! empty( $review->post_longitude ) ) {
485
+					if (!empty($review->post_longitude)) {
486 486
 						$data[] = array(
487
-							'name'  => __( 'Review Longitude', 'geodirectory' ),
487
+							'name'  => __('Review Longitude', 'geodirectory'),
488 488
 							'value' => $review->post_longitude,
489 489
 						);
490 490
 					}
491 491
 
492
-					$data = apply_filters( 'geodir_privacy_export_review_data', $data, $review, $email_address );
492
+					$data = apply_filters('geodir_privacy_export_review_data', $data, $review, $email_address);
493 493
 
494
-					if ( ! empty( $data ) ) {
495
-						$response['data'][ $key ]['data'] = $data;
494
+					if (!empty($data)) {
495
+						$response['data'][$key]['data'] = $data;
496 496
 					}
497 497
 				}
498 498
 			}
@@ -508,36 +508,36 @@  discard block
 block discarded – undo
508 508
 	 * @param int    $page  Page.
509 509
 	 * @return array An array of personal data in name value pairs
510 510
 	 */
511
-	public static function favorites_data_exporter( $email_address, $page ) {
511
+	public static function favorites_data_exporter($email_address, $page) {
512 512
 		$done           = true;
513 513
 		$page           = (int) $page;
514 514
 		$data_to_export = array();
515 515
 
516
-		$items 			= GeoDir_Privacy::favorites_by_user( $email_address, $page );
516
+		$items = GeoDir_Privacy::favorites_by_user($email_address, $page);
517 517
 
518
-		if ( 0 < count( $items ) ) {
519
-			foreach ( $items as $item ) {
520
-				$gd_post = geodir_get_post_info( $item );
521
-				if ( empty( $gd_post ) ) {
518
+		if (0 < count($items)) {
519
+			foreach ($items as $item) {
520
+				$gd_post = geodir_get_post_info($item);
521
+				if (empty($gd_post)) {
522 522
 					continue;
523 523
 				}
524 524
 
525 525
 				$data_to_export[] = array(
526 526
 					'group_id'    => 'geodirectory-post-favorites',
527
-					'group_label' => __( 'GeoDirectory Favorite Listings', 'geodirectory' ),
528
-					'item_id'     => 'gd-favorite-' . $gd_post->ID,
527
+					'group_label' => __('GeoDirectory Favorite Listings', 'geodirectory'),
528
+					'item_id'     => 'gd-favorite-'.$gd_post->ID,
529 529
 					'data'        => array(
530 530
 						array(
531
-							'name'  => __( 'Post ID', 'geodirectory' ),
531
+							'name'  => __('Post ID', 'geodirectory'),
532 532
 							'value' => $gd_post->ID,
533 533
 						),
534 534
 						array(
535
-							'name'  => __( 'Post Title', 'geodirectory' ),
535
+							'name'  => __('Post Title', 'geodirectory'),
536 536
 							'value' => $gd_post->post_title,
537 537
 						),
538 538
 						array(
539
-							'name'  => __( 'Post URL', 'geodirectory' ),
540
-							'value' => get_permalink( $gd_post->ID ),
539
+							'name'  => __('Post URL', 'geodirectory'),
540
+							'value' => get_permalink($gd_post->ID),
541 541
 						)
542 542
 					),
543 543
 				);
@@ -550,27 +550,27 @@  discard block
 block discarded – undo
550 550
 		);
551 551
 	}
552 552
 
553
-	public static function parse_files_value( $files ) {
554
-		if ( empty( $files ) ) {
553
+	public static function parse_files_value($files) {
554
+		if (empty($files)) {
555 555
 			return '';
556 556
 		}
557 557
 
558
-		if ( ! is_array( $files ) ) {
558
+		if (!is_array($files)) {
559 559
 			return $files;
560 560
 		}
561 561
 
562
-		if ( count( $files ) == 1 ) {
562
+		if (count($files) == 1) {
563 563
 			return $files[0];
564 564
 		}
565 565
 
566 566
 		$links = array();
567
-		foreach ( $files as $file ) {
568
-			if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) {
569
-				$file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>';
567
+		foreach ($files as $file) {
568
+			if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) {
569
+				$file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>';
570 570
 			}
571 571
 			$links[] = $file;
572 572
 		}
573
-		$links = ! empty( $links ) ? implode( ' <br> ', $links ) : '';
573
+		$links = !empty($links) ? implode(' <br> ', $links) : '';
574 574
 
575 575
 		return $links;
576 576
 	}
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-erasers.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -103,6 +103,10 @@
 block discarded – undo
103 103
 		);
104 104
 	}
105 105
 
106
+	/**
107
+	 * @param string $email_address
108
+	 * @param integer $page
109
+	 */
106 110
 	public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) {
107 111
 		global $wpdb;
108 112
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -159,12 +159,12 @@
 block discarded – undo
159 159
 		$messages       = array();
160 160
 
161 161
 		$site_id = '';
162
-        if ( is_multisite() ) {
163
-            $blog_id = get_current_blog_id();
164
-            if ( $blog_id && $blog_id != '1' ) {
162
+		if ( is_multisite() ) {
163
+			$blog_id = get_current_blog_id();
164
+			if ( $blog_id && $blog_id != '1' ) {
165 165
 				$site_id  = '_' . $blog_id;
166 166
 			}
167
-        }
167
+		}
168 168
 
169 169
 		if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) {
170 170
 			$messages[]    = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' );
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy_Erasers Class.
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @param  int    $page          Review page.
23 23
 	 * @return array
24 24
 	 */
25
-	public static function review_data_eraser( $email_address, $page ) {
25
+	public static function review_data_eraser($email_address, $page) {
26 26
 		global $wpdb;
27 27
 
28 28
 		$response = array(
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 			'done'           => true,
33 33
 		);
34 34
 
35
-		if ( empty( $email_address ) ) {
35
+		if (empty($email_address)) {
36 36
 			return $response;
37 37
 		}
38 38
 
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		$items_removed  = false;
41 41
 		$items_retained = false;
42 42
 
43
-		$reviews = self::reviews_by_author( $email_address, $page );
43
+		$reviews = self::reviews_by_author($email_address, $page);
44 44
 
45
-		if ( empty( $reviews ) ) {
45
+		if (empty($reviews)) {
46 46
 			return $response;
47 47
 		}
48 48
 
49
-		$messages    = array();
49
+		$messages = array();
50 50
 
51
-		foreach ( $reviews as $review ) {
51
+		foreach ($reviews as $review) {
52 52
 			$anonymized_review                         		= array();
53 53
 			$anonymized_review['user_id']               	= 0;
54
-			$anonymized_review['rating_ip']    				= wp_privacy_anonymize_data( 'ip', $review->rating_ip );
54
+			$anonymized_review['rating_ip'] = wp_privacy_anonymize_data('ip', $review->rating_ip);
55 55
 
56 56
 			$review_id = (int) $review->id;
57 57
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 			 * @param object 	 $review             Review object.
66 66
 			 * @param array      $anonymized_review  Anonymized review data.
67 67
 			 */
68
-			$anon_message = apply_filters( 'geodir_anonymize_post_review', true, $review, $anonymized_review );
68
+			$anon_message = apply_filters('geodir_anonymize_post_review', true, $review, $anonymized_review);
69 69
 
70
-			if ( true !== $anon_message ) {
71
-				if ( $anon_message && is_string( $anon_message ) ) {
72
-					$messages[] = esc_html( $anon_message );
70
+			if (true !== $anon_message) {
71
+				if ($anon_message && is_string($anon_message)) {
72
+					$messages[] = esc_html($anon_message);
73 73
 				} else {
74 74
 					/* translators: %d: Review ID */
75
-					$messages[] = sprintf( __( 'Review %d contains personal data but could not be anonymized.', 'geodirectory' ), $review_id );
75
+					$messages[] = sprintf(__('Review %d contains personal data but could not be anonymized.', 'geodirectory'), $review_id);
76 76
 				}
77 77
 
78 78
 				$items_retained = true;
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 				'id' => $review_id,
85 85
 			);
86 86
 
87
-			$updated = $wpdb->update( GEODIR_REVIEW_TABLE, $anonymized_review, $args );
87
+			$updated = $wpdb->update(GEODIR_REVIEW_TABLE, $anonymized_review, $args);
88 88
 
89
-			if ( $updated ) {
89
+			if ($updated) {
90 90
 				$items_removed = true;
91 91
 			} else {
92 92
 				$items_retained = true;
93 93
 			}
94 94
 		}
95 95
 
96
-		$done = count( $reviews ) < $number;
96
+		$done = count($reviews) < $number;
97 97
 
98 98
 		return array(
99 99
 			'items_removed'  => $items_removed,
@@ -103,29 +103,29 @@  discard block
 block discarded – undo
103 103
 		);
104 104
 	}
105 105
 
106
-	public static function reviews_by_author( $email_address, $page, $posts_per_page = 10 ) {
106
+	public static function reviews_by_author($email_address, $page, $posts_per_page = 10) {
107 107
 		global $wpdb;
108 108
 
109
-		if ( empty( $email_address ) || empty( $page ) ) {
109
+		if (empty($email_address) || empty($page)) {
110 110
 			return array();
111 111
 		}
112 112
 
113
-		$user = get_user_by( 'email', $email_address );
114
-		if ( empty( $user ) ) {
113
+		$user = get_user_by('email', $email_address);
114
+		if (empty($user)) {
115 115
 			return array();
116 116
 		}
117 117
 
118
-		if ( absint( $page ) < 1 ) {
118
+		if (absint($page) < 1) {
119 119
 			$page = 1;
120 120
 		}
121 121
 
122
-		$limit = absint( ( $page - 1 ) * $posts_per_page ) . ", " . $posts_per_page;
122
+		$limit = absint(($page - 1) * $posts_per_page).", ".$posts_per_page;
123 123
 			
124
-		$query = $wpdb->prepare( "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d ORDER BY comment_id ASC LIMIT " . $limit, array( $user->ID ) );
124
+		$query = $wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d ORDER BY comment_id ASC LIMIT ".$limit, array($user->ID));
125 125
 
126
-		$reviews = $wpdb->get_results( $query );
126
+		$reviews = $wpdb->get_results($query);
127 127
 
128
-		return apply_filters( 'geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page );
128
+		return apply_filters('geodir_privacy_review_data_eraser_reviews', $reviews, $email_address, $user, $page);
129 129
 	}
130 130
 
131 131
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param  int    $page          Page number.
138 138
 	 * @return array
139 139
 	 */
140
-	public static function favorites_data_eraser( $email_address, $page ) {
140
+	public static function favorites_data_eraser($email_address, $page) {
141 141
 		$response = array(
142 142
 			'items_removed'  => false,
143 143
 			'items_retained' => false,
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 			'done'           => true,
146 146
 		);
147 147
 
148
-		if ( empty( $email_address ) ) {
148
+		if (empty($email_address)) {
149 149
 			return $response;
150 150
 		}
151 151
 
152
-		$user = get_user_by( 'email', $email_address );
153
-		if ( empty( $user ) ) {
152
+		$user = get_user_by('email', $email_address);
153
+		if (empty($user)) {
154 154
 			return $response;
155 155
 		}
156 156
 
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 		$messages       = array();
160 160
 
161 161
 		$site_id = '';
162
-        if ( is_multisite() ) {
162
+        if (is_multisite()) {
163 163
             $blog_id = get_current_blog_id();
164
-            if ( $blog_id && $blog_id != '1' ) {
165
-				$site_id  = '_' . $blog_id;
164
+            if ($blog_id && $blog_id != '1') {
165
+				$site_id = '_'.$blog_id;
166 166
 			}
167 167
         }
168 168
 
169
-		if ( delete_user_meta( $user->ID, 'gd_user_favourite_post' . $site_id ) ) {
170
-			$messages[]    = __( 'Removed "Favorite Listings" data from user.', 'geodirectory' );
169
+		if (delete_user_meta($user->ID, 'gd_user_favourite_post'.$site_id)) {
170
+			$messages[]    = __('Removed "Favorite Listings" data from user.', 'geodirectory');
171 171
 			$items_removed = true;
172 172
 		}
173 173
 
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_popular_widget.php 3 patches
Indentation   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -14,83 +14,83 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_popular_post_category extends WP_Widget
16 16
 {
17
-    /**
18
-     * Register the popular post category widget.
19
-     *
20
-     * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
-     */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
-        parent::__construct(
26
-            'popular_post_category', // Base ID
27
-            __('GD > Popular Post Category', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
31
-
32
-    /**
33
-     * Front-end display content for popular post category widget.
34
-     *
35
-     * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
37
-     *
38
-     * @param array $args     Widget arguments.
39
-     * @param array $instance Saved values from database.
40
-     */
41
-    public function widget($args, $instance)
42
-    {
43
-        geodir_popular_post_category_output($args, $instance);
44
-    }
45
-
46
-    /**
47
-     * Sanitize popular post category widget form values as they are saved.
48
-     *
49
-     * @since 1.0.0
50
-     * @since 1.5.1 Declare function public.
51
-     * @since 1.5.1 Added default_post_type parameter.
52
-     * @since 1.6.9 Added parent_only parameter.
53
-     *
54
-     * @param array $new_instance Values just sent to be saved.
55
-     * @param array $old_instance Previously saved values from database.
56
-     *
57
-     * @return array Updated safe values to be saved.
58
-     */ 
59
-    public function update($new_instance, $old_instance)
60
-    {
61
-        //save the widget
62
-        $instance = $old_instance;
63
-        $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
65
-        $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
-        $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
-        $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
-        return $instance;
69
-    }
70
-
71
-    /**
72
-     * Back-end popular post category widget settings form.
73
-     *
74
-     * @since 1.0.0
75
-     * @since 1.5.1 Declare function public.
76
-     * @since 1.5.1 Added option to set default post type.
77
-     * @since 1.6.9 Added option to show parent categories only.
78
-     *
79
-     * @param array $instance Previously saved values from database.
80
-     */
81
-    public function form($instance) 
82
-    {
83
-        //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
-
86
-        $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
88
-        $category_limit = $category_limit > 0 ? $category_limit : 15;
89
-        $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
-        $parent_only = !empty($instance['parent_only']) ? true: false;
17
+	/**
18
+	 * Register the popular post category widget.
19
+	 *
20
+	 * @since 1.0.0
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22
+	 */
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
25
+		parent::__construct(
26
+			'popular_post_category', // Base ID
27
+			__('GD > Popular Post Category', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31
+
32
+	/**
33
+	 * Front-end display content for popular post category widget.
34
+	 *
35
+	 * @since 1.0.0
36
+	 * @since 1.5.1 Declare function public.
37
+	 *
38
+	 * @param array $args     Widget arguments.
39
+	 * @param array $instance Saved values from database.
40
+	 */
41
+	public function widget($args, $instance)
42
+	{
43
+		geodir_popular_post_category_output($args, $instance);
44
+	}
45
+
46
+	/**
47
+	 * Sanitize popular post category widget form values as they are saved.
48
+	 *
49
+	 * @since 1.0.0
50
+	 * @since 1.5.1 Declare function public.
51
+	 * @since 1.5.1 Added default_post_type parameter.
52
+	 * @since 1.6.9 Added parent_only parameter.
53
+	 *
54
+	 * @param array $new_instance Values just sent to be saved.
55
+	 * @param array $old_instance Previously saved values from database.
56
+	 *
57
+	 * @return array Updated safe values to be saved.
58
+	 */ 
59
+	public function update($new_instance, $old_instance)
60
+	{
61
+		//save the widget
62
+		$instance = $old_instance;
63
+		$instance['title'] = strip_tags($new_instance['title']);
64
+		$category_limit = (int)$new_instance['category_limit'];
65
+		$instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66
+		$instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67
+		$instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
68
+		return $instance;
69
+	}
70
+
71
+	/**
72
+	 * Back-end popular post category widget settings form.
73
+	 *
74
+	 * @since 1.0.0
75
+	 * @since 1.5.1 Declare function public.
76
+	 * @since 1.5.1 Added option to set default post type.
77
+	 * @since 1.6.9 Added option to show parent categories only.
78
+	 *
79
+	 * @param array $instance Previously saved values from database.
80
+	 */
81
+	public function form($instance) 
82
+	{
83
+		//widgetform in backend
84
+		$instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85
+
86
+		$title = strip_tags($instance['title']);
87
+		$category_limit = (int)$instance['category_limit'];
88
+		$category_limit = $category_limit > 0 ? $category_limit : 15;
89
+		$default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90
+		$parent_only = !empty($instance['parent_only']) ? true: false;
91 91
         
92
-        $post_type_options = geodir_get_posttypes('options');
93
-        ?>
92
+		$post_type_options = geodir_get_posttypes('options');
93
+		?>
94 94
         <p>
95 95
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
96 96
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>"/>
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
117 117
         </p>
118 118
     <?php
119
-    }
119
+	}
120 120
 } // class geodir_popular_post_category
121 121
 
122 122
 register_widget('geodir_popular_post_category');
@@ -130,40 +130,40 @@  discard block
 block discarded – undo
130 130
 class geodir_popular_postview extends WP_Widget
131 131
 {
132 132
 
133
-    /**
133
+	/**
134 134
 	 * Register the popular posts widget.
135 135
 	 *
136 136
 	 * @since 1.0.0
137
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
137
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
138 138
 	 */
139
-    public function __construct() {
140
-        $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
-        parent::__construct(
142
-            'popular_post_view', // Base ID
143
-            __('GD > Popular Post View', 'geodirectory'), // Name
144
-            $widget_ops// Args
145
-        );
146
-    }
139
+	public function __construct() {
140
+		$widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
141
+		parent::__construct(
142
+			'popular_post_view', // Base ID
143
+			__('GD > Popular Post View', 'geodirectory'), // Name
144
+			$widget_ops// Args
145
+		);
146
+	}
147 147
 
148 148
 	/**
149 149
 	 * Front-end display content for popular posts widget.
150 150
 	 *
151 151
 	 * @since 1.0.0
152
-     * @since 1.5.1 Declare function public.
152
+	 * @since 1.5.1 Declare function public.
153 153
 	 *
154 154
 	 * @param array $args     Widget arguments.
155 155
 	 * @param array $instance Saved values from database.
156 156
 	 */
157 157
 	public function widget($args, $instance)
158
-    {
159
-        geodir_popular_postview_output($args, $instance);
160
-    }
158
+	{
159
+		geodir_popular_postview_output($args, $instance);
160
+	}
161 161
 
162 162
 	/**
163 163
 	 * Sanitize popular posts widget form values as they are saved.
164 164
 	 *
165 165
 	 * @since 1.0.0
166
-     * @since 1.5.1 Declare function public.
166
+	 * @since 1.5.1 Declare function public.
167 167
 	 *
168 168
 	 * @param array $new_instance Values just sent to be saved.
169 169
 	 * @param array $old_instance Previously saved values from database.
@@ -171,106 +171,106 @@  discard block
 block discarded – undo
171 171
 	 * @return array Updated safe values to be saved.
172 172
 	 */
173 173
 	public function update($new_instance, $old_instance)
174
-    {
175
-        //save the widget
176
-        $instance = $old_instance;
177
-
178
-        if ($new_instance['title'] == '') {
179
-            $title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
-            //$instance['title'] = $title;
181
-        }
182
-        $instance['title'] = strip_tags($new_instance['title']);
183
-
184
-        $instance['post_type'] = strip_tags($new_instance['post_type']);
185
-        //$instance['category'] = strip_tags($new_instance['category']);
186
-        $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
-        $instance['category_title'] = strip_tags($new_instance['category_title']);
188
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
189
-        $instance['layout'] = strip_tags($new_instance['layout']);
190
-        $instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
-        $instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
-        $instance['title_tag'] = strip_tags($new_instance['title_tag']);
193
-        $instance['character_count'] = $new_instance['character_count'];
194
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
195
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
196
-        else
197
-            $instance['add_location_filter'] = '0';
198
-
199
-        $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
200
-        $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
201
-        $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
202
-        $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
203
-        $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
204
-        $instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0;
205
-
206
-        return $instance;
207
-    }
174
+	{
175
+		//save the widget
176
+		$instance = $old_instance;
177
+
178
+		if ($new_instance['title'] == '') {
179
+			$title = geodir_ucwords(strip_tags($new_instance['category_title']));
180
+			//$instance['title'] = $title;
181
+		}
182
+		$instance['title'] = strip_tags($new_instance['title']);
183
+
184
+		$instance['post_type'] = strip_tags($new_instance['post_type']);
185
+		//$instance['category'] = strip_tags($new_instance['category']);
186
+		$instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : '';
187
+		$instance['category_title'] = strip_tags($new_instance['category_title']);
188
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
189
+		$instance['layout'] = strip_tags($new_instance['layout']);
190
+		$instance['listing_width'] = strip_tags($new_instance['listing_width']);
191
+		$instance['list_sort'] = strip_tags($new_instance['list_sort']);
192
+		$instance['title_tag'] = strip_tags($new_instance['title_tag']);
193
+		$instance['character_count'] = $new_instance['character_count'];
194
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
195
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
196
+		else
197
+			$instance['add_location_filter'] = '0';
198
+
199
+		$instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
200
+		$instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
201
+		$instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0;
202
+		$instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0;
203
+		$instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0;
204
+		$instance['hide_if_empty'] = !empty($new_instance['hide_if_empty']) ? 1 : 0;
205
+
206
+		return $instance;
207
+	}
208 208
 
209 209
 	/**
210 210
 	 * Back-end popular posts widget settings form.
211 211
 	 *
212 212
 	 * @since 1.0.0
213
-     * @since 1.5.1 Declare function public.
213
+	 * @since 1.5.1 Declare function public.
214 214
 	 *
215 215
 	 * @param array $instance Previously saved values from database.
216 216
 	 */
217 217
 	public function form($instance)
218
-    {
219
-        //widgetform in backend
220
-        $instance = wp_parse_args((array)$instance,
221
-            array('title' => '',
222
-                'post_type' => '',
223
-                'category' => array(),
224
-                'category_title' => '',
225
-                'list_sort' => '',
226
-                'title_tag' => 'h3',
227
-                'list_order' => '',
228
-                'post_number' => '5',
229
-                'layout' => 'gridview_onehalf',
230
-                'listing_width' => '',
231
-                'add_location_filter' => '1',
232
-                'character_count' => '20',
233
-                'show_featured_only' => '',
234
-                'show_special_only' => '',
235
-                'with_pics_only' => '',
236
-                'with_videos_only' => '',
237
-                'use_viewing_post_type' => '',
238
-                'hide_if_empty' => ''
239
-            )
240
-        );
218
+	{
219
+		//widgetform in backend
220
+		$instance = wp_parse_args((array)$instance,
221
+			array('title' => '',
222
+				'post_type' => '',
223
+				'category' => array(),
224
+				'category_title' => '',
225
+				'list_sort' => '',
226
+				'title_tag' => 'h3',
227
+				'list_order' => '',
228
+				'post_number' => '5',
229
+				'layout' => 'gridview_onehalf',
230
+				'listing_width' => '',
231
+				'add_location_filter' => '1',
232
+				'character_count' => '20',
233
+				'show_featured_only' => '',
234
+				'show_special_only' => '',
235
+				'with_pics_only' => '',
236
+				'with_videos_only' => '',
237
+				'use_viewing_post_type' => '',
238
+				'hide_if_empty' => ''
239
+			)
240
+		);
241 241
 
242
-        $title = strip_tags($instance['title']);
242
+		$title = strip_tags($instance['title']);
243 243
 
244
-        $post_type = strip_tags($instance['post_type']);
244
+		$post_type = strip_tags($instance['post_type']);
245 245
 
246
-        $category = $instance['category'];
246
+		$category = $instance['category'];
247 247
 
248
-        $category_title = strip_tags($instance['category_title']);
248
+		$category_title = strip_tags($instance['category_title']);
249 249
 
250
-        $list_sort = strip_tags($instance['list_sort']);
250
+		$list_sort = strip_tags($instance['list_sort']);
251 251
 
252
-        $list_order = strip_tags($instance['list_order']);
252
+		$list_order = strip_tags($instance['list_order']);
253 253
 
254
-        $title_tag = strip_tags($instance['title_tag']);
254
+		$title_tag = strip_tags($instance['title_tag']);
255 255
 
256
-        $post_number = strip_tags($instance['post_number']);
256
+		$post_number = strip_tags($instance['post_number']);
257 257
 
258
-        $layout = strip_tags($instance['layout']);
258
+		$layout = strip_tags($instance['layout']);
259 259
 
260
-        $listing_width = strip_tags($instance['listing_width']);
260
+		$listing_width = strip_tags($instance['listing_width']);
261 261
 
262
-        $add_location_filter = strip_tags($instance['add_location_filter']);
262
+		$add_location_filter = strip_tags($instance['add_location_filter']);
263 263
 
264
-        $character_count = $instance['character_count'];
264
+		$character_count = $instance['character_count'];
265 265
 
266
-        $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
267
-        $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
268
-        $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
269
-        $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
270
-        $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
271
-        $hide_if_empty = !empty($instance['hide_if_empty']) ? true : false;
266
+		$show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false;
267
+		$show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false;
268
+		$with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false;
269
+		$with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false;
270
+		$use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false;
271
+		$hide_if_empty = !empty($instance['hide_if_empty']) ? true : false;
272 272
 
273
-        ?>
273
+		?>
274 274
         <p>
275 275
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
276 276
                 <small>(%posttype_singular_label% ,
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
                     <?php foreach ($postypes as $postypes_obj) { ?>
305 305
 
306 306
                         <option <?php if ($post_type == $postypes_obj) {
307
-                            echo 'selected="selected"';
308
-                        } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
309
-                            echo geodir_utf8_ucfirst($extvalue[1]); ?></option>
307
+							echo 'selected="selected"';
308
+						} ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
309
+							echo geodir_utf8_ucfirst($extvalue[1]); ?></option>
310 310
 
311 311
                     <?php } ?>
312 312
 
@@ -321,30 +321,30 @@  discard block
 block discarded – undo
321 321
 
322 322
                 <?php
323 323
 
324
-                $post_type = ($post_type != '') ? $post_type : 'gd_place';
324
+				$post_type = ($post_type != '') ? $post_type : 'gd_place';
325 325
 
326
-                $all_postypes = geodir_get_posttypes();
326
+				$all_postypes = geodir_get_posttypes();
327 327
 
328
-                if (!in_array($post_type, $all_postypes))
329
-                    $post_type = 'gd_place';
328
+				if (!in_array($post_type, $all_postypes))
329
+					$post_type = 'gd_place';
330 330
 
331
-                $category_taxonomy = geodir_get_taxonomies($post_type);
332
-                $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
331
+				$category_taxonomy = geodir_get_taxonomies($post_type);
332
+				$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
333 333
 
334
-                ?>
334
+				?>
335 335
 
336 336
                 <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]"
337 337
                         onchange="geodir_popular_widget_cat_title(this)">
338 338
 
339 339
                     <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) {
340
-                        echo 'selected="selected"';
341
-                    } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
340
+						echo 'selected="selected"';
341
+					} ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
342 342
                     <?php foreach ($categories as $category_obj) {
343
-                        $selected = '';
344
-                        if (is_array($category) && in_array($category_obj->term_id, $category))
345
-                            echo $selected = 'selected="selected"';
343
+						$selected = '';
344
+						if (is_array($category) && in_array($category_obj->term_id, $category))
345
+							echo $selected = 'selected="selected"';
346 346
 
347
-                        ?>
347
+						?>
348 348
 
349 349
                         <option <?php echo $selected; ?>
350 350
                             value="<?php echo $category_obj->term_id; ?>"><?php echo geodir_utf8_ucfirst($category_obj->name); ?></option>
@@ -365,32 +365,32 @@  discard block
 block discarded – undo
365 365
             <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
366 366
 
367 367
                 <?php
368
-                $list_sort_arr = array(
369
-                    "az"        =>  __('A-Z', 'geodirectory'),
370
-                    "latest"        =>  __('Latest', 'geodirectory'),
371
-                    "featured"        =>  __('Featured', 'geodirectory'),
372
-                    "high_review"        =>  __('Review', 'geodirectory'),
373
-                    "high_rating"        =>  __('Rating', 'geodirectory'),
374
-                    "random"        =>  __('Random', 'geodirectory'),
375
-                );
376
-
377
-                /**
378
-                 * Filter the Popular post view widget sorting options.
379
-                 *
380
-                 * @since 1.6.22
381
-                 * @param array $list_sort_arr The array of key value pairs of settings.
382
-                 * @param array $instance The array of widget settings.
383
-                 */
384
-                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
385
-                ?>
368
+				$list_sort_arr = array(
369
+					"az"        =>  __('A-Z', 'geodirectory'),
370
+					"latest"        =>  __('Latest', 'geodirectory'),
371
+					"featured"        =>  __('Featured', 'geodirectory'),
372
+					"high_review"        =>  __('Review', 'geodirectory'),
373
+					"high_rating"        =>  __('Rating', 'geodirectory'),
374
+					"random"        =>  __('Random', 'geodirectory'),
375
+				);
376
+
377
+				/**
378
+				 * Filter the Popular post view widget sorting options.
379
+				 *
380
+				 * @since 1.6.22
381
+				 * @param array $list_sort_arr The array of key value pairs of settings.
382
+				 * @param array $instance The array of widget settings.
383
+				 */
384
+				$list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
385
+				?>
386 386
 
387 387
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
388 388
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
389 389
                     <?php
390
-                    foreach($list_sort_arr as $sort_val => $sort_title){
391
-                        echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
392
-                    }
393
-                    ?>
390
+					foreach($list_sort_arr as $sort_val => $sort_title){
391
+						echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
392
+					}
393
+					?>
394 394
                 </select>
395 395
             </label>
396 396
         </p>
@@ -399,28 +399,28 @@  discard block
 block discarded – undo
399 399
             <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?>
400 400
 
401 401
                 <?php
402
-                $title_tag_arr = array(
403
-                    "h3"        =>  __('h3 (default)', 'geodirectory'),
404
-                    "h2"        =>  __('h2 (if main content of page)', 'geodirectory'),
405
-                );
406
-
407
-                /**
408
-                 * Filter the Popular post view widget title tag.
409
-                 *
410
-                 * @since 1.6.26
411
-                 * @param array $title_tag_arr The array of key value pairs of settings.
412
-                 * @param array $instance The array of widget settings.
413
-                 */
414
-                $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance);
415
-                ?>
402
+				$title_tag_arr = array(
403
+					"h3"        =>  __('h3 (default)', 'geodirectory'),
404
+					"h2"        =>  __('h2 (if main content of page)', 'geodirectory'),
405
+				);
406
+
407
+				/**
408
+				 * Filter the Popular post view widget title tag.
409
+				 *
410
+				 * @since 1.6.26
411
+				 * @param array $title_tag_arr The array of key value pairs of settings.
412
+				 * @param array $instance The array of widget settings.
413
+				 */
414
+				$title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance);
415
+				?>
416 416
 
417 417
                 <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>"
418 418
                         name="<?php echo $this->get_field_name('title_tag'); ?>">
419 419
                     <?php
420
-                    foreach($title_tag_arr as $title_val => $title_title){
421
-                        echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>";
422
-                    }
423
-                    ?>
420
+					foreach($title_tag_arr as $title_val => $title_title){
421
+						echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>";
422
+					}
423
+					?>
424 424
                 </select>
425 425
             </label>
426 426
         </p>
@@ -442,24 +442,24 @@  discard block
 block discarded – undo
442 442
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
443 443
                         name="<?php echo $this->get_field_name('layout'); ?>">
444 444
                     <option <?php if ($layout == 'gridview_onehalf') {
445
-                        echo 'selected="selected"';
446
-                    } ?>
445
+						echo 'selected="selected"';
446
+					} ?>
447 447
                         value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option>
448 448
                     <option <?php if ($layout == 'gridview_onethird') {
449
-                        echo 'selected="selected"';
450
-                    } ?>
449
+						echo 'selected="selected"';
450
+					} ?>
451 451
                         value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option>
452 452
                     <option <?php if ($layout == 'gridview_onefourth') {
453
-                        echo 'selected="selected"';
454
-                    } ?>
453
+						echo 'selected="selected"';
454
+					} ?>
455 455
                         value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option>
456 456
                     <option <?php if ($layout == 'gridview_onefifth') {
457
-                        echo 'selected="selected"';
458
-                    } ?>
457
+						echo 'selected="selected"';
458
+					} ?>
459 459
                         value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option>
460 460
                     <option <?php if ($layout == 'list') {
461
-                        echo 'selected="selected"';
462
-                    } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
461
+						echo 'selected="selected"';
462
+					} ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
463 463
 
464 464
                 </select>
465 465
             </label>
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
                 for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
530 530
                 <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
531 531
                        name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
532
-                    echo 'checked="checked"';
533
-                } ?>  value="1"/>
532
+					echo 'checked="checked"';
533
+				} ?>  value="1"/>
534 534
             </label>
535 535
         </p>
536 536
         <p>
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
         </script>
579 579
 
580 580
     <?php
581
-    }
581
+	}
582 582
 } // class geodir_popular_postview
583 583
 
584 584
 register_widget('geodir_popular_postview');
585 585
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         //save the widget
62 62
         $instance = $old_instance;
63 63
         $instance['title'] = strip_tags($new_instance['title']);
64
-        $category_limit = (int)$new_instance['category_limit'];
64
+        $category_limit = (int) $new_instance['category_limit'];
65 65
         $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15;
66 66
         $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : '';
67 67
         $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false;
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     public function form($instance) 
82 82
     {
83 83
         //widgetform in backend
84
-        $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
84
+        $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
85 85
 
86 86
         $title = strip_tags($instance['title']);
87
-        $category_limit = (int)$instance['category_limit'];
87
+        $category_limit = (int) $instance['category_limit'];
88 88
         $category_limit = $category_limit > 0 ? $category_limit : 15;
89 89
         $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : '';
90 90
         $parent_only = !empty($instance['parent_only']) ? true: false;
@@ -97,23 +97,23 @@  discard block
 block discarded – undo
97 97
             </label>
98 98
         </p>
99 99
         <p>
100
-            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?>
100
+            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?>
101 101
                 <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>">
102 102
                 <?php foreach ($post_type_options as $name => $title) { ?>
103
-                    <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option>
103
+                    <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option>
104 104
                 <?php } ?>
105 105
                 </select>
106 106
             </label>
107 107
         </p>
108 108
         <p>
109 109
             <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?>
110
-                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/>
110
+                <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/>
111 111
                 <p class="description" style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p>
112 112
             </label>
113 113
         </p>
114 114
         <p>
115
-            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" />
116
-            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
115
+            <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" />
116
+            <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label>
117 117
         </p>
118 118
     <?php
119 119
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	public function form($instance)
218 218
     {
219 219
         //widgetform in backend
220
-        $instance = wp_parse_args((array)$instance,
220
+        $instance = wp_parse_args((array) $instance,
221 221
             array('title' => '',
222 222
                 'post_type' => '',
223 223
                 'category' => array(),
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 
273 273
         ?>
274 274
         <p>
275
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
275
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
276 276
                 <small>(%posttype_singular_label% ,
277
-                    %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>)
277
+                    %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>)
278 278
                 </small>
279 279
 
280 280
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 
286 286
         <p>
287 287
             <label
288
-                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
288
+                for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
289 289
 
290 290
                 <?php $postypes = geodir_get_posttypes();
291 291
 				/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
         <p id="post_type_cats">
319 319
             <label
320
-                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
320
+                for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
321 321
 
322 322
                 <?php
323 323
 
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
 
357 357
                 <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
358 358
                        id="<?php echo $this->get_field_id('category_title'); ?>"
359
-                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
359
+                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/>
360 360
 
361 361
             </label>
362 362
         </p>
363 363
 
364 364
         <p>
365
-            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
365
+            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?>
366 366
 
367 367
                 <?php
368 368
                 $list_sort_arr = array(
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
                  * @param array $list_sort_arr The array of key value pairs of settings.
382 382
                  * @param array $instance The array of widget settings.
383 383
                  */
384
-                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort',$list_sort_arr,$instance);
384
+                $list_sort_arr = apply_filters('geodir_popular_post_view_list_sort', $list_sort_arr, $instance);
385 385
                 ?>
386 386
 
387 387
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
388 388
                         name="<?php echo $this->get_field_name('list_sort'); ?>">
389 389
                     <?php
390
-                    foreach($list_sort_arr as $sort_val => $sort_title){
391
-                        echo "<option value='$sort_val' ".selected($list_sort,$sort_val)." >$sort_title</option>";
390
+                    foreach ($list_sort_arr as $sort_val => $sort_title) {
391
+                        echo "<option value='$sort_val' ".selected($list_sort, $sort_val)." >$sort_title</option>";
392 392
                     }
393 393
                     ?>
394 394
                 </select>
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         </p>
397 397
 
398 398
         <p>
399
-            <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory');?>
399
+            <label for="<?php echo $this->get_field_id('title_tag'); ?>"><?php _e('Title tag:', 'geodirectory'); ?>
400 400
 
401 401
                 <?php
402 402
                 $title_tag_arr = array(
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
                  * @param array $title_tag_arr The array of key value pairs of settings.
412 412
                  * @param array $instance The array of widget settings.
413 413
                  */
414
-                $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag',$title_tag_arr,$instance);
414
+                $title_tag_arr = apply_filters('geodir_popular_post_view_title_tag', $title_tag_arr, $instance);
415 415
                 ?>
416 416
 
417 417
                 <select class="widefat" id="<?php echo $this->get_field_id('title_tag'); ?>"
418 418
                         name="<?php echo $this->get_field_name('title_tag'); ?>">
419 419
                     <?php
420
-                    foreach($title_tag_arr as $title_val => $title_title){
421
-                        echo "<option value='$title_val' ".selected($title_tag,$title_val)." >$title_title</option>";
420
+                    foreach ($title_tag_arr as $title_val => $title_title) {
421
+                        echo "<option value='$title_val' ".selected($title_tag, $title_val)." >$title_title</option>";
422 422
                     }
423 423
                     ?>
424 424
                 </select>
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         <p>
429 429
 
430 430
             <label
431
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
431
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
432 432
 
433 433
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
434 434
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
         <p>
440 440
             <label for="<?php echo $this->get_field_id('layout'); ?>">
441
-                <?php _e('Layout:', 'geodirectory');?>
441
+                <?php _e('Layout:', 'geodirectory'); ?>
442 442
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
443 443
                         name="<?php echo $this->get_field_name('layout'); ?>">
444 444
                     <option <?php if ($layout == 'gridview_onehalf') {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
         <p>
469 469
             <label
470
-                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?>
470
+                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?>
471 471
 
472 472
                 <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>"
473 473
                        name="<?php echo $this->get_field_name('listing_width'); ?>" type="text"
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
         <p>
479 479
             <label
480
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
480
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
481 481
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
482 482
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
483 483
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -486,41 +486,41 @@  discard block
 block discarded – undo
486 486
 
487 487
         <p>
488 488
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
489
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
489
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
490 490
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
491
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
491
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
492 492
                        value="1"/>
493 493
             </label>
494 494
         </p>
495 495
         <p>
496 496
             <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
497
-                <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
497
+                <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox"
498 498
                                                                                             id="<?php echo $this->get_field_id('show_featured_only'); ?>"
499
-                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
499
+                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
500 500
                                                                                             value="1"/>
501 501
             </label>
502 502
         </p>
503 503
         <p>
504 504
             <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
505
-                <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
505
+                <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox"
506 506
                                                                                                        id="<?php echo $this->get_field_id('show_special_only'); ?>"
507
-                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
507
+                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?>
508 508
                                                                                                        value="1"/>
509 509
             </label>
510 510
         </p>
511 511
         <p>
512 512
             <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
513
-                <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
513
+                <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox"
514 514
                                                                                              id="<?php echo $this->get_field_id('with_pics_only'); ?>"
515
-                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
515
+                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?>
516 516
                                                                                              value="1"/>
517 517
             </label>
518 518
         </p>
519 519
         <p>
520 520
             <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
521
-                <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
521
+                <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox"
522 522
                                                                                                id="<?php echo $this->get_field_id('with_videos_only'); ?>"
523
-                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
523
+                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?>
524 524
                                                                                                value="1"/>
525 525
             </label>
526 526
         </p>
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 
571 571
             }
572 572
 
573
-            <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
573
+            <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
574 574
             var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
575 575
 
576 576
             <?php } ?>
Please login to merge, or discard this patch.
Braces   +37 added lines, -14 removed lines patch added patch discarded remove patch
@@ -191,10 +191,11 @@  discard block
 block discarded – undo
191 191
         $instance['list_sort'] = strip_tags($new_instance['list_sort']);
192 192
         $instance['title_tag'] = strip_tags($new_instance['title_tag']);
193 193
         $instance['character_count'] = $new_instance['character_count'];
194
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
195
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
196
-        else
197
-            $instance['add_location_filter'] = '0';
194
+        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') {
195
+                    $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
196
+        } else {
197
+                    $instance['add_location_filter'] = '0';
198
+        }
198 199
 
199 200
         $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0;
200 201
         $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0;
@@ -325,8 +326,9 @@  discard block
 block discarded – undo
325 326
 
326 327
                 $all_postypes = geodir_get_posttypes();
327 328
 
328
-                if (!in_array($post_type, $all_postypes))
329
-                    $post_type = 'gd_place';
329
+                if (!in_array($post_type, $all_postypes)) {
330
+                                    $post_type = 'gd_place';
331
+                }
330 332
 
331 333
                 $category_taxonomy = geodir_get_taxonomies($post_type);
332 334
                 $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
@@ -341,8 +343,9 @@  discard block
 block discarded – undo
341 343
                     } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
342 344
                     <?php foreach ($categories as $category_obj) {
343 345
                         $selected = '';
344
-                        if (is_array($category) && in_array($category_obj->term_id, $category))
345
-                            echo $selected = 'selected="selected"';
346
+                        if (is_array($category) && in_array($category_obj->term_id, $category)) {
347
+                                                    echo $selected = 'selected="selected"';
348
+                        }
346 349
 
347 350
                         ?>
348 351
 
@@ -356,7 +359,12 @@  discard block
 block discarded – undo
356 359
 
357 360
                 <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
358 361
                        id="<?php echo $this->get_field_id('category_title'); ?>"
359
-                       value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
362
+                       value="<?php if ($category_title != '') {
363
+	echo $category_title;
364
+} else {
365
+	echo __('All', 'geodirectory');
366
+}
367
+?>"/>
360 368
 
361 369
             </label>
362 370
         </p>
@@ -488,7 +496,10 @@  discard block
 block discarded – undo
488 496
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
489 497
                 <?php _e('Enable Location Filter:', 'geodirectory');?>
490 498
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
491
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
499
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) {
500
+	echo 'checked="checked"';
501
+}
502
+?>
492 503
                        value="1"/>
493 504
             </label>
494 505
         </p>
@@ -496,7 +507,10 @@  discard block
 block discarded – undo
496 507
             <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
497 508
                 <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
498 509
                                                                                             id="<?php echo $this->get_field_id('show_featured_only'); ?>"
499
-                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
510
+                                                                                            name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) {
511
+	echo 'checked="checked"';
512
+}
513
+?>
500 514
                                                                                             value="1"/>
501 515
             </label>
502 516
         </p>
@@ -504,7 +518,10 @@  discard block
 block discarded – undo
504 518
             <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
505 519
                 <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
506 520
                                                                                                        id="<?php echo $this->get_field_id('show_special_only'); ?>"
507
-                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
521
+                                                                                                       name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) {
522
+	echo 'checked="checked"';
523
+}
524
+?>
508 525
                                                                                                        value="1"/>
509 526
             </label>
510 527
         </p>
@@ -512,7 +529,10 @@  discard block
 block discarded – undo
512 529
             <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
513 530
                 <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
514 531
                                                                                              id="<?php echo $this->get_field_id('with_pics_only'); ?>"
515
-                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
532
+                                                                                             name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) {
533
+	echo 'checked="checked"';
534
+}
535
+?>
516 536
                                                                                              value="1"/>
517 537
             </label>
518 538
         </p>
@@ -520,7 +540,10 @@  discard block
 block discarded – undo
520 540
             <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
521 541
                 <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
522 542
                                                                                                id="<?php echo $this->get_field_id('with_videos_only'); ?>"
523
-                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
543
+                                                                                               name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) {
544
+	echo 'checked="checked"';
545
+}
546
+?>
524 547
                                                                                                value="1"/>
525 548
             </label>
526 549
         </p>
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -71,31 +71,31 @@
 block discarded – undo
71 71
 	public function get_privacy_message() {
72 72
 
73 73
 		$content = '<h2>' . __( 'Listings', 'geodirectory' ) . '</h2>' .
74
-		           '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' .
75
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
76
-		           '<ul>' .
77
-		           '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' .
78
-		           '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' .
79
-		           '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' .
80
-		           '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' .
81
-		           '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' .
82
-		           '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' .
83
-		           '</ul>' .
84
-		           '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' .
85
-		           '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' .
86
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
87
-		           '<ul>' .
88
-		           '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' .
89
-		           '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' .
90
-		           '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' .
91
-		           '</ul>' .
92
-		           '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' .
93
-		           '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' .
94
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
95
-		           '<ul>' .
96
-		           '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' .
97
-		           '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' .
98
-		           '</ul>';
74
+				   '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' .
75
+				   '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
76
+				   '<ul>' .
77
+				   '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' .
78
+				   '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' .
79
+				   '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' .
80
+				   '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' .
81
+				   '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' .
82
+				   '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' .
83
+				   '</ul>' .
84
+				   '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' .
85
+				   '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' .
86
+				   '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
87
+				   '<ul>' .
88
+				   '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' .
89
+				   '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' .
90
+				   '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' .
91
+				   '</ul>' .
92
+				   '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' .
93
+				   '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' .
94
+				   '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
95
+				   '<ul>' .
96
+				   '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' .
97
+				   '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' .
98
+				   '</ul>';
99 99
 
100 100
 
101 101
 		return apply_filters( 'geodir_privacy_policy_content', $content) ;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -285,6 +285,10 @@
 block discarded – undo
285 285
 		return apply_filters( 'geodir_privacy_allow_erase_favorites_data', $allow );
286 286
 	}
287 287
 
288
+	/**
289
+	 * @param string $email_address
290
+	 * @param integer $page
291
+	 */
288 292
 	public static function favorites_by_user( $email_address, $page ) {
289 293
 		if ( empty( $email_address ) ) {
290 294
 			return array();
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy Class.
@@ -17,44 +17,44 @@  discard block
 block discarded – undo
17 17
 	 * Init - hook into events.
18 18
 	 */
19 19
 	public function __construct() {
20
-		parent::__construct( __( 'GeoDirectory', 'geodirectory' ) );
20
+		parent::__construct(__('GeoDirectory', 'geodirectory'));
21 21
 
22 22
 		// Include supporting classes.
23
-		include_once( 'class-geodir-privacy-erasers.php' );
24
-		include_once( 'class-geodir-privacy-exporters.php' );
23
+		include_once('class-geodir-privacy-erasers.php');
24
+		include_once('class-geodir-privacy-exporters.php');
25 25
 
26
-		$gd_post_types = geodir_get_posttypes( 'object' );
26
+		$gd_post_types = geodir_get_posttypes('object');
27 27
 
28
-		if ( ! empty( $gd_post_types ) ) {
29
-			foreach ( $gd_post_types as $post_type => $info ) {
28
+		if (!empty($gd_post_types)) {
29
+			foreach ($gd_post_types as $post_type => $info) {
30 30
 				$name = $info->labels->name;
31 31
 
32
-				if ( self::allow_export_post_type_data( $post_type ) ) {
32
+				if (self::allow_export_post_type_data($post_type)) {
33 33
 					// This hook registers GeoDirectory data exporters.
34
-					$this->add_exporter( 'geodirectory-post-' . $post_type, wp_sprintf( __( 'User %s', 'geodirectory' ), $name ), array( 'GeoDir_Privacy_Exporters', 'post_data_exporter' ) );
34
+					$this->add_exporter('geodirectory-post-'.$post_type, wp_sprintf(__('User %s', 'geodirectory'), $name), array('GeoDir_Privacy_Exporters', 'post_data_exporter'));
35 35
 				}
36 36
 			}
37 37
 		}
38 38
 
39 39
 		// Handles custom anonomization types not included in core.
40
-		add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 );
40
+		add_filter('wp_privacy_anonymize_data', array($this, 'anonymize_custom_data_types'), 10, 3);
41 41
 
42
-		if ( self::allow_export_reviews_data() ) {
42
+		if (self::allow_export_reviews_data()) {
43 43
 			// Review data export
44
-			add_filter( 'wp_privacy_personal_data_export_page', array( 'GeoDir_Privacy_Exporters', 'review_data_exporter' ), 10, 7 );
44
+			add_filter('wp_privacy_personal_data_export_page', array('GeoDir_Privacy_Exporters', 'review_data_exporter'), 10, 7);
45 45
 		}
46 46
 
47
-		if ( self::allow_erase_reviews_data() ) {
47
+		if (self::allow_erase_reviews_data()) {
48 48
 			// Review data erase
49
-			$this->add_eraser( 'geodirectory-post-reviews', __( 'User Listing Reviews', 'geodirectory' ), array( 'GeoDir_Privacy_Erasers', 'review_data_eraser' ) );
49
+			$this->add_eraser('geodirectory-post-reviews', __('User Listing Reviews', 'geodirectory'), array('GeoDir_Privacy_Erasers', 'review_data_eraser'));
50 50
 		}
51 51
 
52 52
 		// Post favorites
53
-		if ( self::allow_export_favorites_data() ) {
54
-			$this->add_exporter( 'geodirectory-post-favorites', __( 'GeoDirectory Favorite Listings', 'geodirectory' ), array( 'GeoDir_Privacy_Exporters', 'favorites_data_exporter' ) );
53
+		if (self::allow_export_favorites_data()) {
54
+			$this->add_exporter('geodirectory-post-favorites', __('GeoDirectory Favorite Listings', 'geodirectory'), array('GeoDir_Privacy_Exporters', 'favorites_data_exporter'));
55 55
 		}
56
-		if ( self::allow_erase_favorites_data() ) {
57
-			$this->add_eraser( 'geodirectory-post-favorites', __( 'GeoDirectory Favorite Listings', 'geodirectory' ), array( 'GeoDir_Privacy_Erasers', 'favorites_data_eraser' ) );
56
+		if (self::allow_erase_favorites_data()) {
57
+			$this->add_eraser('geodirectory-post-favorites', __('GeoDirectory Favorite Listings', 'geodirectory'), array('GeoDir_Privacy_Erasers', 'favorites_data_eraser'));
58 58
 		}
59 59
 	}
60 60
 
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function get_privacy_message() {
69 69
 
70
-		$content = '<h2>' . __( 'Listings', 'geodirectory' ) . '</h2>' .
71
-		           '<p>' . __( 'We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory' ) . '</p>' .
72
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
73
-		           '<ul>' .
74
-		           '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory' ) . '</li>' .
75
-		           '<li>' . __( '- Send you important account/order/service information.', 'geodirectory' ) . '</li>' .
76
-		           '<li>' . __( '- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory' ) . '</li>' .
77
-		           '<li>' . __( '- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory' ) . '</li>' .
78
-		           '<li>' . __( '- Respond to your queries or complaints.', 'geodirectory' ) . '</li>' .
79
-		           '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory' ) . '</li>' .
80
-		           '</ul>' .
81
-		           '<h2>' . __( 'Reviews', 'geodirectory' ) . '</h2>' .
82
-		           '<p>' . __( 'We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory' ) . '</p>' .
83
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
84
-		           '<ul>' .
85
-		           '<li>' . __( '- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory' ) . '</li>' .
86
-		           '<li>' . __( '- Notify you of interactions such as approval or rejection of your review.', 'geodirectory' ) . '</li>' .
87
-		           '<li>' . __( '- Notify you of user interactions such as reply notifications.', 'geodirectory' ) . '</li>' .
88
-		           '</ul>' .
89
-		           '<h2>' . __( 'Listing contact forms', 'geodirectory' ) . '</h2>' .
90
-		           '<p>' . __( 'We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory' ) . '</p>' .
91
-		           '<p>' . __( 'Handling this data also allows us to:', 'geodirectory' ) . '</p>' .
92
-		           '<ul>' .
93
-		           '<li>' . __( '- Send your contact message and details to the listings contact email.', 'geodirectory' ) . '</li>' .
94
-		           '<li>' . __( '- Monitor the contact system for spam and abuse.', 'geodirectory' ) . '</li>' .
70
+		$content = '<h2>'.__('Listings', 'geodirectory').'</h2>'.
71
+		           '<p>'.__('We collect information about you during the add listing process on our site. This information may include, but is not limited to, your name, email address, phone number, address, locations details including GPS co-ordinates and any other details that might be requested from you for the purpose of adding your business/personal listings.', 'geodirectory').'</p>'.
72
+		           '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'.
73
+		           '<ul>'.
74
+		           '<li>'.__('- Display this information in a public facing manner (such as a web page or API request) and allow website users to search and view submitted listing information.', 'geodirectory').'</li>'.
75
+		           '<li>'.__('- Send you important account/order/service information.', 'geodirectory').'</li>'.
76
+		           '<li>'.__('- Provide a way for users to contact your listing via the provided contact information.', 'geodirectory').'</li>'.
77
+		           '<li>'.__('- Notify you of user interactions such as but not limited to review and contact notifications.', 'geodirectory').'</li>'.
78
+		           '<li>'.__('- Respond to your queries or complaints.', 'geodirectory').'</li>'.
79
+		           '<li>'.__('- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'geodirectory').'</li>'.
80
+		           '</ul>'.
81
+		           '<h2>'.__('Reviews', 'geodirectory').'</h2>'.
82
+		           '<p>'.__('We collect information about you during the leave a review process on our site. This information may include, but is not limited to, your name, email address, IP address, website url, image(s), review ratings and review texts.', 'geodirectory').'</p>'.
83
+		           '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'.
84
+		           '<ul>'.
85
+		           '<li>'.__('- Display this information in a public facing manner (such as a web page or API request).', 'geodirectory').'</li>'.
86
+		           '<li>'.__('- Notify you of interactions such as approval or rejection of your review.', 'geodirectory').'</li>'.
87
+		           '<li>'.__('- Notify you of user interactions such as reply notifications.', 'geodirectory').'</li>'.
88
+		           '</ul>'.
89
+		           '<h2>'.__('Listing contact forms', 'geodirectory').'</h2>'.
90
+		           '<p>'.__('We may collect information about you when you submit a contact form to a listing. This information may include, but is not limited to, your name, email address, IP address and contact texts.', 'geodirectory').'</p>'.
91
+		           '<p>'.__('Handling this data also allows us to:', 'geodirectory').'</p>'.
92
+		           '<ul>'.
93
+		           '<li>'.__('- Send your contact message and details to the listings contact email.', 'geodirectory').'</li>'.
94
+		           '<li>'.__('- Monitor the contact system for spam and abuse.', 'geodirectory').'</li>'.
95 95
 		           '</ul>';
96 96
 
97 97
 
98
-		return apply_filters( 'geodir_privacy_policy_content', $content) ;
98
+		return apply_filters('geodir_privacy_policy_content', $content);
99 99
 	}
100 100
 
101 101
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 * @param string $data The data being anonymized.
107 107
 	 * @return string Anonymized string.
108 108
 	 */
109
-	public function anonymize_custom_data_types( $anonymous, $type, $data ) {
110
-		switch ( $type ) {
109
+	public function anonymize_custom_data_types($anonymous, $type, $data) {
110
+		switch ($type) {
111 111
 			case 'phone':
112
-				$anonymous = preg_replace( '/\d/u', '0', $data );
112
+				$anonymous = preg_replace('/\d/u', '0', $data);
113 113
 				break;
114 114
 			case 'numeric_id':
115 115
 				$anonymous = 0;
@@ -122,46 +122,46 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 
124 124
 	public static function personal_data_exporter_key() {
125
-		if ( ! wp_doing_ajax() ) {
125
+		if (!wp_doing_ajax()) {
126 126
 			return false;
127 127
 		}
128 128
 
129
-		if ( empty( $_POST['id'] ) ) {
129
+		if (empty($_POST['id'])) {
130 130
 			return false;
131 131
 		}
132 132
 		$request_id = (int) $_POST['id'];
133 133
 
134
-		if ( $request_id < 1 ) {
134
+		if ($request_id < 1) {
135 135
 			return false;
136 136
 		}
137 137
 
138
-		if ( ! current_user_can( 'export_others_personal_data' ) ) {
138
+		if (!current_user_can('export_others_personal_data')) {
139 139
 			return false;
140 140
 		}
141 141
 
142 142
 		// Get the request data.
143
-		$request = wp_get_user_request_data( $request_id );
143
+		$request = wp_get_user_request_data($request_id);
144 144
 
145
-		if ( ! $request || 'export_personal_data' !== $request->action_name ) {
145
+		if (!$request || 'export_personal_data' !== $request->action_name) {
146 146
 			return false;
147 147
 		}
148 148
 
149 149
 		$email_address = $request->email;
150
-		if ( ! is_email( $email_address ) ) {
150
+		if (!is_email($email_address)) {
151 151
 			return false;
152 152
 		}
153 153
 
154
-		if ( ! isset( $_POST['exporter'] ) ) {
154
+		if (!isset($_POST['exporter'])) {
155 155
 			return false;
156 156
 		}
157 157
 		$exporter_index = (int) $_POST['exporter'];
158 158
 
159
-		if ( ! isset( $_POST['page'] ) ) {
159
+		if (!isset($_POST['page'])) {
160 160
 			return false;
161 161
 		}
162 162
 		$page = (int) $_POST['page'];
163 163
 
164
-		$send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false;
164
+		$send_as_email = isset($_POST['sendAsEmail']) ? ('true' === $_POST['sendAsEmail']) : false;
165 165
 
166 166
 		/**
167 167
 		 * Filters the array of exporter callbacks.
@@ -182,37 +182,37 @@  discard block
 block discarded – undo
182 182
 		 *     }
183 183
 		 * }
184 184
 		 */
185
-		$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
185
+		$exporters = apply_filters('wp_privacy_personal_data_exporters', array());
186 186
 
187
-		if ( ! is_array( $exporters ) ) {
187
+		if (!is_array($exporters)) {
188 188
 			return false;
189 189
 		}
190 190
 
191 191
 		// Do we have any registered exporters?
192
-		if ( 0 < count( $exporters ) ) {
193
-			if ( $exporter_index < 1 ) {
192
+		if (0 < count($exporters)) {
193
+			if ($exporter_index < 1) {
194 194
 				return false;
195 195
 			}
196 196
 
197
-			if ( $exporter_index > count( $exporters ) ) {
197
+			if ($exporter_index > count($exporters)) {
198 198
 				return false;
199 199
 			}
200 200
 
201
-			if ( $page < 1 ) {
201
+			if ($page < 1) {
202 202
 				return false;
203 203
 			}
204 204
 
205
-			$exporter_keys = array_keys( $exporters );
206
-			$exporter_key  = $exporter_keys[ $exporter_index - 1 ];
207
-			$exporter      = $exporters[ $exporter_key ];
205
+			$exporter_keys = array_keys($exporters);
206
+			$exporter_key  = $exporter_keys[$exporter_index - 1];
207
+			$exporter      = $exporters[$exporter_key];
208 208
 			
209
-			if ( ! is_array( $exporter ) || empty( $exporter_key ) ) {
209
+			if (!is_array($exporter) || empty($exporter_key)) {
210 210
 				return false;
211 211
 			}
212
-			if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) {
212
+			if (!array_key_exists('exporter_friendly_name', $exporter)) {
213 213
 				return false;
214 214
 			}
215
-			if ( ! array_key_exists( 'callback', $exporter ) ) {
215
+			if (!array_key_exists('callback', $exporter)) {
216 216
 				return false;
217 217
 			}
218 218
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		 * @param int    $request_id      The privacy request post ID associated with this request.
231 231
 		 * @param bool   $send_as_email   Whether the final results of the export should be emailed to the user.
232 232
 		 */
233
-		$exporter_key = apply_filters( 'geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email );
233
+		$exporter_key = apply_filters('geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email);
234 234
 
235 235
 		return $exporter_key;
236 236
 	}
@@ -238,66 +238,66 @@  discard block
 block discarded – undo
238 238
 	public static function exporter_post_type() {
239 239
 		$exporter_key = self::personal_data_exporter_key();
240 240
 
241
-		if ( empty( $exporter_key ) ) {
241
+		if (empty($exporter_key)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( strpos( $exporter_key, 'geodirectory-post-' ) !== 0 ) {
245
+		if (strpos($exporter_key, 'geodirectory-post-') !== 0) {
246 246
 			return false;
247 247
 		}
248 248
 
249
-		$post_type = str_replace( 'geodirectory-post-', '', $exporter_key );
249
+		$post_type = str_replace('geodirectory-post-', '', $exporter_key);
250 250
 
251
-		if ( $post_type != '' && in_array( $post_type, geodir_get_posttypes() ) ) {
251
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
252 252
 			return $post_type;
253 253
 		}
254 254
 
255 255
 		return false;
256 256
 	}
257 257
 
258
-	public static function allow_export_post_type_data( $post_type ) {
258
+	public static function allow_export_post_type_data($post_type) {
259 259
 		$allow = true;
260 260
 
261
-		return apply_filters( 'geodir_privacy_allow_export_post_type_data', $allow, $post_type );
261
+		return apply_filters('geodir_privacy_allow_export_post_type_data', $allow, $post_type);
262 262
 	}
263 263
 
264 264
 	public static function allow_export_reviews_data() {
265 265
 		$allow = true;
266 266
 
267
-		return apply_filters( 'geodir_privacy_allow_export_reviews_data', $allow );
267
+		return apply_filters('geodir_privacy_allow_export_reviews_data', $allow);
268 268
 	}
269 269
 
270 270
 	public static function allow_erase_reviews_data() {
271 271
 		$allow = true;
272 272
 
273
-		return apply_filters( 'geodir_privacy_allow_erase_reviews_data', $allow );
273
+		return apply_filters('geodir_privacy_allow_erase_reviews_data', $allow);
274 274
 	}
275 275
 
276 276
 	public static function allow_export_favorites_data() {
277 277
 		$allow = true;
278 278
 
279
-		return apply_filters( 'geodir_privacy_allow_export_favorites_data', $allow );
279
+		return apply_filters('geodir_privacy_allow_export_favorites_data', $allow);
280 280
 	}
281 281
 
282 282
 	public static function allow_erase_favorites_data() {
283 283
 		$allow = true;
284 284
 
285
-		return apply_filters( 'geodir_privacy_allow_erase_favorites_data', $allow );
285
+		return apply_filters('geodir_privacy_allow_erase_favorites_data', $allow);
286 286
 	}
287 287
 
288
-	public static function favorites_by_user( $email_address, $page ) {
289
-		if ( empty( $email_address ) ) {
288
+	public static function favorites_by_user($email_address, $page) {
289
+		if (empty($email_address)) {
290 290
 			return array();
291 291
 		}
292 292
 
293
-		$user = get_user_by( 'email', $email_address );
294
-		if ( empty( $user ) ) {
293
+		$user = get_user_by('email', $email_address);
294
+		if (empty($user)) {
295 295
 			return array();
296 296
 		}
297 297
 
298
-		$favourites = geodir_get_user_favourites( $user->ID );
298
+		$favourites = geodir_get_user_favourites($user->ID);
299 299
 
300
-		return ( ! empty( $favourites ) && is_array( $favourites ) ? $favourites : array() );
300
+		return (!empty($favourites) && is_array($favourites) ? $favourites : array());
301 301
 	}
302 302
 }
303 303
 
Please login to merge, or discard this patch.