@@ -30,8 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | if (is_ssl()) : |
32 | 32 | return str_replace('http://', 'https://', WP_PLUGIN_URL) . "/" . plugin_basename(dirname(dirname(__FILE__))); |
33 | - else : |
|
34 | - return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
33 | + else { |
|
34 | + : |
|
35 | + return WP_PLUGIN_URL . "/" . plugin_basename(dirname(dirname(__FILE__))); |
|
36 | + } |
|
35 | 37 | endif; |
36 | 38 | } |
37 | 39 | |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | { |
68 | 70 | $active_plugins = get_option('active_plugins'); |
69 | 71 | foreach ($active_plugins as $key => $active_plugin) { |
70 | - if (strstr($active_plugin, $plugin)) return true; |
|
72 | + if (strstr($active_plugin, $plugin)) { |
|
73 | + return true; |
|
74 | + } |
|
71 | 75 | } |
72 | 76 | return false; |
73 | 77 | } |
@@ -118,12 +122,25 @@ discard block |
||
118 | 122 | */ |
119 | 123 | function geodir_getlink($url, $params = array(), $use_existing_arguments = false) |
120 | 124 | { |
121 | - if ($use_existing_arguments) $params = $params + $_GET; |
|
122 | - if (!$params) return $url; |
|
125 | + if ($use_existing_arguments) { |
|
126 | + $params = $params + $_GET; |
|
127 | + } |
|
128 | + if (!$params) { |
|
129 | + return $url; |
|
130 | + } |
|
123 | 131 | $link = $url; |
124 | - if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end |
|
125 | - elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&'; //If there is no '&' at the END, add one. |
|
126 | - elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one. |
|
132 | + if (strpos($link, '?') === false) { |
|
133 | + $link .= '?'; |
|
134 | + } |
|
135 | + //If there is no '?' add one at the end |
|
136 | + elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) { |
|
137 | + $link .= '&'; |
|
138 | + } |
|
139 | + //If there is no '&' at the END, add one. |
|
140 | + elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) { |
|
141 | + $link .= '&'; |
|
142 | + } |
|
143 | + //If there is no '&' at the END, add one. |
|
127 | 144 | |
128 | 145 | $params_arr = array(); |
129 | 146 | foreach ($params as $key => $value) { |
@@ -161,9 +178,10 @@ discard block |
||
161 | 178 | $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
162 | 179 | |
163 | 180 | return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) ); |
164 | - } else |
|
165 | - return get_bloginfo('url'); |
|
166 | -} |
|
181 | + } else { |
|
182 | + return get_bloginfo('url'); |
|
183 | + } |
|
184 | + } |
|
167 | 185 | |
168 | 186 | /** |
169 | 187 | * Get the current page URL. |
@@ -268,24 +286,28 @@ discard block |
||
268 | 286 | case 'preview': |
269 | 287 | if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type']) |
270 | 288 | && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
271 | - ) |
|
272 | - return true; |
|
289 | + ) { |
|
290 | + return true; |
|
291 | + } |
|
273 | 292 | break; |
274 | 293 | case 'listing-success': |
275 | - if (is_page() && get_query_var('page_id') == geodir_success_page_id()) |
|
276 | - return true; |
|
294 | + if (is_page() && get_query_var('page_id') == geodir_success_page_id()) { |
|
295 | + return true; |
|
296 | + } |
|
277 | 297 | break; |
278 | 298 | case 'detail': |
279 | 299 | $post_type = get_query_var('post_type'); |
280 | 300 | if(is_array($post_type)){$post_type = reset($post_type);} |
281 | - if (is_single() && in_array($post_type, geodir_get_posttypes())) |
|
282 | - return true; |
|
301 | + if (is_single() && in_array($post_type, geodir_get_posttypes())) { |
|
302 | + return true; |
|
303 | + } |
|
283 | 304 | break; |
284 | 305 | case 'pt': |
285 | 306 | $post_type = get_query_var('post_type'); |
286 | 307 | if(is_array($post_type)){$post_type = reset($post_type);} |
287 | - if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) |
|
288 | - return true; |
|
308 | + if (is_post_type_archive() && in_array($post_type , geodir_get_posttypes()) && !is_tax()) { |
|
309 | + return true; |
|
310 | + } |
|
289 | 311 | |
290 | 312 | break; |
291 | 313 | case 'listing': |
@@ -296,23 +318,27 @@ discard block |
||
296 | 318 | } |
297 | 319 | $post_type = get_query_var('post_type'); |
298 | 320 | if(is_array($post_type)){$post_type = reset($post_type);} |
299 | - if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) |
|
300 | - return true; |
|
321 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) { |
|
322 | + return true; |
|
323 | + } |
|
301 | 324 | |
302 | 325 | break; |
303 | 326 | case 'home': |
304 | 327 | |
305 | - if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) |
|
306 | - return true; |
|
328 | + if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) { |
|
329 | + return true; |
|
330 | + } |
|
307 | 331 | |
308 | 332 | break; |
309 | 333 | case 'location': |
310 | - if (is_page() && get_query_var('page_id') == geodir_location_page_id()) |
|
311 | - return true; |
|
334 | + if (is_page() && get_query_var('page_id') == geodir_location_page_id()) { |
|
335 | + return true; |
|
336 | + } |
|
312 | 337 | break; |
313 | 338 | case 'author': |
314 | - if (is_author() && isset($_REQUEST['geodir_dashbord'])) |
|
315 | - return true; |
|
339 | + if (is_author() && isset($_REQUEST['geodir_dashbord'])) { |
|
340 | + return true; |
|
341 | + } |
|
316 | 342 | |
317 | 343 | if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) { |
318 | 344 | if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) { |
@@ -321,24 +347,29 @@ discard block |
||
321 | 347 | } |
322 | 348 | break; |
323 | 349 | case 'search': |
324 | - if (is_search() && isset($_REQUEST['geodir_search'])) |
|
325 | - return true; |
|
350 | + if (is_search() && isset($_REQUEST['geodir_search'])) { |
|
351 | + return true; |
|
352 | + } |
|
326 | 353 | break; |
327 | 354 | case 'info': |
328 | - if (is_page() && get_query_var('page_id') == geodir_info_page_id()) |
|
329 | - return true; |
|
355 | + if (is_page() && get_query_var('page_id') == geodir_info_page_id()) { |
|
356 | + return true; |
|
357 | + } |
|
330 | 358 | break; |
331 | 359 | case 'login': |
332 | - if (is_page() && get_query_var('page_id') == geodir_login_page_id()) |
|
333 | - return true; |
|
360 | + if (is_page() && get_query_var('page_id') == geodir_login_page_id()) { |
|
361 | + return true; |
|
362 | + } |
|
334 | 363 | break; |
335 | 364 | case 'checkout': |
336 | - if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) |
|
337 | - return true; |
|
365 | + if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) { |
|
366 | + return true; |
|
367 | + } |
|
338 | 368 | break; |
339 | 369 | case 'invoices': |
340 | - if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) |
|
341 | - return true; |
|
370 | + if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) { |
|
371 | + return true; |
|
372 | + } |
|
342 | 373 | break; |
343 | 374 | default: |
344 | 375 | return false; |
@@ -366,8 +397,9 @@ discard block |
||
366 | 397 | //$wp->query_vars['gd_is_geodir_page'] = false; |
367 | 398 | //print_r() |
368 | 399 | if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) { |
369 | - if (get_option('geodir_set_as_home')) |
|
370 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
400 | + if (get_option('geodir_set_as_home')) { |
|
401 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
402 | + } |
|
371 | 403 | if(geodir_is_page('home')){ |
372 | 404 | $wp->query_vars['gd_is_geodir_page'] = true; |
373 | 405 | } |
@@ -386,8 +418,9 @@ discard block |
||
386 | 418 | || $wp->query_vars['page_id'] == geodir_login_page_id() |
387 | 419 | || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
388 | 420 | || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
389 | - ) |
|
390 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
421 | + ) { |
|
422 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
423 | + } |
|
391 | 424 | } |
392 | 425 | |
393 | 426 | if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) { |
@@ -404,8 +437,9 @@ discard block |
||
404 | 437 | || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id()) |
405 | 438 | || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id()) |
406 | 439 | ) |
407 | - ) |
|
408 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
440 | + ) { |
|
441 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
442 | + } |
|
409 | 443 | } |
410 | 444 | |
411 | 445 | |
@@ -431,12 +465,14 @@ discard block |
||
431 | 465 | |
432 | 466 | } |
433 | 467 | |
434 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) |
|
435 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
468 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) { |
|
469 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
470 | + } |
|
436 | 471 | |
437 | 472 | |
438 | - if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) |
|
439 | - $wp->query_vars['gd_is_geodir_page'] = true; |
|
473 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) { |
|
474 | + $wp->query_vars['gd_is_geodir_page'] = true; |
|
475 | + } |
|
440 | 476 | |
441 | 477 | |
442 | 478 | //check if homepage |
@@ -466,11 +502,12 @@ discard block |
||
466 | 502 | function geodir_is_geodir_page() |
467 | 503 | { |
468 | 504 | global $wp; |
469 | - if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) |
|
470 | - return true; |
|
471 | - else |
|
472 | - return false; |
|
473 | -} |
|
505 | + if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) { |
|
506 | + return true; |
|
507 | + } else { |
|
508 | + return false; |
|
509 | + } |
|
510 | + } |
|
474 | 511 | |
475 | 512 | if (!function_exists('geodir_get_imagesize')) { |
476 | 513 | /** |
@@ -848,20 +885,16 @@ discard block |
||
848 | 885 | $subject .= ' - ADMIN BCC COPY'; |
849 | 886 | $admin_bcc = true; |
850 | 887 | |
851 | - } |
|
852 | - elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) { |
|
888 | + } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) { |
|
853 | 889 | $subject .= ' - ADMIN BCC COPY'; |
854 | 890 | $admin_bcc = true; |
855 | - } |
|
856 | - elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) { |
|
891 | + } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) { |
|
857 | 892 | $subject .= ' - ADMIN BCC COPY'; |
858 | 893 | $admin_bcc = true; |
859 | - } |
|
860 | - elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) { |
|
894 | + } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) { |
|
861 | 895 | $subject .= ' - ADMIN BCC COPY'; |
862 | 896 | $admin_bcc = true; |
863 | - } |
|
864 | - elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) { |
|
897 | + } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) { |
|
865 | 898 | $subject .= ' - ADMIN BCC COPY'; |
866 | 899 | $admin_bcc = true; |
867 | 900 | } |
@@ -1030,21 +1063,24 @@ discard block |
||
1030 | 1063 | $is_location_last = ''; |
1031 | 1064 | $is_taxonomy_last = ''; |
1032 | 1065 | $breadcrumb .= '<li>'; |
1033 | - if (get_query_var($gd_post_type . 'category')) |
|
1034 | - $gd_taxonomy = $gd_post_type . 'category'; |
|
1035 | - elseif (get_query_var($gd_post_type . '_tags')) |
|
1036 | - $gd_taxonomy = $gd_post_type . '_tags'; |
|
1066 | + if (get_query_var($gd_post_type . 'category')) { |
|
1067 | + $gd_taxonomy = $gd_post_type . 'category'; |
|
1068 | + } elseif (get_query_var($gd_post_type . '_tags')) { |
|
1069 | + $gd_taxonomy = $gd_post_type . '_tags'; |
|
1070 | + } |
|
1037 | 1071 | |
1038 | 1072 | $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
1039 | - if (!empty($gd_taxonomy) || geodir_is_page('detail')) |
|
1040 | - $is_location_last = false; |
|
1041 | - else |
|
1042 | - $is_location_last = true; |
|
1043 | - |
|
1044 | - if (!empty($gd_taxonomy) && geodir_is_page('listing')) |
|
1045 | - $is_taxonomy_last = true; |
|
1046 | - else |
|
1047 | - $is_taxonomy_last = false; |
|
1073 | + if (!empty($gd_taxonomy) || geodir_is_page('detail')) { |
|
1074 | + $is_location_last = false; |
|
1075 | + } else { |
|
1076 | + $is_location_last = true; |
|
1077 | + } |
|
1078 | + |
|
1079 | + if (!empty($gd_taxonomy) && geodir_is_page('listing')) { |
|
1080 | + $is_taxonomy_last = true; |
|
1081 | + } else { |
|
1082 | + $is_taxonomy_last = false; |
|
1083 | + } |
|
1048 | 1084 | |
1049 | 1085 | if (!empty($location_terms)) { |
1050 | 1086 | $geodir_get_locations = function_exists('get_actual_location_name') ? true : false; |
@@ -1126,8 +1162,9 @@ discard block |
||
1126 | 1162 | { |
1127 | 1163 | if (get_query_var($gd_post_type . '_tags')) { |
1128 | 1164 | $cat_link = $listing_link . 'tags/'; |
1129 | - } else |
|
1130 | - $cat_link = $listing_link; |
|
1165 | + } else { |
|
1166 | + $cat_link = $listing_link; |
|
1167 | + } |
|
1131 | 1168 | |
1132 | 1169 | foreach ($location_terms as $key => $location_term) { |
1133 | 1170 | if ($location_manager && in_array($key, $hide_url_part)) { |
@@ -1154,9 +1191,9 @@ discard block |
||
1154 | 1191 | $term_link_text = geodir_ucwords(urldecode($term_link_text)); |
1155 | 1192 | } |
1156 | 1193 | |
1157 | - if ($term_index == count($term_array) && $is_taxonomy_last) |
|
1158 | - $breadcrumb .= $separator . $term_link_text; |
|
1159 | - else { |
|
1194 | + if ($term_index == count($term_array) && $is_taxonomy_last) { |
|
1195 | + $breadcrumb .= $separator . $term_link_text; |
|
1196 | + } else { |
|
1160 | 1197 | $cat_link .= $term . '/'; |
1161 | 1198 | $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
1162 | 1199 | } |
@@ -1167,8 +1204,9 @@ discard block |
||
1167 | 1204 | |
1168 | 1205 | } |
1169 | 1206 | |
1170 | - if (geodir_is_page('detail')) |
|
1171 | - $breadcrumb .= $separator . get_the_title(); |
|
1207 | + if (geodir_is_page('detail')) { |
|
1208 | + $breadcrumb .= $separator . get_the_title(); |
|
1209 | + } |
|
1172 | 1210 | |
1173 | 1211 | $breadcrumb .= '</li>'; |
1174 | 1212 | |
@@ -1205,8 +1243,9 @@ discard block |
||
1205 | 1243 | |
1206 | 1244 | $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>'; |
1207 | 1245 | $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']); |
1208 | - } else |
|
1209 | - $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory'); |
|
1246 | + } else { |
|
1247 | + $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory'); |
|
1248 | + } |
|
1210 | 1249 | |
1211 | 1250 | $breadcrumb .= '</li>'; |
1212 | 1251 | } elseif (is_category() || is_single()) { |
@@ -1281,12 +1320,14 @@ discard block |
||
1281 | 1320 | function geodir_allow_wpadmin() |
1282 | 1321 | { |
1283 | 1322 | global $wpdb; |
1284 | - if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through |
|
1323 | + if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) { |
|
1324 | + // checking action in request to allow ajax request go through |
|
1285 | 1325 | { |
1286 | 1326 | if (current_user_can('manage_options')) { |
1287 | 1327 | } else { |
1288 | 1328 | |
1289 | - wp_redirect(home_url()); |
|
1329 | + wp_redirect(home_url()); |
|
1330 | + } |
|
1290 | 1331 | exit; |
1291 | 1332 | } |
1292 | 1333 | |
@@ -1318,8 +1359,9 @@ discard block |
||
1318 | 1359 | $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : ''; |
1319 | 1360 | |
1320 | 1361 | $upload = wp_upload_bits($file_name, 0, '', $post_upload_date); |
1321 | - if ($upload['error']) |
|
1322 | - return new WP_Error('upload_dir_error', $upload['error']); |
|
1362 | + if ($upload['error']) { |
|
1363 | + return new WP_Error('upload_dir_error', $upload['error']); |
|
1364 | + } |
|
1323 | 1365 | |
1324 | 1366 | // fetch the remote url and write it to the placeholder file |
1325 | 1367 | $headers = wp_remote_get($url, array('stream' => true,'filename' => $upload['file'])); |
@@ -1333,11 +1375,9 @@ discard block |
||
1333 | 1375 | // make sure the fetch was successful |
1334 | 1376 | elseif ($headers['response']['code'] != '200') { |
1335 | 1377 | $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response'])); |
1336 | - } |
|
1337 | - elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
|
1378 | + } elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) { |
|
1338 | 1379 | $log_message = __('Remote file is incorrect size', 'geodirectory'); |
1339 | - } |
|
1340 | - elseif (0 == $filesize) { |
|
1380 | + } elseif (0 == $filesize) { |
|
1341 | 1381 | $log_message = __('Zero size file downloaded', 'geodirectory'); |
1342 | 1382 | } |
1343 | 1383 | |
@@ -1389,10 +1429,11 @@ discard block |
||
1389 | 1429 | function geodir_dummy_folder_exists() |
1390 | 1430 | { |
1391 | 1431 | $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
1392 | - if (!is_dir($path)) |
|
1393 | - return false; |
|
1394 | - else |
|
1395 | - return true; |
|
1432 | + if (!is_dir($path)) { |
|
1433 | + return false; |
|
1434 | + } else { |
|
1435 | + return true; |
|
1436 | + } |
|
1396 | 1437 | |
1397 | 1438 | } |
1398 | 1439 | |
@@ -1663,12 +1704,10 @@ discard block |
||
1663 | 1704 | if ($message_type == 'registration' && get_option('bcc_new_user')) { |
1664 | 1705 | $subject .= ' - ADMIN BCC COPY'; |
1665 | 1706 | $admin_bcc = true; |
1666 | - } |
|
1667 | - elseif ($message_type == 'send_friend' && get_option('bcc_friend')) { |
|
1707 | + } elseif ($message_type == 'send_friend' && get_option('bcc_friend')) { |
|
1668 | 1708 | $subject .= ' - ADMIN BCC COPY'; |
1669 | 1709 | $admin_bcc = true; |
1670 | - } |
|
1671 | - elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) { |
|
1710 | + } elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) { |
|
1672 | 1711 | $subject .= ' - ADMIN BCC COPY'; |
1673 | 1712 | $admin_bcc = true; |
1674 | 1713 | } |
@@ -1712,7 +1751,9 @@ discard block |
||
1712 | 1751 | $res = array(); |
1713 | 1752 | foreach ($ids_array as $id) { |
1714 | 1753 | $xlat = icl_object_id($id, $type, false); |
1715 | - if (!is_null($xlat)) $res[] = $xlat; |
|
1754 | + if (!is_null($xlat)) { |
|
1755 | + $res[] = $xlat; |
|
1756 | + } |
|
1716 | 1757 | } |
1717 | 1758 | return $res; |
1718 | 1759 | } else { |
@@ -2053,8 +2094,9 @@ discard block |
||
2053 | 2094 | $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type); |
2054 | 2095 | |
2055 | 2096 | $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
2056 | - if ( !$page ) |
|
2057 | - $page = 1; |
|
2097 | + if ( !$page ) { |
|
2098 | + $page = 1; |
|
2099 | + } |
|
2058 | 2100 | |
2059 | 2101 | $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : ""; |
2060 | 2102 | |
@@ -2380,7 +2422,7 @@ discard block |
||
2380 | 2422 | $home_url = str_replace("www.", "", $home_url); |
2381 | 2423 | if ( (strpos($home_url, $cur_url) !== false || strpos($home_url . '/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')) ) { |
2382 | 2424 | return true; |
2383 | - }elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){ |
|
2425 | + } elseif(get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front')==get_option('geodir_home_page')){ |
|
2384 | 2426 | return true; |
2385 | 2427 | } else { |
2386 | 2428 | return false; |
@@ -2466,9 +2508,9 @@ discard block |
||
2466 | 2508 | $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15; |
2467 | 2509 | if(!empty($gd_post_type)){ |
2468 | 2510 | $default_post_type = $gd_post_type; |
2469 | - }elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){ |
|
2511 | + } elseif(isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ){ |
|
2470 | 2512 | $default_post_type = $instance['default_post_type']; |
2471 | - }else{ |
|
2513 | + } else{ |
|
2472 | 2514 | $all_gd_post_type = geodir_get_posttypes(); |
2473 | 2515 | $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : ''; |
2474 | 2516 | } |
@@ -2892,8 +2934,9 @@ discard block |
||
2892 | 2934 | $name = $postobj->labels->name; |
2893 | 2935 | |
2894 | 2936 | $selected = ''; |
2895 | - if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) |
|
2896 | - $selected = 'selected="selected"'; |
|
2937 | + if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) { |
|
2938 | + $selected = 'selected="selected"'; |
|
2939 | + } |
|
2897 | 2940 | |
2898 | 2941 | /** |
2899 | 2942 | * Filter add listing link. |
@@ -3360,8 +3403,9 @@ discard block |
||
3360 | 3403 | $geodir_is_widget_listing = false; |
3361 | 3404 | |
3362 | 3405 | $GLOBALS['post'] = $current_post; |
3363 | - if (!empty($current_post)) |
|
3364 | - setup_postdata($current_post); |
|
3406 | + if (!empty($current_post)) { |
|
3407 | + setup_postdata($current_post); |
|
3408 | + } |
|
3365 | 3409 | $map_jason = $current_map_jason; |
3366 | 3410 | $map_canvas_arr = $current_map_canvas_arr; |
3367 | 3411 | ?> |
@@ -3739,11 +3783,15 @@ discard block |
||
3739 | 3783 | |
3740 | 3784 | $language_file = geodir_plugin_path() . '/db-language.php'; |
3741 | 3785 | |
3742 | - if(is_file($language_file) && !is_writable($language_file)) |
|
3743 | - return false; // Not possible to create. |
|
3786 | + if(is_file($language_file) && !is_writable($language_file)) { |
|
3787 | + return false; |
|
3788 | + } |
|
3789 | + // Not possible to create. |
|
3744 | 3790 | |
3745 | - if(!is_file($language_file) && !is_writable(dirname($language_file))) |
|
3746 | - return false; // Not possible to create. |
|
3791 | + if(!is_file($language_file) && !is_writable(dirname($language_file))) { |
|
3792 | + return false; |
|
3793 | + } |
|
3794 | + // Not possible to create. |
|
3747 | 3795 | |
3748 | 3796 | $contents_strings = array(); |
3749 | 3797 | |
@@ -3786,8 +3834,10 @@ discard block |
||
3786 | 3834 | |
3787 | 3835 | $contents .= implode(PHP_EOL, $contents_foot); |
3788 | 3836 | |
3789 | - if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) |
|
3790 | - return false; // Failure; could not write file. |
|
3837 | + if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) { |
|
3838 | + return false; |
|
3839 | + } |
|
3840 | + // Failure; could not write file. |
|
3791 | 3841 | |
3792 | 3842 | return true; |
3793 | 3843 | } |
@@ -3813,23 +3863,29 @@ discard block |
||
3813 | 3863 | |
3814 | 3864 | if (!empty($rows)) { |
3815 | 3865 | foreach($rows as $row) { |
3816 | - if (!empty($row->admin_title)) |
|
3817 | - $translation_texts[] = stripslashes_deep($row->admin_title); |
|
3866 | + if (!empty($row->admin_title)) { |
|
3867 | + $translation_texts[] = stripslashes_deep($row->admin_title); |
|
3868 | + } |
|
3818 | 3869 | |
3819 | - if (!empty($row->admin_desc)) |
|
3820 | - $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
3870 | + if (!empty($row->admin_desc)) { |
|
3871 | + $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
3872 | + } |
|
3821 | 3873 | |
3822 | - if (!empty($row->site_title)) |
|
3823 | - $translation_texts[] = stripslashes_deep($row->site_title); |
|
3874 | + if (!empty($row->site_title)) { |
|
3875 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
3876 | + } |
|
3824 | 3877 | |
3825 | - if (!empty($row->clabels)) |
|
3826 | - $translation_texts[] = stripslashes_deep($row->clabels); |
|
3878 | + if (!empty($row->clabels)) { |
|
3879 | + $translation_texts[] = stripslashes_deep($row->clabels); |
|
3880 | + } |
|
3827 | 3881 | |
3828 | - if (!empty($row->required_msg)) |
|
3829 | - $translation_texts[] = stripslashes_deep($row->required_msg); |
|
3882 | + if (!empty($row->required_msg)) { |
|
3883 | + $translation_texts[] = stripslashes_deep($row->required_msg); |
|
3884 | + } |
|
3830 | 3885 | |
3831 | - if (!empty($row->default_value)) |
|
3832 | - $translation_texts[] = stripslashes_deep($row->default_value); |
|
3886 | + if (!empty($row->default_value)) { |
|
3887 | + $translation_texts[] = stripslashes_deep($row->default_value); |
|
3888 | + } |
|
3833 | 3889 | |
3834 | 3890 | if (!empty($row->option_values)) { |
3835 | 3891 | $option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values)); |
@@ -3851,14 +3907,17 @@ discard block |
||
3851 | 3907 | |
3852 | 3908 | if (!empty($rows)) { |
3853 | 3909 | foreach($rows as $row) { |
3854 | - if (!empty($row->site_title)) |
|
3855 | - $translation_texts[] = stripslashes_deep($row->site_title); |
|
3910 | + if (!empty($row->site_title)) { |
|
3911 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
3912 | + } |
|
3856 | 3913 | |
3857 | - if (!empty($row->asc_title)) |
|
3858 | - $translation_texts[] = stripslashes_deep($row->asc_title); |
|
3914 | + if (!empty($row->asc_title)) { |
|
3915 | + $translation_texts[] = stripslashes_deep($row->asc_title); |
|
3916 | + } |
|
3859 | 3917 | |
3860 | - if (!empty($row->desc_title)) |
|
3861 | - $translation_texts[] = stripslashes_deep($row->desc_title); |
|
3918 | + if (!empty($row->desc_title)) { |
|
3919 | + $translation_texts[] = stripslashes_deep($row->desc_title); |
|
3920 | + } |
|
3862 | 3921 | } |
3863 | 3922 | } |
3864 | 3923 | |
@@ -3869,14 +3928,17 @@ discard block |
||
3869 | 3928 | |
3870 | 3929 | if (!empty($rows)) { |
3871 | 3930 | foreach($rows as $row) { |
3872 | - if (!empty($row->field_site_name)) |
|
3873 | - $translation_texts[] = stripslashes_deep($row->field_site_name); |
|
3931 | + if (!empty($row->field_site_name)) { |
|
3932 | + $translation_texts[] = stripslashes_deep($row->field_site_name); |
|
3933 | + } |
|
3874 | 3934 | |
3875 | - if (!empty($row->front_search_title)) |
|
3876 | - $translation_texts[] = stripslashes_deep($row->front_search_title); |
|
3935 | + if (!empty($row->front_search_title)) { |
|
3936 | + $translation_texts[] = stripslashes_deep($row->front_search_title); |
|
3937 | + } |
|
3877 | 3938 | |
3878 | - if (!empty($row->field_desc)) |
|
3879 | - $translation_texts[] = stripslashes_deep($row->field_desc); |
|
3939 | + if (!empty($row->field_desc)) { |
|
3940 | + $translation_texts[] = stripslashes_deep($row->field_desc); |
|
3941 | + } |
|
3880 | 3942 | } |
3881 | 3943 | } |
3882 | 3944 | } |
@@ -4194,7 +4256,7 @@ discard block |
||
4194 | 4256 | if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
4195 | 4257 | $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
4196 | 4258 | } |
4197 | - }elseif($gd_page=='add-listing'){ |
|
4259 | + } elseif($gd_page=='add-listing'){ |
|
4198 | 4260 | $geodir_post_types = get_option('geodir_post_types'); |
4199 | 4261 | $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : ''; |
4200 | 4262 | if(!$spt && isset($_REQUEST['pid'])){ |
@@ -4204,8 +4266,7 @@ discard block |
||
4204 | 4266 | if(isset($geodir_post_types[$spt]['labels']['singular_name'])){ |
4205 | 4267 | $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory'); |
4206 | 4268 | } |
4207 | - } |
|
4208 | - elseif($post->post_type){ |
|
4269 | + } elseif($post->post_type){ |
|
4209 | 4270 | $geodir_post_types = get_option('geodir_post_types'); |
4210 | 4271 | if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){ |
4211 | 4272 | $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory'); |
@@ -4224,15 +4285,14 @@ discard block |
||
4224 | 4285 | if(isset($geodir_post_types[$spt]['labels']['name'])){ |
4225 | 4286 | $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
4226 | 4287 | } |
4227 | - }elseif($gd_page=='add-listing'){ |
|
4288 | + } elseif($gd_page=='add-listing'){ |
|
4228 | 4289 | $geodir_post_types = get_option('geodir_post_types'); |
4229 | 4290 | $spt = sanitize_text_field($_REQUEST['listing_type']); |
4230 | 4291 | if(!$spt){$spt='gd_place';} |
4231 | 4292 | if(isset($geodir_post_types[$spt]['labels']['name'])){ |
4232 | 4293 | $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory'); |
4233 | 4294 | } |
4234 | - } |
|
4235 | - elseif(isset($post->post_type) && $post->post_type){ |
|
4295 | + } elseif(isset($post->post_type) && $post->post_type){ |
|
4236 | 4296 | $geodir_post_types = get_option('geodir_post_types'); |
4237 | 4297 | if(isset($geodir_post_types[$post->post_type]['labels']['name'])){ |
4238 | 4298 | $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory'); |
@@ -4252,7 +4312,7 @@ discard block |
||
4252 | 4312 | $cat = get_term($post->default_category, $post->post_type . 'category'); |
4253 | 4313 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
4254 | 4314 | } |
4255 | - }elseif($gd_page=='listing'){ |
|
4315 | + } elseif($gd_page=='listing'){ |
|
4256 | 4316 | $queried_object = get_queried_object(); |
4257 | 4317 | if(isset($queried_object->name)){ |
4258 | 4318 | $cat_name = $queried_object->name; |
@@ -4269,7 +4329,7 @@ discard block |
||
4269 | 4329 | $cat = get_term($post->default_category, $post->post_type . 'category'); |
4270 | 4330 | $cat_name = (isset($cat->name)) ? $cat->name : ''; |
4271 | 4331 | } |
4272 | - }elseif($gd_page=='listing'){ |
|
4332 | + } elseif($gd_page=='listing'){ |
|
4273 | 4333 | $queried_object = get_queried_object(); |
4274 | 4334 | if(isset($queried_object->name)){ |
4275 | 4335 | $cat_name = $queried_object->name; |
@@ -4487,38 +4547,54 @@ discard block |
||
4487 | 4547 | $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : ''; |
4488 | 4548 | |
4489 | 4549 | if (!empty($labels)) { |
4490 | - if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) |
|
4491 | - $translation_texts[] = $labels['name']; |
|
4492 | - if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) |
|
4493 | - $translation_texts[] = $labels['singular_name']; |
|
4494 | - if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) |
|
4495 | - $translation_texts[] = $labels['add_new']; |
|
4496 | - if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) |
|
4497 | - $translation_texts[] = $labels['add_new_item']; |
|
4498 | - if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) |
|
4499 | - $translation_texts[] = $labels['edit_item']; |
|
4500 | - if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) |
|
4501 | - $translation_texts[] = $labels['new_item']; |
|
4502 | - if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) |
|
4503 | - $translation_texts[] = $labels['view_item']; |
|
4504 | - if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) |
|
4505 | - $translation_texts[] = $labels['search_items']; |
|
4506 | - if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) |
|
4507 | - $translation_texts[] = $labels['not_found']; |
|
4508 | - if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) |
|
4509 | - $translation_texts[] = $labels['not_found_in_trash']; |
|
4510 | - if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) |
|
4511 | - $translation_texts[] = $labels['label_post_profile']; |
|
4512 | - if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) |
|
4513 | - $translation_texts[] = $labels['label_post_info']; |
|
4514 | - if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) |
|
4515 | - $translation_texts[] = $labels['label_post_images']; |
|
4516 | - if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) |
|
4517 | - $translation_texts[] = $labels['label_post_map']; |
|
4518 | - if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) |
|
4519 | - $translation_texts[] = $labels['label_reviews']; |
|
4520 | - if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) |
|
4521 | - $translation_texts[] = $labels['label_related_listing']; |
|
4550 | + if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) { |
|
4551 | + $translation_texts[] = $labels['name']; |
|
4552 | + } |
|
4553 | + if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) { |
|
4554 | + $translation_texts[] = $labels['singular_name']; |
|
4555 | + } |
|
4556 | + if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) { |
|
4557 | + $translation_texts[] = $labels['add_new']; |
|
4558 | + } |
|
4559 | + if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) { |
|
4560 | + $translation_texts[] = $labels['add_new_item']; |
|
4561 | + } |
|
4562 | + if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) { |
|
4563 | + $translation_texts[] = $labels['edit_item']; |
|
4564 | + } |
|
4565 | + if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) { |
|
4566 | + $translation_texts[] = $labels['new_item']; |
|
4567 | + } |
|
4568 | + if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) { |
|
4569 | + $translation_texts[] = $labels['view_item']; |
|
4570 | + } |
|
4571 | + if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) { |
|
4572 | + $translation_texts[] = $labels['search_items']; |
|
4573 | + } |
|
4574 | + if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) { |
|
4575 | + $translation_texts[] = $labels['not_found']; |
|
4576 | + } |
|
4577 | + if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) { |
|
4578 | + $translation_texts[] = $labels['not_found_in_trash']; |
|
4579 | + } |
|
4580 | + if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) { |
|
4581 | + $translation_texts[] = $labels['label_post_profile']; |
|
4582 | + } |
|
4583 | + if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) { |
|
4584 | + $translation_texts[] = $labels['label_post_info']; |
|
4585 | + } |
|
4586 | + if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) { |
|
4587 | + $translation_texts[] = $labels['label_post_images']; |
|
4588 | + } |
|
4589 | + if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) { |
|
4590 | + $translation_texts[] = $labels['label_post_map']; |
|
4591 | + } |
|
4592 | + if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) { |
|
4593 | + $translation_texts[] = $labels['label_reviews']; |
|
4594 | + } |
|
4595 | + if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) { |
|
4596 | + $translation_texts[] = $labels['label_related_listing']; |
|
4597 | + } |
|
4522 | 4598 | } |
4523 | 4599 | |
4524 | 4600 | if ($description != '' && !in_array($description, $translation_texts)) { |
@@ -4526,11 +4602,13 @@ discard block |
||
4526 | 4602 | } |
4527 | 4603 | |
4528 | 4604 | if (!empty($seo)) { |
4529 | - if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) |
|
4530 | - $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
4605 | + if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) { |
|
4606 | + $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
4607 | + } |
|
4531 | 4608 | |
4532 | - if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) |
|
4533 | - $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
4609 | + if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) { |
|
4610 | + $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
4611 | + } |
|
4534 | 4612 | } |
4535 | 4613 | } |
4536 | 4614 | } |
@@ -4556,16 +4634,20 @@ discard block |
||
4556 | 4634 | $hide_region_part = get_option('geodir_location_hide_region_part'); |
4557 | 4635 | |
4558 | 4636 | if ($hide_region_part && $hide_country_part) { |
4559 | - if (isset($location_terms['gd_country'])) |
|
4560 | - unset($location_terms['gd_country']); |
|
4561 | - if (isset($location_terms['gd_region'])) |
|
4562 | - unset($location_terms['gd_region']); |
|
4637 | + if (isset($location_terms['gd_country'])) { |
|
4638 | + unset($location_terms['gd_country']); |
|
4639 | + } |
|
4640 | + if (isset($location_terms['gd_region'])) { |
|
4641 | + unset($location_terms['gd_region']); |
|
4642 | + } |
|
4563 | 4643 | } else if ($hide_region_part && !$hide_country_part) { |
4564 | - if (isset($location_terms['gd_region'])) |
|
4565 | - unset($location_terms['gd_region']); |
|
4644 | + if (isset($location_terms['gd_region'])) { |
|
4645 | + unset($location_terms['gd_region']); |
|
4646 | + } |
|
4566 | 4647 | } else if (!$hide_region_part && $hide_country_part) { |
4567 | - if (isset($location_terms['gd_country'])) |
|
4568 | - unset($location_terms['gd_country']); |
|
4648 | + if (isset($location_terms['gd_country'])) { |
|
4649 | + unset($location_terms['gd_country']); |
|
4650 | + } |
|
4569 | 4651 | } |
4570 | 4652 | } |
4571 | 4653 |