Passed
Pull Request — master (#205)
by Kiran
06:14
created
geodirectory-admin/admin_functions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6537,7 +6537,7 @@  discard block
 block discarded – undo
6537 6537
  *
6538 6538
  * @since 1.5.0
6539 6539
  *
6540
- * @return True if WPML is active else False.
6540
+ * @return boolean if WPML is active else False.
6541 6541
  */
6542 6542
 function geodir_is_wpml() {
6543 6543
 	if (function_exists('icl_object_id')) {
@@ -6633,7 +6633,7 @@  discard block
 block discarded – undo
6633 6633
  * @param int $master_post_id Original Post ID.
6634 6634
  * @param int $tr_post_id Translation Post ID.
6635 6635
  * @param string $lang Language code for translating post.
6636
- * @return bool True for success, False for fail.
6636
+ * @return boolean|null True for success, False for fail.
6637 6637
  */
6638 6638
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
6639 6639
 	global $sitepress, $wpdb;
Please login to merge, or discard this patch.
Braces   +240 added lines, -133 removed lines patch added patch discarded remove patch
@@ -177,8 +177,9 @@  discard block
 block discarded – undo
177 177
 
178 178
         $thumb_img_arr = array();
179 179
 
180
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
181
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
180
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
181
+                    $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
182
+        }
182 183
 
183 184
         $totImg = '';
184 185
         $image_limit = '';
@@ -234,7 +235,9 @@  discard block
 block discarded – undo
234 235
     {
235 236
         global $menu, $geodirectory;
236 237
 
237
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
238
+        if (current_user_can('manage_options')) {
239
+            $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
240
+        }
238 241
 
239 242
         add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
240 243
 
@@ -303,7 +306,9 @@  discard block
 block discarded – undo
303 306
      */
304 307
     function geodir_admin_custom_menu_order()
305 308
     {
306
-        if (!current_user_can('manage_options')) return false;
309
+        if (!current_user_can('manage_options')) {
310
+            return false;
311
+        }
307 312
         return true;
308 313
     }
309 314
 }
@@ -334,10 +339,11 @@  discard block
 block discarded – undo
334 339
 			case 'fail':
335 340
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
336 341
 				
337
-				if ($gderr == 21)
338
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
339
-				else
340
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
342
+				if ($gderr == 21) {
343
+							    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
344
+				} else {
345
+									echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
346
+				}
341 347
                 break;
342 348
         }
343 349
     }
@@ -374,8 +380,12 @@  discard block
 block discarded – undo
374 380
         include_once('option-pages/' . $current_tab . '_array.php');
375 381
     }
376 382
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
377
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
378
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
383
+        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) {
384
+            die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
385
+        }
386
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) {
387
+            die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
388
+        }
379 389
 		
380 390
 		/**
381 391
 		 * Fires before updating geodirectory admin settings.
@@ -387,8 +397,9 @@  discard block
 block discarded – undo
387 397
 		 */
388 398
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
389 399
 		
390
-        if (!empty($geodir_settings[$current_tab]))
391
-            geodir_update_options($geodir_settings[$current_tab]);
400
+        if (!empty($geodir_settings[$current_tab])) {
401
+                    geodir_update_options($geodir_settings[$current_tab]);
402
+        }
392 403
 
393 404
         /**
394 405
          * Called after GeoDirectory options settings are updated.
@@ -456,8 +467,9 @@  discard block
 block discarded – undo
456 467
                 $options_list = '';
457 468
                 for ($option = 1; $option <= 30; $option++) {
458 469
                     $selected = '';
459
-                    if ($option == 10)
460
-                        $selected = 'selected="selected"';
470
+                    if ($option == 10) {
471
+                                            $selected = 'selected="selected"';
472
+                    }
461 473
 
462 474
                     $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
463 475
                 }
@@ -657,10 +669,11 @@  discard block
 block discarded – undo
657 669
                     }
658 670
 
659 671
 
660
-                    if (geodir_dummy_folder_exists())
661
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
662
-                    else
663
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
672
+                    if (geodir_dummy_folder_exists()) {
673
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
674
+                    } else {
675
+                                            $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
676
+                    }
664 677
                     $catname = str_replace(' ', '_', $catname);
665 678
                     $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
666 679
 
@@ -698,10 +711,11 @@  discard block
 block discarded – undo
698 711
             if (!term_exists($catname, 'gd_placecategory')) {
699 712
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
700 713
 
701
-                if (geodir_dummy_folder_exists())
702
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
703
-                else
704
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
714
+                if (geodir_dummy_folder_exists()) {
715
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
716
+                } else {
717
+                                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
718
+                }
705 719
                 $catname = str_replace(' ', '_', $catname);
706 720
                 $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
707 721
 
@@ -753,11 +767,14 @@  discard block
 block discarded – undo
753 767
 {
754 768
    // print_r($_POST);    print_r($options);    exit;
755 769
 
756
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
770
+    if ((!isset($_POST) || !$_POST) && !$dummy) {
771
+        return false;
772
+    }
757 773
 
758 774
     foreach ($options as $value) {
759
-        if ($dummy && isset($value['std']))
760
-            $_POST[$value['id']] = $value['std'];
775
+        if ($dummy && isset($value['std'])) {
776
+                    $_POST[$value['id']] = $value['std'];
777
+        }
761 778
 
762 779
 
763 780
         if (isset($value['type']) && $value['type'] == 'checkbox') :
@@ -766,25 +783,23 @@  discard block
 block discarded – undo
766 783
                 update_option($value['id'], $_POST[$value['id']]);
767 784
             } else {
768 785
                 update_option($value['id'], 0);
769
-            }
770
-
771
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
786
+            } elseif (isset($value['type']) && $value['type'] == 'image_width') :
772 787
 
773 788
             if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
774 789
                 update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
775 790
                 update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
776 791
                 if (isset($_POST[$value['id'] . '_crop'])) :
777 792
                     update_option($value['id'] . '_crop', 1);
778
-                else :
779
-                    update_option($value['id'] . '_crop', 0);
793
+                else {
794
+                    :
795
+                    update_option($value['id'] . '_crop', 0);
796
+                }
780 797
                 endif;
781 798
             } else {
782 799
                 update_option($value['id'] . '_width', $value['std']);
783 800
                 update_option($value['id'] . '_height', $value['std']);
784 801
                 update_option($value['id'] . '_crop', 1);
785
-            }
786
-
787
-        elseif (isset($value['type']) && $value['type'] == 'map') :
802
+            } elseif (isset($value['type']) && $value['type'] == 'map') :
788 803
             $post_types = array();
789 804
             $categories = array();
790 805
             $i = 0;
@@ -830,8 +845,9 @@  discard block
 block discarded – undo
830 845
                     $image_name_arr = explode('/', get_option($value['id']));
831 846
                     $noimg_name = end($image_name_arr);
832 847
                     $img_path = $uploads['path'] . '/' . $noimg_name;
833
-                    if (file_exists($img_path))
834
-                        unlink($img_path);
848
+                    if (file_exists($img_path)) {
849
+                                            unlink($img_path);
850
+                    }
835 851
                 }
836 852
 
837 853
                 update_option($value['id'], '');
@@ -847,8 +863,10 @@  discard block
 block discarded – undo
847 863
                 foreach ($uploadedfile as $key => $uplaod):
848 864
                     if ($key == 'name'):
849 865
                         $uplaods[$key] = $filename;
850
-                    else :
851
-                        $uplaods[$key] = $uplaod;
866
+                    else {
867
+                        :
868
+                        $uplaods[$key] = $uplaod;
869
+                    }
852 870
                     endif;
853 871
                 endforeach;
854 872
 
@@ -858,8 +876,9 @@  discard block
 block discarded – undo
858 876
                     $image_name_arr = explode('/', get_option($value['id']));
859 877
                     $noimg_name = end($image_name_arr);
860 878
                     $img_path = $uploads['path'] . '/' . $noimg_name;
861
-                    if (file_exists($img_path))
862
-                        unlink($img_path);
879
+                    if (file_exists($img_path)) {
880
+                                            unlink($img_path);
881
+                    }
863 882
                 }
864 883
 
865 884
                 $upload_overrides = array('test_form' => false);
@@ -874,10 +893,12 @@  discard block
 block discarded – undo
874 893
             endif;
875 894
 
876 895
 
877
-        else :
896
+        else {
897
+            :
878 898
             // same menu setting per theme.
879 899
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
880
-                $theme = wp_get_theme();
900
+                $theme = wp_get_theme();
901
+        }
881 902
                 update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
882 903
             }
883 904
 
@@ -889,8 +910,9 @@  discard block
 block discarded – undo
889 910
 
890 911
         endif;
891 912
     }
892
-    if ($dummy)
893
-        unset($_POST);
913
+    if ($dummy) {
914
+            unset($_POST);
915
+    }
894 916
     return true;
895 917
 
896 918
 }
@@ -1035,9 +1057,12 @@  discard block
 block discarded – undo
1035 1057
         $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1036 1058
             'categorys' => __('Categories', 'geodirectory'));
1037 1059
 
1038
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1060
+        if (($offset = array_search('author', array_keys($columns))) === false) {
1061
+            // if the key doesn't exist
1039 1062
         {
1040
-            $offset = 0; // should we prepend $array with $data?
1063
+            $offset = 0;
1064
+        }
1065
+        // should we prepend $array with $data?
1041 1066
             $offset = count($columns); // or should we append $array with $data? lets pick this one...
1042 1067
         }
1043 1068
 
@@ -1097,11 +1122,13 @@  discard block
 block discarded – undo
1097 1122
                     $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1098 1123
                 }
1099 1124
                 /* If no expire_date is found, output a default message. */
1100
-                if (empty($expire_date))
1101
-                    echo __('Unknown', 'geodirectory');
1125
+                if (empty($expire_date)) {
1126
+                                    echo __('Unknown', 'geodirectory');
1127
+                }
1102 1128
                 /* If there is a expire_date, append 'days left' to the text string. */
1103
-                else
1104
-                    echo $expire_date . $date_diff_text;
1129
+                else {
1130
+                                    echo $expire_date . $date_diff_text;
1131
+                }
1105 1132
                 break;
1106 1133
 
1107 1134
             /* If displaying the 'categorys' column. */
@@ -1174,21 +1201,26 @@  discard block
 block discarded – undo
1174 1201
 
1175 1202
     $geodir_posttypes = geodir_get_posttypes();
1176 1203
 
1177
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1178
-        return;
1204
+    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
1205
+            return;
1206
+    }
1179 1207
 
1180 1208
     if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1181
-        if (isset($_REQUEST['_status']))
1182
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1209
+        if (isset($_REQUEST['_status'])) {
1210
+                    geodir_change_post_status($post_id, $_REQUEST['_status']);
1211
+        }
1183 1212
 
1184
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1185
-            return;
1213
+        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) {
1214
+                    return;
1215
+        }
1186 1216
 
1187
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1188
-            return;
1217
+        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) {
1218
+                    return;
1219
+        }
1189 1220
 
1190
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1191
-            return;
1221
+        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) {
1222
+                    return;
1223
+        }
1192 1224
 
1193 1225
         geodir_save_listing($_REQUEST);
1194 1226
     }
@@ -2024,8 +2056,9 @@  discard block
 block discarded – undo
2024 2056
                                         'geo_lng' => $post_longitude);
2025 2057
 
2026 2058
                                     $post_location_info = $request_info['post_location'];
2027
-                                    if ($location_id = geodir_add_new_location($post_location_info))
2028
-                                        $post_location_id = $location_id;
2059
+                                    if ($location_id = geodir_add_new_location($post_location_info)) {
2060
+                                                                            $post_location_id = $location_id;
2061
+                                    }
2029 2062
 
2030 2063
                                 } else {
2031 2064
                                     $post_location_id = 0;
@@ -2089,8 +2122,9 @@  discard block
 block discarded – undo
2089 2122
                                     $attachment_set = '';
2090 2123
 
2091 2124
                                     foreach ($attachment as $key => $val) {
2092
-                                        if ($val != '')
2093
-                                            $attachment_set .= $key . " = '" . $val . "', ";
2125
+                                        if ($val != '') {
2126
+                                                                                    $attachment_set .= $key . " = '" . $val . "', ";
2127
+                                        }
2094 2128
                                     }
2095 2129
 
2096 2130
                                     $attachment_set = trim($attachment_set, ", ");
@@ -2140,8 +2174,9 @@  discard block
 block discarded – undo
2140 2174
                 fclose($fd);
2141 2175
                 //unlink($csv_target_path);
2142 2176
                 //rmdir($destination_path);
2143
-                if (!empty($filename))
2144
-                    geodir_remove_temp_images();
2177
+                if (!empty($filename)) {
2178
+                                    geodir_remove_temp_images();
2179
+                }
2145 2180
 
2146 2181
 
2147 2182
                 echo $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=csv_upload_settings&msg=success&rowcount=' . $countpost . '&invalidcount=' . $address_invalid . '&blank_address=' . $blank_address . '&upload_files=' . $upload_files . '&invalid_post_type=' . $invalid_post_type . '&invalid_title=' . $invalid_title . '&total_records=' . $total_records;
@@ -2174,10 +2209,18 @@  discard block
 block discarded – undo
2174 2209
     $tab_id = '';
2175 2210
     $i = 0;
2176 2211
     foreach ($options as $value) :
2177
-        if (!isset($value['name'])) $value['name'] = '';
2178
-        if (!isset($value['class'])) $value['class'] = '';
2179
-        if (!isset($value['css'])) $value['css'] = '';
2180
-        if (!isset($value['std'])) $value['std'] = '';
2212
+        if (!isset($value['name'])) {
2213
+            $value['name'] = '';
2214
+        }
2215
+        if (!isset($value['class'])) {
2216
+            $value['class'] = '';
2217
+        }
2218
+        if (!isset($value['css'])) {
2219
+            $value['css'] = '';
2220
+        }
2221
+        if (!isset($value['std'])) {
2222
+            $value['std'] = '';
2223
+        }
2181 2224
         $desc = '';
2182 2225
         switch ($value['type']) :
2183 2226
             case 'dummy_installer':
@@ -2196,11 +2239,13 @@  discard block
 block discarded – undo
2196 2239
 
2197 2240
                 $i++;
2198 2241
 
2199
-                if (isset($value['id']) && $value['id'])
2200
-                    $tab_id = $value['id'];
2242
+                if (isset($value['id']) && $value['id']) {
2243
+                                    $tab_id = $value['id'];
2244
+                }
2201 2245
 
2202
-                if (isset($value['desc']) && $value['desc'])
2203
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
2246
+                if (isset($value['desc']) && $value['desc']) {
2247
+                                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
2248
+                }
2204 2249
 
2205 2250
                 if (isset($value['name']) && $value['name']) {
2206 2251
                     if ($first_title === true) {
@@ -2231,10 +2276,12 @@  discard block
 block discarded – undo
2231 2276
                 break;
2232 2277
 
2233 2278
             case 'sectionstart':
2234
-                if (isset($value['desc']) && $value['desc'])
2235
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
2236
-                if (isset($value['name']) && $value['name'])
2237
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
2279
+                if (isset($value['desc']) && $value['desc']) {
2280
+                                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
2281
+                }
2282
+                if (isset($value['name']) && $value['name']) {
2283
+                                    echo '<h3>' . $value['name'] . $desc . '</h3>';
2284
+                }
2238 2285
                 /**
2239 2286
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
2240 2287
                  *
@@ -2242,7 +2289,9 @@  discard block
 block discarded – undo
2242 2289
                  *
2243 2290
                  * @since 1.0.0
2244 2291
                  */
2245
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
2292
+                if (isset($value['id']) && $value['id']) {
2293
+                    do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
2294
+                }
2246 2295
                 echo '<table class="form-table">' . "\n\n";
2247 2296
 
2248 2297
                 break;
@@ -2254,7 +2303,9 @@  discard block
 block discarded – undo
2254 2303
                  *
2255 2304
                  * @since 1.0.0
2256 2305
                  */
2257
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
2306
+                if (isset($value['id']) && $value['id']) {
2307
+                    do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
2308
+                }
2258 2309
                 echo '</table>';
2259 2310
                 /**
2260 2311
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -2263,7 +2314,9 @@  discard block
 block discarded – undo
2263 2314
                  *
2264 2315
                  * @since 1.0.0
2265 2316
                  */
2266
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
2317
+                if (isset($value['id']) && $value['id']) {
2318
+                    do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
2319
+                }
2267 2320
                 break;
2268 2321
             case 'text':
2269 2322
                 ?>
@@ -2335,17 +2388,32 @@  discard block
 block discarded – undo
2335 2388
                     <?php _e('Width', 'geodirectory'); ?> <input
2336 2389
                         name="<?php echo esc_attr($value['id']); ?>_width"
2337 2390
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
2338
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
2391
+                        value="<?php if ($size = get_option($value['id'] . '_width')) {
2392
+    echo stripslashes($size);
2393
+} else {
2394
+    echo $value['std'];
2395
+}
2396
+?>"/>
2339 2397
 
2340 2398
                     <?php _e('Height', 'geodirectory'); ?> <input
2341 2399
                         name="<?php echo esc_attr($value['id']); ?>_height"
2342 2400
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
2343
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
2401
+                        value="<?php if ($size = get_option($value['id'] . '_height')) {
2402
+    echo stripslashes($size);
2403
+} else {
2404
+    echo $value['std'];
2405
+}
2406
+?>"/>
2344 2407
 
2345 2408
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
2346 2409
                             name="<?php echo esc_attr($value['id']); ?>_crop"
2347 2410
                             id="<?php echo esc_attr($value['id']); ?>_crop"
2348
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
2411
+                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') {
2412
+    checked(get_option($value['id'] . '_crop'), 1);
2413
+} else {
2414
+    checked(1);
2415
+}
2416
+?> /></label>
2349 2417
 
2350 2418
                     <span class="description"><?php echo $value['desc'] ?></span></td>
2351 2419
                 </tr><?php
@@ -2357,17 +2425,22 @@  discard block
 block discarded – undo
2357 2425
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
2358 2426
                                             id="<?php echo esc_attr($value['id']); ?>"
2359 2427
                                             style="<?php echo esc_attr($value['css']); ?>"
2360
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
2428
+                                            class="<?php if (isset($value['class'])) {
2429
+    echo $value['class'];
2430
+}
2431
+?>"
2361 2432
                                             option-ajaxchosen="false">
2362 2433
                         <?php
2363 2434
                         foreach ($value['options'] as $key => $val) {
2364 2435
                             $geodir_select_value = '';
2365 2436
                             if (get_option($value['id']) != '') {
2366
-                                if (get_option($value['id']) != '' && get_option($value['id']) == $key)
2367
-                                    $geodir_select_value = ' selected="selected" ';
2437
+                                if (get_option($value['id']) != '' && get_option($value['id']) == $key) {
2438
+                                                                    $geodir_select_value = ' selected="selected" ';
2439
+                                }
2368 2440
                             } else {
2369
-                                if ($value['std'] == $key)
2370
-                                    $geodir_select_value = ' selected="selected" ';
2441
+                                if ($value['std'] == $key) {
2442
+                                                                    $geodir_select_value = ' selected="selected" ';
2443
+                                }
2371 2444
                             }
2372 2445
 
2373 2446
 
@@ -2389,8 +2462,14 @@  discard block
 block discarded – undo
2389 2462
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
2390 2463
                                             id="<?php echo esc_attr($value['id']); ?>"
2391 2464
                                             style="<?php echo esc_attr($value['css']); ?>"
2392
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
2393
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
2465
+                                            class="<?php if (isset($value['class'])) {
2466
+    echo $value['class'];
2467
+}
2468
+?>"
2469
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) {
2470
+    echo $value['placeholder_text'];
2471
+}
2472
+?>"
2394 2473
                                             option-ajaxchosen="false">
2395 2474
                         <?php
2396 2475
                         foreach ($value['options'] as $key => $val) {
@@ -2419,7 +2498,10 @@  discard block
 block discarded – undo
2419 2498
                 <td class="forminp">
2420 2499
                     <input type="file" name="<?php echo esc_attr($value['id']); ?>"
2421 2500
                            id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>"
2422
-                           class="<?php if (isset($value['class'])) echo $value['class']; ?>"/>
2501
+                           class="<?php if (isset($value['class'])) {
2502
+    echo $value['class'];
2503
+}
2504
+?>"/>
2423 2505
                     <?php if (get_option($value['id'])) { ?>
2424 2506
                         <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove"
2425 2507
                                id="<?php echo esc_attr($value['id']); ?>_remove" value="0">
@@ -2500,13 +2582,15 @@  discard block
 block discarded – undo
2500 2582
                                 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
2501 2583
                             );
2502 2584
                             $geodir_default_map_language = get_option('geodir_default_map_language');
2503
-                            if (empty($geodir_default_map_language))
2504
-                                $geodir_default_map_language = 'en';
2585
+                            if (empty($geodir_default_map_language)) {
2586
+                                                            $geodir_default_map_language = 'en';
2587
+                            }
2505 2588
                             foreach ($arr_map_langages as $language_key => $language_txt) {
2506
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
2507
-                                    $geodir_default_language_selected = "selected='selected'";
2508
-                                else
2509
-                                    $geodir_default_language_selected = '';
2589
+                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) {
2590
+                                                                    $geodir_default_language_selected = "selected='selected'";
2591
+                                } else {
2592
+                                                                    $geodir_default_language_selected = '';
2593
+                                }
2510 2594
 
2511 2595
                                 ?>
2512 2596
                                 <option
@@ -2526,14 +2610,16 @@  discard block
 block discarded – undo
2526 2610
                             <?php
2527 2611
                             $post_types = geodir_get_posttypes('array');
2528 2612
                             $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
2529
-                            if (empty($geodir_default_map_search_pt))
2530
-                                $geodir_default_map_search_pt = 'gd_place';
2613
+                            if (empty($geodir_default_map_search_pt)) {
2614
+                                                            $geodir_default_map_search_pt = 'gd_place';
2615
+                            }
2531 2616
                             if (is_array($post_types)) {
2532 2617
                                 foreach ($post_types as $key => $post_types_obj) {
2533
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
2534
-                                        $geodir_search_pt_selected = "selected='selected'";
2535
-                                    else
2536
-                                        $geodir_search_pt_selected = '';
2618
+                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) {
2619
+                                                                            $geodir_search_pt_selected = "selected='selected'";
2620
+                                    } else {
2621
+                                                                            $geodir_search_pt_selected = '';
2622
+                                    }
2537 2623
 
2538 2624
                                     ?>
2539 2625
                                     <option
@@ -2653,7 +2739,7 @@  discard block
 block discarded – undo
2653 2739
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
2654 2740
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
2655 2741
                             echo 'checked="checked"';
2656
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2742
+                        } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2657 2743
                         <?php echo $value['desc']; ?></label><br>
2658 2744
                 </fieldset>
2659 2745
                 <?php
@@ -2673,10 +2759,18 @@  discard block
 block discarded – undo
2673 2759
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
2674 2760
                 <td class="forminp">
2675 2761
                     <textarea
2676
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
2762
+                        <?php if (isset($value['args'])) {
2763
+    echo $value['args'] . ' ';
2764
+}
2765
+?>name="<?php echo esc_attr($value['id']); ?>"
2677 2766
                         id="<?php echo esc_attr($value['id']); ?>"
2678 2767
                         <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2679
-                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
2768
+                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) {
2769
+    echo esc_textarea(stripslashes(get_option($value['id'])));
2770
+} else {
2771
+    echo esc_textarea($value['std']);
2772
+}
2773
+?></textarea><span
2680 2774
                         class="description"><?php echo $value['desc'] ?></span>
2681 2775
 
2682 2776
                 </td>
@@ -2690,10 +2784,11 @@  discard block
 block discarded – undo
2690 2784
                 <td class="forminp"><?php
2691 2785
 
2692 2786
                     $content = '';
2693
-                    if (get_option($value['id']))
2694
-                        $content = stripslashes(get_option($value['id']));
2695
-                    else
2696
-                        $content = $value['std'];
2787
+                    if (get_option($value['id'])) {
2788
+                                            $content = stripslashes(get_option($value['id']));
2789
+                    } else {
2790
+                                            $content = $value['std'];
2791
+                    }
2697 2792
 
2698 2793
                     $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2699 2794
 
@@ -2733,7 +2828,9 @@  discard block
 block discarded – undo
2733 2828
                     'echo' => false,
2734 2829
                     'selected' => $page_setting);
2735 2830
 
2736
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
2831
+                if (isset($value['args'])) {
2832
+                    $args = wp_parse_args($value['args'], $args);
2833
+                }
2737 2834
 
2738 2835
                 ?>
2739 2836
                 <tr valign="top" class="single_select_page">
@@ -2753,8 +2850,10 @@  discard block
 block discarded – undo
2753 2850
                 if (strstr($country_setting, ':')) :
2754 2851
                     $country = current(explode(':', $country_setting));
2755 2852
                     $state = end(explode(':', $country_setting));
2756
-                else :
2757
-                    $country = $country_setting;
2853
+                else {
2854
+                    :
2855
+                    $country = $country_setting;
2856
+                }
2758 2857
                     $state = '*';
2759 2858
                 endif;
2760 2859
                 ?>
@@ -2781,8 +2880,10 @@  discard block
 block discarded – undo
2781 2880
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
2782 2881
                             title="Country" class="chosen_select">
2783 2882
                         <?php
2784
-                        if ($countries) foreach ($countries as $key => $val) :
2785
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
2883
+                        if ($countries) {
2884
+                            foreach ($countries as $key => $val) :
2885
+                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
2886
+                        }
2786 2887
                         endforeach;
2787 2888
                         ?>
2788 2889
                     </select>
@@ -3046,8 +3147,9 @@  discard block
 block discarded – undo
3046 3147
         endforeach;
3047 3148
     endif;
3048 3149
 
3049
-    if (!empty($place_img_array))
3050
-        $curImages = implode(',', $place_img_array);
3150
+    if (!empty($place_img_array)) {
3151
+            $curImages = implode(',', $place_img_array);
3152
+    }
3051 3153
 
3052 3154
 
3053 3155
     // adjust values here
@@ -3394,16 +3496,17 @@  discard block
 block discarded – undo
3394 3496
 	
3395 3497
 	$post_type = NULL;
3396 3498
 	
3397
-	if ($post && isset($post->post_type))
3398
-		$post_type = $post->post_type;
3399
-	elseif ($typenow)
3400
-		$post_type = $typenow;
3401
-	elseif ($current_screen && isset($current_screen->post_type))
3402
-		$post_type = $current_screen->post_type;
3403
-	elseif (isset($_REQUEST['post_type']))
3404
-		$post_type = sanitize_key($_REQUEST['post_type']);
3405
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
3406
-		$post_type = get_post_type($_REQUEST['post']);
3499
+	if ($post && isset($post->post_type)) {
3500
+			$post_type = $post->post_type;
3501
+	} elseif ($typenow) {
3502
+			$post_type = $typenow;
3503
+	} elseif ($current_screen && isset($current_screen->post_type)) {
3504
+			$post_type = $current_screen->post_type;
3505
+	} elseif (isset($_REQUEST['post_type'])) {
3506
+			$post_type = sanitize_key($_REQUEST['post_type']);
3507
+	} elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
3508
+			$post_type = get_post_type($_REQUEST['post']);
3509
+	}
3407 3510
 
3408 3511
 	return $post_type;
3409 3512
 }
@@ -3462,9 +3565,10 @@  discard block
 block discarded – undo
3462 3565
 function geodir_hide_admin_preview_button() {
3463 3566
     global $post_type;
3464 3567
     $post_types = geodir_get_posttypes();
3465
-    if(in_array($post_type, $post_types))
3466
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3467
-}
3568
+    if(in_array($post_type, $post_types)) {
3569
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3570
+    }
3571
+    }
3468 3572
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
3469 3573
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
3470 3574
 
@@ -6258,8 +6362,9 @@  discard block
 block discarded – undo
6258 6362
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
6259 6363
 	global $wpdb, $plugin_prefix;
6260 6364
 
6261
-	if ( ! post_type_exists( $post_type ) )
6262
-		return new stdClass;
6365
+	if ( ! post_type_exists( $post_type ) ) {
6366
+			return new stdClass;
6367
+	}
6263 6368
 		
6264 6369
 	$table = $plugin_prefix . $post_type . '_detail';
6265 6370
 	
@@ -7039,7 +7144,9 @@  discard block
 block discarded – undo
7039 7144
 
7040 7145
     if ($page_found) :
7041 7146
         // Page exists
7042
-        if (!$option_value) update_option($option, $page_found);
7147
+        if (!$option_value) {
7148
+            update_option($option, $page_found);
7149
+        }
7043 7150
         return;
7044 7151
     endif;
7045 7152
 
Please login to merge, or discard this patch.
Indentation   +891 added lines, -891 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Admin functions.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Updates option value when GeoDirectory get deactivated.
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
         wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133 133
         wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135
-		// font awesome rating script
136
-		if (get_option('geodir_reviewrating_enable_font_awesome')) {
137
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
138
-			wp_enqueue_script('geodir-barrating-js');
139
-		} else { // default rating script
140
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
141
-			wp_enqueue_script('geodir-jRating-js');
142
-		}
135
+        // font awesome rating script
136
+        if (get_option('geodir_reviewrating_enable_font_awesome')) {
137
+            wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
138
+            wp_enqueue_script('geodir-barrating-js');
139
+        } else { // default rating script
140
+            wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
141
+            wp_enqueue_script('geodir-jRating-js');
142
+        }
143 143
 
144 144
         wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145 145
         wp_enqueue_script('geodir-on-document-load');
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
                 flush_rewrite_rules(false);
338 338
 
339 339
                 break;
340
-			case 'fail':
341
-				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
340
+            case 'fail':
341
+                $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343
-				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345
-				else
346
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
343
+                if ($gderr == 21)
344
+                    echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345
+                else
346
+                    echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
347 347
                 break;
348 348
         }
349 349
     }
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384 384
         if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
385 385
 		
386
-		/**
387
-		 * Fires before updating geodirectory admin settings.
388
-		 *
389
-		 * @since 1.4.2
390
-		 *
391
-		 * @param string $current_tab Current tab in geodirectory settings.
392
-		 * @param array  $geodir_settings Array of geodirectory settings.
393
-		 */
394
-		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
386
+        /**
387
+         * Fires before updating geodirectory admin settings.
388
+         *
389
+         * @since 1.4.2
390
+         *
391
+         * @param string $current_tab Current tab in geodirectory settings.
392
+         * @param array  $geodir_settings Array of geodirectory settings.
393
+         */
394
+        do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 395
 		
396 396
         if (!empty($geodir_settings[$current_tab]))
397 397
             geodir_update_options($geodir_settings[$current_tab]);
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
                 <?php
481 481
 
482 482
                     $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
483
+                    $city =  isset($default_location->city) ? $default_location->city : '';
484
+                    $region =isset($default_location->region) ? $default_location->region : '';
485
+                    $country =isset($default_location->country) ? $default_location->country : '';
486
+                    $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+                    $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489 489
                 ?>
490 490
                 var geocoder = new google.maps.Geocoder();
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
  */
758 758
 function geodir_update_options($options, $dummy = false)
759 759
 {
760
-   // print_r($_POST);    print_r($options);    exit;
760
+    // print_r($_POST);    print_r($options);    exit;
761 761
 
762 762
     if ((!isset($_POST) || !$_POST) && !$dummy) return false;
763 763
 
@@ -2253,10 +2253,10 @@  discard block
 block discarded – undo
2253 2253
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2254 2254
                                            style=" <?php echo esc_attr($value['css']); ?>"
2255 2255
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2256
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2257
-                                           } else {
2258
-                                               echo esc_attr($value['std']);
2259
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2256
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2257
+                                            } else {
2258
+                                                echo esc_attr($value['std']);
2259
+                                            } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2260 2260
                 </tr><?php
2261 2261
                 break;
2262 2262
 
@@ -2270,10 +2270,10 @@  discard block
 block discarded – undo
2270 2270
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2271 2271
                                            style="<?php echo esc_attr($value['css']); ?>"
2272 2272
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2273
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2274
-                                           } else {
2275
-                                               echo esc_attr($value['std']);
2276
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2273
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2274
+                                            } else {
2275
+                                                echo esc_attr($value['std']);
2276
+                                            } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2277 2277
                 </tr><?php
2278 2278
                 break;
2279 2279
 
@@ -2293,10 +2293,10 @@  discard block
 block discarded – undo
2293 2293
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
2294 2294
                                            style="<?php echo esc_attr($value['css']); ?>"
2295 2295
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2296
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2297
-                                           } else {
2298
-                                               echo esc_attr($value['std']);
2299
-                                           } ?>" class="colorpick"/> <span
2296
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2297
+                                            } else {
2298
+                                                echo esc_attr($value['std']);
2299
+                                            } ?>" class="colorpick"/> <span
2300 2300
                         class="description"><?php echo $value['desc']; ?></span>
2301 2301
 
2302 2302
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
@@ -2685,22 +2685,22 @@  discard block
 block discarded – undo
2685 2685
 
2686 2686
             case 'single_select_page' :
2687 2687
                 // WPML
2688
-				$switch_lang = false;
2689
-				$disabled = '';
2690
-				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2691
-					global $sitepress;
2688
+                $switch_lang = false;
2689
+                $disabled = '';
2690
+                if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2691
+                    global $sitepress;
2692 2692
 					
2693
-					$default_lang = $sitepress->get_default_language();
2694
-					$current_lang = $sitepress->get_current_language();
2693
+                    $default_lang = $sitepress->get_default_language();
2694
+                    $current_lang = $sitepress->get_current_language();
2695 2695
 					
2696
-					if ($current_lang != 'all' && $current_lang != $default_lang) {
2697
-						$disabled = "disabled='disabled'";
2698
-						$switch_lang = $current_lang;
2699
-						$sitepress->switch_lang('all', true);
2700
-					}
2701
-				}
2702
-				//
2703
-				$page_setting = (int)get_option($value['id']);
2696
+                    if ($current_lang != 'all' && $current_lang != $default_lang) {
2697
+                        $disabled = "disabled='disabled'";
2698
+                        $switch_lang = $current_lang;
2699
+                        $sitepress->switch_lang('all', true);
2700
+                    }
2701
+                }
2702
+                //
2703
+                $page_setting = (int)get_option($value['id']);
2704 2704
 
2705 2705
                 $args = array('name' => $value['id'],
2706 2706
                     'id' => $value['id'],
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
                     <span class="description"><?php echo $value['desc'] ?></span>
2722 2722
                 </td>
2723 2723
                 </tr><?php
2724
-				if ($switch_lang) {
2725
-					$sitepress->switch_lang($switch_lang, true);
2726
-				}
2724
+                if ($switch_lang) {
2725
+                    $sitepress->switch_lang($switch_lang, true);
2726
+                }
2727 2727
                 break;
2728 2728
             case 'single_select_country' :
2729 2729
                 $countries = $geodirectory->countries->countries;
@@ -3355,22 +3355,22 @@  discard block
 block discarded – undo
3355 3355
  * @return string Post type ex: gd_place
3356 3356
  */
3357 3357
 function geodir_admin_current_post_type() {
3358
-	global $post, $typenow, $current_screen;
3358
+    global $post, $typenow, $current_screen;
3359 3359
 	
3360
-	$post_type = NULL;
3360
+    $post_type = NULL;
3361 3361
 	
3362
-	if ($post && isset($post->post_type))
3363
-		$post_type = $post->post_type;
3364
-	elseif ($typenow)
3365
-		$post_type = $typenow;
3366
-	elseif ($current_screen && isset($current_screen->post_type))
3367
-		$post_type = $current_screen->post_type;
3368
-	elseif (isset($_REQUEST['post_type']))
3369
-		$post_type = sanitize_key($_REQUEST['post_type']);
3370
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
3371
-		$post_type = get_post_type($_REQUEST['post']);
3372
-
3373
-	return $post_type;
3362
+    if ($post && isset($post->post_type))
3363
+        $post_type = $post->post_type;
3364
+    elseif ($typenow)
3365
+        $post_type = $typenow;
3366
+    elseif ($current_screen && isset($current_screen->post_type))
3367
+        $post_type = $current_screen->post_type;
3368
+    elseif (isset($_REQUEST['post_type']))
3369
+        $post_type = sanitize_key($_REQUEST['post_type']);
3370
+    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
3371
+        $post_type = get_post_type($_REQUEST['post']);
3372
+
3373
+    return $post_type;
3374 3374
 }
3375 3375
 
3376 3376
 /**
@@ -3385,33 +3385,33 @@  discard block
 block discarded – undo
3385 3385
  * @param array  $geodir_settings Array of geodirectory settings.
3386 3386
  */
3387 3387
 function geodir_before_update_options($current_tab, $geodir_settings) {
3388
-	$active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : '';
3388
+    $active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : '';
3389 3389
 		
3390
-	// Permalink settings
3391
-	if ($current_tab == 'permalink_settings') {
3392
-		$listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : '';
3393
-		$location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : '';
3390
+    // Permalink settings
3391
+    if ($current_tab == 'permalink_settings') {
3392
+        $listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : '';
3393
+        $location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : '';
3394 3394
 		
3395
-		// Don't allow same slug url for listing and location
3396
-		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
3397
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
3398
-        	wp_redirect($redirect_url);
3399
-			exit;
3400
-		}
3395
+        // Don't allow same slug url for listing and location
3396
+        if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
3397
+            $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
3398
+            wp_redirect($redirect_url);
3399
+            exit;
3400
+        }
3401 3401
 		
3402
-		// Don't allow to update page settings on different language.
3403
-		if (geodir_is_wpml()) {
3404
-			global $sitepress;
3405
-			$current_language = $sitepress->get_current_language();
3406
-			$default_language = $sitepress->get_default_language();
3402
+        // Don't allow to update page settings on different language.
3403
+        if (geodir_is_wpml()) {
3404
+            global $sitepress;
3405
+            $current_language = $sitepress->get_current_language();
3406
+            $default_language = $sitepress->get_default_language();
3407 3407
 			
3408
-			if ($current_language != 'all' && $current_language != $default_language) {
3409
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
3410
-				wp_redirect($redirect_url);
3411
-				exit;
3412
-			}
3413
-		}
3414
-	}
3408
+            if ($current_language != 'all' && $current_language != $default_language) {
3409
+                $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
3410
+                wp_redirect($redirect_url);
3411
+                exit;
3412
+            }
3413
+        }
3414
+    }
3415 3415
 }
3416 3416
 
3417 3417
 
@@ -3442,7 +3442,7 @@  discard block
 block discarded – undo
3442 3442
  * @return array Array of tab data.
3443 3443
  */
3444 3444
 function geodir_import_export_tab( $tabs ) {
3445
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3445
+    $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3446 3446
     return $tabs;
3447 3447
 }
3448 3448
 
@@ -3456,8 +3456,8 @@  discard block
 block discarded – undo
3456 3456
  * @return string Html content.
3457 3457
  */
3458 3458
 function geodir_import_export_page() {
3459
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3460
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3459
+    $nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3460
+    $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3461 3461
     /**
3462 3462
      * Filter sample category data csv file url.
3463 3463
      *
@@ -3466,9 +3466,9 @@  discard block
 block discarded – undo
3466 3466
      *
3467 3467
      * @param string $gd_cats_sample_csv Sample category data csv file url.
3468 3468
      */
3469
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3469
+    $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3470 3470
 	
3471
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3471
+    $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3472 3472
     /**
3473 3473
      * Filter sample post data csv file url.
3474 3474
      *
@@ -3479,42 +3479,42 @@  discard block
 block discarded – undo
3479 3479
      */
3480 3480
     $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3481 3481
 	
3482
-	$gd_posttypes = geodir_get_posttypes( 'array' );
3482
+    $gd_posttypes = geodir_get_posttypes( 'array' );
3483 3483
 	
3484
-	$gd_posttypes_option = '';
3485
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3487
-	}
3488
-	wp_enqueue_script( 'jquery-ui-progressbar' );
3484
+    $gd_posttypes_option = '';
3485
+    foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
+        $gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3487
+    }
3488
+    wp_enqueue_script( 'jquery-ui-progressbar' );
3489 3489
 	
3490
-	$gd_chunksize_options = array();
3491
-	$gd_chunksize_options[100] = 100;
3492
-	$gd_chunksize_options[200] = 200;
3493
-	$gd_chunksize_options[500] = 500;
3494
-	$gd_chunksize_options[1000] = 1000;
3495
-	$gd_chunksize_options[2000] = 2000;
3496
-	$gd_chunksize_options[5000] = 5000;
3497
-	$gd_chunksize_options[10000] = 10000;
3498
-	$gd_chunksize_options[20000] = 20000;
3499
-	$gd_chunksize_options[50000] = 50000;
3500
-	$gd_chunksize_options[100000] = 100000;
3490
+    $gd_chunksize_options = array();
3491
+    $gd_chunksize_options[100] = 100;
3492
+    $gd_chunksize_options[200] = 200;
3493
+    $gd_chunksize_options[500] = 500;
3494
+    $gd_chunksize_options[1000] = 1000;
3495
+    $gd_chunksize_options[2000] = 2000;
3496
+    $gd_chunksize_options[5000] = 5000;
3497
+    $gd_chunksize_options[10000] = 10000;
3498
+    $gd_chunksize_options[20000] = 20000;
3499
+    $gd_chunksize_options[50000] = 50000;
3500
+    $gd_chunksize_options[100000] = 100000;
3501 3501
 	 
3502
-	 /**
3503
-     * Filter max entries per export csv file.
3504
-     *
3505
-     * @since 1.5.6
3506
-     * @package GeoDirectory
3507
-     *
3508
-     * @param string $gd_chunksize_options Entries options.
3509
-     */
3502
+        /**
3503
+         * Filter max entries per export csv file.
3504
+         *
3505
+         * @since 1.5.6
3506
+         * @package GeoDirectory
3507
+         *
3508
+         * @param string $gd_chunksize_options Entries options.
3509
+         */
3510 3510
     $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3511 3511
 	
3512
-	$gd_chunksize_option = '';
3513
-	foreach ($gd_chunksize_options as $value => $title) {
3514
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
3515
-	}
3512
+    $gd_chunksize_option = '';
3513
+    foreach ($gd_chunksize_options as $value => $title) {
3514
+        $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
3515
+    }
3516 3516
 	
3517
-	$uploads = wp_upload_dir();
3517
+    $uploads = wp_upload_dir();
3518 3518
 ?>
3519 3519
 </form>
3520 3520
 <div class="inner_content_tab_main gd-import-export">
@@ -3576,13 +3576,13 @@  discard block
 block discarded – undo
3576 3576
 							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577 3577
 						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
3578 3578
 							<?php
3579
-							/**
3580
-							 * Called just after the sample CSV download link.
3581
-							 *
3582
-							 * @since 1.0.0
3583
-							 */
3584
-							do_action('geodir_sample_csv_download_link');
3585
-							?>
3579
+                            /**
3580
+                             * Called just after the sample CSV download link.
3581
+                             *
3582
+                             * @since 1.0.0
3583
+                             */
3584
+                            do_action('geodir_sample_csv_download_link');
3585
+                            ?>
3586 3586
 							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
3587 3587
 							<div class="filelist"></div>
3588 3588
 						</div>
@@ -3690,14 +3690,14 @@  discard block
 block discarded – undo
3690 3690
 							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691 3691
 						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
3692 3692
 						<?php
3693
-						/**
3694
-						 * Called just after the sample CSV download link.
3695
-						 *
3696
-						 * @since 1.0.0
3693
+                        /**
3694
+                         * Called just after the sample CSV download link.
3695
+                         *
3696
+                         * @since 1.0.0
3697 3697
                          * @package GeoDirectory
3698
-						 */
3699
-						do_action('geodir_sample_cats_csv_download_link');
3700
-						?>
3698
+                         */
3699
+                        do_action('geodir_sample_cats_csv_download_link');
3700
+                        ?>
3701 3701
 							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
3702 3702
 							<div class="filelist"></div>
3703 3703
 						</div>
@@ -3773,19 +3773,19 @@  discard block
 block discarded – undo
3773 3773
       </div>
3774 3774
     </div>
3775 3775
 	<?php
3776
-	/**
3777
-	 * Allows you to add more setting to the GD > Import & Export page.
3778
-	 *
3779
-	 * Called after the last setting on the GD > Import & Export page.
3780
-	 * @since 1.4.6
3776
+    /**
3777
+     * Allows you to add more setting to the GD > Import & Export page.
3778
+     *
3779
+     * Called after the last setting on the GD > Import & Export page.
3780
+     * @since 1.4.6
3781 3781
      * @package GeoDirectory
3782
-	 *
3783
-	 * @param array $gd_posttypes GD post types.
3782
+     *
3783
+     * @param array $gd_posttypes GD post types.
3784 3784
      * @param array $gd_chunksize_options File chunk size options.
3785 3785
      * @param string $nonce Wordpress security token for GD import & export.
3786
-	 */
3787
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3788
-	?>
3786
+     */
3787
+    do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3788
+    ?>
3789 3789
   </div>
3790 3790
 </div>
3791 3791
 <script type="text/javascript">
@@ -5760,32 +5760,32 @@  discard block
 block discarded – undo
5760 5760
  * @return int|bool Term id when success, false when fail.
5761 5761
  */
5762 5762
 function geodir_imex_insert_term( $taxonomy, $term_data ) {
5763
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5764
-		return false;
5765
-	}
5763
+    if ( empty( $taxonomy ) || empty( $term_data ) ) {
5764
+        return false;
5765
+    }
5766 5766
 	
5767
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5768
-	$args = array();
5769
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5767
+    $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5768
+    $args = array();
5769
+    $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
+    $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
+    $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5772 5772
 	
5773
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
-		$term_args = array_merge( $term_data, $args );
5775
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
-		$term_args = wp_parse_args( $term_args, $defaults );
5777
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5779
-	}
5773
+    if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
+        $term_args = array_merge( $term_data, $args );
5775
+        $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
+        $term_args = wp_parse_args( $term_args, $defaults );
5777
+        $term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
+        $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5779
+    }
5780 5780
 	
5781 5781
     if( !empty( $term ) ) {
5782
-		$result = wp_insert_term( $term, $taxonomy, $args );
5782
+        $result = wp_insert_term( $term, $taxonomy, $args );
5783 5783
         if( !is_wp_error( $result ) ) {
5784 5784
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5785 5785
         }
5786 5786
     }
5787 5787
 	
5788
-	return false;
5788
+    return false;
5789 5789
 }
5790 5790
 
5791 5791
 /**
@@ -5812,39 +5812,39 @@  discard block
 block discarded – undo
5812 5812
  * @return int|bool Term id when success, false when fail.
5813 5813
  */
5814 5814
 function geodir_imex_update_term( $taxonomy, $term_data ) {
5815
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5816
-		return false;
5817
-	}
5815
+    if ( empty( $taxonomy ) || empty( $term_data ) ) {
5816
+        return false;
5817
+    }
5818 5818
 	
5819
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5819
+    $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
+    $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5821 5821
 	
5822
-	$args = array();
5823
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5822
+    $args = array();
5823
+    $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
+    $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
+    $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5826 5826
 	
5827
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5828
-		$term_data['term_id'] = $term_info['term_id'];
5827
+    if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5828
+        $term_data['term_id'] = $term_info['term_id'];
5829 5829
 		
5830
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5830
+        $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5831 5831
 		
5832
-		if( !is_wp_error( $result ) ) {
5832
+        if( !is_wp_error( $result ) ) {
5833 5833
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5834 5834
         }
5835
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5836
-		$term_data['term_id'] = $term_info['term_id'];
5835
+    } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5836
+        $term_data['term_id'] = $term_info['term_id'];
5837 5837
 		
5838
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5838
+        $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5839 5839
 		
5840
-		if( !is_wp_error( $result ) ) {
5840
+        if( !is_wp_error( $result ) ) {
5841 5841
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5842 5842
         }
5843
-	} else {
5844
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5845
-	}
5843
+    } else {
5844
+        return geodir_imex_insert_term( $taxonomy, $term_data );
5845
+    }
5846 5846
 	
5847
-	return false;
5847
+    return false;
5848 5848
 }
5849 5849
 
5850 5850
 /**
@@ -5857,21 +5857,21 @@  discard block
 block discarded – undo
5857 5857
  * @return int Posts count.
5858 5858
  */
5859 5859
 function geodir_get_posts_count( $post_type ) {
5860
-	$posts_count = wp_count_posts( $post_type );
5861
-	$posts_count = array_sum( (array)$posts_count );
5860
+    $posts_count = wp_count_posts( $post_type );
5861
+    $posts_count = array_sum( (array)$posts_count );
5862 5862
 	
5863
-	/**
5864
-	 * Modify returned post counts for the current post type.
5865
-	 *
5866
-	 * @since 1.4.6
5863
+    /**
5864
+     * Modify returned post counts for the current post type.
5865
+     *
5866
+     * @since 1.4.6
5867 5867
      * @package GeoDirectory
5868
-	 *
5869
-	 * @param int $posts_count Post counts.
5870
-	 * @param string $post_type Post type.
5871
-	 */
5872
-	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5868
+     *
5869
+     * @param int $posts_count Post counts.
5870
+     * @param string $post_type Post type.
5871
+     */
5872
+    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5873 5873
 	
5874
-	return $posts_count;
5874
+    return $posts_count;
5875 5875
 }
5876 5876
 
5877 5877
 /**
@@ -5888,18 +5888,18 @@  discard block
 block discarded – undo
5888 5888
  * @return int Posts count.
5889 5889
  */
5890 5890
 function geodir_imex_count_events( $posts_count, $post_type ) {
5891
-	if ( $post_type == 'gd_event' ) {
5892
-		global $wpdb, $plugin_prefix;
5891
+    if ( $post_type == 'gd_event' ) {
5892
+        global $wpdb, $plugin_prefix;
5893 5893
 		
5894
-		$table = $plugin_prefix . $post_type . '_detail';
5895
-		$schedule_table = EVENT_SCHEDULE;
5894
+        $table = $plugin_prefix . $post_type . '_detail';
5895
+        $schedule_table = EVENT_SCHEDULE;
5896 5896
 
5897
-		$query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5897
+        $query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5898 5898
 		
5899
-		$posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5900
-	}
5899
+        $posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5900
+    }
5901 5901
 	
5902
-	return $posts_count;
5902
+    return $posts_count;
5903 5903
 }
5904 5904
 
5905 5905
 /**
@@ -5919,290 +5919,290 @@  discard block
 block discarded – undo
5919 5919
  * @return array Array of posts data.
5920 5920
  */
5921 5921
 function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5922
-	global $wp_filesystem;
5922
+    global $wp_filesystem;
5923 5923
 
5924
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5924
+    $posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5925 5925
 
5926
-	$csv_rows = array();
5926
+    $csv_rows = array();
5927 5927
 	
5928
-	if ( !empty( $posts ) ) {
5929
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5928
+    if ( !empty( $posts ) ) {
5929
+        $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5930 5930
 		
5931
-		$csv_row = array();
5932
-		$csv_row[] = 'post_id';
5933
-		$csv_row[] = 'post_title';
5934
-		$csv_row[] = 'post_author';
5935
-		$csv_row[] = 'post_content';
5936
-		$csv_row[] = 'post_category';
5937
-		$csv_row[] = 'default_category';
5938
-		$csv_row[] = 'post_tags';
5939
-		$csv_row[] = 'post_type';
5940
-		if ( $post_type == 'gd_event' ) {
5941
-			$csv_row[] = 'event_date';
5942
-			$csv_row[] = 'event_enddate';
5943
-			$csv_row[] = 'starttime';
5944
-			$csv_row[] = 'endtime';
5931
+        $csv_row = array();
5932
+        $csv_row[] = 'post_id';
5933
+        $csv_row[] = 'post_title';
5934
+        $csv_row[] = 'post_author';
5935
+        $csv_row[] = 'post_content';
5936
+        $csv_row[] = 'post_category';
5937
+        $csv_row[] = 'default_category';
5938
+        $csv_row[] = 'post_tags';
5939
+        $csv_row[] = 'post_type';
5940
+        if ( $post_type == 'gd_event' ) {
5941
+            $csv_row[] = 'event_date';
5942
+            $csv_row[] = 'event_enddate';
5943
+            $csv_row[] = 'starttime';
5944
+            $csv_row[] = 'endtime';
5945 5945
 			
5946
-			$csv_row[] = 'is_recurring_event';
5947
-			$csv_row[] = 'event_duration_days';
5948
-			$csv_row[] = 'recurring_dates';
5949
-			$csv_row[] = 'is_whole_day_event';
5950
-			$csv_row[] = 'event_starttimes';
5951
-			$csv_row[] = 'event_endtimes';
5952
-			$csv_row[] = 'recurring_type';
5953
-			$csv_row[] = 'recurring_interval';
5954
-			$csv_row[] = 'recurring_week_days';
5955
-			$csv_row[] = 'recurring_week_nos';
5956
-			$csv_row[] = 'max_recurring_count';
5957
-			$csv_row[] = 'recurring_end_date';
5958
-		}
5959
-		$csv_row[] = 'post_status';
5960
-		$csv_row[] = 'is_featured';
5961
-		if ($is_payment_plugin) {
5962
-			$csv_row[] = 'package_id';
5963
-			$csv_row[] = 'expire_date';
5964
-		}
5965
-		$csv_row[] = 'geodir_video';
5966
-		$csv_row[] = 'post_address';
5967
-		$csv_row[] = 'post_city';
5968
-		$csv_row[] = 'post_region';
5969
-		$csv_row[] = 'post_country';
5970
-		$csv_row[] = 'post_zip';
5971
-		$csv_row[] = 'post_latitude';
5972
-		$csv_row[] = 'post_longitude';
5973
-		$csv_row[] = 'geodir_timing';
5974
-		$csv_row[] = 'geodir_contact';
5975
-		$csv_row[] = 'geodir_email';
5976
-		$csv_row[] = 'geodir_website';
5977
-		$csv_row[] = 'geodir_twitter';
5978
-		$csv_row[] = 'geodir_facebook';
5979
-		$csv_row[] = 'geodir_video';
5980
-		$csv_row[] = 'geodir_special_offers';
5981
-		// WPML
5982
-		$is_wpml = geodir_is_wpml();
5983
-		if ($is_wpml) {
5984
-			$csv_row[] = 'language';
5985
-			$csv_row[] = 'original_post_id';
5986
-		}
5987
-		// WPML
5946
+            $csv_row[] = 'is_recurring_event';
5947
+            $csv_row[] = 'event_duration_days';
5948
+            $csv_row[] = 'recurring_dates';
5949
+            $csv_row[] = 'is_whole_day_event';
5950
+            $csv_row[] = 'event_starttimes';
5951
+            $csv_row[] = 'event_endtimes';
5952
+            $csv_row[] = 'recurring_type';
5953
+            $csv_row[] = 'recurring_interval';
5954
+            $csv_row[] = 'recurring_week_days';
5955
+            $csv_row[] = 'recurring_week_nos';
5956
+            $csv_row[] = 'max_recurring_count';
5957
+            $csv_row[] = 'recurring_end_date';
5958
+        }
5959
+        $csv_row[] = 'post_status';
5960
+        $csv_row[] = 'is_featured';
5961
+        if ($is_payment_plugin) {
5962
+            $csv_row[] = 'package_id';
5963
+            $csv_row[] = 'expire_date';
5964
+        }
5965
+        $csv_row[] = 'geodir_video';
5966
+        $csv_row[] = 'post_address';
5967
+        $csv_row[] = 'post_city';
5968
+        $csv_row[] = 'post_region';
5969
+        $csv_row[] = 'post_country';
5970
+        $csv_row[] = 'post_zip';
5971
+        $csv_row[] = 'post_latitude';
5972
+        $csv_row[] = 'post_longitude';
5973
+        $csv_row[] = 'geodir_timing';
5974
+        $csv_row[] = 'geodir_contact';
5975
+        $csv_row[] = 'geodir_email';
5976
+        $csv_row[] = 'geodir_website';
5977
+        $csv_row[] = 'geodir_twitter';
5978
+        $csv_row[] = 'geodir_facebook';
5979
+        $csv_row[] = 'geodir_video';
5980
+        $csv_row[] = 'geodir_special_offers';
5981
+        // WPML
5982
+        $is_wpml = geodir_is_wpml();
5983
+        if ($is_wpml) {
5984
+            $csv_row[] = 'language';
5985
+            $csv_row[] = 'original_post_id';
5986
+        }
5987
+        // WPML
5988 5988
 
5989
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
-		if ( !empty( $custom_fields ) ) {
5991
-			foreach ( $custom_fields as $custom_field ) {
5992
-				$csv_row[] = $custom_field->htmlvar_name;
5993
-			}
5994
-		}
5989
+        $custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
+        if ( !empty( $custom_fields ) ) {
5991
+            foreach ( $custom_fields as $custom_field ) {
5992
+                $csv_row[] = $custom_field->htmlvar_name;
5993
+            }
5994
+        }
5995 5995
 
5996
-		// Export franchise fields
5997
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5998
-		if ($is_franchise_active) {
5999
-			$csv_row[] = 'gd_is_franchise';
6000
-			$csv_row[] = 'gd_franchise_lock';
6001
-			$csv_row[] = 'franchise';
6002
-		}
5996
+        // Export franchise fields
5997
+        $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5998
+        if ($is_franchise_active) {
5999
+            $csv_row[] = 'gd_is_franchise';
6000
+            $csv_row[] = 'gd_franchise_lock';
6001
+            $csv_row[] = 'franchise';
6002
+        }
6003 6003
 		
6004
-		$csv_rows[] = $csv_row;
6004
+        $csv_rows[] = $csv_row;
6005 6005
 
6006
-		$images_count = 5;
6006
+        $images_count = 5;
6007 6007
         $xx=0;
6008
-		foreach ( $posts as $post ) {$xx++;
6009
-			$post_id = $post['ID'];
6008
+        foreach ( $posts as $post ) {$xx++;
6009
+            $post_id = $post['ID'];
6010 6010
 			
6011
-			$gd_post_info = geodir_get_post_info( $post_id );
6012
-			$post_info = (array)$gd_post_info;
6011
+            $gd_post_info = geodir_get_post_info( $post_id );
6012
+            $post_info = (array)$gd_post_info;
6013 6013
 						
6014
-			$taxonomy_category = $post_type . 'category';
6015
-			$taxonomy_tags = $post_type . '_tags';
6014
+            $taxonomy_category = $post_type . 'category';
6015
+            $taxonomy_tags = $post_type . '_tags';
6016 6016
 			
6017
-			$post_category = '';
6018
-			$default_category_id = $gd_post_info->default_category;
6019
-			$default_category = '';
6020
-			$post_tags = '';
6021
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6017
+            $post_category = '';
6018
+            $default_category_id = $gd_post_info->default_category;
6019
+            $default_category = '';
6020
+            $post_tags = '';
6021
+            $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6022 6022
 			
6023
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6024
-				$post_category = array();
6025
-				$post_tags = array();
6023
+            if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6024
+                $post_category = array();
6025
+                $post_tags = array();
6026 6026
 			
6027
-				foreach ( $terms as $term ) {
6028
-					if ( $term->taxonomy == $taxonomy_category ) {
6029
-						$post_category[] = $term->name;
6027
+                foreach ( $terms as $term ) {
6028
+                    if ( $term->taxonomy == $taxonomy_category ) {
6029
+                        $post_category[] = $term->name;
6030 6030
 						
6031
-						if ($default_category_id == $term->term_id) {
6032
-							$default_category = $term->name; // Default category.
6033
-						}
6034
-					}
6031
+                        if ($default_category_id == $term->term_id) {
6032
+                            $default_category = $term->name; // Default category.
6033
+                        }
6034
+                    }
6035 6035
 					
6036
-					if ( $term->taxonomy == $taxonomy_tags ) {
6037
-						$post_tags[] = $term->name;
6038
-					}
6039
-				}
6036
+                    if ( $term->taxonomy == $taxonomy_tags ) {
6037
+                        $post_tags[] = $term->name;
6038
+                    }
6039
+                }
6040 6040
 				
6041
-				if (empty($default_category) && !empty($post_category)) {
6042
-					$default_category = $post_category[0]; // Set first one as default category.
6043
-				}
6044
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6046
-			}
6041
+                if (empty($default_category) && !empty($post_category)) {
6042
+                    $default_category = $post_category[0]; // Set first one as default category.
6043
+                }
6044
+                $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
+                $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6046
+            }
6047 6047
 
6048
-			// Franchise data
6049
-			$franchise_id = NULL;
6050
-			$franchise_info = array();
6051
-			$locked_fields = array();
6048
+            // Franchise data
6049
+            $franchise_id = NULL;
6050
+            $franchise_info = array();
6051
+            $locked_fields = array();
6052 6052
 			
6053
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6054
-				$franchise_id = $post_info['franchise'];
6055
-				$gd_franchise_info = geodir_get_post_info($franchise_id);
6053
+            if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6054
+                $franchise_id = $post_info['franchise'];
6055
+                $gd_franchise_info = geodir_get_post_info($franchise_id);
6056 6056
 
6057
-				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
-					$franchise_info = (array)$gd_franchise_info;
6059
-					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6057
+                if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
+                    $franchise_info = (array)$gd_franchise_info;
6059
+                    $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6060 6060
 					
6061
-					if (!empty($locked_fields)) {
6062
-						foreach( $locked_fields as $locked_field) {
6063
-							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064
-								$post_info[$locked_field] = $franchise_info[$locked_field];
6065
-							}
6061
+                    if (!empty($locked_fields)) {
6062
+                        foreach( $locked_fields as $locked_field) {
6063
+                            if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064
+                                $post_info[$locked_field] = $franchise_info[$locked_field];
6065
+                            }
6066 6066
 							
6067
-							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6067
+                            if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
+                                $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6069 6069
 			
6070
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6071
-									$franchise_post_category = array();
6072
-									$franchise_post_tags = array();
6070
+                                if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6071
+                                    $franchise_post_category = array();
6072
+                                    $franchise_post_tags = array();
6073 6073
 								
6074
-									foreach ( $franchise_terms as $franchise_term ) {
6075
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
6076
-											$franchise_post_category[] = $franchise_term->name;
6077
-										}
6074
+                                    foreach ( $franchise_terms as $franchise_term ) {
6075
+                                        if ( $franchise_term->taxonomy == $taxonomy_category ) {
6076
+                                            $franchise_post_category[] = $franchise_term->name;
6077
+                                        }
6078 6078
 										
6079
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6080
-											$franchise_post_tags[] = $franchise_term->name;
6081
-										}
6082
-									}
6079
+                                        if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6080
+                                            $franchise_post_tags[] = $franchise_term->name;
6081
+                                        }
6082
+                                    }
6083 6083
 									
6084
-									if (in_array($taxonomy_category, $locked_fields)) {
6085
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6086
-									}
6087
-									if (in_array('post_tags', $locked_fields)) {
6088
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6089
-									}
6090
-								}
6091
-							}
6092
-						}
6093
-					}
6094
-				}
6095
-			}
6084
+                                    if (in_array($taxonomy_category, $locked_fields)) {
6085
+                                        $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6086
+                                    }
6087
+                                    if (in_array('post_tags', $locked_fields)) {
6088
+                                        $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6089
+                                    }
6090
+                                }
6091
+                            }
6092
+                        }
6093
+                    }
6094
+                }
6095
+            }
6096 6096
 						
6097
-			$post_images = geodir_get_images( $post_id );
6098
-			$current_images = array();
6099
-			if ( !empty( $post_images ) ) {
6100
-				foreach ( $post_images as $post_image ) {
6101
-					$post_image = (array)$post_image;
6102
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
-					if ( $image ) {
6104
-						$current_images[] = $image;
6105
-					}
6106
-				}
6097
+            $post_images = geodir_get_images( $post_id );
6098
+            $current_images = array();
6099
+            if ( !empty( $post_images ) ) {
6100
+                foreach ( $post_images as $post_image ) {
6101
+                    $post_image = (array)$post_image;
6102
+                    $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
+                    if ( $image ) {
6104
+                        $current_images[] = $image;
6105
+                    }
6106
+                }
6107 6107
 				
6108
-				$images_count = max( $images_count, count( $current_images ) );
6109
-			}
6108
+                $images_count = max( $images_count, count( $current_images ) );
6109
+            }
6110 6110
 
6111
-			$csv_row = array();
6112
-			$csv_row[] = $post_id; // post_id
6113
-			$csv_row[] = $post_info['post_title']; // post_title
6114
-			$csv_row[] = $post_info['post_author']; // post_author
6115
-			$csv_row[] = $post_info['post_content']; // post_content
6116
-			$csv_row[] = $post_category; // post_category
6117
-			$csv_row[] = $default_category; // default_category
6118
-			$csv_row[] = $post_tags; // post_tags
6119
-			$csv_row[] = $post_type; // post_type
6120
-			if ( $post_type == 'gd_event' ) {
6121
-				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122
-				$csv_row[] = $event_data['event_date']; // event_date
6123
-				$csv_row[] = $event_data['event_enddate']; // enddate
6124
-				$csv_row[] = $event_data['starttime']; // starttime
6125
-				$csv_row[] = $event_data['endtime']; // endtime
6111
+            $csv_row = array();
6112
+            $csv_row[] = $post_id; // post_id
6113
+            $csv_row[] = $post_info['post_title']; // post_title
6114
+            $csv_row[] = $post_info['post_author']; // post_author
6115
+            $csv_row[] = $post_info['post_content']; // post_content
6116
+            $csv_row[] = $post_category; // post_category
6117
+            $csv_row[] = $default_category; // default_category
6118
+            $csv_row[] = $post_tags; // post_tags
6119
+            $csv_row[] = $post_type; // post_type
6120
+            if ( $post_type == 'gd_event' ) {
6121
+                $event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122
+                $csv_row[] = $event_data['event_date']; // event_date
6123
+                $csv_row[] = $event_data['event_enddate']; // enddate
6124
+                $csv_row[] = $event_data['starttime']; // starttime
6125
+                $csv_row[] = $event_data['endtime']; // endtime
6126 6126
 				
6127
-				$csv_row[] = $event_data['is_recurring_event']; // is_recurring
6128
-				$csv_row[] = $event_data['event_duration_days']; // duration_x
6129
-				$csv_row[] = $event_data['recurring_dates']; // recurring_dates
6130
-				$csv_row[] = $event_data['is_whole_day_event']; // all_day
6131
-				$csv_row[] = $event_data['event_starttimes']; // starttimes
6132
-				$csv_row[] = $event_data['event_endtimes']; // endtimes
6133
-				$csv_row[] = $event_data['recurring_type']; // repeat_type
6134
-				$csv_row[] = $event_data['recurring_interval']; // repeat_x
6135
-				$csv_row[] = $event_data['recurring_week_days']; // repeat_days
6136
-				$csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks
6137
-				$csv_row[] = $event_data['max_recurring_count']; // max_repeat
6138
-				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139
-			}
6140
-			$csv_row[] = $post_info['post_status']; // post_status
6141
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142
-			if ($is_payment_plugin) {
6143
-				$csv_row[] = (int)$post_info['package_id']; // package_id
6144
-				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145
-			}
6146
-			$csv_row[] = $post_info['geodir_video']; // geodir_video
6147
-			$csv_row[] = $post_info['post_address']; // post_address
6148
-			$csv_row[] = $post_info['post_city']; // post_city
6149
-			$csv_row[] = $post_info['post_region']; // post_region
6150
-			$csv_row[] = $post_info['post_country']; // post_country
6151
-			$csv_row[] = $post_info['post_zip']; // post_zip
6152
-			$csv_row[] = $post_info['post_latitude']; // post_latitude
6153
-			$csv_row[] = $post_info['post_longitude']; // post_longitude
6154
-			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
6155
-			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
6156
-			$csv_row[] = $post_info['geodir_email']; // geodir_email
6157
-			$csv_row[] = $post_info['geodir_website']; // geodir_website
6158
-			$csv_row[] = $post_info['geodir_twitter']; // geodir_twitter
6159
-			$csv_row[] = $post_info['geodir_facebook']; // geodir_facebook
6160
-			$csv_row[] = $post_info['geodir_video']; // geodir_video
6161
-			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162
-			// WPML
6163
-			if ($is_wpml) {
6164
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6166
-			}
6167
-			// WPML
6127
+                $csv_row[] = $event_data['is_recurring_event']; // is_recurring
6128
+                $csv_row[] = $event_data['event_duration_days']; // duration_x
6129
+                $csv_row[] = $event_data['recurring_dates']; // recurring_dates
6130
+                $csv_row[] = $event_data['is_whole_day_event']; // all_day
6131
+                $csv_row[] = $event_data['event_starttimes']; // starttimes
6132
+                $csv_row[] = $event_data['event_endtimes']; // endtimes
6133
+                $csv_row[] = $event_data['recurring_type']; // repeat_type
6134
+                $csv_row[] = $event_data['recurring_interval']; // repeat_x
6135
+                $csv_row[] = $event_data['recurring_week_days']; // repeat_days
6136
+                $csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks
6137
+                $csv_row[] = $event_data['max_recurring_count']; // max_repeat
6138
+                $csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139
+            }
6140
+            $csv_row[] = $post_info['post_status']; // post_status
6141
+            $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142
+            if ($is_payment_plugin) {
6143
+                $csv_row[] = (int)$post_info['package_id']; // package_id
6144
+                $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145
+            }
6146
+            $csv_row[] = $post_info['geodir_video']; // geodir_video
6147
+            $csv_row[] = $post_info['post_address']; // post_address
6148
+            $csv_row[] = $post_info['post_city']; // post_city
6149
+            $csv_row[] = $post_info['post_region']; // post_region
6150
+            $csv_row[] = $post_info['post_country']; // post_country
6151
+            $csv_row[] = $post_info['post_zip']; // post_zip
6152
+            $csv_row[] = $post_info['post_latitude']; // post_latitude
6153
+            $csv_row[] = $post_info['post_longitude']; // post_longitude
6154
+            $csv_row[] = $post_info['geodir_timing']; // geodir_timing
6155
+            $csv_row[] = $post_info['geodir_contact']; // geodir_contact
6156
+            $csv_row[] = $post_info['geodir_email']; // geodir_email
6157
+            $csv_row[] = $post_info['geodir_website']; // geodir_website
6158
+            $csv_row[] = $post_info['geodir_twitter']; // geodir_twitter
6159
+            $csv_row[] = $post_info['geodir_facebook']; // geodir_facebook
6160
+            $csv_row[] = $post_info['geodir_video']; // geodir_video
6161
+            $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162
+            // WPML
6163
+            if ($is_wpml) {
6164
+                $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
+                $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6166
+            }
6167
+            // WPML
6168 6168
 			
6169
-			if ( !empty( $custom_fields ) ) {
6170
-				foreach ( $custom_fields as $custom_field ) {
6171
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6172
-				}
6173
-			}
6169
+            if ( !empty( $custom_fields ) ) {
6170
+                foreach ( $custom_fields as $custom_field ) {
6171
+                    $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6172
+                }
6173
+            }
6174 6174
 			
6175
-			// Franchise data
6176
-			if ($is_franchise_active) {
6177
-				$gd_is_franchise = '';
6178
-				$locaked_fields = '';
6179
-				$franchise = '';
6175
+            // Franchise data
6176
+            if ($is_franchise_active) {
6177
+                $gd_is_franchise = '';
6178
+                $locaked_fields = '';
6179
+                $franchise = '';
6180 6180
 					
6181
-				if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6184
-					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6186
-				}
6181
+                if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
+                    $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
+                    $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6184
+                    $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
+                    $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6186
+                }
6187 6187
 				
6188
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6189
-				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
-				$csv_row[] = (int)$franchise; // franchise id
6191
-			}
6188
+                $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6189
+                $csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
+                $csv_row[] = (int)$franchise; // franchise id
6191
+            }
6192 6192
 			
6193
-			for ( $c = 0; $c < $images_count; $c++ ) {
6194
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6195
-			}
6193
+            for ( $c = 0; $c < $images_count; $c++ ) {
6194
+                $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6195
+            }
6196 6196
 			
6197
-			$csv_rows[] = $csv_row;
6197
+            $csv_rows[] = $csv_row;
6198 6198
 
6199
-		}
6199
+        }
6200 6200
 
6201
-		for ( $c = 0; $c < $images_count; $c++ ) {
6202
-			$csv_rows[0][] = 'IMAGE';
6203
-		}
6204
-	}
6205
-	return $csv_rows;
6201
+        for ( $c = 0; $c < $images_count; $c++ ) {
6202
+            $csv_rows[0][] = 'IMAGE';
6203
+        }
6204
+    }
6205
+    return $csv_rows;
6206 6206
 }
6207 6207
 
6208 6208
 /**
@@ -6221,48 +6221,48 @@  discard block
 block discarded – undo
6221 6221
  * @return array Array of posts data.
6222 6222
  */
6223 6223
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
6224
-	global $wpdb, $plugin_prefix;
6224
+    global $wpdb, $plugin_prefix;
6225 6225
 
6226
-	if ( ! post_type_exists( $post_type ) )
6227
-		return new stdClass;
6226
+    if ( ! post_type_exists( $post_type ) )
6227
+        return new stdClass;
6228 6228
 		
6229
-	$table = $plugin_prefix . $post_type . '_detail';
6229
+    $table = $plugin_prefix . $post_type . '_detail';
6230 6230
 	
6231
-	$limit = '';
6232
-	if ( $per_page > 0 && $page_no > 0 ) {
6233
-		$offset = ( $page_no - 1 ) * $per_page;
6231
+    $limit = '';
6232
+    if ( $per_page > 0 && $page_no > 0 ) {
6233
+        $offset = ( $page_no - 1 ) * $per_page;
6234 6234
 		
6235
-		if ( $offset > 0 ) {
6236
-			$limit = " LIMIT " . $offset . "," . $per_page;
6237
-		} else {
6238
-			$limit = " LIMIT " . $per_page;
6239
-		}
6240
-	}
6235
+        if ( $offset > 0 ) {
6236
+            $limit = " LIMIT " . $offset . "," . $per_page;
6237
+        } else {
6238
+            $limit = " LIMIT " . $per_page;
6239
+        }
6240
+    }
6241 6241
 
6242
-	$query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit;
6243
-	/**
6244
-	 * Modify returned posts SQL query for the current post type.
6245
-	 *
6246
-	 * @since 1.4.6
6242
+    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit;
6243
+    /**
6244
+     * Modify returned posts SQL query for the current post type.
6245
+     *
6246
+     * @since 1.4.6
6247 6247
      * @package GeoDirectory
6248
-	 *
6249
-	 * @param int $query The SQL query.
6250
-	 * @param string $post_type Post type.
6251
-	 */
6252
-	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6253
-
6254
-	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6255
-
6256
-	/**
6257
-	 * Modify returned post results for the current post type.
6258
-	 *
6259
-	 * @since 1.4.6
6248
+     *
6249
+     * @param int $query The SQL query.
6250
+     * @param string $post_type Post type.
6251
+     */
6252
+    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6253
+
6254
+    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6255
+
6256
+    /**
6257
+     * Modify returned post results for the current post type.
6258
+     *
6259
+     * @since 1.4.6
6260 6260
      * @package GeoDirectory
6261
-	 *
6262
-	 * @param object $results An object containing all post ids.
6263
-	 * @param string $post_type Post type.
6264
-	 */
6265
-	return apply_filters( 'geodir_export_posts', $results, $post_type );
6261
+     *
6262
+     * @param object $results An object containing all post ids.
6263
+     * @param string $post_type Post type.
6264
+     */
6265
+    return apply_filters( 'geodir_export_posts', $results, $post_type );
6266 6266
 }
6267 6267
 
6268 6268
 /**
@@ -6280,16 +6280,16 @@  discard block
 block discarded – undo
6280 6280
  * @return string The SQL query.
6281 6281
  */
6282 6282
 function geodir_imex_get_events_query( $query, $post_type ) {
6283
-	if ( $post_type == 'gd_event' ) {
6284
-		global $wpdb, $plugin_prefix;
6283
+    if ( $post_type == 'gd_event' ) {
6284
+        global $wpdb, $plugin_prefix;
6285 6285
 		
6286
-		$table = $plugin_prefix . $post_type . '_detail';
6287
-		$schedule_table = EVENT_SCHEDULE;
6286
+        $table = $plugin_prefix . $post_type . '_detail';
6287
+        $schedule_table = EVENT_SCHEDULE;
6288 6288
 
6289
-		$query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
6290
-	}
6289
+        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
6290
+    }
6291 6291
 	
6292
-	return $query; 
6292
+    return $query; 
6293 6293
 }
6294 6294
 
6295 6295
 /**
@@ -6302,16 +6302,16 @@  discard block
 block discarded – undo
6302 6302
  * @return int Total terms count.
6303 6303
  */
6304 6304
 function geodir_get_terms_count( $post_type ) {
6305
-	$args = array( 'hide_empty' => 0 );
6305
+    $args = array( 'hide_empty' => 0 );
6306 6306
 	
6307
-	remove_all_filters( 'get_terms' );
6307
+    remove_all_filters( 'get_terms' );
6308 6308
 	
6309
-	$taxonomy = $post_type . 'category';
6309
+    $taxonomy = $post_type . 'category';
6310 6310
 
6311
-	$count_terms = wp_count_terms( $taxonomy, $args );
6312
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6311
+    $count_terms = wp_count_terms( $taxonomy, $args );
6312
+    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6313 6313
 	 
6314
-	return $count_terms;
6314
+    return $count_terms;
6315 6315
 }
6316 6316
 
6317 6317
 /**
@@ -6327,76 +6327,76 @@  discard block
 block discarded – undo
6327 6327
  * @return array Array of terms data.
6328 6328
  */
6329 6329
 function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
6330
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6330
+    $args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6331 6331
 	
6332
-	remove_all_filters( 'get_terms' );
6332
+    remove_all_filters( 'get_terms' );
6333 6333
 	
6334
-	$taxonomy = $post_type . 'category';
6334
+    $taxonomy = $post_type . 'category';
6335 6335
 	
6336
-	if ( $per_page > 0 && $page_no > 0 ) {
6337
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
6338
-		$args['number'] = $per_page;
6339
-	}
6336
+    if ( $per_page > 0 && $page_no > 0 ) {
6337
+        $args['offset'] = ( $page_no - 1 ) * $per_page;
6338
+        $args['number'] = $per_page;
6339
+    }
6340 6340
 	
6341
-	$terms = get_terms( $taxonomy, $args );
6341
+    $terms = get_terms( $taxonomy, $args );
6342 6342
 
6343
-	$csv_rows = array();
6343
+    $csv_rows = array();
6344 6344
 	
6345
-	if ( !empty( $terms ) ) {
6346
-		$csv_row = array();
6347
-		$csv_row[] = 'cat_id';
6348
-		$csv_row[] = 'cat_name';
6349
-		$csv_row[] = 'cat_slug';
6350
-		$csv_row[] = 'cat_posttype';
6351
-		$csv_row[] = 'cat_parent';
6352
-		$csv_row[] = 'cat_schema';
6353
-		$csv_row[] = 'cat_description';
6354
-		$csv_row[] = 'cat_top_description';
6355
-		$csv_row[] = 'cat_image';
6356
-		$csv_row[] = 'cat_icon';
6357
-		// WPML
6358
-		$is_wpml = geodir_is_wpml();
6359
-		if ($is_wpml) {
6360
-			$csv_row[] = 'cat_language';
6361
-		}
6362
-		// WPML
6345
+    if ( !empty( $terms ) ) {
6346
+        $csv_row = array();
6347
+        $csv_row[] = 'cat_id';
6348
+        $csv_row[] = 'cat_name';
6349
+        $csv_row[] = 'cat_slug';
6350
+        $csv_row[] = 'cat_posttype';
6351
+        $csv_row[] = 'cat_parent';
6352
+        $csv_row[] = 'cat_schema';
6353
+        $csv_row[] = 'cat_description';
6354
+        $csv_row[] = 'cat_top_description';
6355
+        $csv_row[] = 'cat_image';
6356
+        $csv_row[] = 'cat_icon';
6357
+        // WPML
6358
+        $is_wpml = geodir_is_wpml();
6359
+        if ($is_wpml) {
6360
+            $csv_row[] = 'cat_language';
6361
+        }
6362
+        // WPML
6363 6363
 		
6364
-		$csv_rows[] = $csv_row;
6364
+        $csv_rows[] = $csv_row;
6365 6365
 		
6366
-		foreach ( $terms as $term ) {			
6367
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6366
+        foreach ( $terms as $term ) {			
6367
+            $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
+            $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6369 6369
 			
6370
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6370
+            $cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
+            $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6372 6372
 			
6373
-			$cat_parent = '';
6374
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6376
-				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377
-			}
6373
+            $cat_parent = '';
6374
+            if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
+                $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6376
+                $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377
+            }
6378 6378
 			
6379
-			$csv_row = array();
6380
-			$csv_row[] = $term->term_id;
6381
-			$csv_row[] = $term->name;
6382
-			$csv_row[] = $term->slug;
6383
-			$csv_row[] = $post_type;
6384
-			$csv_row[] = $cat_parent;
6385
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6386
-			$csv_row[] = $term->description;
6387
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6388
-			$csv_row[] = $cat_image;
6389
-			$csv_row[] = $cat_icon;
6390
-			// WPML
6391
-			if ($is_wpml) {
6392
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6393
-			}
6394
-			// WPML
6379
+            $csv_row = array();
6380
+            $csv_row[] = $term->term_id;
6381
+            $csv_row[] = $term->name;
6382
+            $csv_row[] = $term->slug;
6383
+            $csv_row[] = $post_type;
6384
+            $csv_row[] = $cat_parent;
6385
+            $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6386
+            $csv_row[] = $term->description;
6387
+            $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6388
+            $csv_row[] = $cat_image;
6389
+            $csv_row[] = $cat_icon;
6390
+            // WPML
6391
+            if ($is_wpml) {
6392
+                $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6393
+            }
6394
+            // WPML
6395 6395
 			
6396
-			$csv_rows[] = $csv_row;
6397
-		}
6398
-	}
6399
-	return $csv_rows;
6396
+            $csv_rows[] = $csv_row;
6397
+        }
6398
+    }
6399
+    return $csv_rows;
6400 6400
 }
6401 6401
 
6402 6402
 /**
@@ -6409,9 +6409,9 @@  discard block
 block discarded – undo
6409 6409
  * @return string Path to the cache directory.
6410 6410
  */
6411 6411
 function geodir_path_import_export( $relative = true ) {
6412
-	$upload_dir = wp_upload_dir();
6412
+    $upload_dir = wp_upload_dir();
6413 6413
 	
6414
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
6414
+    return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
6415 6415
 }
6416 6416
 
6417 6417
 /**
@@ -6428,29 +6428,29 @@  discard block
 block discarded – undo
6428 6428
  * @return bool true if success otherwise false.
6429 6429
  */
6430 6430
 function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
6431
-	if ( empty( $csv_data ) ) {
6432
-		return false;
6433
-	}
6431
+    if ( empty( $csv_data ) ) {
6432
+        return false;
6433
+    }
6434 6434
 	
6435
-	global $wp_filesystem;
6435
+    global $wp_filesystem;
6436 6436
 	
6437
-	$mode = $clear ? 'w+' : 'a+';
6437
+    $mode = $clear ? 'w+' : 'a+';
6438 6438
 	
6439
-	if ( function_exists( 'fputcsv' ) ) {
6440
-		$file = fopen( $file_path, $mode );
6441
-		foreach( $csv_data as $csv_row ) {
6442
-			//$csv_row = array_map( 'utf8_decode', $csv_row );
6443
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6444
-		}
6445
-		fclose( $file );
6446
-	} else {
6447
-		foreach( $csv_data as $csv_row ) {
6448
-			//$csv_row = array_map( 'utf8_decode', $csv_row );
6449
-			$wp_filesystem->put_contents( $file_path, $csv_row );
6450
-		}
6451
-	}
6439
+    if ( function_exists( 'fputcsv' ) ) {
6440
+        $file = fopen( $file_path, $mode );
6441
+        foreach( $csv_data as $csv_row ) {
6442
+            //$csv_row = array_map( 'utf8_decode', $csv_row );
6443
+            $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6444
+        }
6445
+        fclose( $file );
6446
+    } else {
6447
+        foreach( $csv_data as $csv_row ) {
6448
+            //$csv_row = array_map( 'utf8_decode', $csv_row );
6449
+            $wp_filesystem->put_contents( $file_path, $csv_row );
6450
+        }
6451
+    }
6452 6452
 		
6453
-	return true;
6453
+    return true;
6454 6454
 }
6455 6455
 
6456 6456
 /**
@@ -6465,17 +6465,17 @@  discard block
 block discarded – undo
6465 6465
  * @return int No of file rows.
6466 6466
  */
6467 6467
 function geodir_import_export_line_count( $file ) {
6468
-	global $wp_filesystem;
6468
+    global $wp_filesystem;
6469 6469
 	
6470
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
-		$contents = $wp_filesystem->get_contents_array( $file );
6470
+    if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
+        $contents = $wp_filesystem->get_contents_array( $file );
6472 6472
 		
6473
-		if ( !empty( $contents ) && is_array( $contents ) ) {
6474
-			return count( $contents ) - 1;
6475
-		}
6476
-	}
6473
+        if ( !empty( $contents ) && is_array( $contents ) ) {
6474
+            return count( $contents ) - 1;
6475
+        }
6476
+    }
6477 6477
 	
6478
-	return NULL;
6478
+    return NULL;
6479 6479
 }
6480 6480
 
6481 6481
 /**
@@ -6489,12 +6489,12 @@  discard block
 block discarded – undo
6489 6489
  * @return object Queried object.
6490 6490
  */
6491 6491
 function geodir_imex_get_custom_fields( $post_type ) {
6492
-	global $wpdb;
6492
+    global $wpdb;
6493 6493
 	 
6494
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
-	$rows = $wpdb->get_results( $sql );
6494
+    $sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
+    $rows = $wpdb->get_results( $sql );
6496 6496
 	 
6497
-	return $rows;
6497
+    return $rows;
6498 6498
 }
6499 6499
 
6500 6500
 /**
@@ -6505,11 +6505,11 @@  discard block
 block discarded – undo
6505 6505
  * @return True if WPML is active else False.
6506 6506
  */
6507 6507
 function geodir_is_wpml() {
6508
-	if (function_exists('icl_object_id')) {
6509
-		return true;
6510
-	}
6508
+    if (function_exists('icl_object_id')) {
6509
+        return true;
6510
+    }
6511 6511
 	
6512
-	return false;
6512
+    return false;
6513 6513
 }
6514 6514
 
6515 6515
 /**
@@ -6524,9 +6524,9 @@  discard block
 block discarded – undo
6524 6524
  * @return Language code.
6525 6525
  */
6526 6526
 function geodir_get_language_for_element($element_id, $element_type) {
6527
-	global $sitepress;
6527
+    global $sitepress;
6528 6528
 	
6529
-	return $sitepress->get_language_for_element($element_id, $element_type);
6529
+    return $sitepress->get_language_for_element($element_id, $element_type);
6530 6530
 }
6531 6531
 
6532 6532
 /**
@@ -6540,18 +6540,18 @@  discard block
 block discarded – undo
6540 6540
  * @param int $tr_post_id Translation Post ID.
6541 6541
  */
6542 6542
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id) {
6543
-	$post_type = get_post_type($master_post_id);
6543
+    $post_type = get_post_type($master_post_id);
6544 6544
 
6545
-	if (in_array($post_type, geodir_get_posttypes())) {				
6546
-		// Duplicate post details
6547
-		geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
6545
+    if (in_array($post_type, geodir_get_posttypes())) {				
6546
+        // Duplicate post details
6547
+        geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
6548 6548
 		
6549
-		// Duplicate taxonomies
6550
-		geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
6549
+        // Duplicate taxonomies
6550
+        geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
6551 6551
 		
6552
-		// Duplicate post images
6553
-		geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
6554
-	}
6552
+        // Duplicate post images
6553
+        geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
6554
+    }
6555 6555
 }
6556 6556
 
6557 6557
 /**
@@ -6568,23 +6568,23 @@  discard block
 block discarded – undo
6568 6568
  * @return bool True for success, False for fail.
6569 6569
  */
6570 6570
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
6571
-	global $wpdb, $plugin_prefix;
6571
+    global $wpdb, $plugin_prefix;
6572 6572
 	
6573
-	$post_type = get_post_type($master_post_id);
6574
-	$post_table = $plugin_prefix . $post_type . '_detail';
6573
+    $post_type = get_post_type($master_post_id);
6574
+    $post_table = $plugin_prefix . $post_type . '_detail';
6575 6575
 	
6576
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
-	$data = (array)$wpdb->get_row($query);
6576
+    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
+    $data = (array)$wpdb->get_row($query);
6578 6578
 	
6579
-	if ( !empty( $data ) ) {
6580
-		$data['post_id'] = $tr_post_id;
6581
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6579
+    if ( !empty( $data ) ) {
6580
+        $data['post_id'] = $tr_post_id;
6581
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6582 6582
 		
6583
-		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6584
-		return true;
6585
-	}
6583
+        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6584
+        return true;
6585
+    }
6586 6586
 	
6587
-	return false;
6587
+    return false;
6588 6588
 }
6589 6589
 
6590 6590
 /**
@@ -6601,40 +6601,40 @@  discard block
 block discarded – undo
6601 6601
  * @return bool True for success, False for fail.
6602 6602
  */
6603 6603
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
6604
-	global $sitepress, $wpdb;
6605
-	$post_type = get_post_type($master_post_id);
6604
+    global $sitepress, $wpdb;
6605
+    $post_type = get_post_type($master_post_id);
6606 6606
 	
6607
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6607
+    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6608 6608
 
6609
-	$taxonomies = get_object_taxonomies($post_type);
6610
-	foreach ($taxonomies as $taxonomy) {
6611
-		$terms = get_the_terms($master_post_id, $taxonomy);
6612
-		$terms_array = array();
6609
+    $taxonomies = get_object_taxonomies($post_type);
6610
+    foreach ($taxonomies as $taxonomy) {
6611
+        $terms = get_the_terms($master_post_id, $taxonomy);
6612
+        $terms_array = array();
6613 6613
 		
6614
-		if ($terms) {
6615
-			foreach ($terms as $term) {
6616
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6614
+        if ($terms) {
6615
+            foreach ($terms as $term) {
6616
+                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6617 6617
 				
6618
-				if (!is_null($tr_id)){
6619
-					// not using get_term - unfiltered get_term
6620
-					$translated_term = $wpdb->get_row($wpdb->prepare("
6618
+                if (!is_null($tr_id)){
6619
+                    // not using get_term - unfiltered get_term
6620
+                    $translated_term = $wpdb->get_row($wpdb->prepare("
6621 6621
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
6622 6622
 
6623
-					$terms_array[] = $translated_term->term_id;
6624
-				}
6625
-			}
6623
+                    $terms_array[] = $translated_term->term_id;
6624
+                }
6625
+            }
6626 6626
 
6627
-			if (!is_taxonomy_hierarchical($taxonomy)){
6628
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6629
-			}
6627
+            if (!is_taxonomy_hierarchical($taxonomy)){
6628
+                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
6629
+            }
6630 6630
 
6631
-			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6631
+            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6632 6632
 			
6633
-			if ($taxonomy == $post_type . 'category') {
6634
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6635
-			}
6636
-		}
6637
-	}
6633
+            if ($taxonomy == $post_type . 'category') {
6634
+                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6635
+            }
6636
+        }
6637
+    }
6638 6638
 }
6639 6639
 
6640 6640
 /**
@@ -6650,29 +6650,29 @@  discard block
 block discarded – undo
6650 6650
  * @return bool True for success, False for fail.
6651 6651
  */
6652 6652
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
6653
-	global $wpdb;
6653
+    global $wpdb;
6654 6654
 	
6655
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6656
-	$wpdb->query($query);
6655
+    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6656
+    $wpdb->query($query);
6657 6657
 	
6658
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659
-	$post_images = $wpdb->get_results($query);
6658
+    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659
+    $post_images = $wpdb->get_results($query);
6660 6660
 	
6661
-	if ( !empty( $post_images ) ) {
6662
-		foreach ( $post_images as $post_image) {
6663
-			$image_data = (array)$post_image;
6664
-			unset($image_data['ID']);
6665
-			$image_data['post_id'] = $tr_post_id;
6661
+    if ( !empty( $post_images ) ) {
6662
+        foreach ( $post_images as $post_image) {
6663
+            $image_data = (array)$post_image;
6664
+            unset($image_data['ID']);
6665
+            $image_data['post_id'] = $tr_post_id;
6666 6666
 			
6667
-			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
6667
+            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
6668 6668
 			
6669
-			geodir_set_wp_featured_image($tr_post_id);
6670
-		}
6669
+            geodir_set_wp_featured_image($tr_post_id);
6670
+        }
6671 6671
 		
6672
-		return true;
6673
-	}
6672
+        return true;
6673
+    }
6674 6674
 	
6675
-	return false;
6675
+    return false;
6676 6676
 }
6677 6677
 
6678 6678
 /**
@@ -6686,141 +6686,141 @@  discard block
 block discarded – undo
6686 6686
  * @return array Event data array.
6687 6687
  */
6688 6688
 function geodir_imex_get_event_data($post, $gd_post_info) {
6689
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6690
-	$event_enddate = $event_date;
6691
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6689
+    $event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6690
+    $event_enddate = $event_date;
6691
+    $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
+    $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6693 6693
 	
6694
-	$is_recurring_event = '';
6695
-	$event_duration_days = '';
6696
-	$is_whole_day_event = '';
6697
-	$recurring_dates = '';
6698
-	$event_starttimes = '';
6699
-	$event_endtimes = '';
6700
-	$recurring_type = '';
6701
-	$recurring_interval = '';
6702
-	$recurring_week_days = '';
6703
-	$recurring_week_nos = '';
6704
-	$max_recurring_count = '';
6705
-	$recurring_end_date = '';
6706
-	$recurring_dates = '';
6694
+    $is_recurring_event = '';
6695
+    $event_duration_days = '';
6696
+    $is_whole_day_event = '';
6697
+    $recurring_dates = '';
6698
+    $event_starttimes = '';
6699
+    $event_endtimes = '';
6700
+    $recurring_type = '';
6701
+    $recurring_interval = '';
6702
+    $recurring_week_days = '';
6703
+    $recurring_week_nos = '';
6704
+    $max_recurring_count = '';
6705
+    $recurring_end_date = '';
6706
+    $recurring_dates = '';
6707 6707
 		
6708
-	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709
-	if (!empty($recurring_data)) {
6710
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6714
-		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715
-		$different_times = !empty($recurring_data['different_times']) ? true : false;
6708
+    $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709
+    if (!empty($recurring_data)) {
6710
+        $event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
+        $event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
+        $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
+        $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6714
+        $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715
+        $different_times = !empty($recurring_data['different_times']) ? true : false;
6716 6716
 	
6717
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6717
+        $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
+        $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6719 6719
 			
6720
-		if ($recurring_pkg && $is_recurring) {
6721
-			$recurring_dates = $event_date;
6722
-			$event_enddate = '';
6723
-			$is_recurring_event = 1;
6720
+        if ($recurring_pkg && $is_recurring) {
6721
+            $recurring_dates = $event_date;
6722
+            $event_enddate = '';
6723
+            $is_recurring_event = 1;
6724 6724
 						
6725
-			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6725
+            $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6726 6726
 			
6727
-			if (!empty($recurring_data['event_recurring_dates'])) {
6728
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6727
+            if (!empty($recurring_data['event_recurring_dates'])) {
6728
+                $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6729 6729
 				
6730
-				if (!empty($event_recurring_dates)) {
6731
-					$recurring_dates = array();
6730
+                if (!empty($event_recurring_dates)) {
6731
+                    $recurring_dates = array();
6732 6732
 					
6733
-					foreach ($event_recurring_dates as $date) {
6734
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6735
-					}
6733
+                    foreach ($event_recurring_dates as $date) {
6734
+                        $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6735
+                    }
6736 6736
 					
6737
-					$recurring_dates = implode(",", $recurring_dates);
6738
-				}
6739
-			}
6737
+                    $recurring_dates = implode(",", $recurring_dates);
6738
+                }
6739
+            }
6740 6740
 			
6741
-			if ($recurring_type == 'custom') {
6742
-				if (!$is_whole_day_event) {
6743
-					$event_starttimes = $starttime;
6744
-					$event_endtimes = $endtime;
6741
+            if ($recurring_type == 'custom') {
6742
+                if (!$is_whole_day_event) {
6743
+                    $event_starttimes = $starttime;
6744
+                    $event_endtimes = $endtime;
6745 6745
 			
6746
-					if (!empty($recurring_data['starttimes'])) {
6747
-						$times = array();
6746
+                    if (!empty($recurring_data['starttimes'])) {
6747
+                        $times = array();
6748 6748
 						
6749
-						foreach ($recurring_data['starttimes'] as $time) {
6750
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6751
-						}
6749
+                        foreach ($recurring_data['starttimes'] as $time) {
6750
+                            $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6751
+                        }
6752 6752
 						
6753
-						$event_starttimes = implode(",", $times);
6754
-					}
6753
+                        $event_starttimes = implode(",", $times);
6754
+                    }
6755 6755
 					
6756
-					if (!empty($recurring_data['endtimes'])) {
6757
-						$times = array();
6756
+                    if (!empty($recurring_data['endtimes'])) {
6757
+                        $times = array();
6758 6758
 						
6759
-						foreach ($recurring_data['endtimes'] as $time) {
6760
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6761
-						}
6759
+                        foreach ($recurring_data['endtimes'] as $time) {
6760
+                            $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6761
+                        }
6762 6762
 						
6763
-						$event_endtimes = implode(",", $times);
6764
-					}
6763
+                        $event_endtimes = implode(",", $times);
6764
+                    }
6765 6765
 					
6766
-					if (!$different_times) {
6767
-						$event_starttimes = '';
6768
-						$event_endtimes = '';
6769
-					}
6770
-				}
6771
-			} else {
6772
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6766
+                    if (!$different_times) {
6767
+                        $event_starttimes = '';
6768
+                        $event_endtimes = '';
6769
+                    }
6770
+                }
6771
+            } else {
6772
+                $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
+                $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6774 6774
 				
6775
-				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776
-					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
6775
+                if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776
+                    $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
6777 6777
 					
6778
-					$days = array();
6779
-					foreach ($recurring_data['repeat_days'] as $day) {
6780
-						if (isset($week_days[$day])) {
6781
-							$days[] = $week_days[$day];
6782
-						}
6783
-					}
6778
+                    $days = array();
6779
+                    foreach ($recurring_data['repeat_days'] as $day) {
6780
+                        if (isset($week_days[$day])) {
6781
+                            $days[] = $week_days[$day];
6782
+                        }
6783
+                    }
6784 6784
 					
6785
-					$recurring_week_days = implode(",", array_unique($days));
6786
-				}
6785
+                    $recurring_week_days = implode(",", array_unique($days));
6786
+                }
6787 6787
 				
6788
-				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6791
-					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792
-				} else {
6793
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6794
-				}
6795
-			}
6796
-		}
6797
-	}
6798
-	if ($is_whole_day_event) {
6799
-		$starttime = '';
6800
-		$endtime = '';
6801
-		$event_starttimes = '';
6802
-		$event_endtimes = '';
6803
-	}
6788
+                $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
+                if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
+                    $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6791
+                    $max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792
+                } else {
6793
+                    $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6794
+                }
6795
+            }
6796
+        }
6797
+    }
6798
+    if ($is_whole_day_event) {
6799
+        $starttime = '';
6800
+        $endtime = '';
6801
+        $event_starttimes = '';
6802
+        $event_endtimes = '';
6803
+    }
6804 6804
 	
6805
-	$data = array();
6806
-	$data['event_date'] = $event_date;
6807
-	$data['event_enddate'] = $event_enddate;
6808
-	$data['starttime'] = $starttime;
6809
-	$data['endtime'] = $endtime;
6810
-	$data['is_recurring_event'] = $is_recurring_event;
6811
-	$data['recurring_dates'] = $recurring_dates;
6812
-	$data['event_duration_days'] = $event_duration_days;
6813
-	$data['is_whole_day_event'] = $is_whole_day_event;
6814
-	$data['event_starttimes'] = $event_starttimes;
6815
-	$data['event_endtimes'] = $event_endtimes;
6816
-	$data['recurring_type'] = $recurring_type;
6817
-	$data['recurring_interval'] = $recurring_interval;
6818
-	$data['recurring_week_days'] = $recurring_week_days;
6819
-	$data['recurring_week_nos'] = $recurring_week_nos;
6820
-	$data['max_recurring_count'] = $max_recurring_count;
6821
-	$data['recurring_end_date'] = $recurring_end_date;
6805
+    $data = array();
6806
+    $data['event_date'] = $event_date;
6807
+    $data['event_enddate'] = $event_enddate;
6808
+    $data['starttime'] = $starttime;
6809
+    $data['endtime'] = $endtime;
6810
+    $data['is_recurring_event'] = $is_recurring_event;
6811
+    $data['recurring_dates'] = $recurring_dates;
6812
+    $data['event_duration_days'] = $event_duration_days;
6813
+    $data['is_whole_day_event'] = $is_whole_day_event;
6814
+    $data['event_starttimes'] = $event_starttimes;
6815
+    $data['event_endtimes'] = $event_endtimes;
6816
+    $data['recurring_type'] = $recurring_type;
6817
+    $data['recurring_interval'] = $recurring_interval;
6818
+    $data['recurring_week_days'] = $recurring_week_days;
6819
+    $data['recurring_week_nos'] = $recurring_week_nos;
6820
+    $data['max_recurring_count'] = $max_recurring_count;
6821
+    $data['recurring_end_date'] = $recurring_end_date;
6822 6822
 	
6823
-	return $data;
6823
+    return $data;
6824 6824
 }
6825 6825
 
6826 6826
 /**
@@ -6836,12 +6836,12 @@  discard block
 block discarded – undo
6836 6836
  * @return doesn't Date.
6837 6837
  */
6838 6838
 function geodir_imex_get_date_ymd($date) {
6839
-	if (strpos($date, '/') !== false) {
6840
-		$date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format.
6841
-	}
6839
+    if (strpos($date, '/') !== false) {
6840
+        $date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format.
6841
+    }
6842 6842
 	
6843
-	$date = date_i18n('Y-m-d', strtotime($date));
6844
-	return $date;
6843
+    $date = date_i18n('Y-m-d', strtotime($date));
6844
+    return $date;
6845 6845
 }
6846 6846
 
6847 6847
 /**
@@ -6854,117 +6854,117 @@  discard block
 block discarded – undo
6854 6854
  * @return array Event data array.
6855 6855
  */
6856 6856
 function geodir_imex_process_event_data($gd_post) {
6857
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6858
-
6859
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6860
-	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861
-	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862
-	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
6863
-	$starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : '';
6864
-	$endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : '';
6857
+    $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6858
+
6859
+    $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6860
+    $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861
+    $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862
+    $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
6863
+    $starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : '';
6864
+    $endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : '';
6865 6865
 	
6866
-	$repeat_type = '';
6867
-	$different_times = '';
6868
-	$starttimes = '';
6869
-	$endtimes = '';
6870
-	$repeat_days = '';
6871
-	$repeat_weeks = '';
6872
-	$event_recurring_dates = '';
6873
-	$repeat_x = '';
6874
-	$duration_x = '';
6875
-	$repeat_end_type = '';
6876
-	$max_repeat = '';
6877
-	$repeat_end = '';
6866
+    $repeat_type = '';
6867
+    $different_times = '';
6868
+    $starttimes = '';
6869
+    $endtimes = '';
6870
+    $repeat_days = '';
6871
+    $repeat_weeks = '';
6872
+    $event_recurring_dates = '';
6873
+    $repeat_x = '';
6874
+    $duration_x = '';
6875
+    $repeat_end_type = '';
6876
+    $max_repeat = '';
6877
+    $repeat_end = '';
6878 6878
 	
6879
-	if ($recurring_pkg && $is_recurring) {
6880
-		$repeat_type = $gd_post['recurring_type'];
6879
+    if ($recurring_pkg && $is_recurring) {
6880
+        $repeat_type = $gd_post['recurring_type'];
6881 6881
 		
6882
-		if ($repeat_type == 'custom') {
6883
-			$starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array();
6884
-			$endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array();
6882
+        if ($repeat_type == 'custom') {
6883
+            $starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array();
6884
+            $endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array();
6885 6885
 			
6886
-			if (!empty($starttimes) || !empty($endtimes)) {
6887
-				$different_times = true;
6888
-			}
6886
+            if (!empty($starttimes) || !empty($endtimes)) {
6887
+                $different_times = true;
6888
+            }
6889 6889
 			
6890
-			$recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array();
6891
-			if (!empty($recurring_dates)) {
6892
-				$event_recurring_dates = array();
6890
+            $recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array();
6891
+            if (!empty($recurring_dates)) {
6892
+                $event_recurring_dates = array();
6893 6893
 				
6894
-				foreach ($recurring_dates as $recurring_date) {
6895
-					$recurring_date = trim($recurring_date);
6894
+                foreach ($recurring_dates as $recurring_date) {
6895
+                    $recurring_date = trim($recurring_date);
6896 6896
 					
6897
-					if ($recurring_date != '') {
6898
-						$event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date);
6899
-					}
6900
-				}
6897
+                    if ($recurring_date != '') {
6898
+                        $event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date);
6899
+                    }
6900
+                }
6901 6901
 				
6902
-				$event_recurring_dates = array_unique($event_recurring_dates);
6903
-				$event_recurring_dates = implode(",", $event_recurring_dates);
6904
-			}
6905
-		} else {
6906
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6902
+                $event_recurring_dates = array_unique($event_recurring_dates);
6903
+                $event_recurring_dates = implode(",", $event_recurring_dates);
6904
+            }
6905
+        } else {
6906
+            $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
+            $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
+            $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
+            $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6910 6910
 			
6911
-			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6912
-			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6911
+            $repeat_end_type = $repeat_end != '' ? 1 : 0;
6912
+            $max_repeat = $repeat_end != '' ? '' : $max_repeat;
6913 6913
 			
6914
-			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6914
+            $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6915 6915
 			
6916
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917
-			$repeat_days = array();
6918
-			if (!empty($a_repeat_days)) {
6919
-				foreach ($a_repeat_days as $repeat_day) {
6920
-					$repeat_day = geodir_strtolower(trim($repeat_day));
6916
+            $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917
+            $repeat_days = array();
6918
+            if (!empty($a_repeat_days)) {
6919
+                foreach ($a_repeat_days as $repeat_day) {
6920
+                    $repeat_day = geodir_strtolower(trim($repeat_day));
6921 6921
 					
6922
-					if ($repeat_day != '' && isset($week_days[$repeat_day])) {
6923
-						$repeat_days[] = $week_days[$repeat_day];
6924
-					}
6925
-				}
6922
+                    if ($repeat_day != '' && isset($week_days[$repeat_day])) {
6923
+                        $repeat_days[] = $week_days[$repeat_day];
6924
+                    }
6925
+                }
6926 6926
 				
6927
-				$repeat_days = array_unique($repeat_days);
6928
-			}
6927
+                $repeat_days = array_unique($repeat_days);
6928
+            }
6929 6929
 			
6930
-			$a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array();
6931
-			$repeat_weeks = array();
6932
-			if (!empty($a_repeat_weeks)) {
6933
-				foreach ($a_repeat_weeks as $repeat_week) {
6934
-					$repeat_weeks[] = (int)$repeat_week;
6935
-				}
6930
+            $a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array();
6931
+            $repeat_weeks = array();
6932
+            if (!empty($a_repeat_weeks)) {
6933
+                foreach ($a_repeat_weeks as $repeat_week) {
6934
+                    $repeat_weeks[] = (int)$repeat_week;
6935
+                }
6936 6936
 				
6937
-				$repeat_weeks = array_unique($repeat_weeks);
6938
-			}
6939
-		}
6940
-	}
6937
+                $repeat_weeks = array_unique($repeat_weeks);
6938
+            }
6939
+        }
6940
+    }
6941 6941
 	
6942
-	if (isset($gd_post['recurring_dates'])) {
6943
-		unset($gd_post['recurring_dates']);
6944
-	}
6942
+    if (isset($gd_post['recurring_dates'])) {
6943
+        unset($gd_post['recurring_dates']);
6944
+    }
6945 6945
 
6946
-	$gd_post['is_recurring'] = $is_recurring;
6947
-	$gd_post['event_date'] = $event_date;
6948
-	$gd_post['event_start'] = $event_date;
6949
-	$gd_post['event_end'] = $event_enddate;
6950
-	$gd_post['all_day'] = $all_day;
6951
-	$gd_post['starttime'] = $starttime;
6952
-	$gd_post['endtime'] = $endtime;
6946
+    $gd_post['is_recurring'] = $is_recurring;
6947
+    $gd_post['event_date'] = $event_date;
6948
+    $gd_post['event_start'] = $event_date;
6949
+    $gd_post['event_end'] = $event_enddate;
6950
+    $gd_post['all_day'] = $all_day;
6951
+    $gd_post['starttime'] = $starttime;
6952
+    $gd_post['endtime'] = $endtime;
6953 6953
 	
6954
-	$gd_post['repeat_type'] = $repeat_type;
6955
-	$gd_post['different_times'] = $different_times;
6956
-	$gd_post['starttimes'] = $starttimes;
6957
-	$gd_post['endtimes'] = $endtimes;
6958
-	$gd_post['repeat_days'] = $repeat_days;
6959
-	$gd_post['repeat_weeks'] = $repeat_weeks;
6960
-	$gd_post['event_recurring_dates'] = $event_recurring_dates;
6961
-	$gd_post['repeat_x'] = $repeat_x;
6962
-	$gd_post['duration_x'] = $duration_x;
6963
-	$gd_post['repeat_end_type'] = $repeat_end_type;
6964
-	$gd_post['max_repeat'] = $max_repeat;
6965
-	$gd_post['repeat_end'] = $repeat_end;
6966
-
6967
-	return $gd_post;
6954
+    $gd_post['repeat_type'] = $repeat_type;
6955
+    $gd_post['different_times'] = $different_times;
6956
+    $gd_post['starttimes'] = $starttimes;
6957
+    $gd_post['endtimes'] = $endtimes;
6958
+    $gd_post['repeat_days'] = $repeat_days;
6959
+    $gd_post['repeat_weeks'] = $repeat_weeks;
6960
+    $gd_post['event_recurring_dates'] = $event_recurring_dates;
6961
+    $gd_post['repeat_x'] = $repeat_x;
6962
+    $gd_post['duration_x'] = $duration_x;
6963
+    $gd_post['repeat_end_type'] = $repeat_end_type;
6964
+    $gd_post['max_repeat'] = $max_repeat;
6965
+    $gd_post['repeat_end'] = $repeat_end;
6966
+
6967
+    return $gd_post;
6968 6968
 }
6969 6969
 
6970 6970
 /**
@@ -7036,12 +7036,12 @@  discard block
 block discarded – undo
7036 7036
  * @return Original element id.
7037 7037
  */
7038 7038
 function geodir_imex_original_post_id($element_id, $element_type) {
7039
-	global $sitepress;
7039
+    global $sitepress;
7040 7040
 	
7041
-	$original_element_id = $sitepress->get_original_element_id($element_id, $element_type);
7042
-	$element_id = $element_id != $original_element_id ? $original_element_id : '';
7041
+    $original_element_id = $sitepress->get_original_element_id($element_id, $element_type);
7042
+    $element_id = $element_id != $original_element_id ? $original_element_id : '';
7043 7043
 	
7044
-	return $element_id;
7044
+    return $element_id;
7045 7045
 }
7046 7046
 
7047 7047
 /*
@@ -7121,15 +7121,15 @@  discard block
 block discarded – undo
7121 7121
  * @global object $sitepress Sitepress WPML object.
7122 7122
  */
7123 7123
 function geodir_wpml_permalink_setting_notice() {
7124
-	if (geodir_is_wpml()) {
7125
-		global $sitepress;
7126
-		$current_language = $sitepress->get_current_language();
7127
-		$default_language = $sitepress->get_default_language();
7128
-		if ($current_language != 'all' && $current_language != $default_language) {
7129
-	?>
7124
+    if (geodir_is_wpml()) {
7125
+        global $sitepress;
7126
+        $current_language = $sitepress->get_current_language();
7127
+        $default_language = $sitepress->get_default_language();
7128
+        if ($current_language != 'all' && $current_language != $default_language) {
7129
+    ?>
7130 7130
 	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
7131 7131
 	<?php
7132
-		}
7133
-	}
7132
+        }
7133
+    }
7134 7134
 }
7135 7135
 ?>
7136 7136
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +642 added lines, -642 removed lines patch added patch discarded remove patch
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
                 <?php
481 481
 
482 482
                     $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
483
+                  $city = isset($default_location->city) ? $default_location->city : '';
484
+                  $region = isset($default_location->region) ? $default_location->region : '';
485
+                  $country = isset($default_location->country) ? $default_location->country : '';
486
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489 489
                 ?>
490 490
                 var geocoder = new google.maps.Geocoder();
491
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
491
+                var CITY_ADDRESS = '<?php echo $city . ',' . $region . ',' . $country; ?>';
492 492
                 var bound_lat_lng;
493 493
                 var lat = <?php echo $city_latitude; ?>;
494 494
                 var lng = <?php echo $city_longitude; ?>;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                             );
526 526
 
527 527
                         } else {
528
-                            alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
528
+                            alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
529 529
                         }
530 530
                     });
531 531
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
539 539
 
540 540
                     if (id == 'geodir_dummy_delete') {
541
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
541
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
542 542
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
543 543
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
544 544
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
558 558
                             function (data) {
559 559
 
560
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
560
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
561 561
                                 dummy_post_index++;
562 562
                                 if (dummy_post_index <= total_dummy_post_count)
563 563
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                     else
669 669
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
670 670
                     $catname = str_replace(' ', '_', $catname);
671
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
671
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
672 672
 
673 673
                     if (empty($uploaded['error'])) {
674 674
                         $new_path = $uploaded['file'];
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
                 else
710 710
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
711 711
                 $catname = str_replace(' ', '_', $catname);
712
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
712
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
713 713
 
714 714
                 if (empty($uploaded['error'])) {
715 715
                     $new_path = $uploaded['file'];
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
  */
1022 1022
 function geodir_extend_geodirectory_setting_tab($tabs)
1023 1023
 {
1024
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1024
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory') . ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1025 1025
     return $tabs;
1026 1026
 }
1027 1027
 
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 function geodir_post_information_save($post_id, $post) {
1175 1175
     global $wpdb, $current_user;
1176 1176
 
1177
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1177
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1178 1178
         return;
1179 1179
     }
1180 1180
 
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 
1257 1257
         if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] == 'csv_upload_settings') {
1258 1258
             if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'success') {
1259
-                $rowcount = (int)$_REQUEST['rowcount'];
1259
+                $rowcount = (int) $_REQUEST['rowcount'];
1260 1260
                 $uploads = wp_upload_dir();
1261 1261
                 ?>
1262 1262
                 <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px;">
@@ -1270,25 +1270,25 @@  discard block
 block discarded – undo
1270 1270
 
1271 1271
                     if (isset($_REQUEST['invalidcount']) && $_REQUEST['invalidcount'] > 0) {
1272 1272
                         echo '<p>';
1273
-                        printf(CSV_INVALID_DEFUALT_ADDRESS, (int)$_REQUEST['invalidcount'], (int)$_REQUEST['total_records']);
1273
+                        printf(CSV_INVALID_DEFUALT_ADDRESS, (int) $_REQUEST['invalidcount'], (int) $_REQUEST['total_records']);
1274 1274
                         echo '</p>';
1275 1275
                     }
1276 1276
 
1277 1277
                     if (isset($_REQUEST['blank_address']) && $_REQUEST['blank_address'] > 0) {
1278 1278
                         echo '<p>';
1279
-                        printf(CSV_INVALID_TOTAL_RECORD, (int)$_REQUEST['blank_address'], (int)$_REQUEST['total_records']);
1279
+                        printf(CSV_INVALID_TOTAL_RECORD, (int) $_REQUEST['blank_address'], (int) $_REQUEST['total_records']);
1280 1280
                         echo '</p>';
1281 1281
                     }
1282 1282
 
1283 1283
                     if (isset($_REQUEST['invalid_post_type']) && $_REQUEST['invalid_post_type'] > 0) {
1284 1284
                         echo '<p>';
1285
-                        printf(CSV_INVALID_POST_TYPE, (int)$_REQUEST['invalid_post_type'], (int)$_REQUEST['total_records']);
1285
+                        printf(CSV_INVALID_POST_TYPE, (int) $_REQUEST['invalid_post_type'], (int) $_REQUEST['total_records']);
1286 1286
                         echo '</p>';
1287 1287
                     }
1288 1288
 
1289 1289
                     if (isset($_REQUEST['invalid_title']) && $_REQUEST['invalid_title'] > 0) {
1290 1290
                         echo '<p>';
1291
-                        printf(CSV_BLANK_POST_TITLE, (int)$_REQUEST['invalid_title'], (int)$_REQUEST['total_records']);
1291
+                        printf(CSV_BLANK_POST_TITLE, (int) $_REQUEST['invalid_title'], (int) $_REQUEST['total_records']);
1292 1292
                         echo '</p>';
1293 1293
                     }
1294 1294
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
                     jQuery('#gd-import-perc').text('0%');
1491 1491
 
1492 1492
                     jQuery('.gd-csv-form-table .filelist .file').remove();
1493
-                    jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
1493
+                    jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
1494 1494
                     jQuery('#gd-import-msg').show();
1495 1495
 
1496 1496
                     return false;
@@ -1658,38 +1658,38 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
                 var gdMsg = '<p></p>';
1660 1660
                 if (gd_invalidcount == 0 && gd_blank_address == 0 && gd_invalid_post_type == 0 && gd_invalid_title == 0) {
1661
-                    gdMsg += "<p><?php echo esc_attr( CSV_INSERT_DATA );?></p>";
1661
+                    gdMsg += "<p><?php echo esc_attr(CSV_INSERT_DATA); ?></p>";
1662 1662
                 }
1663 1663
 
1664
-                var msgParse = '<p><?php echo addslashes( CSV_TOTAL_RECORD );?></p>';
1664
+                var msgParse = '<p><?php echo addslashes(CSV_TOTAL_RECORD); ?></p>';
1665 1665
                 gdMsg += msgParse.replace("%s", gd_rowcount);
1666 1666
 
1667 1667
                 if (gd_invalidcount > 0) {
1668
-                    msgParse = msgParse = '<p><?php echo sprintf( CSV_INVALID_DEFUALT_ADDRESS, '%s', '%d' );?></p>';
1668
+                    msgParse = msgParse = '<p><?php echo sprintf(CSV_INVALID_DEFUALT_ADDRESS, '%s', '%d'); ?></p>';
1669 1669
                     msgParse = msgParse.replace("%s", gd_invalidcount);
1670 1670
                     msgParse = msgParse.replace("%d", gd_total_records);
1671 1671
                     gdMsg += msgParse;
1672 1672
                 }
1673 1673
                 if (gd_blank_address > 0) {
1674
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_INVALID_TOTAL_RECORD, '%s', '%d' ) );?></p>';
1674
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_TOTAL_RECORD, '%s', '%d')); ?></p>';
1675 1675
                     msgParse = msgParse.replace("%s", gd_blank_address);
1676 1676
                     msgParse = msgParse.replace("%d", gd_total_records);
1677 1677
                     gdMsg += msgParse;
1678 1678
                 }
1679 1679
                 if (gd_invalid_post_type > 0) {
1680
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_INVALID_POST_TYPE, '%s', '%d' ) );?></p>';
1680
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_POST_TYPE, '%s', '%d')); ?></p>';
1681 1681
                     msgParse = msgParse.replace("%s", gd_invalid_post_type);
1682 1682
                     msgParse = msgParse.replace("%d", gd_total_records);
1683 1683
                     gdMsg += msgParse;
1684 1684
                 }
1685 1685
                 if (gd_invalid_title > 0) {
1686
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_BLANK_POST_TITLE, '%s', '%d' ) );?></p>';
1686
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_BLANK_POST_TITLE, '%s', '%d')); ?></p>';
1687 1687
                     msgParse = msgParse.replace("%s", gd_invalid_title);
1688 1688
                     msgParse = msgParse.replace("%d", gd_total_records);
1689 1689
                     gdMsg += msgParse;
1690 1690
                 }
1691 1691
                 if (gd_upload_files > 0) {
1692
-                    gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
1692
+                    gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
1693 1693
                 }
1694 1694
                 gdMsg += '<p></p>';
1695 1695
                 jQuery('#gd-import-msg').find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
         <table class="form-table gd-csv-form-table">
1700 1700
             <tbody>
1701 1701
             <tr valign="top" class="single_select_page">
1702
-                <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE;?></th>
1702
+                <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE; ?></th>
1703 1703
                 <td class="forminp">
1704 1704
                     <div class="gtd-formfeild">
1705 1705
                         <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox">
@@ -1734,12 +1734,12 @@  discard block
 block discarded – undo
1734 1734
                                id="gd_import_data" class="button-primary" name="save">
1735 1735
                         <input onclick="gdContinueImport()" type="button" value="Continue Import Data"
1736 1736
                                id="gd_continue_data" class="button-primary" style="display:none"/>
1737
-                        <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>"
1737
+                        <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>"
1738 1738
                                id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none"
1739 1739
                                onclick="gdTerminateImport()"/>
1740 1740
 
1741 1741
                         <div id="gd_process_data" style="display:none"><span class="spinner"
1742
-                                                                             style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
1742
+                                                                             style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
1743 1743
                         </div>
1744 1744
                     </div>
1745 1745
                     <div id="gd_importer" style="display:none">
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
                         <input type="hidden" id="gd_total_records" value="0"/>
1758 1758
                     </div>
1759 1759
                     <div class="gd-import-progress" id="gd-import-progress" style="display:none">
1760
-                        <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
1760
+                        <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
1761 1761
                                 id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
1762 1762
                                 id="gd-import-perc">0%</font> )
1763 1763
                             <div class="gd-fileprogress"></div>
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
                             $payment_info = array();
2017 2017
                             $package_info = array();
2018 2018
 
2019
-                            $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2019
+                            $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2020 2020
                             $package_id = '';
2021 2021
                             if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2022 2022
                                 $package_id = $gd_post_info['package_id'];
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
2251 2251
                                            id="<?php echo esc_attr($value['id']); ?>"
2252 2252
                                            type="<?php echo esc_attr($value['type']); ?>"
2253
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2253
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2254 2254
                                            style=" <?php echo esc_attr($value['css']); ?>"
2255 2255
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2256 2256
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
2268 2268
                                            id="<?php echo esc_attr($value['id']); ?>"
2269 2269
                                            type="<?php echo esc_attr($value['type']); ?>"
2270
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2270
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2271 2271
                                            style="<?php echo esc_attr($value['css']); ?>"
2272 2272
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2273 2273
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -2368,7 +2368,7 @@  discard block
 block discarded – undo
2368 2368
                                             id="<?php echo esc_attr($value['id']); ?>"
2369 2369
                                             style="<?php echo esc_attr($value['css']); ?>"
2370 2370
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
2371
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
2371
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
2372 2372
                                             option-ajaxchosen="false">
2373 2373
                         <?php
2374 2374
                         foreach ($value['options'] as $key => $val) {
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
                 ?>
2417 2417
 
2418 2418
                 <tr valign="top">
2419
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
2419
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
2420 2420
                     <td width="60%">
2421 2421
                         <select name="geodir_default_map_language" style="width:60%">
2422 2422
                             <?php
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 
2499 2499
                 <tr valign="top">
2500 2500
                     <th class="titledesc"
2501
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
2501
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
2502 2502
                     <td width="60%">
2503 2503
                         <select name="geodir_default_map_search_pt" style="width:60%">
2504 2504
                             <?php
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
                         $cat_display = 'checkbox';
2540 2540
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
2541 2541
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
2542
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
2542
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
2543 2543
                         $count = 1;
2544 2544
                         ?>
2545 2545
                         <table width="70%" class="widefat">
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
                                                                                            name="home_map_post_types[]"
2569 2569
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
2570 2570
                                                                                            value="<?php echo $key; ?>"
2571
-                                                                                           class="map_post_type" <?php echo $checked;?> />
2571
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
2572 2572
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
2573 2573
                                     <td width="40%">
2574 2574
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -2626,12 +2626,12 @@  discard block
 block discarded – undo
2626 2626
                 ?>
2627 2627
                 <fieldset>
2628 2628
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
2629
-                    <label for="<?php echo $value['id'];?>">
2629
+                    <label for="<?php echo $value['id']; ?>">
2630 2630
                         <input name="<?php echo esc_attr($value['id']); ?>"
2631 2631
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
2632 2632
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
2633 2633
                             echo 'checked="checked"';
2634
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2634
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
2635 2635
                         <?php echo $value['desc']; ?></label><br>
2636 2636
                 </fieldset>
2637 2637
                 <?php
@@ -2653,7 +2653,7 @@  discard block
 block discarded – undo
2653 2653
                     <textarea
2654 2654
                         <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
2655 2655
                         id="<?php echo esc_attr($value['id']); ?>"
2656
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2656
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2657 2657
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
2658 2658
                         class="description"><?php echo $value['desc'] ?></span>
2659 2659
 
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 					}
2701 2701
 				}
2702 2702
 				//
2703
-				$page_setting = (int)get_option($value['id']);
2703
+				$page_setting = (int) get_option($value['id']);
2704 2704
 
2705 2705
                 $args = array('name' => $value['id'],
2706 2706
                     'id' => $value['id'],
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                 break;
2728 2728
             case 'single_select_country' :
2729 2729
                 $countries = $geodirectory->countries->countries;
2730
-                $country_setting = (string)get_option($value['id']);
2730
+                $country_setting = (string) get_option($value['id']);
2731 2731
                 if (strstr($country_setting, ':')) :
2732 2732
                     $country = current(explode(':', $country_setting));
2733 2733
                     $state = end(explode(':', $country_setting));
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
             case 'multi_select_countries' :
2751 2751
                 $countries = $geodirectory->countries->countries;
2752 2752
                 asort($countries);
2753
-                $selections = (array)get_option($value['id']);
2753
+                $selections = (array) get_option($value['id']);
2754 2754
                 ?>
2755 2755
                 <tr valign="top">
2756 2756
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -2772,8 +2772,8 @@  discard block
 block discarded – undo
2772 2772
                 break;
2773 2773
 
2774 2774
             case 'google_analytics' :
2775
-                $selections = (array)get_option($value['id']);
2776
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
2775
+                $selections = (array) get_option($value['id']);
2776
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
2777 2777
                     ?>
2778 2778
                     <tr valign="top">
2779 2779
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -2784,10 +2784,10 @@  discard block
 block discarded – undo
2784 2784
 
2785 2785
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
2786 2786
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
2787
-                            $state = "&state=123";//any string
2787
+                            $state = "&state=123"; //any string
2788 2788
                             $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2789 2789
                             $response_type = "&response_type=code";
2790
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
2790
+                            $client_id = "&client_id=" . get_option('geodir_ga_client_id');
2791 2791
                             $access_type = "&access_type=offline";
2792 2792
                             $approval_prompt = "&approval_prompt=force";
2793 2793
 
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
                             ?>
2798 2798
                             <script>
2799 2799
                                 function gd_ga_popup() {
2800
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
2800
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
2801 2801
                                     var pollTimer = window.setInterval(function () {
2802 2802
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
2803 2803
                                             window.clearInterval(pollTimer);
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
                             } else {
2820 2820
                                 ?>
2821 2821
                                 <span class="button-primary"
2822
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
2822
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
2823 2823
                             <?php
2824 2824
                             }
2825 2825
                             ?>
@@ -2890,9 +2890,9 @@  discard block
 block discarded – undo
2890 2890
 
2891 2891
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
2892 2892
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
2893
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
2893
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
2894 2894
             jQuery('.gd-content-heading').hide();
2895
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
2895
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
2896 2896
             <?php } ?>
2897 2897
         });
2898 2898
     </script>
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
         <div
3035 3035
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
3036 3036
             id="<?php echo $id; ?>plupload-upload-ui">
3037
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
3037
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
3038 3038
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
3039 3039
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
3040 3040
             <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
3050 3050
         </div>
3051 3051
         <span
3052
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
3052
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
3053 3053
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
3054 3054
     </div>
3055 3055
 
@@ -3427,11 +3427,11 @@  discard block
 block discarded – undo
3427 3427
 function geodir_hide_admin_preview_button() {
3428 3428
     global $post_type;
3429 3429
     $post_types = geodir_get_posttypes();
3430
-    if(in_array($post_type, $post_types))
3430
+    if (in_array($post_type, $post_types))
3431 3431
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3432 3432
 }
3433
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
3434
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
3433
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
3434
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
3435 3435
 
3436 3436
 /**
3437 3437
  * Add the tab in left sidebar menu fro import & export page.
@@ -3441,8 +3441,8 @@  discard block
 block discarded – undo
3441 3441
  *
3442 3442
  * @return array Array of tab data.
3443 3443
  */
3444
-function geodir_import_export_tab( $tabs ) {
3445
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3444
+function geodir_import_export_tab($tabs) {
3445
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
3446 3446
     return $tabs;
3447 3447
 }
3448 3448
 
@@ -3456,7 +3456,7 @@  discard block
 block discarded – undo
3456 3456
  * @return string Html content.
3457 3457
  */
3458 3458
 function geodir_import_export_page() {
3459
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3459
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
3460 3460
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3461 3461
     /**
3462 3462
      * Filter sample category data csv file url.
@@ -3466,7 +3466,7 @@  discard block
 block discarded – undo
3466 3466
      *
3467 3467
      * @param string $gd_cats_sample_csv Sample category data csv file url.
3468 3468
      */
3469
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3469
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
3470 3470
 	
3471 3471
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3472 3472
     /**
@@ -3477,15 +3477,15 @@  discard block
 block discarded – undo
3477 3477
      *
3478 3478
      * @param string $gd_posts_sample_csv Sample post data csv file url.
3479 3479
      */
3480
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3480
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
3481 3481
 	
3482
-	$gd_posttypes = geodir_get_posttypes( 'array' );
3482
+	$gd_posttypes = geodir_get_posttypes('array');
3483 3483
 	
3484 3484
 	$gd_posttypes_option = '';
3485
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3485
+	foreach ($gd_posttypes as $gd_posttype => $row) {
3486
+		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int) geodir_get_terms_count($gd_posttype) . '" data-posts="' . (int) geodir_get_posts_count($gd_posttype) . '">' . __($row['labels']['name'], 'geodirectory') . '</option>';
3487 3487
 	}
3488
-	wp_enqueue_script( 'jquery-ui-progressbar' );
3488
+	wp_enqueue_script('jquery-ui-progressbar');
3489 3489
 	
3490 3490
 	$gd_chunksize_options = array();
3491 3491
 	$gd_chunksize_options[100] = 100;
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
      *
3508 3508
      * @param string $gd_chunksize_options Entries options.
3509 3509
      */
3510
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3510
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
3511 3511
 	
3512 3512
 	$gd_chunksize_option = '';
3513 3513
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -3518,38 +3518,38 @@  discard block
 block discarded – undo
3518 3518
 ?>
3519 3519
 </form>
3520 3520
 <div class="inner_content_tab_main gd-import-export">
3521
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
3522
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
3521
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
3522
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
3523 3523
   <div class="gd-content-heading">
3524 3524
 
3525 3525
   <?php
3526 3526
     ini_set('max_execution_time', 999999);
3527
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
3527
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
3528 3528
     ini_restore('max_execution_time');
3529 3529
 
3530
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
3530
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
3531 3531
         ?>
3532 3532
 	<div id="gd_ie_reqs" class="metabox-holder">
3533 3533
       <div class="meta-box-sortables ui-sortable">
3534 3534
         <div class="postbox">
3535
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
3535
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
3536 3536
           <div class="inside">
3537
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
3537
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
3538 3538
 			<table class="form-table">
3539 3539
 				<thead>
3540 3540
 				  <tr>
3541
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
3541
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
3542 3542
 				  </tr>
3543 3543
 				</thead>
3544 3544
 				<tbody>
3545 3545
 				  <tr>
3546
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
3546
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
3547 3547
 				  </tr>
3548 3548
 				  <tr>
3549
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
3549
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
3550 3550
 				  </tr>
3551 3551
 				  <tr>
3552
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
3552
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
3553 3553
 				  </tr>
3554 3554
 				</tbody>
3555 3555
 		    </table>
@@ -3561,20 +3561,20 @@  discard block
 block discarded – undo
3561 3561
 	<div id="gd_ie_imposts" class="metabox-holder">
3562 3562
       <div class="meta-box-sortables ui-sortable">
3563 3563
         <div id="gd_ie_im_posts" class="postbox">
3564
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
3564
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
3565 3565
           <div class="inside">
3566 3566
             <table class="form-table">
3567 3567
 				<tbody>
3568 3568
 				  <tr>
3569 3569
 					<td class="gd-imex-box">
3570 3570
 						<div class="gd-im-choices">
3571
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
3572
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
3571
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
3572
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
3573 3573
 						</div>
3574 3574
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
3575 3575
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
3576
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
3576
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
3578 3578
 							<?php
3579 3579
 							/**
3580 3580
 							 * Called just after the sample CSV download link.
@@ -3583,7 +3583,7 @@  discard block
 block discarded – undo
3583 3583
 							 */
3584 3584
 							do_action('geodir_sample_csv_download_link');
3585 3585
 							?>
3586
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
3586
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
3587 3587
 							<div class="filelist"></div>
3588 3588
 						</div>
3589 3589
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -3601,7 +3601,7 @@  discard block
 block discarded – undo
3601 3601
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
3602 3602
 						</div>
3603 3603
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
3604
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
3604
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
3605 3605
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
3606 3606
 									id="gd-import-perc">0%</font> )
3607 3607
 								<div class="gd-fileprogress"></div>
@@ -3613,10 +3613,10 @@  discard block
 block discarded – undo
3613 3613
                     	<div class="gd-imex-btns" style="display:none;">
3614 3614
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
3615 3615
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
3616
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3617
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
3616
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3617
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
3618 3618
 							<div id="gd_process_data" style="display:none">
3619
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
3619
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
3620 3620
 							</div>
3621 3621
 						</div>
3622 3622
 					</td>
@@ -3630,25 +3630,25 @@  discard block
 block discarded – undo
3630 3630
 	<div id="gd_ie_excategs" class="metabox-holder">
3631 3631
 	  <div class="meta-box-sortables ui-sortable">
3632 3632
 		<div id="gd_ie_ex_posts" class="postbox">
3633
-		  <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
3633
+		  <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
3634 3634
 		  <div class="inside">
3635 3635
 			<table class="form-table">
3636 3636
 			  <tbody>
3637 3637
 				<tr>
3638 3638
 				  <td class="fld"><label for="gd_post_type">
3639
-					<?php _e( 'Post Type:', 'geodirectory' );?>
3639
+					<?php _e('Post Type:', 'geodirectory'); ?>
3640 3640
 					</label></td>
3641 3641
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
3642
-					  <?php echo $gd_posttypes_option;?>
3642
+					  <?php echo $gd_posttypes_option; ?>
3643 3643
 					</select></td>
3644 3644
 				</tr>
3645 3645
 				<tr>
3646
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
3647
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
3646
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
3647
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
3648 3648
 				  </tr>
3649 3649
 				<tr>
3650 3650
 				  <td class="fld" style="vertical-align:top"><label>
3651
-					<?php _e( 'Progress:', 'geodirectory' );?>
3651
+					<?php _e('Progress:', 'geodirectory'); ?>
3652 3652
 					</label></td>
3653 3653
 				  <td><div id='gd_progressbar_box'>
3654 3654
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -3656,13 +3656,13 @@  discard block
 block discarded – undo
3656 3656
 					  </div>
3657 3657
 					</div>
3658 3658
 					<p style="display:inline-block">
3659
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
3659
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
3660 3660
 					</p>
3661 3661
 					  
3662 3662
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3663 3663
 				</tr>
3664 3664
 				<tr class="gd-ie-actions">
3665
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
3665
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
3666 3666
 				  </td>
3667 3667
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
3668 3668
 				</tr>
@@ -3675,20 +3675,20 @@  discard block
 block discarded – undo
3675 3675
 	<div id="gd_ie_imcategs" class="metabox-holder">
3676 3676
       <div class="meta-box-sortables ui-sortable">
3677 3677
         <div id="gd_ie_imcats" class="postbox">
3678
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
3678
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
3679 3679
           <div class="inside">
3680 3680
             <table class="form-table">
3681 3681
 				<tbody>
3682 3682
 				  <tr>
3683 3683
 					<td class="gd-imex-box">
3684 3684
 						<div class="gd-im-choices">
3685
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
3686
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
3685
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
3686
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
3687 3687
 						</div>
3688 3688
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
3689 3689
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
3690
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
3690
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
3692 3692
 						<?php
3693 3693
 						/**
3694 3694
 						 * Called just after the sample CSV download link.
@@ -3698,7 +3698,7 @@  discard block
 block discarded – undo
3698 3698
 						 */
3699 3699
 						do_action('geodir_sample_cats_csv_download_link');
3700 3700
 						?>
3701
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
3701
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
3702 3702
 							<div class="filelist"></div>
3703 3703
 						</div>
3704 3704
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -3715,7 +3715,7 @@  discard block
 block discarded – undo
3715 3715
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
3716 3716
 						</div>
3717 3717
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
3718
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
3718
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
3719 3719
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
3720 3720
 									id="gd-import-perc">0%</font> )
3721 3721
 								<div class="gd-fileprogress"></div>
@@ -3727,10 +3727,10 @@  discard block
 block discarded – undo
3727 3727
                     	<div class="gd-imex-btns" style="display:none;">
3728 3728
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
3729 3729
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
3730
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3731
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
3730
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3731
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
3732 3732
 							<div id="gd_process_data" style="display:none">
3733
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
3733
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
3734 3734
 							</div>
3735 3735
 						</div>
3736 3736
 					</td>
@@ -3744,25 +3744,25 @@  discard block
 block discarded – undo
3744 3744
 	<div id="gd_ie_excategs" class="metabox-holder">
3745 3745
       <div class="meta-box-sortables ui-sortable">
3746 3746
         <div id="gd_ie_ex_cats" class="postbox">
3747
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
3747
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
3748 3748
           <div class="inside">
3749 3749
             <table class="form-table">
3750 3750
 				<tbody>
3751 3751
 				  <tr>
3752
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
3753
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
3752
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
3753
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
3754 3754
 				  </tr>
3755 3755
 				   <tr>
3756
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
3757
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
3756
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
3757
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
3758 3758
 				  </tr>
3759 3759
 				  <tr>
3760
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
3761
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3760
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
3761
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3762 3762
 				  </tr>
3763 3763
 				  <tr class="gd-ie-actions">
3764 3764
 					<td style="vertical-align:top">
3765
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
3765
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
3766 3766
 					</td>
3767 3767
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
3768 3768
 				  </tr>
@@ -3784,7 +3784,7 @@  discard block
 block discarded – undo
3784 3784
      * @param array $gd_chunksize_options File chunk size options.
3785 3785
      * @param string $nonce Wordpress security token for GD import & export.
3786 3786
 	 */
3787
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3787
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
3788 3788
 	?>
3789 3789
   </div>
3790 3790
 </div>
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
 		jQuery.ajax({
3804 3804
 			url: ajaxurl,
3805 3805
 			type: "POST",
3806
-			data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
3806
+			data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
3807 3807
 			dataType: 'json',
3808 3808
 			cache: false,
3809 3809
 			success: function(data) {
@@ -3855,7 +3855,7 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
 		jQuery(cont).find('.filelist .file').remove();
3857 3857
 		
3858
-		jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
3858
+		jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
3859 3859
 		jQuery('#gd-import-msg', cont).show();
3860 3860
 		
3861 3861
 		return false;
@@ -3914,7 +3914,7 @@  discard block
 block discarded – undo
3914 3914
 	jQuery.ajax({
3915 3915
 		url: ajaxurl,
3916 3916
 		type: "POST",
3917
-		data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
3917
+		data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
3918 3918
 		dataType : 'json',
3919 3919
 		cache: false,
3920 3920
 		success: function (data) {
@@ -4090,27 +4090,27 @@  discard block
 block discarded – undo
4090 4090
 	
4091 4091
 	var gdMsg = '<p></p>';
4092 4092
 	if ( processed > 0 ) {
4093
-		var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
4093
+		var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
4094 4094
 		msgParse = msgParse.replace("%s", processed);
4095 4095
 		gdMsg += msgParse;
4096 4096
 	}
4097 4097
 	
4098 4098
 	if ( updated > 0 ) {
4099
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4099
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
4100 4100
 		msgParse = msgParse.replace("%s", updated);
4101 4101
 		msgParse = msgParse.replace("%d", processed);
4102 4102
 		gdMsg += msgParse;
4103 4103
 	}
4104 4104
 	
4105 4105
 	if ( created > 0 ) {
4106
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4106
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
4107 4107
 		msgParse = msgParse.replace("%s", created);
4108 4108
 		msgParse = msgParse.replace("%d", processed);
4109 4109
 		gdMsg += msgParse;
4110 4110
 	}
4111 4111
 	
4112 4112
 	if ( skipped > 0 ) {
4113
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4113
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
4114 4114
 		msgParse = msgParse.replace("%s", skipped);
4115 4115
 		msgParse = msgParse.replace("%d", processed);
4116 4116
 		gdMsg += msgParse;
@@ -4120,21 +4120,21 @@  discard block
 block discarded – undo
4120 4120
 		if (type=='loc') {
4121 4121
 			invalid_addr = invalid;
4122 4122
 		}
4123
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
4123
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
4124 4124
 		msgParse = msgParse.replace("%s", invalid_addr);
4125 4125
 		msgParse = msgParse.replace("%d", total);
4126 4126
 		gdMsg += msgParse;
4127 4127
 	}
4128 4128
 	
4129 4129
 	if (invalid > 0 && type!='loc') {
4130
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4130
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory'), '%s', '%d')); ?></p>';
4131 4131
 		msgParse = msgParse.replace("%s", invalid);
4132 4132
 		msgParse = msgParse.replace("%d", total);
4133 4133
 		gdMsg += msgParse;
4134 4134
 	}
4135 4135
 	
4136 4136
 	if (images > 0) {
4137
-		gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
4137
+		gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
4138 4138
 	}
4139 4139
 	gdMsg += '<p></p>';
4140 4140
 	jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -4283,7 +4283,7 @@  discard block
 block discarded – undo
4283 4283
 		
4284 4284
 	function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
4285 4285
 		if (page < 2) {
4286
-			gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4286
+			gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4287 4287
 			jQuery(el).find('#gd_timer').text('00:00:01');
4288 4288
 			jQuery('#gd_ie_ex_files', el).html('');
4289 4289
 		}
@@ -4291,7 +4291,7 @@  discard block
 block discarded – undo
4291 4291
 		jQuery.ajax({
4292 4292
 			url: ajaxurl,
4293 4293
 			type: "POST",
4294
-			data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
4294
+			data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
4295 4295
 			dataType : 'json',
4296 4296
 			cache: false,
4297 4297
 			beforeSend: function (jqXHR, settings) {},
@@ -4305,11 +4305,11 @@  discard block
 block discarded – undo
4305 4305
 					} else {
4306 4306
 						if (pages < page || pages == page) {
4307 4307
 							window.clearInterval(timer_posts);
4308
-							gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
4308
+							gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
4309 4309
 						} else {
4310 4310
 							var percentage = Math.ceil(( page / pages ) * 100);
4311 4311
 							percentage = percentage > 100 ? 100 : percentage;
4312
-							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4312
+							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4313 4313
 						}
4314 4314
 						if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
4315 4315
 							var obj_files = data.files;
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
 	
4340 4340
 	function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
4341 4341
 		if (page < 2) {
4342
-			gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4342
+			gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4343 4343
 			jQuery(el).find('#gd_timer').text('00:00:01');
4344 4344
 			jQuery('#gd_ie_ex_files', el).html('');
4345 4345
 		}
@@ -4347,7 +4347,7 @@  discard block
 block discarded – undo
4347 4347
 		jQuery.ajax({
4348 4348
 			url: ajaxurl,
4349 4349
 			type: "POST",
4350
-			data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
4350
+			data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
4351 4351
 			dataType : 'json',
4352 4352
 			cache: false,
4353 4353
 			beforeSend: function (jqXHR, settings) {},
@@ -4361,11 +4361,11 @@  discard block
 block discarded – undo
4361 4361
 					} else {
4362 4362
 						if (pages < page || pages == page) {
4363 4363
 							window.clearInterval(timer_cats);
4364
-							gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
4364
+							gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
4365 4365
 						} else {
4366 4366
 							var percentage = Math.ceil(( page / pages ) * 100);
4367 4367
 							percentage = percentage > 100 ? 100 : percentage;
4368
-							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
4368
+							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
4369 4369
 						}
4370 4370
 						if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
4371 4371
 							var obj_files = data.files;
@@ -4422,8 +4422,8 @@  discard block
 block discarded – undo
4422 4422
 function geodir_init_filesystem()
4423 4423
 {
4424 4424
 
4425
-    if(!function_exists('get_filesystem_method')){
4426
-        require_once(ABSPATH."/wp-admin/includes/file.php");
4425
+    if (!function_exists('get_filesystem_method')) {
4426
+        require_once(ABSPATH . "/wp-admin/includes/file.php");
4427 4427
     }
4428 4428
     $access_type = get_filesystem_method();
4429 4429
     if ($access_type === 'direct') {
@@ -4476,7 +4476,7 @@  discard block
 block discarded – undo
4476 4476
  * @package GeoDirectory
4477 4477
  */
4478 4478
 function geodir_filesystem_notice()
4479
-{   if ( defined( 'DOING_AJAX' ) ){return;}
4479
+{   if (defined('DOING_AJAX')) {return; }
4480 4480
     $access_type = get_filesystem_method();
4481 4481
     if ($access_type === 'direct') {
4482 4482
     } elseif (!defined('FTP_USER')) {
@@ -4513,61 +4513,61 @@  discard block
 block discarded – undo
4513 4513
     // try to set higher limits for import
4514 4514
     $max_input_time = ini_get('max_input_time');
4515 4515
     $max_execution_time = ini_get('max_execution_time');
4516
-    $memory_limit= ini_get('memory_limit');
4516
+    $memory_limit = ini_get('memory_limit');
4517 4517
 
4518
-    if(!$max_input_time || $max_input_time<3000){
4518
+    if (!$max_input_time || $max_input_time < 3000) {
4519 4519
         ini_set('max_input_time', 3000);
4520 4520
     }
4521 4521
 
4522
-    if(!$max_execution_time || $max_execution_time<3000){
4522
+    if (!$max_execution_time || $max_execution_time < 3000) {
4523 4523
         ini_set('max_execution_time', 3000);
4524 4524
     }
4525 4525
 
4526
-    if($memory_limit && str_replace('M','',$memory_limit)){
4527
-        if(str_replace('M','',$memory_limit)<256){
4526
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
4527
+        if (str_replace('M', '', $memory_limit) < 256) {
4528 4528
             ini_set('memory_limit', '256M');
4529 4529
         }
4530 4530
     }
4531 4531
 
4532 4532
     $json = array();
4533 4533
 
4534
-    if ( !current_user_can( 'manage_options' ) ) {
4535
-        wp_send_json( $json );
4534
+    if (!current_user_can('manage_options')) {
4535
+        wp_send_json($json);
4536 4536
     }
4537 4537
 
4538
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
4539
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
4540
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
4538
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
4539
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
4540
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
4541 4541
 
4542
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
4543
-        wp_send_json( $json );
4542
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
4543
+        wp_send_json($json);
4544 4544
     }
4545 4545
 
4546
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
4547
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
4546
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
4547
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
4548 4548
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
4549
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
4549
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
4550 4550
 
4551 4551
     $wp_filesystem = geodir_init_filesystem();
4552 4552
     if (!$wp_filesystem) {
4553
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
4554
-        wp_send_json( $json );
4553
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
4554
+        wp_send_json($json);
4555 4555
     }
4556 4556
 
4557 4557
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
4558
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
4559
-        wp_send_json( $json );
4558
+        $json['error'] = __('Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory');
4559
+        wp_send_json($json);
4560 4560
     }
4561 4561
 
4562
-    $csv_file_dir = geodir_path_import_export( false );
4563
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
4564
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
4565
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
4566
-            wp_send_json( $json );
4562
+    $csv_file_dir = geodir_path_import_export(false);
4563
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
4564
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
4565
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
4566
+            wp_send_json($json);
4567 4567
         }
4568 4568
     }
4569 4569
 
4570
-    switch ( $task ) {
4570
+    switch ($task) {
4571 4571
         case 'export_posts': {
4572 4572
             // WPML
4573 4573
             $is_wpml = geodir_is_wpml();
@@ -4578,12 +4578,12 @@  discard block
 block discarded – undo
4578 4578
                 $sitepress->switch_lang('all', true);
4579 4579
             }
4580 4580
             // WPML
4581
-            if ( $post_type == 'gd_event' ) {
4581
+            if ($post_type == 'gd_event') {
4582 4582
                 //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
4583
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
4583
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
4584 4584
             }
4585
-            $file_name = $post_type . '_' . date( 'dmyHi' );
4586
-            $posts_count = geodir_get_posts_count( $post_type );
4585
+            $file_name = $post_type . '_' . date('dmyHi');
4586
+            $posts_count = geodir_get_posts_count($post_type);
4587 4587
             $file_url_base = geodir_path_import_export() . '/';
4588 4588
             $file_url = $file_url_base . $file_name . '.csv';
4589 4589
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -4591,10 +4591,10 @@  discard block
 block discarded – undo
4591 4591
             
4592 4592
             $chunk_file_paths = array();
4593 4593
 
4594
-            if ( isset( $_REQUEST['_st'] ) ) {
4595
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4596
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
4597
-                $percentage = min( $percentage, 100 );
4594
+            if (isset($_REQUEST['_st'])) {
4595
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4596
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
4597
+                $percentage = min($percentage, 100);
4598 4598
                 
4599 4599
                 $json['percentage'] = $percentage;
4600 4600
                 // WPML
@@ -4602,49 +4602,49 @@  discard block
 block discarded – undo
4602 4602
                     $sitepress->switch_lang($active_lang, true);
4603 4603
                 }
4604 4604
                 // WPML
4605
-                wp_send_json( $json );
4605
+                wp_send_json($json);
4606 4606
                 exit;
4607 4607
             } else {				
4608
-                if ( !$posts_count > 0 ) {
4609
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4608
+                if (!$posts_count > 0) {
4609
+                    $json['error'] = __('No records to export.', 'geodirectory');
4610 4610
                 } else {
4611 4611
                     $total_posts = $posts_count;
4612 4612
                     if ($chunk_per_page > $total_posts) {
4613 4613
                         $chunk_per_page = $total_posts;
4614 4614
                     }
4615
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
4615
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
4616 4616
                     
4617 4617
                     $j = $chunk_page_no;
4618
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
4618
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
4619 4619
                     
4620 4620
                     $per_page = 500;
4621 4621
                     if ($per_page > $chunk_per_page) {
4622 4622
                         $per_page = $chunk_per_page;
4623 4623
                     }
4624
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4624
+                    $total_pages = ceil($chunk_per_page / $per_page);
4625 4625
                     
4626
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4627
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
4626
+                    for ($i = 0; $i <= $total_pages; $i++) {
4627
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
4628 4628
                         
4629 4629
                         $clear = $i == 0 ? true : false;
4630
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
4630
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
4631 4631
                     }
4632 4632
                         
4633
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4633
+                    if ($wp_filesystem->exists($file_path_temp)) {
4634 4634
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4635 4635
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4636 4636
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4637
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4637
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4638 4638
                         
4639 4639
                         $file_url = $file_url_base . $chunk_file_name;
4640 4640
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4641 4641
                     }
4642 4642
                     
4643
-                    if ( !empty($chunk_file_paths) ) {
4643
+                    if (!empty($chunk_file_paths)) {
4644 4644
                         $json['total'] = $posts_count;
4645 4645
                         $json['files'] = $chunk_file_paths;
4646 4646
                     } else {
4647
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4647
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
4648 4648
                     }
4649 4649
                 }
4650 4650
                 // WPML
@@ -4652,7 +4652,7 @@  discard block
 block discarded – undo
4652 4652
                     $sitepress->switch_lang($active_lang, true);
4653 4653
                 }
4654 4654
                 // WPML
4655
-                wp_send_json( $json );
4655
+                wp_send_json($json);
4656 4656
             }
4657 4657
         }
4658 4658
         break;
@@ -4666,9 +4666,9 @@  discard block
 block discarded – undo
4666 4666
                 $sitepress->switch_lang('all', true);
4667 4667
             }
4668 4668
             // WPML
4669
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
4669
+            $file_name = $post_type . 'category_' . date('dmyHi');
4670 4670
             
4671
-            $terms_count = geodir_get_terms_count( $post_type );
4671
+            $terms_count = geodir_get_terms_count($post_type);
4672 4672
             $file_url_base = geodir_path_import_export() . '/';
4673 4673
             $file_url = $file_url_base . $file_name . '.csv';
4674 4674
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -4676,10 +4676,10 @@  discard block
 block discarded – undo
4676 4676
             
4677 4677
             $chunk_file_paths = array();
4678 4678
             
4679
-            if ( isset( $_REQUEST['_st'] ) ) {
4680
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4681
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
4682
-                $percentage = min( $percentage, 100 );
4679
+            if (isset($_REQUEST['_st'])) {
4680
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4681
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
4682
+                $percentage = min($percentage, 100);
4683 4683
                 
4684 4684
                 $json['percentage'] = $percentage;
4685 4685
                 // WPML
@@ -4687,48 +4687,48 @@  discard block
 block discarded – undo
4687 4687
                     $sitepress->switch_lang($active_lang, true);
4688 4688
                 }
4689 4689
                 // WPML
4690
-                wp_send_json( $json );
4690
+                wp_send_json($json);
4691 4691
             } else {				
4692
-                if ( !$terms_count > 0 ) {
4693
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4692
+                if (!$terms_count > 0) {
4693
+                    $json['error'] = __('No records to export.', 'geodirectory');
4694 4694
                 } else {
4695 4695
                     $total_terms = $terms_count;
4696 4696
                     if ($chunk_per_page > $terms_count) {
4697 4697
                         $chunk_per_page = $terms_count;
4698 4698
                     }
4699
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
4699
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
4700 4700
                     
4701 4701
                     $j = $chunk_page_no;					
4702
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
4702
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
4703 4703
                     
4704 4704
                     $per_page = 500;
4705 4705
                     if ($per_page > $chunk_per_page) {
4706 4706
                         $per_page = $chunk_per_page;
4707 4707
                     }
4708
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4708
+                    $total_pages = ceil($chunk_per_page / $per_page);
4709 4709
                     
4710
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4711
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
4710
+                    for ($i = 0; $i <= $total_pages; $i++) {
4711
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
4712 4712
                         
4713 4713
                         $clear = $i == 0 ? true : false;
4714
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
4714
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
4715 4715
                     }
4716 4716
                     
4717
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4717
+                    if ($wp_filesystem->exists($file_path_temp)) {
4718 4718
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4719 4719
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4720 4720
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4721
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4721
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4722 4722
                         
4723 4723
                         $file_url = $file_url_base . $chunk_file_name;
4724 4724
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4725 4725
                     }
4726 4726
                     
4727
-                    if ( !empty($chunk_file_paths) ) {
4727
+                    if (!empty($chunk_file_paths)) {
4728 4728
                         $json['total'] = $terms_count;
4729 4729
                         $json['files'] = $chunk_file_paths;
4730 4730
                     } else {
4731
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4731
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
4732 4732
                     }
4733 4733
                 }
4734 4734
                 // WPML
@@ -4736,67 +4736,67 @@  discard block
 block discarded – undo
4736 4736
                     $sitepress->switch_lang($active_lang, true);
4737 4737
                 }
4738 4738
                 // WPML
4739
-                wp_send_json( $json );
4739
+                wp_send_json($json);
4740 4740
             }
4741 4741
         }
4742 4742
         break;
4743 4743
         case 'export_locations': {
4744 4744
             $file_url_base = geodir_path_import_export() . '/';
4745
-            $file_name = 'gd_locations_' . date( 'dmyHi' );			
4745
+            $file_name = 'gd_locations_' . date('dmyHi');			
4746 4746
             $file_url = $file_url_base . $file_name . '.csv';
4747 4747
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
4748 4748
             $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
4749 4749
             
4750
-            $items_count = (int)geodir_location_imex_count_locations();
4750
+            $items_count = (int) geodir_location_imex_count_locations();
4751 4751
             
4752
-            if ( isset( $_REQUEST['_st'] ) ) {
4753
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4754
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
4755
-                $percentage = min( $percentage, 100 );
4752
+            if (isset($_REQUEST['_st'])) {
4753
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4754
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
4755
+                $percentage = min($percentage, 100);
4756 4756
                 
4757 4757
                 $json['percentage'] = $percentage;
4758
-                wp_send_json( $json );
4758
+                wp_send_json($json);
4759 4759
             } else {
4760 4760
                 $chunk_file_paths = array();
4761 4761
                 
4762
-                if ( !$items_count > 0 ) {
4763
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4762
+                if (!$items_count > 0) {
4763
+                    $json['error'] = __('No records to export.', 'geodirectory');
4764 4764
                 } else {
4765
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
4766
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
4765
+                    $chunk_per_page = min($chunk_per_page, $items_count);
4766
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
4767 4767
                     
4768 4768
                     $j = $chunk_page_no;					
4769
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
4769
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
4770 4770
                     
4771 4771
                     $per_page = 500;
4772
-                    $per_page = min( $per_page, $chunk_per_page );
4773
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4772
+                    $per_page = min($per_page, $chunk_per_page);
4773
+                    $total_pages = ceil($chunk_per_page / $per_page);
4774 4774
                     
4775
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4776
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
4775
+                    for ($i = 0; $i <= $total_pages; $i++) {
4776
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
4777 4777
                         
4778 4778
                         $clear = $i == 0 ? true : false;
4779
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
4779
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
4780 4780
                     }
4781 4781
                     
4782
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4782
+                    if ($wp_filesystem->exists($file_path_temp)) {
4783 4783
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4784 4784
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4785 4785
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4786
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4786
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4787 4787
                         
4788 4788
                         $file_url = $file_url_base . $chunk_file_name;
4789 4789
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4790 4790
                     }
4791 4791
                     
4792
-                    if ( !empty($chunk_file_paths) ) {
4792
+                    if (!empty($chunk_file_paths)) {
4793 4793
                         $json['total'] = $items_count;
4794 4794
                         $json['files'] = $chunk_file_paths;
4795 4795
                     } else {
4796
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4796
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
4797 4797
                     }
4798 4798
                 }
4799
-                wp_send_json( $json );
4799
+                wp_send_json($json);
4800 4800
             }
4801 4801
         }
4802 4802
         break;
@@ -4812,32 +4812,32 @@  discard block
 block discarded – undo
4812 4812
             }
4813 4813
             // WPML
4814 4814
             
4815
-            ini_set( 'auto_detect_line_endings', true );
4815
+            ini_set('auto_detect_line_endings', true);
4816 4816
             
4817 4817
             $uploads = wp_upload_dir();
4818 4818
             $uploads_dir = $uploads['path'];
4819 4819
             $uploads_subdir = $uploads['subdir'];
4820 4820
             
4821
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4822
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4821
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
4822
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
4823 4823
             
4824
-            $csv_file_arr = explode( '/', $csv_file );
4825
-            $csv_filename = end( $csv_file_arr );
4824
+            $csv_file_arr = explode('/', $csv_file);
4825
+            $csv_filename = end($csv_file_arr);
4826 4826
             $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4827 4827
             
4828 4828
             $json['file'] = $csv_file;
4829
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4829
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
4830 4830
 
4831
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4832
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4831
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
4832
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
4833 4833
                 
4834 4834
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4835 4835
                     $json['error'] = NULL;
4836 4836
                     $json['rows'] = 0;
4837 4837
                     
4838
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4839
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4840
-                            if ( !empty( $data ) ) {
4838
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
4839
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
4840
+                            if (!empty($data)) {
4841 4841
                                 $file[] = $data;
4842 4842
                             }
4843 4843
                         }
@@ -4850,19 +4850,19 @@  discard block
 block discarded – undo
4850 4850
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4851 4851
                     }
4852 4852
                 } else {
4853
-                    wp_send_json( $json );
4853
+                    wp_send_json($json);
4854 4854
                 }
4855 4855
             } else {
4856
-                wp_send_json( $json );
4856
+                wp_send_json($json);
4857 4857
             }
4858 4858
             
4859
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4860
-                wp_send_json( $json );
4859
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4860
+                wp_send_json($json);
4861 4861
             }
4862 4862
             
4863 4863
             $total = $json['rows'];
4864
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4865
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4864
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4865
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4866 4866
             
4867 4867
             $count = $limit;
4868 4868
             $requested_limit = $limit;
@@ -4891,13 +4891,13 @@  discard block
 block discarded – undo
4891 4891
             
4892 4892
             $post_types = geodir_get_posttypes();
4893 4893
 
4894
-            if ( $task == 'import_cat' ) {				
4894
+            if ($task == 'import_cat') {				
4895 4895
                 if (!empty($file)) {
4896 4896
                     $columns = isset($file[0]) ? $file[0] : NULL;
4897 4897
                     
4898 4898
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4899 4899
                         $json['error'] = CSV_INVAILD_FILE;
4900
-                        wp_send_json( $json );
4900
+                        wp_send_json($json);
4901 4901
                         exit;
4902 4902
                     }
4903 4903
                     
@@ -4906,7 +4906,7 @@  discard block
 block discarded – undo
4906 4906
                         
4907 4907
                         if (isset($file[$index])) {
4908 4908
                             $row = $file[$index];
4909
-                            $row = array_map( 'trim', $row );
4909
+                            $row = array_map('trim', $row);
4910 4910
                             //$row = array_map( 'utf8_encode', $row );
4911 4911
                             
4912 4912
                             $cat_id = '';
@@ -4922,26 +4922,26 @@  discard block
 block discarded – undo
4922 4922
                             $cat_language = '';
4923 4923
                             
4924 4924
                             $c = 0;
4925
-                            foreach ($columns as $column ) {
4926
-                                if ( $column == 'cat_id' ) {
4927
-                                    $cat_id = (int)$row[$c];
4928
-                                } else if ( $column == 'cat_name' ) {
4925
+                            foreach ($columns as $column) {
4926
+                                if ($column == 'cat_id') {
4927
+                                    $cat_id = (int) $row[$c];
4928
+                                } else if ($column == 'cat_name') {
4929 4929
                                     $cat_name = $row[$c];
4930
-                                } else if ( $column == 'cat_slug' ) {
4930
+                                } else if ($column == 'cat_slug') {
4931 4931
                                     $cat_slug = $row[$c];
4932
-                                } else if ( $column == 'cat_posttype' ) {
4932
+                                } else if ($column == 'cat_posttype') {
4933 4933
                                     $cat_posttype = $row[$c];
4934
-                                } else if ( $column == 'cat_parent' ) {
4934
+                                } else if ($column == 'cat_parent') {
4935 4935
                                     $cat_parent = trim($row[$c]);
4936
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4936
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4937 4937
                                     $cat_schema = $row[$c];
4938
-                                } else if ( $column == 'cat_description' ) {
4938
+                                } else if ($column == 'cat_description') {
4939 4939
                                     $cat_description = $row[$c];
4940
-                                } else if ( $column == 'cat_top_description' ) {
4940
+                                } else if ($column == 'cat_top_description') {
4941 4941
                                     $cat_top_description = $row[$c];
4942
-                                } else if ( $column == 'cat_image' ) {
4942
+                                } else if ($column == 'cat_image') {
4943 4943
                                     $cat_image = $row[$c];
4944
-                                } else if ( $column == 'cat_icon' ) {
4944
+                                } else if ($column == 'cat_icon') {
4945 4945
                                     $cat_icon = $row[$c];
4946 4946
                                 }
4947 4947
                                 // WPML
@@ -4952,7 +4952,7 @@  discard block
 block discarded – undo
4952 4952
                                 $c++;
4953 4953
                             }
4954 4954
                             
4955
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4955
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4956 4956
                                 $invalid++;
4957 4957
                                 continue;
4958 4958
                             }
@@ -4969,8 +4969,8 @@  discard block
 block discarded – undo
4969 4969
                             $term_data['description'] = $cat_description;
4970 4970
                             $term_data['cat_schema'] = $cat_schema;
4971 4971
                             $term_data['top_description'] = $cat_top_description;
4972
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4973
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4972
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4973
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4974 4974
                             
4975 4975
                             //$term_data = array_map( 'utf8_encode', $term_data );
4976 4976
                             
@@ -4979,14 +4979,14 @@  discard block
 block discarded – undo
4979 4979
                             $term_data['taxonomy'] = $taxonomy;
4980 4980
 
4981 4981
                             $term_parent_id = 0;
4982
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4982
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4983 4983
                                 $term_parent = '';
4984 4984
                                 
4985
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4985
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4986 4986
                                     $term_parent = $term_parent;
4987
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4987
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4988 4988
                                     $term_parent = $term_parent;
4989
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4989
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4990 4990
                                     $term_parent = $term_parent;
4991 4991
                                 } else {
4992 4992
                                     $term_parent_data = array();
@@ -4994,47 +4994,47 @@  discard block
 block discarded – undo
4994 4994
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4995 4995
                                     $term_parent_data['taxonomy'] = $taxonomy;
4996 4996
                                     
4997
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4997
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4998 4998
                                 }
4999 4999
                                 
5000
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
5001
-                                    $term_parent_id = (int)$term_parent->term_id;
5000
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
5001
+                                    $term_parent_id = (int) $term_parent->term_id;
5002 5002
                                 }
5003 5003
                             }
5004
-                            $term_data['parent'] = (int)$term_parent_id;
5004
+                            $term_data['parent'] = (int) $term_parent_id;
5005 5005
 
5006 5006
                             $term_id = NULL;
5007
-                            if ( $import_choice == 'update' ) {
5008
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5007
+                            if ($import_choice == 'update') {
5008
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
5009 5009
                                     $term_data['term_id'] = $term['term_id'];
5010 5010
                                     
5011
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5011
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
5012 5012
                                         $updated++;
5013 5013
                                     } else {
5014 5014
                                         $invalid++;
5015 5015
                                     }
5016
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5016
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
5017 5017
                                     $term_data['term_id'] = $term['term_id'];
5018 5018
                                     
5019
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5019
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
5020 5020
                                         $updated++;
5021 5021
                                     } else {
5022 5022
                                         $invalid++;
5023 5023
                                     }
5024 5024
                                 } else {
5025
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
5025
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
5026 5026
                                         $created++;
5027 5027
                                     } else {
5028 5028
                                         $invalid++;
5029 5029
                                     }
5030 5030
                                 }
5031
-                            } else if ( $import_choice == 'skip' ) {
5032
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5031
+                            } else if ($import_choice == 'skip') {
5032
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
5033 5033
                                     $skipped++;
5034
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5034
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
5035 5035
                                     $skipped++;
5036 5036
                                 } else {
5037
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
5037
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {										
5038 5038
                                         $created++;
5039 5039
                                     } else {
5040 5040
                                         $invalid++;
@@ -5044,37 +5044,37 @@  discard block
 block discarded – undo
5044 5044
                                 $invalid++;
5045 5045
                             }
5046 5046
                             
5047
-                            if ( $term_id ) {
5048
-                                if ( isset( $term_data['top_description'] ) ) {
5049
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
5047
+                            if ($term_id) {
5048
+                                if (isset($term_data['top_description'])) {
5049
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
5050 5050
                                 }
5051 5051
                                 
5052
-                                if ( isset( $term_data['cat_schema'] ) ) {
5053
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
5052
+                                if (isset($term_data['cat_schema'])) {
5053
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
5054 5054
                                 }
5055 5055
             
5056 5056
                                 $attachment = false;
5057
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
5058
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
5059
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
5057
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
5058
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
5059
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
5060 5060
                                     
5061
-                                    if ( basename($cat_image) != $term_data['image'] ) {
5061
+                                    if (basename($cat_image) != $term_data['image']) {
5062 5062
                                         $attachment = true;
5063
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
5063
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image']), $cat_posttype);
5064 5064
                                     }
5065 5065
                                 }
5066 5066
                                 
5067
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
5068
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
5069
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5067
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
5068
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
5069
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5070 5070
                                         
5071
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
5071
+                                    if (basename($cat_icon) != $term_data['icon']) {
5072 5072
                                         $attachment = true;
5073
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
5073
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon']), $cat_posttype);
5074 5074
                                     }
5075 5075
                                 }
5076 5076
                                 
5077
-                                if ( $attachment ) {
5077
+                                if ($attachment) {
5078 5078
                                     $images++;
5079 5079
                                 }
5080 5080
                             }
@@ -5096,14 +5096,14 @@  discard block
 block discarded – undo
5096 5096
                 $json['invalid'] = $invalid;
5097 5097
                 $json['images'] = $images;
5098 5098
                 
5099
-                wp_send_json( $json );
5099
+                wp_send_json($json);
5100 5100
                 exit;
5101
-            } else if ( $task == 'import_post' ) {
5101
+            } else if ($task == 'import_post') {
5102 5102
 
5103 5103
                 //run some stuff to make the import quicker
5104
-                wp_defer_term_counting( true );
5105
-                wp_defer_comment_counting( true );
5106
-                $wpdb->query( 'SET autocommit = 0;' );
5104
+                wp_defer_term_counting(true);
5105
+                wp_defer_comment_counting(true);
5106
+                $wpdb->query('SET autocommit = 0;');
5107 5107
 
5108 5108
                 //remove_all_actions('publish_post');
5109 5109
                 //remove_all_actions('transition_post_status');
@@ -5113,26 +5113,26 @@  discard block
 block discarded – undo
5113 5113
                 if (!empty($file)) {
5114 5114
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
5115 5115
                     $default_status = 'publish';
5116
-                    $current_date = date_i18n( 'Y-m-d', time() );
5116
+                    $current_date = date_i18n('Y-m-d', time());
5117 5117
                     
5118 5118
                     $columns = isset($file[0]) ? $file[0] : NULL;
5119 5119
                     
5120 5120
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5121 5121
                         $json['error'] = CSV_INVAILD_FILE;
5122
-                        wp_send_json( $json );
5122
+                        wp_send_json($json);
5123 5123
                         exit;
5124 5124
                     }
5125 5125
 
5126
-                    $processed_actual=0;
5126
+                    $processed_actual = 0;
5127 5127
                     for ($i = 1; $i <= $limit; $i++) {
5128 5128
                         $index = $processed + $i;
5129 5129
                         $gd_post = array();
5130 5130
                         
5131 5131
                         if (isset($file[$index])) {$processed_actual++;
5132 5132
                             $row = $file[$index];
5133
-                            $row = array_map( 'trim', $row );
5133
+                            $row = array_map('trim', $row);
5134 5134
                             //$row = array_map( 'utf8_encode', $row );
5135
-                            $row = array_map( 'addslashes_gpc', $row );
5135
+                            $row = array_map('addslashes_gpc', $row);
5136 5136
                             
5137 5137
                             $post_id = '';
5138 5138
                             $post_title = '';
@@ -5166,73 +5166,73 @@  discard block
 block discarded – undo
5166 5166
                             $original_post_id = '';
5167 5167
                                                         
5168 5168
                             $c = 0;
5169
-                            foreach ($columns as $column ) {
5169
+                            foreach ($columns as $column) {
5170 5170
                                 $gd_post[$column] = $row[$c];
5171 5171
                                 
5172
-                                if ( $column == 'post_id' ) {
5172
+                                if ($column == 'post_id') {
5173 5173
                                     $post_id = $row[$c];
5174
-                                } else if ( $column == 'post_title' ) {
5174
+                                } else if ($column == 'post_title') {
5175 5175
                                     $post_title = $row[$c];
5176
-                                } else if ( $column == 'post_author' ) {
5176
+                                } else if ($column == 'post_author') {
5177 5177
                                     $post_author = $row[$c];
5178
-                                } else if ( $column == 'post_content' ) {
5178
+                                } else if ($column == 'post_content') {
5179 5179
                                     $post_content = $row[$c];
5180
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
5181
-                                    $post_category_arr = explode( ',', $row[$c] );
5182
-                                } else if ( $column == 'default_category' ) {
5180
+                                } else if ($column == 'post_category' && $row[$c] != '') {
5181
+                                    $post_category_arr = explode(',', $row[$c]);
5182
+                                } else if ($column == 'default_category') {
5183 5183
                                     $default_category = wp_kses_normalize_entities($row[$c]);
5184
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
5185
-                                    $post_tags = explode( ',', $row[$c] );
5186
-                                } else if ( $column == 'post_type' ) {
5184
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
5185
+                                    $post_tags = explode(',', $row[$c]);
5186
+                                } else if ($column == 'post_type') {
5187 5187
                                     $post_type = $row[$c];
5188
-                                } else if ( $column == 'post_status' ) {
5189
-                                    $post_status = sanitize_key( $row[$c] );
5190
-                                } else if ( $column == 'is_featured' ) {
5191
-                                    $is_featured = (int)$row[$c];
5192
-                                } else if ( $column == 'geodir_video' ) {
5188
+                                } else if ($column == 'post_status') {
5189
+                                    $post_status = sanitize_key($row[$c]);
5190
+                                } else if ($column == 'is_featured') {
5191
+                                    $is_featured = (int) $row[$c];
5192
+                                } else if ($column == 'geodir_video') {
5193 5193
                                     $geodir_video = $row[$c];
5194
-                                } else if ( $column == 'post_address' ) {
5194
+                                } else if ($column == 'post_address') {
5195 5195
                                     $post_address = $row[$c];
5196
-                                } else if ( $column == 'post_city' ) {
5196
+                                } else if ($column == 'post_city') {
5197 5197
                                     $post_city = $row[$c];
5198
-                                } else if ( $column == 'post_region' ) {
5198
+                                } else if ($column == 'post_region') {
5199 5199
                                     $post_region = $row[$c];
5200
-                                } else if ( $column == 'post_country' ) {
5200
+                                } else if ($column == 'post_country') {
5201 5201
                                     $post_country = $row[$c];
5202
-                                } else if ( $column == 'post_zip' ) {
5202
+                                } else if ($column == 'post_zip') {
5203 5203
                                     $post_zip = $row[$c];
5204
-                                } else if ( $column == 'post_latitude' ) {
5204
+                                } else if ($column == 'post_latitude') {
5205 5205
                                     $post_latitude = $row[$c];
5206
-                                } else if ( $column == 'post_longitude' ) {
5206
+                                } else if ($column == 'post_longitude') {
5207 5207
                                     $post_longitude = $row[$c];
5208
-                                } else if ( $column == 'geodir_timing' ) {
5208
+                                } else if ($column == 'geodir_timing') {
5209 5209
                                     $geodir_timing = $row[$c];
5210
-                                } else if ( $column == 'geodir_contact' ) {
5210
+                                } else if ($column == 'geodir_contact') {
5211 5211
                                     $geodir_contact = $row[$c];
5212
-                                } else if ( $column == 'geodir_email' ) {
5212
+                                } else if ($column == 'geodir_email') {
5213 5213
                                     $geodir_email = $row[$c];
5214
-                                } else if ( $column == 'geodir_website' ) {
5214
+                                } else if ($column == 'geodir_website') {
5215 5215
                                     $geodir_website = $row[$c];
5216
-                                } else if ( $column == 'geodir_twitter' ) {
5216
+                                } else if ($column == 'geodir_twitter') {
5217 5217
                                     $geodir_twitter = $row[$c];
5218
-                                } else if ( $column == 'geodir_facebook' ) {
5218
+                                } else if ($column == 'geodir_facebook') {
5219 5219
                                     $geodir_facebook = $row[$c];
5220
-                                } else if ( $column == 'geodir_twitter' ) {
5220
+                                } else if ($column == 'geodir_twitter') {
5221 5221
                                     $geodir_twitter = $row[$c];
5222
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
5222
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
5223 5223
                                     $post_images[] = $row[$c];
5224
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
5225
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
5226
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
5224
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
5225
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $row[$c] . ' days'));
5226
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
5227 5227
                                     $row[$c] = str_replace('/', '-', $row[$c]);
5228
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
5228
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
5229 5229
                                 }
5230 5230
                                 // WPML
5231 5231
                                 if ($is_wpml) {
5232 5232
                                     if ($column == 'language') {
5233 5233
                                         $language = geodir_strtolower(trim($row[$c]));
5234 5234
                                     } else if ($column == 'original_post_id') {
5235
-                                        $original_post_id = (int)$row[$c];
5235
+                                        $original_post_id = (int) $row[$c];
5236 5236
                                     }
5237 5237
                                 }
5238 5238
                                 // WPML
@@ -5247,24 +5247,24 @@  discard block
 block discarded – undo
5247 5247
 
5248 5248
                             $gd_post['IMAGE'] = $post_images;
5249 5249
                             
5250
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
5251
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
5250
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
5251
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
5252 5252
                                                                                                                 
5253 5253
                             $valid = true;
5254 5254
                             
5255
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
5255
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
5256 5256
                                 $invalid++;
5257 5257
                                 $valid = false;
5258 5258
                             }
5259 5259
                             
5260
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5261
-                            if ( $location_allowed ) {
5260
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5261
+                            if ($location_allowed) {
5262 5262
                                 $location_result = geodir_get_default_location();
5263
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
5263
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
5264 5264
                                     $invalid_addr++;
5265 5265
                                     $valid = false;
5266
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
5267
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
5266
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
5267
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
5268 5268
                                         $invalid_addr++;
5269 5269
                                         $valid = false;
5270 5270
                                     } else {
@@ -5275,7 +5275,7 @@  discard block
 block discarded – undo
5275 5275
                                 }
5276 5276
                             }
5277 5277
                             
5278
-                            if ( !$valid ) {
5278
+                            if (!$valid) {
5279 5279
                                 continue;
5280 5280
                             }
5281 5281
 
@@ -5288,16 +5288,16 @@  discard block
 block discarded – undo
5288 5288
 
5289 5289
                             $post_category = array();
5290 5290
                             $default_category_id = NULL;
5291
-                            if ( !empty( $post_category_arr ) ) {
5292
-                                foreach ( $post_category_arr as $value ) {
5293
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
5291
+                            if (!empty($post_category_arr)) {
5292
+                                foreach ($post_category_arr as $value) {
5293
+                                    $category_name = wp_kses_normalize_entities(trim($value));
5294 5294
                                     
5295
-                                    if ( $category_name != '' ) {
5295
+                                    if ($category_name != '') {
5296 5296
                                         $term_category = array();
5297 5297
                                         
5298
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
5298
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
5299 5299
                                             $term_category = $term;
5300
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
5300
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
5301 5301
                                             $term_category = $term;
5302 5302
                                         } else {
5303 5303
                                             $term_data = array();
@@ -5305,13 +5305,13 @@  discard block
 block discarded – undo
5305 5305
                                             //$term_data = array_map( 'utf8_encode', $term_data );										
5306 5306
                                             $term_data['taxonomy'] = $cat_taxonomy;
5307 5307
                                             
5308
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
5309
-                                            if ( $term_id ) {
5310
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
5308
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
5309
+                                            if ($term_id) {
5310
+                                                $term_category = get_term($term_id, $cat_taxonomy);
5311 5311
                                             }
5312 5312
                                         }
5313 5313
                                         
5314
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
5314
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
5315 5315
                                             //$post_category[] = $term_category->slug;
5316 5316
                                             $post_category[] = intval($term_category->term_id);
5317 5317
                                             
@@ -5333,28 +5333,28 @@  discard block
 block discarded – undo
5333 5333
                             $save_post['post_tags'] = $post_tags;
5334 5334
 
5335 5335
                             $saved_post_id = NULL;
5336
-                            if ( $import_choice == 'update' ) {
5337
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5336
+                            if ($import_choice == 'update') {
5337
+                                if ($post_id > 0 && get_post($post_id)) {
5338 5338
                                     $save_post['ID'] = $post_id;
5339 5339
                                     
5340
-                                    if ( wp_update_post( $save_post ) ) {
5340
+                                    if (wp_update_post($save_post)) {
5341 5341
                                         $saved_post_id = $post_id;
5342 5342
                                         $updated++;
5343 5343
                                     }
5344 5344
                                 } else {
5345
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5345
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
5346 5346
                                         $created++;
5347 5347
                                     }
5348 5348
                                 }
5349 5349
                                 
5350
-                                if ( !$saved_post_id > 0 ) {
5350
+                                if (!$saved_post_id > 0) {
5351 5351
                                     $invalid++;
5352 5352
                                 }
5353
-                            } else if ( $import_choice == 'skip' ) {
5354
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5353
+                            } else if ($import_choice == 'skip') {
5354
+                                if ($post_id > 0 && get_post($post_id)) {
5355 5355
                                     $skipped++;	
5356 5356
                                 } else {
5357
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5357
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
5358 5358
                                         $created++;	
5359 5359
                                     } else {
5360 5360
                                         $invalid++;
@@ -5364,19 +5364,19 @@  discard block
 block discarded – undo
5364 5364
                                 $invalid++;
5365 5365
                             }
5366 5366
 
5367
-                            if ( (int)$saved_post_id > 0 ) {
5367
+                            if ((int) $saved_post_id > 0) {
5368 5368
                                 // WPML
5369 5369
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
5370 5370
                                     $wpml_post_type = 'post_' . $post_type;
5371
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
5371
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
5372 5372
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
5373 5373
 
5374
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
5374
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
5375 5375
                                     
5376
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
5376
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
5377 5377
                                 }
5378 5378
                                 // WPML
5379
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
5379
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
5380 5380
                                 
5381 5381
                                 $gd_post['post_id'] = $saved_post_id;
5382 5382
                                 $gd_post['ID'] = $saved_post_id;
@@ -5388,7 +5388,7 @@  discard block
 block discarded – undo
5388 5388
                                                     
5389 5389
                                 // post location
5390 5390
                                 $post_location_id = 0;
5391
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
5391
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
5392 5392
                                     $post_location_info = array(
5393 5393
                                                                 'city' => $post_city,
5394 5394
                                                                 'region' => $post_region,
@@ -5396,21 +5396,21 @@  discard block
 block discarded – undo
5396 5396
                                                                 'geo_lat' => $post_latitude,
5397 5397
                                                                 'geo_lng' => $post_longitude
5398 5398
                                                             );
5399
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
5399
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
5400 5400
                                         $post_location_id = $location_id;
5401 5401
                                     }
5402 5402
                                 }
5403 5403
                                 $gd_post['post_location_id'] = $post_location_id;
5404 5404
                                 
5405 5405
                                 // post package info
5406
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
5406
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
5407 5407
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
5408 5408
                                     $package_id = $gd_post_info->package_id;
5409 5409
                                 }
5410 5410
                                 
5411 5411
                                 $package_info = array();
5412 5412
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
5413
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
5413
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
5414 5414
                                     
5415 5415
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
5416 5416
                                         $package_info = array();
@@ -5418,18 +5418,18 @@  discard block
 block discarded – undo
5418 5418
                                 }
5419 5419
                                 
5420 5420
                                 if (empty($package_info)) {
5421
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
5421
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
5422 5422
                                 }
5423 5423
                                  
5424
-                                if (!empty($package_info))	 {
5424
+                                if (!empty($package_info)) {
5425 5425
                                     $package_id = $package_info['pid'];
5426 5426
                                     
5427 5427
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
5428 5428
                                         $gd_post['expire_date'] = $expire_date;
5429 5429
                                     } else {
5430
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
5431
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
5432
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
5430
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
5431
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
5432
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $package_info['days'] . ' days'));
5433 5433
                                         } else {
5434 5434
                                             $gd_post['expire_date'] = 'Never';
5435 5435
                                         }
@@ -5449,28 +5449,28 @@  discard block
 block discarded – undo
5449 5449
                                 }
5450 5450
 
5451 5451
                                 // Export franchise fields
5452
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5452
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5453 5453
                                 if ($is_franchise_active) {
5454
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
5454
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
5455 5455
                                         $gd_franchise_lock = array();
5456 5456
                                         
5457
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
5458
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
5459
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
5460
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
5457
+                                        if (isset($gd_post['gd_franchise_lock'])) {
5458
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
5459
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
5460
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
5461 5461
                                         }
5462 5462
                                         
5463
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
5464
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
5463
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
5464
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
5465 5465
                                     } else {
5466
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
5467
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
5466
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
5467
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
5468 5468
                                         }
5469 5469
                                     }
5470 5470
                                 }
5471 5471
                                 
5472 5472
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
5473
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
5473
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
5474 5474
                                     if ($default_category_id) {
5475 5475
                                         $save_post['post_default_category'] = $default_category_id;
5476 5476
                                         $gd_post['default_category'] = $default_category_id;
@@ -5479,12 +5479,12 @@  discard block
 block discarded – undo
5479 5479
                                 }
5480 5480
                                 
5481 5481
                                 // Save post info
5482
-                                geodir_save_post_info( $saved_post_id, $gd_post );
5482
+                                geodir_save_post_info($saved_post_id, $gd_post);
5483 5483
                                 // post taxonomies
5484
-                                if ( !empty( $save_post['post_category'] ) ) {
5485
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
5484
+                                if (!empty($save_post['post_category'])) {
5485
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
5486 5486
                                     
5487
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
5487
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
5488 5488
                                     if ($default_category_id) {
5489 5489
                                         $post_default_category = $default_category_id;
5490 5490
                                     }
@@ -5498,15 +5498,15 @@  discard block
 block discarded – undo
5498 5498
                                     
5499 5499
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
5500 5500
                                     
5501
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
5501
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
5502 5502
                                 }
5503 5503
 
5504
-                                if ( !empty( $save_post['post_tags'] ) ) {
5505
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
5504
+                                if (!empty($save_post['post_tags'])) {
5505
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
5506 5506
                                 }
5507 5507
 
5508 5508
                                 // Post images
5509
-                                if ( !empty( $post_images ) ) {
5509
+                                if (!empty($post_images)) {
5510 5510
                                     $post_images = array_unique($post_images);
5511 5511
                                     
5512 5512
                                     $old_post_images_arr = array();
@@ -5514,30 +5514,30 @@  discard block
 block discarded – undo
5514 5514
                                     
5515 5515
                                     $order = 1;
5516 5516
                                     
5517
-                                    $old_post_images = geodir_get_images( $saved_post_id );
5517
+                                    $old_post_images = geodir_get_images($saved_post_id);
5518 5518
                                     if (!empty($old_post_images)) {
5519
-                                        foreach( $old_post_images as $old_post_image ) {
5519
+                                        foreach ($old_post_images as $old_post_image) {
5520 5520
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
5521 5521
                                                 $old_post_images_arr[] = $old_post_image->file;
5522 5522
                                             }
5523 5523
                                         }
5524 5524
                                     }
5525 5525
                                     
5526
-                                    foreach ( $post_images as $post_image ) {
5527
-                                        $image_name = basename( $post_image );
5526
+                                    foreach ($post_images as $post_image) {
5527
+                                        $image_name = basename($post_image);
5528 5528
                                         $saved_post_images_arr[] = $image_name;
5529 5529
                                         
5530
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
5530
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
5531 5531
                                             continue; // Skip if image already exists.
5532 5532
                                         }
5533 5533
                                         
5534
-                                        $image_name_parts = explode( '.', $image_name );
5535
-                                        array_pop( $image_name_parts );
5536
-                                        $proper_image_name = implode( '.', $image_name_parts );
5534
+                                        $image_name_parts = explode('.', $image_name);
5535
+                                        array_pop($image_name_parts);
5536
+                                        $proper_image_name = implode('.', $image_name_parts);
5537 5537
                                         
5538
-                                        $arr_file_type = wp_check_filetype( $image_name );
5538
+                                        $arr_file_type = wp_check_filetype($image_name);
5539 5539
                                         
5540
-                                        if ( !empty( $arr_file_type ) ) {
5540
+                                        if (!empty($arr_file_type)) {
5541 5541
                                             $uploaded_file_type = $arr_file_type['type'];
5542 5542
                                             
5543 5543
                                             $attachment = array();
@@ -5550,46 +5550,46 @@  discard block
 block discarded – undo
5550 5550
                                             $attachment['is_featured'] = 0;
5551 5551
 
5552 5552
                                             $attachment_set = '';
5553
-                                            foreach ( $attachment as $key => $val ) {
5554
-                                                if ( $val != '' ) {
5553
+                                            foreach ($attachment as $key => $val) {
5554
+                                                if ($val != '') {
5555 5555
                                                     $attachment_set .= $key . " = '" . $val . "', ";
5556 5556
                                                 }
5557 5557
                                             }
5558
-                                            $attachment_set = trim( $attachment_set, ", " );
5558
+                                            $attachment_set = trim($attachment_set, ", ");
5559 5559
                                                                                         
5560 5560
                                             // Add new attachment
5561
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
5561
+                                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
5562 5562
                                                                                         
5563 5563
                                             $order++;
5564 5564
                                         }
5565 5565
                                     }
5566 5566
 
5567
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
5567
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
5568 5568
                                     // Remove previous attachment
5569
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
5569
+                                    $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int) $saved_post_id . " " . $saved_post_images_sql);
5570 5570
                                     
5571
-                                    if ( !empty( $saved_post_images_arr ) ) {
5571
+                                    if (!empty($saved_post_images_arr)) {
5572 5572
                                         $menu_order = 1;
5573 5573
                                         
5574
-                                        foreach ( $saved_post_images_arr as $img_name ) {
5575
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
5574
+                                        foreach ($saved_post_images_arr as $img_name) {
5575
+                                            $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/' . $img_name)));
5576 5576
                                             
5577
-                                            if( $menu_order == 1 ) {
5578
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
5579
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
5577
+                                            if ($menu_order == 1) {
5578
+                                                if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/' . $img_name)))) {
5579
+                                                    $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
5580 5580
                                                 }
5581 5581
                                             }
5582 5582
                                             $menu_order++;
5583 5583
                                         }
5584 5584
                                     }
5585 5585
                                     
5586
-                                    if ( $order > 1 ) {
5586
+                                    if ($order > 1) {
5587 5587
                                         $images++;
5588 5588
                                     }
5589 5589
                                 }
5590 5590
 
5591 5591
                                 /** This action is documented in geodirectory-functions/post-functions.php */
5592
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
5592
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
5593 5593
                                 
5594 5594
                                 if (isset($is_featured)) {
5595 5595
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -5609,10 +5609,10 @@  discard block
 block discarded – undo
5609 5609
                 }
5610 5610
 
5611 5611
                 //undo some stuff to make the import quicker
5612
-                wp_defer_term_counting( false );
5613
-                wp_defer_comment_counting( false );
5614
-                $wpdb->query( 'COMMIT;' );
5615
-                $wpdb->query( 'SET autocommit = 1;' );
5612
+                wp_defer_term_counting(false);
5613
+                wp_defer_comment_counting(false);
5614
+                $wpdb->query('COMMIT;');
5615
+                $wpdb->query('SET autocommit = 1;');
5616 5616
 
5617 5617
                 $json = array();
5618 5618
                 $json['processed'] = $processed_actual;
@@ -5623,9 +5623,9 @@  discard block
 block discarded – undo
5623 5623
                 $json['invalid_addr'] = $invalid_addr;
5624 5624
                 $json['images'] = $images;
5625 5625
                 
5626
-                wp_send_json( $json );
5626
+                wp_send_json($json);
5627 5627
                 exit;
5628
-            } else if ( $task == 'import_loc' ) {
5628
+            } else if ($task == 'import_loc') {
5629 5629
                 global $gd_post_types;
5630 5630
                 $gd_post_types = $post_types;
5631 5631
                 
@@ -5634,7 +5634,7 @@  discard block
 block discarded – undo
5634 5634
                     
5635 5635
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5636 5636
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5637
-                        wp_send_json( $json );
5637
+                        wp_send_json($json);
5638 5638
                     }
5639 5639
                     
5640 5640
                     for ($i = 1; $i <= $limit; $i++) {
@@ -5642,59 +5642,59 @@  discard block
 block discarded – undo
5642 5642
                         
5643 5643
                         if (isset($file[$index])) {
5644 5644
                             $row = $file[$index];
5645
-                            $row = array_map( 'trim', $row );
5645
+                            $row = array_map('trim', $row);
5646 5646
                             $data = array();
5647 5647
                             
5648
-                            foreach ($columns as $c => $column ) {
5648
+                            foreach ($columns as $c => $column) {
5649 5649
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
5650 5650
                                     $data[$column] = $row[$c];
5651 5651
                                 }
5652 5652
                             }
5653 5653
 
5654
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
5654
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
5655 5655
                                 $invalid++;
5656 5656
                                 continue;
5657 5657
                             }
5658 5658
                             
5659 5659
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
5660 5660
                             
5661
-                            if ( $import_choice == 'update' ) {
5662
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5663
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5661
+                            if ($import_choice == 'update') {
5662
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
5663
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
5664 5664
                                         $updated++;
5665 5665
                                     } else {
5666 5666
                                         $invalid++;
5667 5667
                                     }
5668
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5669
-                                    $data['location_id'] = (int)$location->location_id;
5668
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
5669
+                                    $data['location_id'] = (int) $location->location_id;
5670 5670
                                     
5671
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
5672
-                                        $data['location_id'] = (int)$location->location_id;
5673
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
5674
-                                        $data['location_id'] = (int)$location->location_id;
5675
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
5676
-                                        $data['location_id'] = (int)$location->location_id;
5671
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
5672
+                                        $data['location_id'] = (int) $location->location_id;
5673
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
5674
+                                        $data['location_id'] = (int) $location->location_id;
5675
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
5676
+                                        $data['location_id'] = (int) $location->location_id;
5677 5677
                                     }
5678 5678
                                     
5679
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5679
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
5680 5680
                                         $updated++;
5681 5681
                                     } else {
5682 5682
                                         $invalid++;
5683 5683
                                     }
5684 5684
                                 } else {
5685
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5685
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
5686 5686
                                         $created++;
5687 5687
                                     } else {
5688 5688
                                         $invalid++;
5689 5689
                                     }
5690 5690
                                 }
5691
-                            } elseif ( $import_choice == 'skip' ) {
5692
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5691
+                            } elseif ($import_choice == 'skip') {
5692
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
5693 5693
                                     $skipped++;
5694
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5694
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
5695 5695
                                     $skipped++;
5696 5696
                                 } else {
5697
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {										
5697
+                                    if ($location_id = geodir_location_insert_city($data, true)) {										
5698 5698
                                         $created++;
5699 5699
                                     } else {
5700 5700
                                         $invalid++;
@@ -5715,7 +5715,7 @@  discard block
 block discarded – undo
5715 5715
                 $json['invalid'] = $invalid;
5716 5716
                 $json['images'] = $images;
5717 5717
                 
5718
-                wp_send_json( $json );
5718
+                wp_send_json($json);
5719 5719
             }
5720 5720
         }
5721 5721
         break;
@@ -5759,29 +5759,29 @@  discard block
 block discarded – undo
5759 5759
  * }
5760 5760
  * @return int|bool Term id when success, false when fail.
5761 5761
  */
5762
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5763
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5762
+function geodir_imex_insert_term($taxonomy, $term_data) {
5763
+	if (empty($taxonomy) || empty($term_data)) {
5764 5764
 		return false;
5765 5765
 	}
5766 5766
 	
5767
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5767
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5768 5768
 	$args = array();
5769
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5769
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5770
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5771
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5772 5772
 	
5773
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
-		$term_args = array_merge( $term_data, $args );
5775
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
-		$term_args = wp_parse_args( $term_args, $defaults );
5777
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5773
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5774
+		$term_args = array_merge($term_data, $args);
5775
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
+		$term_args = wp_parse_args($term_args, $defaults);
5777
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5778
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5779 5779
 	}
5780 5780
 	
5781
-    if( !empty( $term ) ) {
5782
-		$result = wp_insert_term( $term, $taxonomy, $args );
5783
-        if( !is_wp_error( $result ) ) {
5784
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5781
+    if (!empty($term)) {
5782
+		$result = wp_insert_term($term, $taxonomy, $args);
5783
+        if (!is_wp_error($result)) {
5784
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5785 5785
         }
5786 5786
     }
5787 5787
 	
@@ -5811,37 +5811,37 @@  discard block
 block discarded – undo
5811 5811
  * }
5812 5812
  * @return int|bool Term id when success, false when fail.
5813 5813
  */
5814
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5815
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5814
+function geodir_imex_update_term($taxonomy, $term_data) {
5815
+	if (empty($taxonomy) || empty($term_data)) {
5816 5816
 		return false;
5817 5817
 	}
5818 5818
 	
5819
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5819
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5820
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5821 5821
 	
5822 5822
 	$args = array();
5823
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5823
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5824
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5825
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5826 5826
 	
5827
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5827
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5828 5828
 		$term_data['term_id'] = $term_info['term_id'];
5829 5829
 		
5830
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5830
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5831 5831
 		
5832
-		if( !is_wp_error( $result ) ) {
5833
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5832
+		if (!is_wp_error($result)) {
5833
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5834 5834
         }
5835
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5835
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5836 5836
 		$term_data['term_id'] = $term_info['term_id'];
5837 5837
 		
5838
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5838
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5839 5839
 		
5840
-		if( !is_wp_error( $result ) ) {
5841
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5840
+		if (!is_wp_error($result)) {
5841
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5842 5842
         }
5843 5843
 	} else {
5844
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5844
+		return geodir_imex_insert_term($taxonomy, $term_data);
5845 5845
 	}
5846 5846
 	
5847 5847
 	return false;
@@ -5856,9 +5856,9 @@  discard block
 block discarded – undo
5856 5856
  * @param string $post_type Post type.
5857 5857
  * @return int Posts count.
5858 5858
  */
5859
-function geodir_get_posts_count( $post_type ) {
5860
-	$posts_count = wp_count_posts( $post_type );
5861
-	$posts_count = array_sum( (array)$posts_count );
5859
+function geodir_get_posts_count($post_type) {
5860
+	$posts_count = wp_count_posts($post_type);
5861
+	$posts_count = array_sum((array) $posts_count);
5862 5862
 	
5863 5863
 	/**
5864 5864
 	 * Modify returned post counts for the current post type.
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
 	 * @param int $posts_count Post counts.
5870 5870
 	 * @param string $post_type Post type.
5871 5871
 	 */
5872
-	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5872
+	$posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);	 
5873 5873
 	
5874 5874
 	return $posts_count;
5875 5875
 }
@@ -5887,8 +5887,8 @@  discard block
 block discarded – undo
5887 5887
  * @param string $post_type Post type.
5888 5888
  * @return int Posts count.
5889 5889
  */
5890
-function geodir_imex_count_events( $posts_count, $post_type ) {
5891
-	if ( $post_type == 'gd_event' ) {
5890
+function geodir_imex_count_events($posts_count, $post_type) {
5891
+	if ($post_type == 'gd_event') {
5892 5892
 		global $wpdb, $plugin_prefix;
5893 5893
 		
5894 5894
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -5896,7 +5896,7 @@  discard block
 block discarded – undo
5896 5896
 
5897 5897
 		$query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5898 5898
 		
5899
-		$posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5899
+		$posts_count = (int) $wpdb->get_var($wpdb->prepare($query, $post_type));
5900 5900
 	}
5901 5901
 	
5902 5902
 	return $posts_count;
@@ -5918,15 +5918,15 @@  discard block
 block discarded – undo
5918 5918
  * @param int $page_no Page number. Default 0.
5919 5919
  * @return array Array of posts data.
5920 5920
  */
5921
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5921
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5922 5922
 	global $wp_filesystem;
5923 5923
 
5924
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5924
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5925 5925
 
5926 5926
 	$csv_rows = array();
5927 5927
 	
5928
-	if ( !empty( $posts ) ) {
5929
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5928
+	if (!empty($posts)) {
5929
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5930 5930
 		
5931 5931
 		$csv_row = array();
5932 5932
 		$csv_row[] = 'post_id';
@@ -5937,7 +5937,7 @@  discard block
 block discarded – undo
5937 5937
 		$csv_row[] = 'default_category';
5938 5938
 		$csv_row[] = 'post_tags';
5939 5939
 		$csv_row[] = 'post_type';
5940
-		if ( $post_type == 'gd_event' ) {
5940
+		if ($post_type == 'gd_event') {
5941 5941
 			$csv_row[] = 'event_date';
5942 5942
 			$csv_row[] = 'event_enddate';
5943 5943
 			$csv_row[] = 'starttime';
@@ -5986,15 +5986,15 @@  discard block
 block discarded – undo
5986 5986
 		}
5987 5987
 		// WPML
5988 5988
 
5989
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
-		if ( !empty( $custom_fields ) ) {
5991
-			foreach ( $custom_fields as $custom_field ) {
5989
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5990
+		if (!empty($custom_fields)) {
5991
+			foreach ($custom_fields as $custom_field) {
5992 5992
 				$csv_row[] = $custom_field->htmlvar_name;
5993 5993
 			}
5994 5994
 		}
5995 5995
 
5996 5996
 		// Export franchise fields
5997
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5997
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5998 5998
 		if ($is_franchise_active) {
5999 5999
 			$csv_row[] = 'gd_is_franchise';
6000 6000
 			$csv_row[] = 'gd_franchise_lock';
@@ -6004,12 +6004,12 @@  discard block
 block discarded – undo
6004 6004
 		$csv_rows[] = $csv_row;
6005 6005
 
6006 6006
 		$images_count = 5;
6007
-        $xx=0;
6008
-		foreach ( $posts as $post ) {$xx++;
6007
+        $xx = 0;
6008
+		foreach ($posts as $post) {$xx++;
6009 6009
 			$post_id = $post['ID'];
6010 6010
 			
6011
-			$gd_post_info = geodir_get_post_info( $post_id );
6012
-			$post_info = (array)$gd_post_info;
6011
+			$gd_post_info = geodir_get_post_info($post_id);
6012
+			$post_info = (array) $gd_post_info;
6013 6013
 						
6014 6014
 			$taxonomy_category = $post_type . 'category';
6015 6015
 			$taxonomy_tags = $post_type . '_tags';
@@ -6018,14 +6018,14 @@  discard block
 block discarded – undo
6018 6018
 			$default_category_id = $gd_post_info->default_category;
6019 6019
 			$default_category = '';
6020 6020
 			$post_tags = '';
6021
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6021
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
6022 6022
 			
6023
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6023
+			if (!empty($terms) && !is_wp_error($terms)) {
6024 6024
 				$post_category = array();
6025 6025
 				$post_tags = array();
6026 6026
 			
6027
-				foreach ( $terms as $term ) {
6028
-					if ( $term->taxonomy == $taxonomy_category ) {
6027
+				foreach ($terms as $term) {
6028
+					if ($term->taxonomy == $taxonomy_category) {
6029 6029
 						$post_category[] = $term->name;
6030 6030
 						
6031 6031
 						if ($default_category_id == $term->term_id) {
@@ -6033,7 +6033,7 @@  discard block
 block discarded – undo
6033 6033
 						}
6034 6034
 					}
6035 6035
 					
6036
-					if ( $term->taxonomy == $taxonomy_tags ) {
6036
+					if ($term->taxonomy == $taxonomy_tags) {
6037 6037
 						$post_tags[] = $term->name;
6038 6038
 					}
6039 6039
 				}
@@ -6041,8 +6041,8 @@  discard block
 block discarded – undo
6041 6041
 				if (empty($default_category) && !empty($post_category)) {
6042 6042
 					$default_category = $post_category[0]; // Set first one as default category.
6043 6043
 				}
6044
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6044
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
6045
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
6046 6046
 			}
6047 6047
 
6048 6048
 			// Franchise data
@@ -6050,42 +6050,42 @@  discard block
 block discarded – undo
6050 6050
 			$franchise_info = array();
6051 6051
 			$locked_fields = array();
6052 6052
 			
6053
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6053
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
6054 6054
 				$franchise_id = $post_info['franchise'];
6055 6055
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
6056 6056
 
6057 6057
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
-					$franchise_info = (array)$gd_franchise_info;
6058
+					$franchise_info = (array) $gd_franchise_info;
6059 6059
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6060 6060
 					
6061 6061
 					if (!empty($locked_fields)) {
6062
-						foreach( $locked_fields as $locked_field) {
6062
+						foreach ($locked_fields as $locked_field) {
6063 6063
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064 6064
 								$post_info[$locked_field] = $franchise_info[$locked_field];
6065 6065
 							}
6066 6066
 							
6067 6067
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6068
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
6069 6069
 			
6070
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6070
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
6071 6071
 									$franchise_post_category = array();
6072 6072
 									$franchise_post_tags = array();
6073 6073
 								
6074
-									foreach ( $franchise_terms as $franchise_term ) {
6075
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
6074
+									foreach ($franchise_terms as $franchise_term) {
6075
+										if ($franchise_term->taxonomy == $taxonomy_category) {
6076 6076
 											$franchise_post_category[] = $franchise_term->name;
6077 6077
 										}
6078 6078
 										
6079
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6079
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
6080 6080
 											$franchise_post_tags[] = $franchise_term->name;
6081 6081
 										}
6082 6082
 									}
6083 6083
 									
6084 6084
 									if (in_array($taxonomy_category, $locked_fields)) {
6085
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6085
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
6086 6086
 									}
6087 6087
 									if (in_array('post_tags', $locked_fields)) {
6088
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6088
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
6089 6089
 									}
6090 6090
 								}
6091 6091
 							}
@@ -6094,18 +6094,18 @@  discard block
 block discarded – undo
6094 6094
 				}
6095 6095
 			}
6096 6096
 						
6097
-			$post_images = geodir_get_images( $post_id );
6097
+			$post_images = geodir_get_images($post_id);
6098 6098
 			$current_images = array();
6099
-			if ( !empty( $post_images ) ) {
6100
-				foreach ( $post_images as $post_image ) {
6101
-					$post_image = (array)$post_image;
6102
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
-					if ( $image ) {
6099
+			if (!empty($post_images)) {
6100
+				foreach ($post_images as $post_image) {
6101
+					$post_image = (array) $post_image;
6102
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
6103
+					if ($image) {
6104 6104
 						$current_images[] = $image;
6105 6105
 					}
6106 6106
 				}
6107 6107
 				
6108
-				$images_count = max( $images_count, count( $current_images ) );
6108
+				$images_count = max($images_count, count($current_images));
6109 6109
 			}
6110 6110
 
6111 6111
 			$csv_row = array();
@@ -6117,7 +6117,7 @@  discard block
 block discarded – undo
6117 6117
 			$csv_row[] = $default_category; // default_category
6118 6118
 			$csv_row[] = $post_tags; // post_tags
6119 6119
 			$csv_row[] = $post_type; // post_type
6120
-			if ( $post_type == 'gd_event' ) {
6120
+			if ($post_type == 'gd_event') {
6121 6121
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122 6122
 				$csv_row[] = $event_data['event_date']; // event_date
6123 6123
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -6138,9 +6138,9 @@  discard block
 block discarded – undo
6138 6138
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139 6139
 			}
6140 6140
 			$csv_row[] = $post_info['post_status']; // post_status
6141
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6141
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142 6142
 			if ($is_payment_plugin) {
6143
-				$csv_row[] = (int)$post_info['package_id']; // package_id
6143
+				$csv_row[] = (int) $post_info['package_id']; // package_id
6144 6144
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145 6145
 			}
6146 6146
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -6161,14 +6161,14 @@  discard block
 block discarded – undo
6161 6161
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162 6162
 			// WPML
6163 6163
 			if ($is_wpml) {
6164
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6164
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_' . $post_type);
6165
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_' . $post_type);
6166 6166
 			}
6167 6167
 			// WPML
6168 6168
 			
6169
-			if ( !empty( $custom_fields ) ) {
6170
-				foreach ( $custom_fields as $custom_field ) {
6171
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6169
+			if (!empty($custom_fields)) {
6170
+				foreach ($custom_fields as $custom_field) {
6171
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
6172 6172
 				}
6173 6173
 			}
6174 6174
 			
@@ -6179,26 +6179,26 @@  discard block
 block discarded – undo
6179 6179
 				$franchise = '';
6180 6180
 					
6181 6181
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6182
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
6183
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
6184 6184
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6185
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
6186 6186
 				}
6187 6187
 				
6188
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6188
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
6189 6189
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
-				$csv_row[] = (int)$franchise; // franchise id
6190
+				$csv_row[] = (int) $franchise; // franchise id
6191 6191
 			}
6192 6192
 			
6193
-			for ( $c = 0; $c < $images_count; $c++ ) {
6194
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6193
+			for ($c = 0; $c < $images_count; $c++) {
6194
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
6195 6195
 			}
6196 6196
 			
6197 6197
 			$csv_rows[] = $csv_row;
6198 6198
 
6199 6199
 		}
6200 6200
 
6201
-		for ( $c = 0; $c < $images_count; $c++ ) {
6201
+		for ($c = 0; $c < $images_count; $c++) {
6202 6202
 			$csv_rows[0][] = 'IMAGE';
6203 6203
 		}
6204 6204
 	}
@@ -6220,19 +6220,19 @@  discard block
 block discarded – undo
6220 6220
  * @param int $page_no Page number. Default 0.
6221 6221
  * @return array Array of posts data.
6222 6222
  */
6223
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
6223
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
6224 6224
 	global $wpdb, $plugin_prefix;
6225 6225
 
6226
-	if ( ! post_type_exists( $post_type ) )
6226
+	if (!post_type_exists($post_type))
6227 6227
 		return new stdClass;
6228 6228
 		
6229 6229
 	$table = $plugin_prefix . $post_type . '_detail';
6230 6230
 	
6231 6231
 	$limit = '';
6232
-	if ( $per_page > 0 && $page_no > 0 ) {
6233
-		$offset = ( $page_no - 1 ) * $per_page;
6232
+	if ($per_page > 0 && $page_no > 0) {
6233
+		$offset = ($page_no - 1) * $per_page;
6234 6234
 		
6235
-		if ( $offset > 0 ) {
6235
+		if ($offset > 0) {
6236 6236
 			$limit = " LIMIT " . $offset . "," . $per_page;
6237 6237
 		} else {
6238 6238
 			$limit = " LIMIT " . $per_page;
@@ -6249,9 +6249,9 @@  discard block
 block discarded – undo
6249 6249
 	 * @param int $query The SQL query.
6250 6250
 	 * @param string $post_type Post type.
6251 6251
 	 */
6252
-	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6252
+	$query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
6253 6253
 
6254
-	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6254
+	$results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
6255 6255
 
6256 6256
 	/**
6257 6257
 	 * Modify returned post results for the current post type.
@@ -6262,7 +6262,7 @@  discard block
 block discarded – undo
6262 6262
 	 * @param object $results An object containing all post ids.
6263 6263
 	 * @param string $post_type Post type.
6264 6264
 	 */
6265
-	return apply_filters( 'geodir_export_posts', $results, $post_type );
6265
+	return apply_filters('geodir_export_posts', $results, $post_type);
6266 6266
 }
6267 6267
 
6268 6268
 /**
@@ -6279,8 +6279,8 @@  discard block
 block discarded – undo
6279 6279
  * @param string $post_type Post type.
6280 6280
  * @return string The SQL query.
6281 6281
  */
6282
-function geodir_imex_get_events_query( $query, $post_type ) {
6283
-	if ( $post_type == 'gd_event' ) {
6282
+function geodir_imex_get_events_query($query, $post_type) {
6283
+	if ($post_type == 'gd_event') {
6284 6284
 		global $wpdb, $plugin_prefix;
6285 6285
 		
6286 6286
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -6301,15 +6301,15 @@  discard block
 block discarded – undo
6301 6301
  * @param  string $post_type Post type.
6302 6302
  * @return int Total terms count.
6303 6303
  */
6304
-function geodir_get_terms_count( $post_type ) {
6305
-	$args = array( 'hide_empty' => 0 );
6304
+function geodir_get_terms_count($post_type) {
6305
+	$args = array('hide_empty' => 0);
6306 6306
 	
6307
-	remove_all_filters( 'get_terms' );
6307
+	remove_all_filters('get_terms');
6308 6308
 	
6309 6309
 	$taxonomy = $post_type . 'category';
6310 6310
 
6311
-	$count_terms = wp_count_terms( $taxonomy, $args );
6312
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6311
+	$count_terms = wp_count_terms($taxonomy, $args);
6312
+	$count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
6313 6313
 	 
6314 6314
 	return $count_terms;
6315 6315
 }
@@ -6326,23 +6326,23 @@  discard block
 block discarded – undo
6326 6326
  * @param int $page_no Page number. Default 0.
6327 6327
  * @return array Array of terms data.
6328 6328
  */
6329
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
6330
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6329
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
6330
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
6331 6331
 	
6332
-	remove_all_filters( 'get_terms' );
6332
+	remove_all_filters('get_terms');
6333 6333
 	
6334 6334
 	$taxonomy = $post_type . 'category';
6335 6335
 	
6336
-	if ( $per_page > 0 && $page_no > 0 ) {
6337
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
6336
+	if ($per_page > 0 && $page_no > 0) {
6337
+		$args['offset'] = ($page_no - 1) * $per_page;
6338 6338
 		$args['number'] = $per_page;
6339 6339
 	}
6340 6340
 	
6341
-	$terms = get_terms( $taxonomy, $args );
6341
+	$terms = get_terms($taxonomy, $args);
6342 6342
 
6343 6343
 	$csv_rows = array();
6344 6344
 	
6345
-	if ( !empty( $terms ) ) {
6345
+	if (!empty($terms)) {
6346 6346
 		$csv_row = array();
6347 6347
 		$csv_row[] = 'cat_id';
6348 6348
 		$csv_row[] = 'cat_name';
@@ -6363,16 +6363,16 @@  discard block
 block discarded – undo
6363 6363
 		
6364 6364
 		$csv_rows[] = $csv_row;
6365 6365
 		
6366
-		foreach ( $terms as $term ) {			
6367
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6366
+		foreach ($terms as $term) {			
6367
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
6368
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
6369 6369
 			
6370
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6370
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
6371
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
6372 6372
 			
6373 6373
 			$cat_parent = '';
6374
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6374
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
6375
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
6376 6376
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377 6377
 			}
6378 6378
 			
@@ -6382,14 +6382,14 @@  discard block
 block discarded – undo
6382 6382
 			$csv_row[] = $term->slug;
6383 6383
 			$csv_row[] = $post_type;
6384 6384
 			$csv_row[] = $cat_parent;
6385
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6385
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
6386 6386
 			$csv_row[] = $term->description;
6387
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6387
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
6388 6388
 			$csv_row[] = $cat_image;
6389 6389
 			$csv_row[] = $cat_icon;
6390 6390
 			// WPML
6391 6391
 			if ($is_wpml) {
6392
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6392
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy);
6393 6393
 			}
6394 6394
 			// WPML
6395 6395
 			
@@ -6408,7 +6408,7 @@  discard block
 block discarded – undo
6408 6408
  * @param  bool $relative True for relative path & False for absolute path.
6409 6409
  * @return string Path to the cache directory.
6410 6410
  */
6411
-function geodir_path_import_export( $relative = true ) {
6411
+function geodir_path_import_export($relative = true) {
6412 6412
 	$upload_dir = wp_upload_dir();
6413 6413
 	
6414 6414
 	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
@@ -6427,8 +6427,8 @@  discard block
 block discarded – undo
6427 6427
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
6428 6428
  * @return bool true if success otherwise false.
6429 6429
  */
6430
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
6431
-	if ( empty( $csv_data ) ) {
6430
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
6431
+	if (empty($csv_data)) {
6432 6432
 		return false;
6433 6433
 	}
6434 6434
 	
@@ -6436,17 +6436,17 @@  discard block
 block discarded – undo
6436 6436
 	
6437 6437
 	$mode = $clear ? 'w+' : 'a+';
6438 6438
 	
6439
-	if ( function_exists( 'fputcsv' ) ) {
6440
-		$file = fopen( $file_path, $mode );
6441
-		foreach( $csv_data as $csv_row ) {
6439
+	if (function_exists('fputcsv')) {
6440
+		$file = fopen($file_path, $mode);
6441
+		foreach ($csv_data as $csv_row) {
6442 6442
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
6443
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6443
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
6444 6444
 		}
6445
-		fclose( $file );
6445
+		fclose($file);
6446 6446
 	} else {
6447
-		foreach( $csv_data as $csv_row ) {
6447
+		foreach ($csv_data as $csv_row) {
6448 6448
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
6449
-			$wp_filesystem->put_contents( $file_path, $csv_row );
6449
+			$wp_filesystem->put_contents($file_path, $csv_row);
6450 6450
 		}
6451 6451
 	}
6452 6452
 		
@@ -6464,14 +6464,14 @@  discard block
 block discarded – undo
6464 6464
  * @param  string $file Full path to file.
6465 6465
  * @return int No of file rows.
6466 6466
  */
6467
-function geodir_import_export_line_count( $file ) {
6467
+function geodir_import_export_line_count($file) {
6468 6468
 	global $wp_filesystem;
6469 6469
 	
6470
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
-		$contents = $wp_filesystem->get_contents_array( $file );
6470
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
6471
+		$contents = $wp_filesystem->get_contents_array($file);
6472 6472
 		
6473
-		if ( !empty( $contents ) && is_array( $contents ) ) {
6474
-			return count( $contents ) - 1;
6473
+		if (!empty($contents) && is_array($contents)) {
6474
+			return count($contents) - 1;
6475 6475
 		}
6476 6476
 	}
6477 6477
 	
@@ -6488,11 +6488,11 @@  discard block
 block discarded – undo
6488 6488
  * @param string $post_type The post type.
6489 6489
  * @return object Queried object.
6490 6490
  */
6491
-function geodir_imex_get_custom_fields( $post_type ) {
6491
+function geodir_imex_get_custom_fields($post_type) {
6492 6492
 	global $wpdb;
6493 6493
 	 
6494
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
-	$rows = $wpdb->get_results( $sql );
6494
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
6495
+	$rows = $wpdb->get_results($sql);
6496 6496
 	 
6497 6497
 	return $rows;
6498 6498
 }
@@ -6574,9 +6574,9 @@  discard block
 block discarded – undo
6574 6574
 	$post_table = $plugin_prefix . $post_type . '_detail';
6575 6575
 	
6576 6576
 	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
-	$data = (array)$wpdb->get_row($query);
6577
+	$data = (array) $wpdb->get_row($query);
6578 6578
 	
6579
-	if ( !empty( $data ) ) {
6579
+	if (!empty($data)) {
6580 6580
 		$data['post_id'] = $tr_post_id;
6581 6581
 		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6582 6582
 		
@@ -6604,7 +6604,7 @@  discard block
 block discarded – undo
6604 6604
 	global $sitepress, $wpdb;
6605 6605
 	$post_type = get_post_type($master_post_id);
6606 6606
 	
6607
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6607
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
6608 6608
 
6609 6609
 	$taxonomies = get_object_taxonomies($post_type);
6610 6610
 	foreach ($taxonomies as $taxonomy) {
@@ -6613,9 +6613,9 @@  discard block
 block discarded – undo
6613 6613
 		
6614 6614
 		if ($terms) {
6615 6615
 			foreach ($terms as $term) {
6616
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6616
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
6617 6617
 				
6618
-				if (!is_null($tr_id)){
6618
+				if (!is_null($tr_id)) {
6619 6619
 					// not using get_term - unfiltered get_term
6620 6620
 					$translated_term = $wpdb->get_row($wpdb->prepare("
6621 6621
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -6624,8 +6624,8 @@  discard block
 block discarded – undo
6624 6624
 				}
6625 6625
 			}
6626 6626
 
6627
-			if (!is_taxonomy_hierarchical($taxonomy)){
6628
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6627
+			if (!is_taxonomy_hierarchical($taxonomy)) {
6628
+				$terms_array = array_unique(array_map('intval', $terms_array));
6629 6629
 			}
6630 6630
 
6631 6631
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
@@ -6658,9 +6658,9 @@  discard block
 block discarded – undo
6658 6658
 	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659 6659
 	$post_images = $wpdb->get_results($query);
6660 6660
 	
6661
-	if ( !empty( $post_images ) ) {
6662
-		foreach ( $post_images as $post_image) {
6663
-			$image_data = (array)$post_image;
6661
+	if (!empty($post_images)) {
6662
+		foreach ($post_images as $post_image) {
6663
+			$image_data = (array) $post_image;
6664 6664
 			unset($image_data['ID']);
6665 6665
 			$image_data['post_id'] = $tr_post_id;
6666 6666
 			
@@ -6686,10 +6686,10 @@  discard block
 block discarded – undo
6686 6686
  * @return array Event data array.
6687 6687
  */
6688 6688
 function geodir_imex_get_event_data($post, $gd_post_info) {
6689
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6689
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
6690 6690
 	$event_enddate = $event_date;
6691
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6691
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6692
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6693 6693
 	
6694 6694
 	$is_recurring_event = '';
6695 6695
 	$event_duration_days = '';
@@ -6707,15 +6707,15 @@  discard block
 block discarded – undo
6707 6707
 		
6708 6708
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709 6709
 	if (!empty($recurring_data)) {
6710
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6710
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
6711
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
6712
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6713
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6714 6714
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715 6715
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6716 6716
 	
6717
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6717
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6718
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6719 6719
 			
6720 6720
 		if ($recurring_pkg && $is_recurring) {
6721 6721
 			$recurring_dates = $event_date;
@@ -6725,13 +6725,13 @@  discard block
 block discarded – undo
6725 6725
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6726 6726
 			
6727 6727
 			if (!empty($recurring_data['event_recurring_dates'])) {
6728
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6728
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6729 6729
 				
6730 6730
 				if (!empty($event_recurring_dates)) {
6731 6731
 					$recurring_dates = array();
6732 6732
 					
6733 6733
 					foreach ($event_recurring_dates as $date) {
6734
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6734
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6735 6735
 					}
6736 6736
 					
6737 6737
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6747,7 +6747,7 @@  discard block
 block discarded – undo
6747 6747
 						$times = array();
6748 6748
 						
6749 6749
 						foreach ($recurring_data['starttimes'] as $time) {
6750
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6750
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6751 6751
 						}
6752 6752
 						
6753 6753
 						$event_starttimes = implode(",", $times);
@@ -6757,7 +6757,7 @@  discard block
 block discarded – undo
6757 6757
 						$times = array();
6758 6758
 						
6759 6759
 						foreach ($recurring_data['endtimes'] as $time) {
6760
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6760
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6761 6761
 						}
6762 6762
 						
6763 6763
 						$event_endtimes = implode(",", $times);
@@ -6769,8 +6769,8 @@  discard block
 block discarded – undo
6769 6769
 					}
6770 6770
 				}
6771 6771
 			} else {
6772
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6772
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6773
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6774 6774
 				
6775 6775
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776 6776
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6786,11 +6786,11 @@  discard block
 block discarded – undo
6786 6786
 				}
6787 6787
 				
6788 6788
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6789
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6790
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
6791 6791
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792 6792
 				} else {
6793
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6793
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6794 6794
 				}
6795 6795
 			}
6796 6796
 		}
@@ -6854,9 +6854,9 @@  discard block
 block discarded – undo
6854 6854
  * @return array Event data array.
6855 6855
  */
6856 6856
 function geodir_imex_process_event_data($gd_post) {
6857
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6857
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6858 6858
 
6859
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6859
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6860 6860
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861 6861
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862 6862
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6903,17 +6903,17 @@  discard block
 block discarded – undo
6903 6903
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6904 6904
 			}
6905 6905
 		} else {
6906
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6906
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6907
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6908
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6909
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6910 6910
 			
6911 6911
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6912 6912
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6913 6913
 			
6914 6914
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6915 6915
 			
6916
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6916
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917 6917
 			$repeat_days = array();
6918 6918
 			if (!empty($a_repeat_days)) {
6919 6919
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6931,7 +6931,7 @@  discard block
 block discarded – undo
6931 6931
 			$repeat_weeks = array();
6932 6932
 			if (!empty($a_repeat_weeks)) {
6933 6933
 				foreach ($a_repeat_weeks as $repeat_week) {
6934
-					$repeat_weeks[] = (int)$repeat_week;
6934
+					$repeat_weeks[] = (int) $repeat_week;
6935 6935
 				}
6936 6936
 				
6937 6937
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -7052,7 +7052,7 @@  discard block
 block discarded – undo
7052 7052
  */
7053 7053
 function geodir_admin_upgrade_notice() {
7054 7054
     $class = "error";
7055
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
7055
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
7056 7056
     echo"<div class=\"$class\"> <p>$message</p></div>";
7057 7057
 }
7058 7058
 
@@ -7067,7 +7067,7 @@  discard block
 block discarded – undo
7067 7067
  * @param (object) $r
7068 7068
  * @return (string) $output
7069 7069
  */
7070
-function geodire_admin_upgrade_notice( $plugin_data, $r )
7070
+function geodire_admin_upgrade_notice($plugin_data, $r)
7071 7071
 {
7072 7072
     // readme contents
7073 7073
     $args = array(
@@ -7075,7 +7075,7 @@  discard block
 block discarded – undo
7075 7075
         'redirection' => 5
7076 7076
     );
7077 7077
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
7078
-    $data       = wp_remote_get( $url, $args );
7078
+    $data = wp_remote_get($url, $args);
7079 7079
 
7080 7080
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
7081 7081
 
@@ -7090,20 +7090,20 @@  discard block
 block discarded – undo
7090 7090
 function geodir_in_plugin_update_message($content) {
7091 7091
     // Output Upgrade Notice
7092 7092
     $matches        = null;
7093
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
7093
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote(GEODIRECTORY_VERSION) . '\s*=|$)~Uis';
7094 7094
     $upgrade_notice = '';
7095
-    if ( preg_match( $regexp, $content, $matches ) ) {
7096
-        if(empty($matches)){return;}
7095
+    if (preg_match($regexp, $content, $matches)) {
7096
+        if (empty($matches)) {return; }
7097 7097
         //print_r($matches );
7098
-        $version = trim( $matches[1] );
7099
-        if($version && $version>GEODIRECTORY_VERSION){
7098
+        $version = trim($matches[1]);
7099
+        if ($version && $version > GEODIRECTORY_VERSION) {
7100 7100
 
7101 7101
 
7102
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
7103
-        if ( version_compare( WC_VERSION, $version, '<' ) ) {
7102
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
7103
+        if (version_compare(WC_VERSION, $version, '<')) {
7104 7104
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
7105
-            foreach ( $notices as $index => $line ) {
7106
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
7105
+            foreach ($notices as $index => $line) {
7106
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
7107 7107
             }
7108 7108
             $upgrade_notice .= '</div> ';
7109 7109
         }
@@ -7127,7 +7127,7 @@  discard block
 block discarded – undo
7127 7127
 		$default_language = $sitepress->get_default_language();
7128 7128
 		if ($current_language != 'all' && $current_language != $default_language) {
7129 7129
 	?>
7130
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
7130
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
7131 7131
 	<?php
7132 7132
 		}
7133 7133
 	}
Please login to merge, or discard this patch.
geodirectory-admin/admin_hooks_actions.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -1639,6 +1639,7 @@
 block discarded – undo
1639 1639
  * @since 1.0.0
1640 1640
  * @package GeoDirectory
1641 1641
  * @global object $current_user Current user object.
1642
+ * @param string|null $input
1642 1643
  * @return array Returns parsed data as array.
1643 1644
  */
1644 1645
 function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\")
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Admin.
4
- *
5
- * Main admin file which loads all settings panels and sets up admin menus.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+     * GeoDirectory Admin.
4
+     *
5
+     * Main admin file which loads all settings panels and sets up admin menus.
6
+     *
7
+     * @since 1.0.0
8
+     * @package GeoDirectory
9
+     */
10 10
 
11 11
 add_action('admin_init', 'geodir_admin_init');
12 12
 if (!function_exists('geodir_admin_init')) {
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 {
86 86
     global $pagenow;
87 87
 	
88
-	// Get the current post type
89
-	$post_type = geodir_admin_current_post_type();
90
-	$geodir_post_types = geodir_get_posttypes();
88
+    // Get the current post type
89
+    $post_type = geodir_admin_current_post_type();
90
+    $geodir_post_types = geodir_get_posttypes();
91 91
     
92
-	if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
92
+    if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
93 93
         add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
94 94
         add_action('admin_enqueue_scripts', 'geodir_admin_styles');
95 95
     }
@@ -1517,20 +1517,20 @@  discard block
 block discarded – undo
1517 1517
 function geodir_diagnose_load_db_language() {
1518 1518
     global $wpdb;
1519 1519
 	
1520
-	$is_error_during_diagnose = geodirectory_load_db_language();
1520
+    $is_error_during_diagnose = geodirectory_load_db_language();
1521 1521
 
1522 1522
     $output_str = '';
1523 1523
 
1524 1524
     if ($is_error_during_diagnose) {
1525 1525
         $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
1526
-		$info_div_class = "geodir_problem_info";
1526
+        $info_div_class = "geodir_problem_info";
1527 1527
     } else {
1528 1528
         $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1529
-		$info_div_class = "geodir_noproblem_info";
1529
+        $info_div_class = "geodir_noproblem_info";
1530 1530
         $fix_button_txt = '';
1531 1531
     }
1532 1532
     
1533
-	echo "<ul class='$info_div_class'>";
1533
+    echo "<ul class='$info_div_class'>";
1534 1534
     echo $output_str;
1535 1535
     echo $fix_button_txt;
1536 1536
     echo "</ul>";
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
     $uploads = wp_upload_dir();
1656 1656
     ini_set('auto_detect_line_endings', true);
1657 1657
 	
1658
-	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1658
+    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1659 1659
 
1660 1660
     $task = isset($_POST['task']) ? $_POST['task'] : '';
1661 1661
     $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
@@ -1855,8 +1855,8 @@  discard block
 block discarded – undo
1855 1855
                             $post_longitude = addslashes($buffer[$c]);
1856 1856
                         }
1857 1857
 						
1858
-						// Post status
1859
-						if ($customKeyarray[$c] == 'post_status') {
1858
+                        // Post status
1859
+                        if ($customKeyarray[$c] == 'post_status') {
1860 1860
                             $post_status = sanitize_key( $buffer[$c] );
1861 1861
                         }
1862 1862
                     }
@@ -1873,10 +1873,10 @@  discard block
 block discarded – undo
1873 1873
                         }
1874 1874
                     }
1875 1875
 					
1876
-					// Default post status
1877
-					$default_status = 'publish';
1878
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1876
+                    // Default post status
1877
+                    $default_status = 'publish';
1878
+                    $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
+                    $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1880 1880
 
1881 1881
                     $my_post['post_title'] = $post_title;
1882 1882
                     $my_post['post_content'] = $post_desc;
@@ -2099,5 +2099,5 @@  discard block
 block discarded – undo
2099 2099
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2100 2100
 
2101 2101
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2102
-	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
2102
+    add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
2103 2103
 }
2104 2104
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function geodir_get_admin_option_form($current_tab)
64 64
 {
65
-    geodir_admin_option_form($current_tab);// defined in admin template tags.php
65
+    geodir_admin_option_form($current_tab); // defined in admin template tags.php
66 66
 }
67 67
 
68 68
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
71 71
 add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
72 72
 add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
73
-add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
73
+add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
74 74
 
75 75
 //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
76 76
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 }
238 238
 
239
-add_action('save_post', 'geodir_post_information_save',10,2);
239
+add_action('save_post', 'geodir_post_information_save', 10, 2);
240 240
 
241 241
 
242 242
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
265 265
 
266
-            if(!empty($gd_taxonomy)) {
266
+            if (!empty($gd_taxonomy)) {
267 267
                 foreach ($gd_taxonomy as $tax) {
268 268
 
269 269
                     remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     global $wpdb;
416 416
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
417 417
     ?>
418
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
418
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
419 419
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
420 420
     <ul>
421 421
     <?php
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
             
434 434
             $display = $check_html_variable ? ' style="display:none;"' : '';
435 435
             ?>
436
-            <li <?php echo $display;?>>
437
-            <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>"
438
-               title="<?php echo $val['site_title'];?>"
439
-               class="gt-draggable-form-items gt-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>"
440
-               href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a>
436
+            <li <?php echo $display; ?>>
437
+            <a id="gt-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>"
438
+               title="<?php echo $val['site_title']; ?>"
439
+               class="gt-draggable-form-items gt-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>"
440
+               href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory'); ?></a>
441 441
             </li>
442 442
             <?php
443 443
         }
@@ -491,39 +491,39 @@  discard block
 block discarded – undo
491 491
 {
492 492
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
493 493
     ?>
494
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
494
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
495 495
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
496 496
     <ul class="full">
497
-        <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory');?></a></li>
497
+        <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory'); ?></a></li>
498 498
     </ul>
499 499
     <ul>
500 500
         <li><a id="gt-text" class="gt-draggable-form-items gt-text"
501
-               href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory');?></a></li>
501
+               href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory'); ?></a></li>
502 502
         <li><a id="gt-datepicker" class="gt-draggable-form-items gt-datepicker"
503
-               href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory');?></a></li>
503
+               href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory'); ?></a></li>
504 504
         <li><a id="gt-textarea" class="gt-draggable-form-items gt-textarea"
505
-               href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory');?></a></li>
505
+               href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory'); ?></a></li>
506 506
         <li><a id="gt-time" class="gt-draggable-form-items gt-time"
507
-               href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory');?></a></li>
507
+               href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory'); ?></a></li>
508 508
         <li><a id="gt-checkbox" class="gt-draggable-form-items gt-checkbox"
509
-               href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory');?></a></li>
509
+               href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory'); ?></a></li>
510 510
         <li><a id="gt-phone" class="gt-draggable-form-items gt-phone"
511
-               href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory');?></a></li>
511
+               href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory'); ?></a></li>
512 512
         <li><a id="gt-radio" class="gt-draggable-form-items gt-radio"
513
-               href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory');?></a></li>
513
+               href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory'); ?></a></li>
514 514
         <li><a id="gt-email" class="gt-draggable-form-items gt-email"
515
-               href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory');?></a></li>
515
+               href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory'); ?></a></li>
516 516
         <li><a id="gt-select" class="gt-draggable-form-items gt-select"
517
-               href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory');?></a></li>
518
-        <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory');?></a></li>-->
517
+               href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory'); ?></a></li>
518
+        <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory'); ?></a></li>-->
519 519
         <li><a id="gt-multiselect" class="gt-draggable-form-items gt-multiselect"
520
-               href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory');?></a></li>
520
+               href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory'); ?></a></li>
521 521
         <li><a id="gt-url" class="gt-draggable-form-items gt-url"
522
-               href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory');?></a></li>
522
+               href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory'); ?></a></li>
523 523
         <li><a id="gt-html" class="gt-draggable-form-items gt-html"
524
-               href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory');?></a></li>
524
+               href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory'); ?></a></li>
525 525
         <li><a id="gt-file" class="gt-draggable-form-items gt-file"
526
-               href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory');?></a></li>
526
+               href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory'); ?></a></li>
527 527
 
528 528
     </ul>
529 529
 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
     switch ($sub_tab) {
636 636
         case 'custom_fields':
637
-            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
637
+            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
638 638
             break;
639 639
 
640 640
         case 'sorting_options':
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 
689 689
     switch ($sub_tab) {
690 690
         case 'custom_fields':
691
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
691
+            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
692 692
             break;
693 693
 
694 694
         case 'sorting_options':
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
         $filter_arr['is_error_during_diagnose'] = true;
788 788
 
789 789
         if ($fix) {
790
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
791
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
790
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak"); // get backup table count
791
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table"); // get new table count
792 792
 
793 793
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
794 794
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
795 795
 
796
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
796
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2"); // rename bak table to new table
797 797
 
798 798
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
799 799
                     $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 
804 804
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
805 805
 
806
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
807
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
806
+                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2"); // rename new table to bak2
807
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table"); // rename bak table to new table
808 808
 
809 809
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
810 810
                     $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
816 816
 
817
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
817
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2"); // rename ms_bak table to ms_bak2
818 818
 
819 819
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
820 820
                     $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
                             $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
999 999
                             foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1000 1000
                                 if (is_numeric($cat_part)) {
1001
-                                    $raw_cats[] = (int)$cat_part;
1001
+                                    $raw_cats[] = (int) $cat_part;
1002 1002
                                 }
1003 1003
                             }
1004 1004
 
@@ -1308,9 +1308,9 @@  discard block
 block discarded – undo
1308 1308
     //////////////////////////////////
1309 1309
     $option_value = get_option('geodir_home_page');
1310 1310
     $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1311
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1312 1312
 
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1313
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1314 1314
         $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315 1315
     else {
1316 1316
         $is_error_during_diagnose = true;
@@ -1333,9 +1333,9 @@  discard block
 block discarded – undo
1333 1333
     //////////////////////////////////
1334 1334
     $option_value = get_option('geodir_add_listing_page');
1335 1335
     $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1336
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1337 1337
 
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1338
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1339 1339
         $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340 1340
     else {
1341 1341
         $is_error_during_diagnose = true;
@@ -1359,9 +1359,9 @@  discard block
 block discarded – undo
1359 1359
     //////////////////////////////////
1360 1360
     $option_value = get_option('geodir_preview_page');
1361 1361
     $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1362
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1363 1363
 
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1364
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1365 1365
         $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366 1366
     else {
1367 1367
         $is_error_during_diagnose = true;
@@ -1384,9 +1384,9 @@  discard block
 block discarded – undo
1384 1384
     //////////////////////////////////
1385 1385
     $option_value = get_option('geodir_success_page');
1386 1386
     $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1387
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1388 1388
 
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1389
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1390 1390
         $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391 1391
     else {
1392 1392
         $is_error_during_diagnose = true;
@@ -1409,9 +1409,9 @@  discard block
 block discarded – undo
1409 1409
     //////////////////////////////////
1410 1410
     $option_value = get_option('geodir_info_page');
1411 1411
     $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1412
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1413 1413
 
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1414
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1415 1415
         $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416 1416
     else {
1417 1417
         $is_error_during_diagnose = true;
@@ -1434,9 +1434,9 @@  discard block
 block discarded – undo
1434 1434
     //////////////////////////////////
1435 1435
     $option_value = get_option('geodir_login_page');
1436 1436
     $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1437
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1438 1438
 
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1439
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1440 1440
         $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441 1441
     else {
1442 1442
         $is_error_during_diagnose = true;
@@ -1459,9 +1459,9 @@  discard block
 block discarded – undo
1459 1459
     //////////////////////////////////
1460 1460
     $option_value = get_option('geodir_location_page');
1461 1461
     $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1462
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1463 1463
 
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1464
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1465 1465
         $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466 1466
     else {
1467 1467
         $is_error_during_diagnose = true;
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
     /* Diagnose Location Page Ends */
1480 1480
     ////////////////////////////////
1481 1481
 
1482
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1482
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1483 1483
     /**
1484 1484
      * This action is called at the end of the GD Tools page check function.
1485 1485
      *
1486 1486
      * @since 1.5.2
1487 1487
      */
1488
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1488
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1489 1489
 
1490 1490
     $output_str = $page_chk_arr['output_str'];
1491 1491
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 
1683 1683
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1684 1684
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1685
-                        if(is_array($data) && !empty($data)) {
1685
+                        if (is_array($data) && !empty($data)) {
1686 1686
                             $file[] = '"' . implode('","', $data) . '"';
1687 1687
                         }
1688 1688
                     }
@@ -1857,7 +1857,7 @@  discard block
 block discarded – undo
1857 1857
 						
1858 1858
 						// Post status
1859 1859
 						if ($customKeyarray[$c] == 'post_status') {
1860
-                            $post_status = sanitize_key( $buffer[$c] );
1860
+                            $post_status = sanitize_key($buffer[$c]);
1861 1861
                         }
1862 1862
                     }
1863 1863
 
@@ -1875,8 +1875,8 @@  discard block
 block discarded – undo
1875 1875
 					
1876 1876
 					// Default post status
1877 1877
 					$default_status = 'publish';
1878
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1878
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
1879
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
1880 1880
 
1881 1881
                     $my_post['post_title'] = $post_title;
1882 1882
                     $my_post['post_content'] = $post_desc;
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
                     $payment_info = array();
1921 1921
                     $package_info = array();
1922 1922
 
1923
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
1923
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
1924 1924
                     $package_id = '';
1925 1925
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
1926 1926
                         $package_id = $gd_post_info['package_id'];
@@ -2021,11 +2021,11 @@  discard block
 block discarded – undo
2021 2021
 }
2022 2022
 
2023 2023
 // Add the tab in left sidebar menu fro import & export page.
2024
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2024
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2025 2025
 
2026 2026
 // Handle ajax request for impot/export.
2027
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2028
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2027
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2028
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2029 2029
 
2030 2030
 
2031 2031
 /**
@@ -2036,40 +2036,40 @@  discard block
 block discarded – undo
2036 2036
  * @param $post_id int $post_id The post ID of the post being saved.
2037 2037
  * @param $post object $post The post object of the post being saved.
2038 2038
  */
2039
-function geodir_update_location_prefix($post_id,$post){
2040
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2041
-        update_option('geodir_location_prefix',$post->post_name);
2039
+function geodir_update_location_prefix($post_id, $post) {
2040
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2041
+        update_option('geodir_location_prefix', $post->post_name);
2042 2042
     }
2043 2043
 
2044 2044
 }
2045 2045
 
2046
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2046
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2047 2047
 
2048
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2048
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2049 2049
 
2050
-function geodir_ga_callback(){
2050
+function geodir_ga_callback() {
2051 2051
 
2052
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2052
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2053 2053
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2054
-    $code = "code=".$_REQUEST['code'];
2054
+    $code = "code=" . $_REQUEST['code'];
2055 2055
     $grant_type = "&grant_type=authorization_code";
2056 2056
     $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2057
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2058
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2057
+    $client_id = "&client_id=" . get_option('geodir_ga_client_id');
2058
+    $client_secret = "&client_secret=" . get_option('geodir_ga_client_secret');
2059 2059
 
2060
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2060
+    $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id . $client_secret;
2061 2061
 
2062 2062
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2063 2063
 
2064 2064
     //print_r($response);
2065 2065
 
2066
-    $error_msg =  __('Something went wrong','geodirectory');
2067
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2066
+    $error_msg = __('Something went wrong', 'geodirectory');
2067
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2068 2068
 
2069 2069
         $parts = json_decode($response['body']);
2070 2070
         //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2071
+        if (!isset($parts->access_token)) {echo $error_msg . " - #1"; exit; }
2072
+        else {
2073 2073
 
2074 2074
             update_option('gd_ga_access_token', $parts->access_token);
2075 2075
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2078,25 +2078,25 @@  discard block
 block discarded – undo
2078 2078
 
2079 2079
 
2080 2080
     }
2081
-    elseif(!empty($response['response']['code'])) {
2081
+    elseif (!empty($response['response']['code'])) {
2082 2082
         $parts = json_decode($response['body']);
2083 2083
 
2084
-        if(isset($parts->error)){
2085
-            echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2087
-            echo $error_msg." - #2";exit;
2084
+        if (isset($parts->error)) {
2085
+            echo $parts->error . ": " . $parts->error_description; exit;
2086
+        } else {
2087
+            echo $error_msg . " - #2"; exit;
2088 2088
         }
2089 2089
 
2090
-    }else{
2090
+    } else {
2091 2091
 
2092
-        echo $error_msg." - #3";exit;
2092
+        echo $error_msg . " - #3"; exit;
2093 2093
 
2094 2094
     }
2095 2095
 }
2096 2096
     exit;
2097 2097
 }
2098 2098
 
2099
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2099
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2100 2100
 
2101 2101
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2102 2102
 	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
Please login to merge, or discard this patch.
Braces   +58 added lines, -50 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoide Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+                // this will avoide Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -313,8 +316,9 @@  discard block
 block discarded – undo
313 316
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
314 317
 
315 318
         foreach ($notification as $key => $value) {
316
-            if ($value['type'] == 'textarea')
317
-                $notification[$key]['type'] = 'editor';
319
+            if ($value['type'] == 'textarea') {
320
+                            $notification[$key]['type'] = 'editor';
321
+            }
318 322
         }
319 323
 
320 324
     }
@@ -339,8 +343,9 @@  discard block
 block discarded – undo
339 343
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
340 344
 
341 345
         foreach ($design_setting as $key => $value) {
342
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
343
-                $design_setting[$key]['type'] = 'editor';
346
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
347
+                            $design_setting[$key]['type'] = 'editor';
348
+            }
344 349
         }
345 350
 
346 351
     }
@@ -715,8 +720,9 @@  discard block
 block discarded – undo
715 720
 
716 721
     if (!get_option('geodir_remove_unnecessary_fields')) {
717 722
 
718
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
719
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
723
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
724
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
725
+        }
720 726
 
721 727
         update_option('geodir_remove_unnecessary_fields', '1');
722 728
 
@@ -742,15 +748,17 @@  discard block
 block discarded – undo
742 748
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
743 749
         switch ($geodir_admin_ajax_action) {
744 750
             case 'diagnosis' :
745
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
746
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
751
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
752
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
753
+                }
747 754
                 call_user_func('geodir_diagnose_' . $diagnose_this);
748 755
                 exit();
749 756
                 break;
750 757
 
751 758
             case 'diagnosis-fix' :
752
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
753
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
759
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
760
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
761
+                }
754 762
                 call_user_func('geodir_diagnose_' . $diagnose_this);
755 763
                 exit();
756 764
                 break;
@@ -1308,11 +1316,11 @@  discard block
 block discarded – undo
1308 1316
     //////////////////////////////////
1309 1317
     $option_value = get_option('geodir_home_page');
1310 1318
     $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1319
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1312 1320
 
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1314
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315
-    else {
1321
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1322
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1323
+    } else {
1316 1324
         $is_error_during_diagnose = true;
1317 1325
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1318 1326
         if ($fix) {
@@ -1333,11 +1341,11 @@  discard block
 block discarded – undo
1333 1341
     //////////////////////////////////
1334 1342
     $option_value = get_option('geodir_add_listing_page');
1335 1343
     $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1344
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1337 1345
 
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1339
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340
-    else {
1346
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1347
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1348
+    } else {
1341 1349
         $is_error_during_diagnose = true;
1342 1350
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1343 1351
         if ($fix) {
@@ -1359,11 +1367,11 @@  discard block
 block discarded – undo
1359 1367
     //////////////////////////////////
1360 1368
     $option_value = get_option('geodir_preview_page');
1361 1369
     $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1370
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1363 1371
 
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1365
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366
-    else {
1372
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1373
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1374
+    } else {
1367 1375
         $is_error_during_diagnose = true;
1368 1376
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1369 1377
         if ($fix) {
@@ -1384,11 +1392,11 @@  discard block
 block discarded – undo
1384 1392
     //////////////////////////////////
1385 1393
     $option_value = get_option('geodir_success_page');
1386 1394
     $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1395
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1388 1396
 
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1390
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391
-    else {
1397
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1398
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1399
+    } else {
1392 1400
         $is_error_during_diagnose = true;
1393 1401
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1394 1402
         if ($fix) {
@@ -1409,11 +1417,11 @@  discard block
 block discarded – undo
1409 1417
     //////////////////////////////////
1410 1418
     $option_value = get_option('geodir_info_page');
1411 1419
     $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1420
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1413 1421
 
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1415
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416
-    else {
1422
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1423
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1424
+    } else {
1417 1425
         $is_error_during_diagnose = true;
1418 1426
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1419 1427
         if ($fix) {
@@ -1434,11 +1442,11 @@  discard block
 block discarded – undo
1434 1442
     //////////////////////////////////
1435 1443
     $option_value = get_option('geodir_login_page');
1436 1444
     $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1445
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1438 1446
 
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1440
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441
-    else {
1447
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1448
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1449
+    } else {
1442 1450
         $is_error_during_diagnose = true;
1443 1451
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1444 1452
         if ($fix) {
@@ -1459,11 +1467,11 @@  discard block
 block discarded – undo
1459 1467
     //////////////////////////////////
1460 1468
     $option_value = get_option('geodir_location_page');
1461 1469
     $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1470
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1463 1471
 
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1465
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466
-    else {
1472
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1473
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1474
+    } else {
1467 1475
         $is_error_during_diagnose = true;
1468 1476
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1469 1477
         if ($fix) {
@@ -1907,8 +1915,9 @@  discard block
 block discarded – undo
1907 1915
                             );
1908 1916
 
1909 1917
                             $post_location_info = $request_info['post_location'];
1910
-                            if ($location_id = geodir_add_new_location($post_location_info))
1911
-                                $post_location_id = $location_id;
1918
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
1919
+                                                            $post_location_id = $location_id;
1920
+                            }
1912 1921
                         } else {
1913 1922
                             $post_location_id = 0;
1914 1923
                         }
@@ -1971,8 +1980,9 @@  discard block
 block discarded – undo
1971 1980
                             $attachment_set = '';
1972 1981
 
1973 1982
                             foreach ($attachment as $key => $val) {
1974
-                                if ($val != '')
1975
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1983
+                                if ($val != '') {
1984
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1985
+                                }
1976 1986
                             }
1977 1987
                             $attachment_set = trim($attachment_set, ", ");
1978 1988
 
@@ -2068,8 +2078,7 @@  discard block
 block discarded – undo
2068 2078
 
2069 2079
         $parts = json_decode($response['body']);
2070 2080
         //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2081
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2073 2082
 
2074 2083
             update_option('gd_ga_access_token', $parts->access_token);
2075 2084
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2077,17 +2086,16 @@  discard block
 block discarded – undo
2077 2086
         }
2078 2087
 
2079 2088
 
2080
-    }
2081
-    elseif(!empty($response['response']['code'])) {
2089
+    } elseif(!empty($response['response']['code'])) {
2082 2090
         $parts = json_decode($response['body']);
2083 2091
 
2084 2092
         if(isset($parts->error)){
2085 2093
             echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2094
+        } else{
2087 2095
             echo $error_msg." - #2";exit;
2088 2096
         }
2089 2097
 
2090
-    }else{
2098
+    } else{
2091 2099
 
2092 2100
         echo $error_msg." - #3";exit;
2093 2101
 
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/Tax-meta-class.php 3 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -2054,6 +2054,11 @@  discard block
 block discarded – undo
2054 2054
         }
2055 2055
 
2056 2056
         //update meta
2057
+
2058
+        /**
2059
+         * @param string $term_id
2060
+         * @param string $key
2061
+         */
2057 2062
         public function update_tax_meta($term_id, $key, $value, $post_type = '')
2058 2063
         {
2059 2064
 
@@ -2095,6 +2100,12 @@  discard block
 block discarded – undo
2095 2100
 
2096 2101
 //get term meta field
2097 2102
 if (!function_exists('get_tax_meta')) {
2103
+
2104
+    /**
2105
+     * @param string $key
2106
+     *
2107
+     * @return string
2108
+     */
2098 2109
     function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2099 2110
     {
2100 2111
 
@@ -2139,6 +2150,10 @@  discard block
 block discarded – undo
2139 2150
 
2140 2151
 //update meta
2141 2152
 if (!function_exists('update_tax_meta')) {
2153
+
2154
+    /**
2155
+     * @param string $key
2156
+     */
2142 2157
     function update_tax_meta($term_id, $key, $value, $post_type = '')
2143 2158
     {
2144 2159
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
         {
804 804
 
805 805
             if (!is_array($meta))
806
-                $meta = (array)$meta;
806
+                $meta = (array) $meta;
807 807
 
808 808
             $this->show_field_begin($field, $meta);
809 809
             echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
         {
828 828
 
829 829
             if (!is_array($meta))
830
-                $meta = (array)$meta;
830
+                $meta = (array) $meta;
831 831
 
832 832
             $this->show_field_begin($field, $meta);
833 833
             foreach ($field['options'] as $key => $value) {
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
             global $post;
891 891
 
892 892
             if (!is_array($meta))
893
-                $meta = (array)$meta;
893
+                $meta = (array) $meta;
894 894
 
895 895
             $this->show_field_begin($field, $meta);
896 896
             echo "{$field['desc']}<br />";
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
         {
1014 1014
 
1015 1015
             if (!is_array($meta))
1016
-                $meta = (array)$meta;
1016
+                $meta = (array) $meta;
1017 1017
 
1018 1018
             $this->show_field_begin($field, $meta);
1019 1019
 
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         {
1074 1074
             global $post;
1075 1075
 
1076
-            if (!is_array($meta)) $meta = (array)$meta;
1076
+            if (!is_array($meta)) $meta = (array) $meta;
1077 1077
             $this->show_field_begin($field, $meta);
1078 1078
             $options = $field['options'];
1079 1079
             $posts = get_posts($options['args']);
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
         {
1112 1112
             global $post;
1113 1113
 
1114
-            if (!is_array($meta)) $meta = (array)$meta;
1114
+            if (!is_array($meta)) $meta = (array) $meta;
1115 1115
             $this->show_field_begin($field, $meta);
1116 1116
             $options = $field['options'];
1117 1117
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
                 if (!is_wp_error($id)) {
1371 1371
 
1372 1372
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1373
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
+                    add_post_meta($term_id, $name, $id, false); // save file's url in meta fields
1374 1374
 
1375 1375
                 } // End if
1376 1376
 
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
                 if (!is_wp_error($id)) {
1416 1416
 
1417 1417
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1418
-                    return $id;    // return file's url in meta fields
1418
+                    return $id; // return file's url in meta fields
1419 1419
                 } // End if
1420 1420
             } // End foreach
1421 1421
         }
@@ -1430,9 +1430,9 @@  discard block
 block discarded – undo
1430 1430
         {
1431 1431
 
1432 1432
             // Default values for meta box
1433
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
+            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array) $this->_meta_box);
1434 1434
 
1435
-            if(is_array($this->_fields)) {
1435
+            if (is_array($this->_fields)) {
1436 1436
                 // Default values for fields
1437 1437
                 foreach ($this->_fields as &$field) {
1438 1438
                     $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
          */
1453 1453
         public function has_field($type)
1454 1454
         {
1455
-            if(is_array($this->_fields)) {
1455
+            if (is_array($this->_fields)) {
1456 1456
                 foreach ($this->_fields as $field) {
1457 1457
                     if ($type == $field['type'])
1458 1458
                         return true;
@@ -2020,12 +2020,12 @@  discard block
 block discarded – undo
2020 2020
                 $post_type = $taxObject->object_type[0];
2021 2021
             }
2022 2022
 
2023
-            if($post_type=='post'){$post_type='';}
2024
-            if($post_type){$post_type = $post_type.'_';}
2023
+            if ($post_type == 'post') {$post_type = ''; }
2024
+            if ($post_type) {$post_type = $post_type . '_'; }
2025 2025
 
2026 2026
             $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2027 2027
 
2028
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2028
+            $m = get_option('tax_meta_' . $post_type . $t_id);
2029 2029
             if (isset($m[$key])) {
2030 2030
                 return $m[$key];
2031 2031
             } else {
@@ -2042,15 +2042,15 @@  discard block
 block discarded – undo
2042 2042
                 $post_type = $taxObject->object_type[0];
2043 2043
             }
2044 2044
 
2045
-            if($post_type=='post'){$post_type='';}
2046
-            if($post_type){$post_type = $post_type.'_';}
2045
+            if ($post_type == 'post') {$post_type = ''; }
2046
+            if ($post_type) {$post_type = $post_type . '_'; }
2047 2047
 
2048
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2048
+            $m = get_option('tax_meta_' . $post_type . $term_id);
2049 2049
 
2050 2050
             if (isset($m[$key])) {
2051 2051
                 unset($m[$key]);
2052 2052
             }
2053
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
+            update_option('tax_meta_' . $post_type . $term_id, $m);
2054 2054
         }
2055 2055
 
2056 2056
         //update meta
@@ -2062,13 +2062,13 @@  discard block
 block discarded – undo
2062 2062
                 $post_type = $taxObject->object_type[0];
2063 2063
             }
2064 2064
 
2065
-            if($post_type=='post'){$post_type='';}
2066
-            if($post_type){$post_type = $post_type.'_';}
2065
+            if ($post_type == 'post') {$post_type = ''; }
2066
+            if ($post_type) {$post_type = $post_type . '_'; }
2067 2067
 
2068
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2068
+            $m = get_option('tax_meta_' . $post_type . $term_id);
2069 2069
 
2070 2070
             $m[$key] = $value;
2071
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
+            update_option('tax_meta_' . $post_type . $term_id, $m);
2072 2072
 
2073 2073
             /**
2074 2074
              * Called after the tax meta is updated.
@@ -2103,12 +2103,12 @@  discard block
 block discarded – undo
2103 2103
             $post_type = $taxObject->object_type[0];
2104 2104
         }
2105 2105
 
2106
-        if($post_type=='post'){$post_type='';}
2107
-        if($post_type){$post_type = $post_type.'_';}
2106
+        if ($post_type == 'post') {$post_type = ''; }
2107
+        if ($post_type) {$post_type = $post_type . '_'; }
2108 2108
 
2109 2109
         $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2110 2110
 
2111
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2111
+        $m = get_option('tax_meta_' . $post_type . $t_id);
2112 2112
         if (isset($m[$key])) {
2113 2113
             return $m[$key];
2114 2114
         } else {
@@ -2125,15 +2125,15 @@  discard block
 block discarded – undo
2125 2125
         $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2126 2126
         $post_type = $taxObject->object_type[0];
2127 2127
 
2128
-        if($post_type=='post'){$post_type='';}
2129
-        if($post_type){$post_type = $post_type.'_';}
2128
+        if ($post_type == 'post') {$post_type = ''; }
2129
+        if ($post_type) {$post_type = $post_type . '_'; }
2130 2130
 
2131 2131
         $m = get_option('tax_meta_' . $post_type . $term_id);
2132 2132
 
2133 2133
         if (isset($m[$key])) {
2134 2134
             unset($m[$key]);
2135 2135
         }
2136
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2136
+        update_option('tax_meta_' . $post_type . $term_id, $m);
2137 2137
     }
2138 2138
 }
2139 2139
 
@@ -2147,10 +2147,10 @@  discard block
 block discarded – undo
2147 2147
             $post_type = $taxObject->object_type[0];
2148 2148
         }
2149 2149
 
2150
-        if($post_type=='post'){$post_type='';}
2151
-        if($post_type){$post_type = $post_type.'_';}
2150
+        if ($post_type == 'post') {$post_type = ''; }
2151
+        if ($post_type) {$post_type = $post_type . '_'; }
2152 2152
 
2153
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2153
+        $m = get_option('tax_meta_' . $post_type . $term_id);
2154 2154
 
2155 2155
         $m[$key] = $value;
2156 2156
         update_option('tax_meta_' . $post_type . $term_id, $m);
Please login to merge, or discard this patch.
Braces   +106 added lines, -69 removed lines patch added patch discarded remove patch
@@ -102,8 +102,9 @@  discard block
 block discarded – undo
102 102
         {
103 103
 
104 104
             // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
105
+            if (!is_admin()) {
106
+                            return;
107
+            }
107 108
 
108 109
             // Assign meta box values to local variables and add it's missed values.
109 110
             $this->_meta_box = $meta_box;
@@ -111,15 +112,15 @@  discard block
 block discarded – undo
111 112
             $this->_fields = &$this->_meta_box['fields'];
112 113
             $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113 114
             $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
115
+            if (isset($meta_box['use_with_theme'])) {
116
+                            if ($meta_box['use_with_theme'] === true) {
116 117
                     $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
118
+            }
117 119
                 } elseif ($meta_box['use_with_theme'] === false) {
118 120
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 121
                 } else {
120 122
                     $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
+                } else {
123 124
                 $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124 125
             }
125 126
 
@@ -190,8 +191,9 @@  discard block
 block discarded – undo
190 191
         {
191 192
 
192 193
             // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
194
+            if (!$this->has_field('image') && !$this->has_field('file')) {
195
+                            return;
196
+            }
195 197
 
196 198
 
197 199
             add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
@@ -235,8 +237,9 @@  discard block
 block discarded – undo
235 237
         {
236 238
 
237 239
             // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
+            if (!isset($_POST['at-insert']) || empty($_POST['attachments'])) {
241
+                            return;
242
+            }
240 243
 
241 244
             // Security Check
242 245
             check_admin_referer('media-form');
@@ -256,8 +259,9 @@  discard block
 block discarded – undo
256 259
                 $attachment = stripslashes_deep($attachment);
257 260
 
258 261
                 // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
262
+                if (empty($attachment['selected']) || empty($attachment['url'])) {
263
+                                    continue;
264
+                }
261 265
 
262 266
                 $li = "<li id='item_{$attachment_id}'>";
263 267
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
@@ -308,13 +312,15 @@  discard block
 block discarded – undo
308 312
 
309 313
 
310 314
             // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
315
+            if (!isset($_POST['data'])) {
316
+                            die();
317
+            }
313 318
 
314 319
             list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315 320
 
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
321
+            if (!wp_verify_nonce($nonce, 'at_ajax_delete')) {
322
+                            die('1');
323
+            }
318 324
 
319 325
             $this->delete_tax_meta($term_id, $key, $attach_id);
320 326
 
@@ -336,8 +342,9 @@  discard block
 block discarded – undo
336 342
             $ok = false;
337 343
             if (strpos($field_id, '[') === false) {
338 344
                 check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
345
+                if ($term_id > 0) {
346
+                                    $this->delete_tax_meta($term_id, $field_id);
347
+                }
341 348
                 //$ok = wp_delete_attachment( $attachment_id );
342 349
                 $ok = 1;
343 350
             } else {
@@ -349,8 +356,9 @@  discard block
 block discarded – undo
349 356
                 $saved = $this->get_tax_meta($term_id, $f[0], true);
350 357
                 if (isset($saved[$f[1]][$f[2]])) {
351 358
                     unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
359
+                    if ($term_id > 0) {
360
+                                            update_post_meta($term_id, $f[0], $saved);
361
+                    }
354 362
                     //$ok = wp_delete_attachment( $attachment_id );
355 363
                     $ok = 1;
356 364
                 }
@@ -375,13 +383,15 @@  discard block
 block discarded – undo
375 383
         public function reorder_images()
376 384
         {
377 385
 
378
-            if (!isset($_POST['data']))
379
-                die();
386
+            if (!isset($_POST['data'])) {
387
+                            die();
388
+            }
380 389
 
381 390
             list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382 391
 
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
392
+            if (!wp_verify_nonce($nonce, 'at_ajax_reorder')) {
393
+                            die('1');
394
+            }
385 395
 
386 396
             parse_str($order, $items);
387 397
             $items = $items['item'];
@@ -513,8 +523,9 @@  discard block
 block discarded – undo
513 523
             foreach ($this->_fields as $field) {
514 524
                 $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515 525
                 $meta = ($meta !== '') ? $meta : $field['std'];
516
-                if ('image' != $field['type'] && $field['type'] != 'repeater')
517
-                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
526
+                if ('image' != $field['type'] && $field['type'] != 'repeater') {
527
+                                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
528
+                }
518 529
 
519 530
                 if ($field['validate_func']) {
520 531
                     echo '<tr class="form-field form-required ' . $field['style'] . '">';
@@ -560,8 +571,9 @@  discard block
 block discarded – undo
560 571
                         $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561 572
                         $m = $me[$f['id']];
562 573
                         $m = ($m !== '') ? $m : $f['std'];
563
-                        if ('image' != $f['type'] && $f['type'] != 'repeater')
564
-                            $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
574
+                        if ('image' != $f['type'] && $f['type'] != 'repeater') {
575
+                                                    $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
576
+                        }
565 577
                         //set new id for field in array format
566 578
                         $f['id'] = $id;
567 579
                         if (!$field['inline']) {
@@ -802,8 +814,9 @@  discard block
 block discarded – undo
802 814
         public function show_field_select($field, $meta)
803 815
         {
804 816
 
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
817
+            if (!is_array($meta)) {
818
+                            $meta = (array)$meta;
819
+            }
807 820
 
808 821
             $this->show_field_begin($field, $meta);
809 822
             echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
@@ -826,8 +839,9 @@  discard block
 block discarded – undo
826 839
         public function show_field_radio($field, $meta)
827 840
         {
828 841
 
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
842
+            if (!is_array($meta)) {
843
+                            $meta = (array)$meta;
844
+            }
831 845
 
832 846
             $this->show_field_begin($field, $meta);
833 847
             foreach ($field['options'] as $key => $value) {
@@ -889,8 +903,9 @@  discard block
 block discarded – undo
889 903
 
890 904
             global $post;
891 905
 
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
906
+            if (!is_array($meta)) {
907
+                            $meta = (array)$meta;
908
+            }
894 909
 
895 910
             $this->show_field_begin($field, $meta);
896 911
             echo "{$field['desc']}<br />";
@@ -934,8 +949,9 @@  discard block
 block discarded – undo
934 949
             $this->show_field_begin($field, $meta);
935 950
             $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936 951
             if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
952
+                if (isset($meta[0]) && is_array($meta[0])) {
953
+                                    $meta = $meta[0];
954
+                }
939 955
             }
940 956
 
941 957
             $uploads = wp_upload_dir();
@@ -947,8 +963,9 @@  discard block
 block discarded – undo
947 963
                 //print_r($uploads);
948 964
                 //print_r($file_info);
949 965
 
950
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
951
-                    $sub_dir = $file_info['dirname'];
966
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
967
+                                    $sub_dir = $file_info['dirname'];
968
+                }
952 969
 
953 970
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs	
954 971
                 $uploads_baseurl = $uploads['baseurl'];
@@ -988,8 +1005,9 @@  discard block
 block discarded – undo
988 1005
         public function show_field_color($field, $meta)
989 1006
         {
990 1007
 
991
-            if (empty($meta))
992
-                $meta = '#';
1008
+            if (empty($meta)) {
1009
+                            $meta = '#';
1010
+            }
993 1011
 
994 1012
             $this->show_field_begin($field, $meta);
995 1013
 
@@ -1012,8 +1030,9 @@  discard block
 block discarded – undo
1012 1030
         public function show_field_checkbox_list($field, $meta)
1013 1031
         {
1014 1032
 
1015
-            if (!is_array($meta))
1016
-                $meta = (array)$meta;
1033
+            if (!is_array($meta)) {
1034
+                            $meta = (array)$meta;
1035
+            }
1017 1036
 
1018 1037
             $this->show_field_begin($field, $meta);
1019 1038
 
@@ -1073,7 +1092,9 @@  discard block
 block discarded – undo
1073 1092
         {
1074 1093
             global $post;
1075 1094
 
1076
-            if (!is_array($meta)) $meta = (array)$meta;
1095
+            if (!is_array($meta)) {
1096
+                $meta = (array)$meta;
1097
+            }
1077 1098
             $this->show_field_begin($field, $meta);
1078 1099
             $options = $field['options'];
1079 1100
             $posts = get_posts($options['args']);
@@ -1111,7 +1132,9 @@  discard block
 block discarded – undo
1111 1132
         {
1112 1133
             global $post;
1113 1134
 
1114
-            if (!is_array($meta)) $meta = (array)$meta;
1135
+            if (!is_array($meta)) {
1136
+                $meta = (array)$meta;
1137
+            }
1115 1138
             $this->show_field_begin($field, $meta);
1116 1139
             $options = $field['options'];
1117 1140
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1145,17 +1168,20 @@  discard block
 block discarded – undo
1145 1168
         {
1146 1169
 
1147 1170
             $taxnow = '';
1148
-            if (isset($_POST['taxonomy']))
1149
-                $taxnow = $_POST['taxonomy'];
1171
+            if (isset($_POST['taxonomy'])) {
1172
+                            $taxnow = $_POST['taxonomy'];
1173
+            }
1150 1174
 
1151 1175
             if (!isset($term_id)                                                        // Check Revision
1152 1176
                 || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1153 1177
                 || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1154 1178
                 || (!current_user_can('manage_categories'))
1155
-            )                                // Check permission
1179
+            ) {
1180
+                // Check permission
1156 1181
             {
1157 1182
                 return $term_id;
1158 1183
             }
1184
+            }
1159 1185
 
1160 1186
 
1161 1187
             foreach ($this->_fields as $field) {
@@ -1249,8 +1275,9 @@  discard block
 block discarded – undo
1249 1275
         {
1250 1276
             $name = $field['id'];
1251 1277
             $this->delete_tax_meta($term_id, $name);
1252
-            if ($new === '' || $new === array())
1253
-                return;
1278
+            if ($new === '' || $new === array()) {
1279
+                            return;
1280
+            }
1254 1281
 
1255 1282
             $this->update_tax_meta($term_id, $name, $new);
1256 1283
         }
@@ -1270,8 +1297,9 @@  discard block
 block discarded – undo
1270 1297
             $name = $field['id'];
1271 1298
 
1272 1299
             $this->delete_tax_meta($term_id, $name);
1273
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1274
-                return;
1300
+            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '') {
1301
+                            return;
1302
+            }
1275 1303
 
1276 1304
             $this->update_tax_meta($term_id, $name, $new);
1277 1305
         }
@@ -1318,8 +1346,9 @@  discard block
 block discarded – undo
1318 1346
                                 break;
1319 1347
                         }
1320 1348
                     }
1321
-                    if (!$this->is_array_empty($n))
1322
-                        $temp[] = $n;
1349
+                    if (!$this->is_array_empty($n)) {
1350
+                                            $temp[] = $n;
1351
+                    }
1323 1352
                 }
1324 1353
                 if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1325 1354
                     $this->update_tax_meta($term_id, $field['id'], $temp);
@@ -1347,14 +1376,16 @@  discard block
 block discarded – undo
1347 1376
         {
1348 1377
 
1349 1378
             $name = $field['id'];
1350
-            if (empty($_FILES[$name]))
1351
-                return;
1379
+            if (empty($_FILES[$name])) {
1380
+                            return;
1381
+            }
1352 1382
             $this->fix_file_array($_FILES[$name]);
1353 1383
             foreach ($_FILES[$name] as $position => $fileitem) {
1354 1384
 
1355 1385
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1356
-                if (empty($file['file']))
1357
-                    continue;
1386
+                if (empty($file['file'])) {
1387
+                                    continue;
1388
+                }
1358 1389
                 $filename = $file['file'];
1359 1390
 
1360 1391
                 $attachment = array(
@@ -1392,14 +1423,16 @@  discard block
 block discarded – undo
1392 1423
         {
1393 1424
 
1394 1425
             $name = $field['id'];
1395
-            if (empty($_FILES[$name]))
1396
-                return;
1426
+            if (empty($_FILES[$name])) {
1427
+                            return;
1428
+            }
1397 1429
             $this->fix_file_array($_FILES[$name]);
1398 1430
             foreach ($_FILES[$name] as $position => $fileitem) {
1399 1431
 
1400 1432
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1401
-                if (empty($file['file']))
1402
-                    continue;
1433
+                if (empty($file['file'])) {
1434
+                                    continue;
1435
+                }
1403 1436
                 $filename = $file['file'];
1404 1437
 
1405 1438
                 $attachment = array(
@@ -1454,8 +1487,9 @@  discard block
 block discarded – undo
1454 1487
         {
1455 1488
             if(is_array($this->_fields)) {
1456 1489
                 foreach ($this->_fields as $field) {
1457
-                    if ($type == $field['type'])
1458
-                        return true;
1490
+                    if ($type == $field['type']) {
1491
+                                            return true;
1492
+                    }
1459 1493
                 }
1460 1494
             }
1461 1495
             return false;
@@ -1993,18 +2027,21 @@  discard block
 block discarded – undo
1993 2027
          */
1994 2028
         public function is_array_empty($array)
1995 2029
         {
1996
-            if (!is_array($array))
1997
-                return true;
2030
+            if (!is_array($array)) {
2031
+                            return true;
2032
+            }
1998 2033
 
1999 2034
             foreach ($array as $a) {
2000 2035
                 if (is_array($a)) {
2001 2036
                     foreach ($a as $sub_a) {
2002
-                        if (!empty($sub_a) && $sub_a != '')
2003
-                            return false;
2037
+                        if (!empty($sub_a) && $sub_a != '') {
2038
+                                                    return false;
2039
+                        }
2004 2040
                     }
2005 2041
                 } else {
2006
-                    if (!empty($a) && $a != '')
2007
-                        return false;
2042
+                    if (!empty($a) && $a != '') {
2043
+                                            return false;
2044
+                    }
2008 2045
                 }
2009 2046
             }
2010 2047
             return true;
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/X.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
  * @since 1.0.0
114 114
  * @package GeoDirectory
115 115
  * @param array $classes Class array.
116
- * @return array Modified class array.
116
+ * @return string[] Modified class array.
117 117
  */
118 118
 function geodir_x_body_class($classes)
119 119
 {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             // 8. Get shop title.
308 308
             //
309 309
 
310
-            GLOBAL $post,$wp;
310
+            GLOBAL $post, $wp;
311 311
 
312 312
             if (geodir_is_page('detail') || geodir_is_page('listing') || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id())) {
313 313
                 geodir_breadcrumb();
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 
316 316
                 $stack = x_get_stack();
317 317
                 $delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> '; // 1
318
-                $home_text = '<span class="home"><i class="x-icon-home"></i></span>';               // 2
319
-                $home_link = home_url();                                                            // 3
320
-                $current_before = '<span class="current">';                                              // 4
321
-                $current_after = '</span>';                                                             // 5
322
-                $page_title = get_the_title();                                                       // 6
323
-                $blog_title = get_the_title(get_option('page_for_posts', true));                 // 7
324
-                $shop_title = get_theme_mod('x_' . $stack . '_shop_title');                        // 8
318
+                $home_text = '<span class="home"><i class="x-icon-home"></i></span>'; // 2
319
+                $home_link = home_url(); // 3
320
+                $current_before = '<span class="current">'; // 4
321
+                $current_after = '</span>'; // 5
322
+                $page_title = get_the_title(); // 6
323
+                $blog_title = get_the_title(get_option('page_for_posts', true)); // 7
324
+                $shop_title = get_theme_mod('x_' . $stack . '_shop_title'); // 8
325 325
 
326 326
                 if (function_exists('woocommerce_get_page_id')) {
327 327
                     $shop_url = x_get_shop_link();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -336,7 +336,9 @@  discard block
 block discarded – undo
336 336
                     echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
337 337
                     if (is_category()) {
338 338
                         $the_cat = get_category(get_query_var('cat'), false);
339
-                        if ($the_cat->parent != 0) echo get_category_parents($the_cat->parent, TRUE, $delimiter);
339
+                        if ($the_cat->parent != 0) {
340
+                            echo get_category_parents($the_cat->parent, TRUE, $delimiter);
341
+                        }
340 342
                         echo $current_before . single_cat_title('', false) . $current_after;
341 343
                     } elseif (x_is_product_category()) {
342 344
                         echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
@@ -371,7 +373,9 @@  discard block
 block discarded – undo
371 373
                         $breadcrumbs = array_reverse($breadcrumbs);
372 374
                         for ($i = 0; $i < count($breadcrumbs); $i++) {
373 375
                             echo $breadcrumbs[$i];
374
-                            if ($i != count($breadcrumbs) - 1) echo $delimiter;
376
+                            if ($i != count($breadcrumbs) - 1) {
377
+                                echo $delimiter;
378
+                            }
375 379
                         }
376 380
                         echo $delimiter . $current_before . $page_title . $current_after;
377 381
                     } elseif (is_tag()) {
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3448,7 +3448,7 @@  discard block
 block discarded – undo
3448 3448
  * @global object $wpdb WordPress Database object.
3449 3449
  * @global string $plugin_prefix Geodirectory plugin table prefix.
3450 3450
  * @param int $post_id The post ID.
3451
- * @return mixed Returns video.
3451
+ * @return string Returns video.
3452 3452
  */
3453 3453
 function geodir_get_video($post_id)
3454 3454
 {
@@ -3474,7 +3474,7 @@  discard block
 block discarded – undo
3474 3474
  * @global object $wpdb WordPress Database object.
3475 3475
  * @global string $plugin_prefix Geodirectory plugin table prefix.
3476 3476
  * @param int $post_id The post ID.
3477
- * @return mixed Returns special offers.
3477
+ * @return string Returns special offers.
3478 3478
  */
3479 3479
 function geodir_get_special_offers($post_id)
3480 3480
 {
@@ -3498,7 +3498,7 @@  discard block
 block discarded – undo
3498 3498
 	 *
3499 3499
 	 * @since 1.0.0
3500 3500
 	 * @package GeoDirectory
3501
-	 * @return mixed|void Returns max upload file size.
3501
+	 * @return string|null Returns max upload file size.
3502 3502
 	 */
3503 3503
 	function geodir_max_upload_size()
3504 3504
     {
Please login to merge, or discard this patch.
Indentation   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Custom fields functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @global object $wpdb WordPress Database object.
8
- * @global string $table_prefix WordPress Database Table prefix.
9
- */
3
+                     * Custom fields functions
4
+                     *
5
+                     * @since 1.0.0
6
+                     * @package GeoDirectory
7
+                     * @global object $wpdb WordPress Database object.
8
+                     * @global string $table_prefix WordPress Database Table prefix.
9
+                     */
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-	/**
14
-	 * Check table column exist or not.
15
-	 *
16
-	 * @since 1.0.0
17
-	 * @package GeoDirectory
13
+    /**
14
+     * Check table column exist or not.
15
+     *
16
+     * @since 1.0.0
17
+     * @package GeoDirectory
18 18
      * @global object $wpdb WordPress Database object.
19
-	 * @param string $db The table name.
20
-	 * @param string $column The column name.
21
-	 * @return bool If column exists returns true. Otherwise false.
22
-	 */
23
-	function geodir_column_exist($db, $column)
19
+     * @param string $db The table name.
20
+     * @param string $column The column name.
21
+     * @return bool If column exists returns true. Otherwise false.
22
+     */
23
+    function geodir_column_exist($db, $column)
24 24
     {
25 25
         global $wpdb;
26 26
         $exists = false;
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-	/**
40
-	 * Add column if table column not exist.
41
-	 *
42
-	 * @since 1.0.0
43
-	 * @package GeoDirectory
39
+    /**
40
+     * Add column if table column not exist.
41
+     *
42
+     * @since 1.0.0
43
+     * @package GeoDirectory
44 44
      * @global object $wpdb WordPress Database object.
45
-	 * @param string $db The table name.
46
-	 * @param string $column The column name.
47
-	 * @param string $column_attr The column attributes.
48
-	 */
49
-	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
45
+     * @param string $db The table name.
46
+     * @param string $column The column name.
47
+     * @param string $column_attr The column attributes.
48
+     */
49
+    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 }
153 153
 
154 154
 if (!function_exists('geodir_custom_field_adminhtml')) {
155
-	/**
156
-	 * Adds admin html for custom fields.
157
-	 *
158
-	 * @since 1.0.0
159
-	 * @package GeoDirectory
155
+    /**
156
+     * Adds admin html for custom fields.
157
+     *
158
+     * @since 1.0.0
159
+     * @package GeoDirectory
160 160
      * @global object $wpdb WordPress Database object.
161
-	 * @param string $field_type The form field type.
162
-	 * @param object|int $result_str The custom field results object or row id.
163
-	 * @param string $field_ins_upd When set to "submit" displays form.
164
-	 * @param bool $default when set to true field will be for admin use only.
165
-	 */
166
-	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
161
+     * @param string $field_type The form field type.
162
+     * @param object|int $result_str The custom field results object or row id.
163
+     * @param string $field_ins_upd When set to "submit" displays form.
164
+     * @param bool $default when set to true field will be for admin use only.
165
+     */
166
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167 167
     {
168 168
         global $wpdb;
169 169
         $cf = $result_str;
@@ -186,32 +186,32 @@  discard block
 block discarded – undo
186 186
 }
187 187
 
188 188
 if (!function_exists('geodir_custom_field_delete')) {
189
-	/**
190
-	 * Delete custom field using field id.
191
-	 *
192
-	 * @since 1.0.0
193
-	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
-	 * @package GeoDirectory
189
+    /**
190
+     * Delete custom field using field id.
191
+     *
192
+     * @since 1.0.0
193
+     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
+     * @package GeoDirectory
195 195
      * @global object $wpdb WordPress Database object.
196 196
      * @global string $plugin_prefix Geodirectory plugin table prefix.
197
-	 * @param string $field_id The custom field ID.
198
-	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
-	 */
200
-	function geodir_custom_field_delete($field_id = '') {
197
+     * @param string $field_id The custom field ID.
198
+     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
+     */
200
+    function geodir_custom_field_delete($field_id = '') {
201 201
         global $wpdb, $plugin_prefix;
202 202
         
203
-		if ($field_id != '') {
203
+        if ($field_id != '') {
204 204
             $cf = trim($field_id, '_');
205 205
 
206 206
             if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207 207
                 $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208 208
 
209 209
                 $post_type = $field->post_type;
210
-				$htmlvar_name = $field->htmlvar_name;
210
+                $htmlvar_name = $field->htmlvar_name;
211 211
 				
212
-				if ($post_type != '' && $htmlvar_name != '') {
213
-					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
-				}
212
+                if ($post_type != '' && $htmlvar_name != '') {
213
+                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
+                }
215 215
 
216 216
                 /**
217 217
                  * Called after a custom field is deleted.
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 }
249 249
 
250 250
 if (!function_exists('geodir_custom_field_save')) {
251
-	/**
252
-	 * Save or Update custom fields into the database.
253
-	 *
254
-	 * @since 1.0.0
251
+    /**
252
+     * Save or Update custom fields into the database.
253
+     *
254
+     * @since 1.0.0
255 255
      * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
-	 * @package GeoDirectory
256
+     * @package GeoDirectory
257 257
      * @global object $wpdb WordPress Database object.
258 258
      * @global string $plugin_prefix Geodirectory plugin table prefix.
259
-	 * @param array $request_field {
259
+     * @param array $request_field {
260 260
      *    Attributes of the request field array.
261 261
      *
262 262
      *    @type string $action Ajax Action name. Default "geodir_ajax_action".
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
      *    @type string $css_class Enter custom css class for field custom style.
290 290
      *
291 291
      * }
292
-	 * @param bool $default Not yet implemented.
293
-	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-	 */
295
-	function geodir_custom_field_save($request_field = array(), $default = false)
292
+     * @param bool $default Not yet implemented.
293
+     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+     */
295
+    function geodir_custom_field_save($request_field = array(), $default = false)
296 296
     {
297 297
 
298 298
         global $wpdb, $plugin_prefix;
@@ -976,27 +976,27 @@  discard block
 block discarded – undo
976 976
                         if (isset($option_values) && $option_values && $field_type == 'select') {
977 977
                             $option_values_arr = explode(',', $option_values);
978 978
                             
979
-							if (is_array($option_values_arr)) {
979
+                            if (is_array($option_values_arr)) {
980 980
                                 $op_max = 0;
981 981
                                 
982
-								foreach ($option_values_arr as $op_val) {
982
+                                foreach ($option_values_arr as $op_val) {
983 983
                                     if (strlen($op_val) && strlen($op_val) > $op_max) {
984
-										$op_max = strlen($op_val);
985
-									}
984
+                                        $op_max = strlen($op_val);
985
+                                    }
986 986
                                 }
987 987
                                 
988
-								if ($op_max) {
989
-									$op_size = $op_max;
990
-								}
988
+                                if ($op_max) {
989
+                                    $op_size = $op_max;
990
+                                }
991 991
                             }
992 992
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
993 993
                             if (strlen($option_values)) {
994 994
                                 $op_size =  strlen($option_values);
995 995
                             }
996 996
 							
997
-							if (isset($request_field['multi_display_type'])) {
998
-								$extra_fields = $request_field['multi_display_type'];
999
-							}
997
+                            if (isset($request_field['multi_display_type'])) {
998
+                                $extra_fields = $request_field['multi_display_type'];
999
+                            }
1000 1000
                         }
1001 1001
 
1002 1002
                         $meta_field_add = $data_type . "( $op_size ) NULL ";
@@ -1214,10 +1214,10 @@  discard block
 block discarded – undo
1214 1214
     $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1215 1215
 
1216 1216
     $fieldset_id = '';
1217
-	$fieldset_field_class = 'gd-fieldset-details';
1218
-	foreach ($custom_fields as $key => $val) {
1217
+    $fieldset_field_class = 'gd-fieldset-details';
1218
+    foreach ($custom_fields as $key => $val) {
1219 1219
         $val = stripslashes_deep($val); // strip slashes from labels
1220
-		$name = $val['name'];
1220
+        $name = $val['name'];
1221 1221
         $site_title = $val['site_title'];
1222 1222
         $type = $val['type'];
1223 1223
         $admin_desc = $val['desc'];
@@ -1582,15 +1582,15 @@  discard block
 block discarded – undo
1582 1582
 				<?php if ($option_values) {
1583 1583
                     $option_values = geodir_string_values_to_options($option_values, true);
1584 1584
 					
1585
-					if (!empty($option_values)) {
1586
-						foreach ($option_values as $option_value) {
1587
-							if (empty($option_value['optgroup'])) {
1588
-							?>
1585
+                    if (!empty($option_values)) {
1586
+                        foreach ($option_values as $option_value) {
1587
+                            if (empty($option_value['optgroup'])) {
1588
+                            ?>
1589 1589
 							<input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?>
1590 1590
 							<?php
1591
-							}
1592
-						}
1593
-					}
1591
+                            }
1592
+                        }
1593
+                    }
1594 1594
                 }
1595 1595
                 ?>
1596 1596
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -2033,8 +2033,8 @@  discard block
 block discarded – undo
2033 2033
                     $file_totImg = count($curImages);
2034 2034
             }
2035 2035
 			
2036
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2037
-			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2036
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2037
+            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2038 2038
 
2039 2039
             ?>
2040 2040
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -2062,10 +2062,10 @@  discard block
 block discarded – undo
2062 2062
 					<?php } ?>
2063 2063
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2064 2064
                            value="<?php if (isset($file_totImg)) {
2065
-                               echo esc_attr($file_totImg);
2066
-                           } else {
2067
-                               echo '0';
2068
-                           } ?>"/>
2065
+                                echo esc_attr($file_totImg);
2066
+                            } else {
2067
+                                echo '0';
2068
+                            } ?>"/>
2069 2069
 
2070 2070
                     <div style="float:left; width:55%;">
2071 2071
                         <div
@@ -2124,18 +2124,18 @@  discard block
 block discarded – undo
2124 2124
 
2125 2125
 
2126 2126
 if (!function_exists('geodir_get_field_infoby')) {
2127
-	/**
2128
-	 * Get custom field using key and value.
2129
-	 *
2130
-	 * @since 1.0.0
2131
-	 * @package GeoDirectory
2127
+    /**
2128
+     * Get custom field using key and value.
2129
+     *
2130
+     * @since 1.0.0
2131
+     * @package GeoDirectory
2132 2132
      * @global object $wpdb WordPress Database object.
2133
-	 * @param string $key The key you want to look for.
2134
-	 * @param string $value The value of the key you want to look for.
2135
-	 * @param string $geodir_post_type The post type.
2136
-	 * @return bool|mixed Returns field info when available. otherwise returns false.
2137
-	 */
2138
-	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2133
+     * @param string $key The key you want to look for.
2134
+     * @param string $value The value of the key you want to look for.
2135
+     * @param string $geodir_post_type The post type.
2136
+     * @return bool|mixed Returns field info when available. otherwise returns false.
2137
+     */
2138
+    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2139 2139
     {
2140 2140
 
2141 2141
         global $wpdb;
@@ -2158,21 +2158,21 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 
2160 2160
 if (!function_exists('geodir_show_listing_info')) {
2161
-	/**
2162
-	 * Show listing info depending on field location.
2163
-	 *
2164
-	 * @since 1.0.0
2165
-	 * @since 1.5.7 Custom fields option values added to db translation.
2161
+    /**
2162
+     * Show listing info depending on field location.
2163
+     *
2164
+     * @since 1.0.0
2165
+     * @since 1.5.7 Custom fields option values added to db translation.
2166 2166
      *              Changes to display url fields title.
2167
-	 * @package GeoDirectory
2167
+     * @package GeoDirectory
2168 2168
      * @global object $wpdb WordPress Database object.
2169 2169
      * @global object $post The current post object.
2170 2170
      * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2171 2171
      *
2172
-	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2173
-	 * @return string Returns listing info html.
2174
-	 */
2175
-	function geodir_show_listing_info($fields_location = '') {
2172
+     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2173
+     * @return string Returns listing info html.
2174
+     */
2175
+    function geodir_show_listing_info($fields_location = '') {
2176 2176
         global $post, $preview, $wpdb, $send_to_friend;
2177 2177
 
2178 2178
         $payment_info = array();
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
         $package_info = geodir_post_package_info($package_info, $post);
2182 2182
         $post_package_id = $package_info->pid;
2183 2183
         $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;
2184
-		$send_to_friend = false;
2184
+        $send_to_friend = false;
2185 2185
 
2186 2186
         ob_start();
2187 2187
         $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 
2196 2196
                 $i = 1;
2197 2197
             foreach ($fields_info as $type) {
2198
-				$type = stripslashes_deep($type); // strip slashes
2198
+                $type = stripslashes_deep($type); // strip slashes
2199 2199
                 $html = '';
2200 2200
                 $html_var = '';
2201 2201
                 $field_icon = '';
@@ -2400,13 +2400,13 @@  discard block
 block discarded – undo
2400 2400
                                 $field_icon = '';
2401 2401
                             }
2402 2402
 							
2403
-							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2403
+                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2404 2404
 
2405 2405
 
2406
-							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2407
-							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2406
+                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2407
+                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2408 2408
                             if(!empty($type['default_value'])){$title = $type['default_value'];}
2409
-							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2409
+                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2410 2410
 
2411 2411
 
2412 2412
                             $geodir_odd_even = '';
@@ -2624,22 +2624,22 @@  discard block
 block discarded – undo
2624 2624
                         if ($post->{$type['htmlvar_name']} != ''):
2625 2625
 
2626 2626
                             if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2627
-								$html_val = __('No', 'geodirectory');
2628
-							} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2629
-								$html_val = __('Yes', 'geodirectory');
2630
-							} else {								
2631
-								if (!empty($type['option_values'])) {
2632
-									$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2627
+                                $html_val = __('No', 'geodirectory');
2628
+                            } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2629
+                                $html_val = __('Yes', 'geodirectory');
2630
+                            } else {								
2631
+                                if (!empty($type['option_values'])) {
2632
+                                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2633 2633
 									
2634
-									if (!empty($cf_option_values)) {
2635
-										foreach ($cf_option_values as $cf_option_value) {
2636
-											if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2637
-												$html_val = $cf_option_value['label'];
2638
-											}
2639
-										}
2640
-									}
2641
-								}
2642
-							}
2634
+                                    if (!empty($cf_option_values)) {
2635
+                                        foreach ($cf_option_values as $cf_option_value) {
2636
+                                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2637
+                                                $html_val = $cf_option_value['label'];
2638
+                                            }
2639
+                                        }
2640
+                                    }
2641
+                                }
2642
+                            }
2643 2643
 
2644 2644
                             if (strpos($field_icon, 'http') !== false) {
2645 2645
                                 $field_icon_af = '';
@@ -2710,19 +2710,19 @@  discard block
 block discarded – undo
2710 2710
                         $html_var = $type['htmlvar_name'];
2711 2711
 
2712 2712
                         if ($post->{$type['htmlvar_name']}):
2713
-							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2713
+                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2714 2714
 							
2715
-							if (!empty($type['option_values'])) {
2716
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2715
+                            if (!empty($type['option_values'])) {
2716
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2717 2717
 								
2718
-								if (!empty($cf_option_values)) {
2719
-									foreach ($cf_option_values as $cf_option_value) {
2720
-										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2721
-											$field_value = $cf_option_value['label'];
2722
-										}
2723
-									}
2724
-								}
2725
-							}
2718
+                                if (!empty($cf_option_values)) {
2719
+                                    foreach ($cf_option_values as $cf_option_value) {
2720
+                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2721
+                                            $field_value = $cf_option_value['label'];
2722
+                                        }
2723
+                                    }
2724
+                                }
2725
+                            }
2726 2726
 							
2727 2727
                             if (strpos($field_icon, 'http') !== false) {
2728 2728
                                 $field_icon_af = '';
@@ -2770,19 +2770,19 @@  discard block
 block discarded – undo
2770 2770
                                 $field_icon = '';
2771 2771
                             }
2772 2772
 							
2773
-							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2773
+                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2774 2774
 
2775 2775
                             $option_values = array();
2776
-							if (!empty($type['option_values'])) {
2777
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2776
+                            if (!empty($type['option_values'])) {
2777
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2778 2778
 								
2779
-								if (!empty($cf_option_values)) {
2780
-									foreach ($cf_option_values as $cf_option_value) {
2781
-										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2782
-											$option_values[] = $cf_option_value['label'];
2783
-										}
2784
-									}
2785
-								}
2779
+                                if (!empty($cf_option_values)) {
2780
+                                    foreach ($cf_option_values as $cf_option_value) {
2781
+                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2782
+                                            $option_values[] = $cf_option_value['label'];
2783
+                                        }
2784
+                                    }
2785
+                                }
2786 2786
                             }
2787 2787
 							
2788 2788
                             $geodir_odd_even = '';
@@ -2802,11 +2802,11 @@  discard block
 block discarded – undo
2802 2802
                             if (count($option_values) > 1) {
2803 2803
                                 $html .= '<ul>';
2804 2804
                                 
2805
-								foreach ($option_values as $val) {
2805
+                                foreach ($option_values as $val) {
2806 2806
                                     $html .= '<li>' . $val . '</li>';
2807 2807
                                 }
2808 2808
                                 
2809
-								$html .= '</ul>';
2809
+                                $html .= '</ul>';
2810 2810
                             } else {
2811 2811
                                 $html .= $post->$type['htmlvar_name'];
2812 2812
                             }
@@ -2815,13 +2815,13 @@  discard block
 block discarded – undo
2815 2815
                         endif;
2816 2816
                         break;
2817 2817
                     case 'email':
2818
-						if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2819
-							continue; // Remove Send Enquiry | Send To Friend from listings page
2820
-						}
2818
+                        if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2819
+                            continue; // Remove Send Enquiry | Send To Friend from listings page
2820
+                        }
2821 2821
                        
2822
-					    if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2823
-						    $send_to_friend = true;
2824
-							$b_send_inquiry = '';
2822
+                        if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2823
+                            $send_to_friend = true;
2824
+                            $b_send_inquiry = '';
2825 2825
                             $b_sendtofriend = '';
2826 2826
 
2827 2827
                             $html = '';
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
 
2860 2860
                             if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
2861 2861
                                 $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
2862
-							}
2862
+                            }
2863 2863
 
2864 2864
                             $html .= '</span></div>';
2865 2865
 
@@ -2932,13 +2932,13 @@  discard block
 block discarded – undo
2932 2932
                             if (!empty($files)):
2933 2933
 
2934 2934
                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2935
-							   $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'] : '';
2935
+                                $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'] : '';
2936 2936
 								
2937
-								$file_paths = '';
2937
+                                $file_paths = '';
2938 2938
                                 foreach ($files as $file) {
2939 2939
                                     if (!empty($file)) {
2940 2940
 
2941
-                                       // $filetype = wp_check_filetype($file);
2941
+                                        // $filetype = wp_check_filetype($file);
2942 2942
 
2943 2943
                                         $image_name_arr = explode('/', $file);
2944 2944
                                         $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
@@ -2947,29 +2947,29 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
                                         $arr_file_type = wp_check_filetype($filename);
2949 2949
                                         if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2950
-											continue;
2951
-										}
2950
+                                            continue;
2951
+                                        }
2952 2952
 										
2953
-										$uploaded_file_type = $arr_file_type['type'];
2954
-										$uploaded_file_ext = $arr_file_type['ext'];
2953
+                                        $uploaded_file_type = $arr_file_type['type'];
2954
+                                        $uploaded_file_ext = $arr_file_type['ext'];
2955 2955
 										
2956
-										if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2957
-											continue; // Invalid file type.
2958
-										}
2956
+                                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2957
+                                            continue; // Invalid file type.
2958
+                                        }
2959 2959
 
2960 2960
                                         //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2961
-										$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2961
+                                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2962 2962
 
2963 2963
                                         // If the uploaded file is image
2964 2964
                                         if (in_array($uploaded_file_type, $image_file_types)) {
2965 2965
                                             $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2966 2966
                                             $file_paths .= '<a href="'.$file.'">';
2967
-											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968
-											$file_paths .= '</a>';
2967
+                                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968
+                                            $file_paths .= '</a>';
2969 2969
                                             //$file_paths .= '<img src="'.$file.'"  />';	
2970 2970
                                             $file_paths .= '</div>';
2971 2971
                                         } else {
2972
-											$ext_path = '_' . $html_var . '_';
2972
+                                            $ext_path = '_' . $html_var . '_';
2973 2973
                                             $filename = explode($ext_path, $filename);
2974 2974
                                             $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2975 2975
                                         }
@@ -3174,14 +3174,14 @@  discard block
 block discarded – undo
3174 3174
 }
3175 3175
 
3176 3176
 if (!function_exists('geodir_default_date_format')) {
3177
-	/**
3178
-	 * Returns default date format.
3179
-	 *
3180
-	 * @since 1.0.0
3181
-	 * @package GeoDirectory
3182
-	 * @return mixed|string|void Returns default date format.
3183
-	 */
3184
-	function geodir_default_date_format()
3177
+    /**
3178
+     * Returns default date format.
3179
+     *
3180
+     * @since 1.0.0
3181
+     * @package GeoDirectory
3182
+     * @return mixed|string|void Returns default date format.
3183
+     */
3184
+    function geodir_default_date_format()
3185 3185
     {
3186 3186
         if ($format = get_option('date_format'))
3187 3187
             return $format;
@@ -3191,30 +3191,30 @@  discard block
 block discarded – undo
3191 3191
 }
3192 3192
 
3193 3193
 if (!function_exists('geodir_get_formated_date')) {
3194
-	/**
3195
-	 * Returns formatted date.
3196
-	 *
3197
-	 * @since 1.0.0
3198
-	 * @package GeoDirectory
3199
-	 * @param string $date Date string to convert.
3200
-	 * @return bool|int|string Returns formatted date.
3201
-	 */
3202
-	function geodir_get_formated_date($date)
3194
+    /**
3195
+     * Returns formatted date.
3196
+     *
3197
+     * @since 1.0.0
3198
+     * @package GeoDirectory
3199
+     * @param string $date Date string to convert.
3200
+     * @return bool|int|string Returns formatted date.
3201
+     */
3202
+    function geodir_get_formated_date($date)
3203 3203
     {
3204 3204
         return mysql2date(get_option('date_format'), $date);
3205 3205
     }
3206 3206
 }
3207 3207
 
3208 3208
 if (!function_exists('geodir_get_formated_time')) {
3209
-	/**
3210
-	 * Returns formatted time.
3211
-	 *
3212
-	 * @since 1.0.0
3213
-	 * @package GeoDirectory
3214
-	 * @param string $time Time string to convert.
3215
-	 * @return bool|int|string Returns formatted time.
3216
-	 */
3217
-	function geodir_get_formated_time($time)
3209
+    /**
3210
+     * Returns formatted time.
3211
+     *
3212
+     * @since 1.0.0
3213
+     * @package GeoDirectory
3214
+     * @param string $time Time string to convert.
3215
+     * @return bool|int|string Returns formatted time.
3216
+     */
3217
+    function geodir_get_formated_time($time)
3218 3218
     {
3219 3219
         return mysql2date(get_option('time_format'), $time, $translate = true);
3220 3220
     }
@@ -3222,21 +3222,21 @@  discard block
 block discarded – undo
3222 3222
 
3223 3223
 
3224 3224
 if (!function_exists('geodir_save_post_file_fields')) {
3225
-	/**
3226
-	 * Save post file fields
3227
-	 *
3228
-	 * @since 1.0.0
3229
-	 * @since 1.4.7 Added `$extra_fields` parameter.
3230
-	 * @package GeoDirectory
3225
+    /**
3226
+     * Save post file fields
3227
+     *
3228
+     * @since 1.0.0
3229
+     * @since 1.4.7 Added `$extra_fields` parameter.
3230
+     * @package GeoDirectory
3231 3231
      * @global object $wpdb WordPress Database object.
3232 3232
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3233 3233
      * @global object $current_user Current user object.
3234
-	 * @param int $post_id
3235
-	 * @param string $field_id
3236
-	 * @param array $post_image
3237
-	 * @param array $extra_fields Array of extra fields.
3238
-	 */
3239
-	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3234
+     * @param int $post_id
3235
+     * @param string $field_id
3236
+     * @param array $post_image
3237
+     * @param array $extra_fields Array of extra fields.
3238
+     */
3239
+    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3240 3240
     {
3241 3241
 
3242 3242
         global $wpdb, $plugin_prefix, $current_user;
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             $geodir_uploadurl = $uploads['url'];
3263 3263
             $sub_dir = $uploads['subdir'];
3264 3264
 			
3265
-			$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'] : '';
3265
+            $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'] : '';
3266 3266
 
3267 3267
             for ($m = 0; $m < count($post_image); $m++) {
3268 3268
 
@@ -3279,47 +3279,47 @@  discard block
 block discarded – undo
3279 3279
 
3280 3280
                     $arr_file_type = wp_check_filetype($filename);
3281 3281
 					
3282
-					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3283
-						continue;
3284
-					}
3282
+                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3283
+                        continue;
3284
+                    }
3285 3285
 					
3286
-					$uploaded_file_type = $arr_file_type['type'];
3287
-					$uploaded_file_ext = $arr_file_type['ext'];
3286
+                    $uploaded_file_type = $arr_file_type['type'];
3287
+                    $uploaded_file_ext = $arr_file_type['ext'];
3288 3288
 					
3289
-					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3290
-						continue; // Invalid file type.
3291
-					}
3289
+                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3290
+                        continue; // Invalid file type.
3291
+                    }
3292 3292
 
3293 3293
                     // Set an array containing a list of acceptable formats
3294 3294
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3295 3295
 
3296
-					if (!function_exists('wp_handle_upload'))
3297
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3296
+                    if (!function_exists('wp_handle_upload'))
3297
+                        require_once(ABSPATH . 'wp-admin/includes/file.php');
3298 3298
 
3299
-					if (!is_dir($geodir_uploadpath))
3300
-						mkdir($geodir_uploadpath);
3299
+                    if (!is_dir($geodir_uploadpath))
3300
+                        mkdir($geodir_uploadpath);
3301 3301
 
3302
-					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303
-					$explode_sub_dir = explode("/", $sub_dir);
3304
-					if ($curr_img_dir == end($explode_sub_dir)) {
3305
-						$img_path = $geodir_uploadpath . '/' . $filename;
3306
-						$img_url = $geodir_uploadurl . '/' . $filename;
3307
-					} else {
3308
-						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3309
-						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
-					}
3302
+                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303
+                    $explode_sub_dir = explode("/", $sub_dir);
3304
+                    if ($curr_img_dir == end($explode_sub_dir)) {
3305
+                        $img_path = $geodir_uploadpath . '/' . $filename;
3306
+                        $img_url = $geodir_uploadurl . '/' . $filename;
3307
+                    } else {
3308
+                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3309
+                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
+                    }
3311 3311
 
3312
-					$uploaded_file = '';
3313
-					if (file_exists($img_path))
3314
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3312
+                    $uploaded_file = '';
3313
+                    if (file_exists($img_path))
3314
+                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3315 3315
 
3316
-					if ($curr_img_dir != $geodir_uploaddir) {
3317
-						if (file_exists($img_path))
3318
-							unlink($img_path);
3319
-					}
3316
+                    if ($curr_img_dir != $geodir_uploaddir) {
3317
+                        if (file_exists($img_path))
3318
+                            unlink($img_path);
3319
+                    }
3320 3320
 
3321
-					if (!empty($uploaded_file))
3322
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3321
+                    if (!empty($uploaded_file))
3322
+                        $file_urls = $geodir_uploadurl . '/' . $new_name;
3323 3323
 
3324 3324
                 } else {
3325 3325
                     $file_urls = $post_image[$m];
@@ -3374,16 +3374,16 @@  discard block
 block discarded – undo
3374 3374
 
3375 3375
 if (!function_exists('geodir_plupload_action')) {
3376 3376
 
3377
-	/**
3378
-	 * Get upload directory path details
3379
-	 *
3380
-	 * @since 1.0.0
3381
-	 * @package GeoDirectory
3377
+    /**
3378
+     * Get upload directory path details
3379
+     *
3380
+     * @since 1.0.0
3381
+     * @package GeoDirectory
3382 3382
      * @global object $current_user Current user object.
3383
-	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3384
-	 * @return mixed Returns upload directory details as an array.
3385
-	 */
3386
-	function geodir_upload_dir($upload)
3383
+     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3384
+     * @return mixed Returns upload directory details as an array.
3385
+     */
3386
+    function geodir_upload_dir($upload)
3387 3387
     {
3388 3388
         global $current_user;
3389 3389
         $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
@@ -3483,14 +3483,14 @@  discard block
 block discarded – undo
3483 3483
 }
3484 3484
 
3485 3485
 if (!function_exists('geodir_max_upload_size')) {
3486
-	/**
3487
-	 * Get max upload file size
3488
-	 *
3489
-	 * @since 1.0.0
3490
-	 * @package GeoDirectory
3491
-	 * @return mixed|void Returns max upload file size.
3492
-	 */
3493
-	function geodir_max_upload_size()
3486
+    /**
3487
+     * Get max upload file size
3488
+     *
3489
+     * @since 1.0.0
3490
+     * @package GeoDirectory
3491
+     * @return mixed|void Returns max upload file size.
3492
+     */
3493
+    function geodir_max_upload_size()
3494 3494
     {
3495 3495
         $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3496 3496
 
@@ -3663,14 +3663,14 @@  discard block
 block discarded – undo
3663 3663
 
3664 3664
 
3665 3665
 if (!function_exists('geodir_custom_sort_field_save')) {
3666
-	/**
3667
-	 * Save or Update custom sort fields into the database.
3668
-	 *
3669
-	 * @since 1.0.0
3670
-	 * @package GeoDirectory
3666
+    /**
3667
+     * Save or Update custom sort fields into the database.
3668
+     *
3669
+     * @since 1.0.0
3670
+     * @package GeoDirectory
3671 3671
      * @global object $wpdb WordPress Database object.
3672 3672
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3673
-	 * @param array $request_field {
3673
+     * @param array $request_field {
3674 3674
      *    Attributes of the Request field.
3675 3675
      *
3676 3676
      *    @type string $action Ajax action name.
@@ -3689,10 +3689,10 @@  discard block
 block discarded – undo
3689 3689
      *    @type string $sort_order Sort Order.
3690 3690
      *
3691 3691
      * }
3692
-	 * @param bool $default Not yet implemented.
3693
-	 * @return int Returns the last affected db table row id.
3694
-	 */
3695
-	function geodir_custom_sort_field_save($request_field = array(), $default = false)
3692
+     * @param bool $default Not yet implemented.
3693
+     * @return int Returns the last affected db table row id.
3694
+     */
3695
+    function geodir_custom_sort_field_save($request_field = array(), $default = false)
3696 3696
     {
3697 3697
 
3698 3698
         global $wpdb, $plugin_prefix;
@@ -3810,16 +3810,16 @@  discard block
 block discarded – undo
3810 3810
 
3811 3811
 
3812 3812
 if (!function_exists('geodir_custom_sort_field_delete')) {
3813
-	/**
3814
-	 * Delete a custom sort field using field id.
3815
-	 * @since 1.0.0
3816
-	 * @package GeoDirectory
3813
+    /**
3814
+     * Delete a custom sort field using field id.
3815
+     * @since 1.0.0
3816
+     * @package GeoDirectory
3817 3817
      * @global object $wpdb WordPress Database object.
3818 3818
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3819
-	 * @param string $field_id The field ID.
3820
-	 * @return int|string Returns field id when successful deletion, else returns 0.
3821
-	 */
3822
-	function geodir_custom_sort_field_delete($field_id = '')
3819
+     * @param string $field_id The field ID.
3820
+     * @return int|string Returns field id when successful deletion, else returns 0.
3821
+     */
3822
+    function geodir_custom_sort_field_delete($field_id = '')
3823 3823
     {
3824 3824
 
3825 3825
         global $wpdb, $plugin_prefix;
@@ -3838,18 +3838,18 @@  discard block
 block discarded – undo
3838 3838
 
3839 3839
 
3840 3840
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
3841
-	/**
3842
-	 * Custom sort field admin html.
3843
-	 *
3844
-	 * @since 1.0.0
3845
-	 * @package GeoDirectory
3841
+    /**
3842
+     * Custom sort field admin html.
3843
+     *
3844
+     * @since 1.0.0
3845
+     * @package GeoDirectory
3846 3846
      * @global object $wpdb WordPress Database object.
3847
-	 * @param string $field_type The form field type.
3848
-	 * @param object|int $result_str The custom field results object or row id.
3849
-	 * @param string $field_ins_upd When set to "submit" displays form.
3850
-	 * @param bool $default when set to true field will be for admin use only.
3851
-	 */
3852
-	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3847
+     * @param string $field_type The form field type.
3848
+     * @param object|int $result_str The custom field results object or row id.
3849
+     * @param string $field_ins_upd When set to "submit" displays form.
3850
+     * @param bool $default when set to true field will be for admin use only.
3851
+     */
3852
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3853 3853
     {
3854 3854
         global $wpdb;
3855 3855
         $cf = $result_str;
@@ -3914,10 +3914,10 @@  discard block
 block discarded – undo
3914 3914
 
3915 3915
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3916 3916
                  style="display:<?php if ($field_ins_upd == 'submit') {
3917
-                     echo 'block;';
3918
-                 } else {
3919
-                     echo 'none;';
3920
-                 } ?>">
3917
+                        echo 'block;';
3918
+                    } else {
3919
+                        echo 'none;';
3920
+                    } ?>">
3921 3921
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3922 3922
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3923 3923
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
@@ -3945,8 +3945,8 @@  discard block
 block discarded – undo
3945 3945
                                 <input type="text" name="asc_title" id="asc_title"
3946 3946
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
3947 3947
                                        value="<?php if (isset($field_info->asc_title)) {
3948
-                                           echo esc_attr($field_info->asc_title);
3949
-                                       } ?>" style="width:45%;"/>
3948
+                                            echo esc_attr($field_info->asc_title);
3949
+                                        } ?>" style="width:45%;"/>
3950 3950
 
3951 3951
                                 <input type="radio" name="is_default"
3952 3952
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
@@ -3969,8 +3969,8 @@  discard block
 block discarded – undo
3969 3969
                                 <input type="text" name="desc_title" id="desc_title"
3970 3970
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
3971 3971
                                        value="<?php if (isset($field_info->desc_title)) {
3972
-                                           echo esc_attr($field_info->desc_title);
3973
-                                       } ?>" style="width:45%;"/>
3972
+                                            echo esc_attr($field_info->desc_title);
3973
+                                        } ?>" style="width:45%;"/>
3974 3974
                                 <input type="radio" name="is_default"
3975 3975
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3976 3976
                                     echo 'checked="checked"';
@@ -4056,19 +4056,19 @@  discard block
 block discarded – undo
4056 4056
 }
4057 4057
 
4058 4058
 if (!function_exists('check_field_visibility')) {
4059
-	/**
4060
-	 * Check field visibility as per price package.
4061
-	 *
4062
-	 * @since 1.0.0
4063
-	 * @package GeoDirectory
4059
+    /**
4060
+     * Check field visibility as per price package.
4061
+     *
4062
+     * @since 1.0.0
4063
+     * @package GeoDirectory
4064 4064
      * @global object $wpdb WordPress Database object.
4065 4065
      * @global array $geodir_addon_list List of active GeoDirectory extensions.
4066
-	 * @param int|string $package_id The package ID.
4067
-	 * @param string $field_name The field name.
4068
-	 * @param string $post_type Optional. The wordpress post type.
4069
-	 * @return bool Returns true when field visible, otherwise false.
4070
-	 */
4071
-	function check_field_visibility($package_id, $field_name, $post_type)
4066
+     * @param int|string $package_id The package ID.
4067
+     * @param string $field_name The field name.
4068
+     * @param string $post_type Optional. The wordpress post type.
4069
+     * @return bool Returns true when field visible, otherwise false.
4070
+     */
4071
+    function check_field_visibility($package_id, $field_name, $post_type)
4072 4072
     {
4073 4073
         global $wpdb, $geodir_addon_list;
4074 4074
         if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
@@ -4116,15 +4116,15 @@  discard block
 block discarded – undo
4116 4116
                 $input_str = explode("/", $input_str, 2);
4117 4117
                 $label = trim($input_str[0]);
4118 4118
                 if ($translated && $label != '') {
4119
-					$label = __($label, 'geodirectory');
4120
-				}
4121
-				$label = ucfirst($label);
4119
+                    $label = __($label, 'geodirectory');
4120
+                }
4121
+                $label = ucfirst($label);
4122 4122
                 $value = trim($input_str[1]);
4123 4123
             } else {
4124 4124
                 if ($translated && $input_str != '') {
4125
-					$input_str = __($input_str, 'geodirectory');
4126
-				}
4127
-				$label = ucfirst($input_str);
4125
+                    $input_str = __($input_str, 'geodirectory');
4126
+                }
4127
+                $label = ucfirst($input_str);
4128 4128
                 $value = $input_str;
4129 4129
             }
4130 4130
 
@@ -4170,9 +4170,9 @@  discard block
 block discarded – undo
4170 4170
                     if (strpos($optgroup_str, "|") !== false) {
4171 4171
                         $optgroup_str_arr = explode("|", $optgroup_str, 2);
4172 4172
                         $optgroup_label = trim($optgroup_str_arr[0]);
4173
-						if ($translated && $optgroup_label != '') {
4174
-							$optgroup_label = __($optgroup_label, 'geodirectory');
4175
-						}
4173
+                        if ($translated && $optgroup_label != '') {
4174
+                            $optgroup_label = __($optgroup_label, 'geodirectory');
4175
+                        }
4176 4176
                         $optgroup_label = ucfirst($optgroup_label);
4177 4177
                         $optgroup_str = $optgroup_str_arr[1];
4178 4178
                     }
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
                 $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429 429
 
430
-                $sort_order = (int)$last_order + 1;
430
+                $sort_order = (int) $last_order + 1;
431 431
             }
432 432
 
433 433
             $default_value_add = '';
@@ -679,18 +679,18 @@  discard block
 block discarded – undo
679 679
                     $op_size = '500';
680 680
 
681 681
                     // only make the field as big as it needs to be.
682
-                    if(isset($option_values) && $option_values && $field_type=='select'){
683
-                        $option_values_arr = explode(',',$option_values);
684
-                        if(is_array($option_values_arr)){
682
+                    if (isset($option_values) && $option_values && $field_type == 'select') {
683
+                        $option_values_arr = explode(',', $option_values);
684
+                        if (is_array($option_values_arr)) {
685 685
                             $op_max = 0;
686
-                            foreach($option_values_arr as $op_val){
687
-                                if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
686
+                            foreach ($option_values_arr as $op_val) {
687
+                                if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
688 688
                             }
689
-                            if($op_max){$op_size =$op_max; }
689
+                            if ($op_max) {$op_size = $op_max; }
690 690
                         }
691
-                    }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
692
-                        if(strlen($option_values)){
693
-                            $op_size =  strlen($option_values);
691
+                    }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
692
+                        if (strlen($option_values)) {
693
+                            $op_size = strlen($option_values);
694 694
                         }
695 695
                     }
696 696
 
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
                         }
702 702
 
703 703
                     $alter_result = $wpdb->query($meta_field_add);
704
-                    if($alter_result===false){
705
-                        return __('Column change failed, you may have too many columns.','geodirectory');
704
+                    if ($alter_result === false) {
705
+                        return __('Column change failed, you may have too many columns.', 'geodirectory');
706 706
                     }
707 707
 
708 708
                         if (isset($request_field['cat_display_type']))
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
                     case 'html':
719 719
 
720 720
                     $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
721
-                    if($alter_result===false){
722
-                        return __('Column change failed, you may have too many columns.','geodirectory');
721
+                    if ($alter_result === false) {
722
+                        return __('Column change failed, you may have too many columns.', 'geodirectory');
723 723
                     }
724 724
                         if (isset($request_field['advanced_editor']))
725 725
                             $extra_fields = $request_field['advanced_editor'];
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                     default:
734 734
                         if ($data_type != 'VARCHAR' && $data_type != '') {
735 735
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
736
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
736
+                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int) $decimal_point . ") NULL";
737 737
                             } else {
738 738
                                 $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
739 739
                             }
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
                         }
750 750
 
751 751
                         $alter_result = $wpdb->query($default_value_add);
752
-                        if($alter_result===false){
753
-                            return __('Column change failed, you may have too many columns.','geodirectory');
752
+                        if ($alter_result === false) {
753
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
754 754
                         }
755 755
                         break;
756 756
                 endswitch;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 					for_admin_use = %s
799 799
 					where id = %d",
800 800
 
801
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
801
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)
802 802
                     )
803 803
 
804 804
                 );
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
                         $data_type = 'TINYINT';
959 959
 
960 960
                         $meta_field_add = $data_type . "( 1 ) NOT NULL ";
961
-                        if ((int)$default_value === 1) {
961
+                        if ((int) $default_value === 1) {
962 962
                             $meta_field_add .= " DEFAULT '1'";
963 963
                         }
964 964
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                             }
992 992
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
993 993
                             if (strlen($option_values)) {
994
-                                $op_size =  strlen($option_values);
994
+                                $op_size = strlen($option_values);
995 995
                             }
996 996
 							
997 997
 							if (isset($request_field['multi_display_type'])) {
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
                             $meta_field_add = $data_type . " NULL ";
1065 1065
 
1066 1066
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1067
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1067
+                                $meta_field_add = "DECIMAL(11, " . (int) $decimal_point . ") NULL ";
1068 1068
                             }
1069 1069
 
1070 1070
                             if (is_numeric($default_value) && $default_value != '') {
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 					validation_msg = %s,
1130 1130
 					for_admin_use = %s ",
1131 1131
 
1132
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1132
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)
1133 1133
 
1134 1134
                     )
1135 1135
 
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
             }
1143 1143
 
1144
-            return (int)$lastid;
1144
+            return (int) $lastid;
1145 1145
 
1146 1146
 
1147 1147
         } else {
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
         $value = '';
1231 1231
 
1232 1232
         /* field available to site admin only for edit */
1233
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1233
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1234 1234
         if ($for_admin_use && !is_super_admin()) {
1235 1235
             continue;
1236 1236
         }
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
         do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1268 1268
 
1269 1269
         if ($type == 'fieldset') {
1270
-            $fieldset_id = (int)$val['id'];
1270
+            $fieldset_id = (int) $val['id'];
1271 1271
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272 1272
             ?>
1273
-            <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1274
-            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1273
+            <h5 id="geodir_fieldset_<?php echo $fieldset_id; ?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id; ?>"><?php echo $site_title; ?>
1274
+            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>'; ?></h5>
1275 1275
             <?php
1276 1276
         } else if ($type == 'address') {
1277 1277
             $prefix = $name . '_';
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
                 $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1298 1298
                 $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1299 1299
             } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1300
-                $post_info = (array)$post_info;
1300
+                $post_info = (array) $post_info;
1301 1301
 
1302 1302
                 $address = $post_info[$prefix . 'address'];
1303 1303
                 $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
@@ -1341,16 +1341,16 @@  discard block
 block discarded – undo
1341 1341
 
1342 1342
             ?>
1343 1343
 
1344
-            <div id="geodir_<?php echo $prefix . 'address';?>_row"
1345
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1344
+            <div id="geodir_<?php echo $prefix . 'address'; ?>_row"
1345
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1346 1346
                 <label>
1347 1347
                     <?php _e($address_title, 'geodirectory'); ?>
1348
-                    <?php if ($is_required) echo '<span>*</span>';?>
1348
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1349 1349
                 </label>
1350
-                <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1351
-                       id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1350
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'address'; ?>"
1351
+                       id="<?php echo $prefix . 'address'; ?>" class="geodir_textfield"
1352 1352
                        value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1353
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1353
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1354 1354
                 <?php if ($is_required) { ?>
1355 1355
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1356 1356
                 <?php } ?>
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1372 1372
 
1373 1373
                 <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1374
-                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1374
+                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1375 1375
                     <label>
1376 1376
                         <?php _e($zip_title, 'geodirectory'); ?>
1377 1377
                         <?php /*if($is_required) echo '<span>*</span>';*/ ?>
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 
1388 1388
             <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1389 1389
 
1390
-                <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1390
+                <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1391 1391
                     <?php
1392 1392
                     /**
1393 1393
                      * Contains add listing page map functions.
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
                 /* show lat lng */
1407 1407
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408 1408
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1409
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1409
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1410 1410
                     <label>
1411 1411
                         <?php echo PLACE_ADDRESS_LAT; ?>
1412 1412
                         <?php if ($is_required) echo '<span>*</span>'; ?>
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
                 </div>
1422 1422
 
1423 1423
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1424
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1424
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1425 1425
                     <label>
1426 1426
                         <?php echo PLACE_ADDRESS_LNG; ?>
1427 1427
                         <?php if ($is_required) echo '<span>*</span>'; ?>
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
             <?php } ?>
1438 1438
 
1439 1439
             <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1440
-                <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1440
+                <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1441 1441
                     <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1442 1442
 
1443 1443
 
@@ -1479,30 +1479,30 @@  discard block
 block discarded – undo
1479 1479
         <?php } elseif ($type == 'text') {
1480 1480
 
1481 1481
             //number and float validation $validation_pattern
1482
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1483
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1482
+            if (isset($val['data_type']) && $val['data_type'] == 'INT') {$type = 'number'; }
1483
+            elseif (isset($val['data_type']) && $val['data_type'] == 'FLOAT') {$type = 'float'; }
1484 1484
             //print_r($val);
1485 1485
             //validation
1486
-            if(isset($val['validation_pattern']) && $val['validation_pattern']){
1487
-                $validation = 'pattern="'.$val['validation_pattern'].'"';
1488
-            }else{$validation='';}
1486
+            if (isset($val['validation_pattern']) && $val['validation_pattern']) {
1487
+                $validation = 'pattern="' . $val['validation_pattern'] . '"';
1488
+            } else {$validation = ''; }
1489 1489
 
1490 1490
             // validation message
1491
-            if(isset($val['validation_msg']) && $val['validation_msg']){
1492
-                $validation_msg = 'title="'.$val['validation_msg'].'"';
1493
-            }else{$validation_msg='';}
1491
+            if (isset($val['validation_msg']) && $val['validation_msg']) {
1492
+                $validation_msg = 'title="' . $val['validation_msg'] . '"';
1493
+            } else {$validation_msg = ''; }
1494 1494
             ?>
1495 1495
 
1496
-            <div id="<?php echo $name;?>_row"
1497
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1496
+            <div id="<?php echo $name; ?>_row"
1497
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1498 1498
                 <label>
1499 1499
                     <?php $site_title = __($site_title, 'geodirectory');
1500 1500
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1501
-                    <?php if ($is_required) echo '<span>*</span>';?>
1501
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1502 1502
                 </label>
1503
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1504
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
1505
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1503
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1504
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
1505
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1506 1506
                 <?php if ($is_required) { ?>
1507 1507
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1508 1508
                 <?php } ?>
@@ -1513,16 +1513,16 @@  discard block
 block discarded – undo
1513 1513
                 $value = '';
1514 1514
             }?>
1515 1515
 
1516
-            <div id="<?php echo $name;?>_row"
1517
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1516
+            <div id="<?php echo $name; ?>_row"
1517
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1518 1518
                 <label>
1519 1519
                     <?php $site_title = __($site_title, 'geodirectory');
1520 1520
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1521
-                    <?php if ($is_required) echo '<span>*</span>';?>
1521
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1522 1522
                 </label>
1523
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1524
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
1525
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1523
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1524
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
1525
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1526 1526
                 <?php if ($is_required) { ?>
1527 1527
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1528 1528
                 <?php } ?>
@@ -1533,16 +1533,16 @@  discard block
 block discarded – undo
1533 1533
                 $value = '';
1534 1534
             } ?>
1535 1535
 
1536
-            <div id="<?php echo $name;?>_row"
1537
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1536
+            <div id="<?php echo $name; ?>_row"
1537
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1538 1538
                 <label>
1539 1539
                     <?php $site_title = __($site_title, 'geodirectory');
1540 1540
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1541
-                    <?php if ($is_required) echo '<span>*</span>';?>
1541
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1542 1542
                 </label>
1543
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1544
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
1545
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1543
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1544
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
1545
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1546 1546
                 <?php if ($is_required) { ?>
1547 1547
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1548 1548
                 <?php } ?>
@@ -1553,31 +1553,31 @@  discard block
 block discarded – undo
1553 1553
                 $value = '';
1554 1554
             }?>
1555 1555
 
1556
-            <div id="<?php echo $name;?>_row"
1557
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1556
+            <div id="<?php echo $name; ?>_row"
1557
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1558 1558
                 <label>
1559 1559
                     <?php $site_title = __($site_title, 'geodirectory');
1560 1560
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1561
-                    <?php if ($is_required) echo '<span>*</span>';?>
1561
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1562 1562
                 </label>
1563
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1564
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
1563
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1564
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
1565 1565
                        oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
1566 1566
                        onchange="try{setCustomValidity('')}catch(e){}"
1567 1567
                     />
1568
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1568
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1569 1569
                 <?php if ($is_required) { ?>
1570 1570
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1571 1571
                 <?php } ?>
1572 1572
             </div>
1573 1573
 
1574 1574
         <?php } elseif ($type == 'radio') { ?>
1575
-            <div id="<?php echo $name;?>_row"
1576
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1575
+            <div id="<?php echo $name; ?>_row"
1576
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1577 1577
                 <label>
1578 1578
                     <?php $site_title = __($site_title, 'geodirectory');
1579 1579
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1580
-                    <?php if ($is_required) echo '<span>*</span>';?>
1580
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1581 1581
                 </label>
1582 1582
 				<?php if ($option_values) {
1583 1583
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1586,14 +1586,14 @@  discard block
 block discarded – undo
1586 1586
 						foreach ($option_values as $option_value) {
1587 1587
 							if (empty($option_value['optgroup'])) {
1588 1588
 							?>
1589
-							<input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?>
1589
+							<input name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type; ?>" type="radio" /><?php echo $option_value['label']; ?>
1590 1590
 							<?php
1591 1591
 							}
1592 1592
 						}
1593 1593
 					}
1594 1594
                 }
1595 1595
                 ?>
1596
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1596
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1597 1597
                 <?php if ($is_required) { ?>
1598 1598
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1599 1599
                 <?php } ?>
@@ -1601,22 +1601,22 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
         <?php } elseif ($type == 'checkbox') { ?>
1603 1603
 
1604
-            <div id="<?php echo $name;?>_row"
1605
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1604
+            <div id="<?php echo $name; ?>_row"
1605
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1606 1606
                 <label>
1607 1607
                     <?php $site_title = __($site_title, 'geodirectory');
1608 1608
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1609
-                    <?php if ($is_required) echo '<span>*</span>';?>
1609
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1610 1610
                 </label>
1611 1611
                 <?php if ($value != '1') {
1612 1612
                     $value = '0';
1613 1613
                 }?>
1614
-                <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>
1614
+                <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>"/>
1615 1615
                 <input  <?php if ($value == '1') {
1616 1616
                     echo 'checked="checked"';
1617
-                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1618
-                     onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
1619
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1617
+                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type; ?>" type="checkbox"
1618
+                     onchange="if(this.checked){jQuery('#<?php echo $name; ?>').val('1');} else{ jQuery('#<?php echo $name; ?>').val('0');}"/>
1619
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1620 1620
                 <?php if ($is_required) { ?>
1621 1621
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1622 1622
                 <?php } ?>
@@ -1625,44 +1625,44 @@  discard block
 block discarded – undo
1625 1625
         <?php } elseif ($type == 'textarea') {
1626 1626
             ?>
1627 1627
 
1628
-            <div id="<?php echo $name;?>_row"
1629
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1628
+            <div id="<?php echo $name; ?>_row"
1629
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1630 1630
                 <label>
1631 1631
                     <?php $site_title = __($site_title, 'geodirectory');
1632 1632
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1633
-                    <?php if ($is_required) echo '<span>*</span>';?>
1633
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1634 1634
                 </label><?php
1635 1635
 
1636 1636
 
1637 1637
                 if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1638 1638
 
1639
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1639
+                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
1640 1640
 
1641
-                <div class="editor" field_id="<?php echo $name;?>" field_type="editor">
1641
+                <div class="editor" field_id="<?php echo $name; ?>" field_type="editor">
1642 1642
                     <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>
1643 1643
                     </div><?php
1644 1644
 
1645 1645
                 } else {
1646 1646
 
1647
-                    ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1648
-                                id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php
1647
+                    ?><textarea field_type="<?php echo $type; ?>" class="geodir_textarea" name="<?php echo $name; ?>"
1648
+                                id="<?php echo $name; ?>"><?php echo stripslashes($value); ?></textarea><?php
1649 1649
 
1650 1650
                 }?>
1651 1651
 
1652 1652
 
1653
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1653
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1654 1654
                 <?php if ($is_required) { ?>
1655 1655
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1656 1656
                 <?php } ?>
1657 1657
             </div>
1658 1658
 
1659 1659
         <?php } elseif ($type == 'select') { ?>
1660
-            <div id="<?php echo $name;?>_row"
1661
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1660
+            <div id="<?php echo $name; ?>_row"
1661
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class; ?>">
1662 1662
                 <label>
1663 1663
                     <?php $site_title = __($site_title, 'geodirectory');
1664 1664
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1665
-                    <?php if ($is_required) echo '<span>*</span>';?>
1665
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1666 1666
                 </label>
1667 1667
                 <?php
1668 1668
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1683,11 +1683,11 @@  discard block
 block discarded – undo
1683 1683
                     }
1684 1684
                 }
1685 1685
                 ?>
1686
-                <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1686
+                <select field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1687 1687
                         class="geodir_textfield textfield_x chosen_select"
1688
-                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
1689
-                        option-ajaxchosen="false"><?php echo $select_options;?></select>
1690
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1688
+                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;'; ?>"
1689
+                        option-ajaxchosen="false"><?php echo $select_options; ?></select>
1690
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1691 1691
                 <?php if ($is_required) { ?>
1692 1692
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1693 1693
                 <?php } ?>
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
             }
1702 1702
             ?>
1703 1703
             <div id="<?php echo $name; ?>_row"
1704
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1704
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1705 1705
                 <label>
1706 1706
                     <?php $site_title = __($site_title, 'geodirectory');
1707 1707
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
             ?>
1776 1776
 
1777 1777
             <div id="<?php echo $name; ?>_row"
1778
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1778
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1779 1779
                 <label>
1780 1780
                     <?php $site_title = __($site_title, 'geodirectory');
1781 1781
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1805,8 +1805,8 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
             $date_format = str_replace($search, $replace, $extra_fields['date_format']);
1807 1807
 
1808
-            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1809
-            if($value && !isset($_REQUEST['backandedit'])) {
1808
+            if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
1809
+            if ($value && !isset($_REQUEST['backandedit'])) {
1810 1810
                 $time = strtotime($value);
1811 1811
                 $value = date($date_format, $time);
1812 1812
             }
@@ -1816,37 +1816,37 @@  discard block
 block discarded – undo
1816 1816
 
1817 1817
                 jQuery(function () {
1818 1818
 
1819
-                    jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
1819
+                    jQuery("#<?php echo $name; ?>").datepicker({changeMonth: true, changeYear: true <?php
1820 1820
                     /**
1821 1821
                      * Used to add extra option to datepicker per custom field.
1822 1822
                      *
1823 1823
                      * @since 1.5.7
1824 1824
                      * @param string $name The custom field name.
1825 1825
                      */
1826
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1826
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
1827 1827
 
1828
-                    jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format'];?>');
1828
+                    jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format']; ?>');
1829 1829
 
1830
-                    <?php if(!empty($value)){?>
1831
-                    jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
1830
+                    <?php if (!empty($value)) {?>
1831
+                    jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
1832 1832
                     <?php } ?>
1833 1833
 
1834 1834
                 });
1835 1835
 
1836 1836
             </script>
1837
-            <div id="<?php echo $name;?>_row"
1838
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1837
+            <div id="<?php echo $name; ?>_row"
1838
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1839 1839
                 <label>
1840 1840
 
1841 1841
                     <?php $site_title = __($site_title, 'geodirectory');
1842 1842
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1843
-                    <?php if ($is_required) echo '<span>*</span>';?>
1843
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1844 1844
                 </label>
1845 1845
 
1846
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1847
-                       value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1846
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1847
+                       value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1848 1848
 
1849
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1849
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1850 1850
                 <?php if ($is_required) { ?>
1851 1851
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1852 1852
                 <?php } ?>
@@ -1860,25 +1860,25 @@  discard block
 block discarded – undo
1860 1860
             <script type="text/javascript">
1861 1861
                 jQuery(document).ready(function () {
1862 1862
 
1863
-                    jQuery('#<?php echo $name;?>').timepicker({
1863
+                    jQuery('#<?php echo $name; ?>').timepicker({
1864 1864
                         showPeriod: true,
1865 1865
                         showLeadingZero: true,
1866 1866
                         showPeriod: true,
1867 1867
                     });
1868 1868
                 });
1869 1869
             </script>
1870
-            <div id="<?php echo $name;?>_row"
1871
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1870
+            <div id="<?php echo $name; ?>_row"
1871
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1872 1872
                 <label>
1873 1873
 
1874 1874
                     <?php $site_title = __($site_title, 'geodirectory');
1875 1875
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1876
-                    <?php if ($is_required) echo '<span>*</span>';?>
1876
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1877 1877
                 </label>
1878
-                <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1879
-                       id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1878
+                <input readonly="readonly" field_type="<?php echo $type; ?>" name="<?php echo $name; ?>"
1879
+                       id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1880 1880
 
1881
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1881
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1882 1882
                 <?php if ($is_required) { ?>
1883 1883
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1884 1884
                 <?php } ?>
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
             if ($value == $val['default']) {
1889 1889
                 $value = '';
1890 1890
             } ?>
1891
-            <div id="<?php echo $name;?>_row"
1892
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1891
+            <div id="<?php echo $name; ?>_row"
1892
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1893 1893
                 <label>
1894 1894
                     <?php $site_title = __($site_title, 'geodirectory');
1895 1895
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1896
-                    <?php if ($is_required) echo '<span>*</span>';?>
1896
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1897 1897
                 </label>
1898 1898
 
1899
-                <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1899
+                <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1900 1900
                     <?php
1901 1901
                     global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1902 1902
 
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 
1909 1909
                         $package_info = array();
1910 1910
 
1911
-                        $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1911
+                        $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1912 1912
 
1913 1913
                         if (!empty($package_info)) {
1914 1914
 
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
                     ?>
1992 1992
                 </div>
1993 1993
 
1994
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1994
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1995 1995
                 <?php if ($is_required) { ?>
1996 1996
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1997 1997
                 <?php } ?>
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
                     $file_totImg = count($curImages);
2034 2034
             }
2035 2035
 			
2036
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2036
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
2037 2037
 			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2038 2038
 
2039 2039
             ?>
@@ -2044,13 +2044,13 @@  discard block
 block discarded – undo
2044 2044
 			</h5>   <?php */
2045 2045
             ?>
2046 2046
 
2047
-            <div id="<?php echo $name;?>_row"
2048
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2047
+            <div id="<?php echo $name; ?>_row"
2048
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
2049 2049
 
2050 2050
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2051 2051
                     <label
2052 2052
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2053
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2053
+                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
2054 2054
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2055 2055
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2056 2056
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
                            id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
2059 2059
 					<?php if ($allowed_file_types != '') { ?>
2060 2060
 					<input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
2061
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
2061
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
2062 2062
 					<?php } ?>
2063 2063
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2064 2064
                            value="<?php if (isset($file_totImg)) {
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
                             <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
2075 2075
                             ?>
2076 2076
                             <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
2077
-                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
2077
+                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
2078 2078
                                    class="geodir_button" style="margin-top:10px;"/>
2079 2079
                             <span class="ajaxnonceplu"
2080 2080
                                   id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 
2098 2098
                     </div>
2099 2099
                 </div>
2100
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
2100
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : ''); ?></span>
2101 2101
                 <?php if ($is_required) { ?>
2102 2102
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2103 2103
                 <?php } ?>
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
                 $variables_array = array();
2204 2204
 
2205
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2205
+                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2206 2206
                     continue;
2207 2207
                 }
2208 2208
 
@@ -2228,12 +2228,12 @@  discard block
 block discarded – undo
2228 2228
 
2229 2229
                     case 'fieldset':
2230 2230
 
2231
-                        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);
2231
+                        $fieldset_class = 'fieldset-' . sanitize_title_with_dashes($type['site_title']);
2232 2232
 
2233 2233
                         if ($field_set_start == 1) {
2234
-                            echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2234
+                            echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="' . $fieldset_class . '">' . __($type['site_title'], 'geodirectory') . '</h2>';
2235 2235
                         } else {
2236
-                            echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2236
+                            echo '<h2 class="' . $fieldset_class . '">' . __($type['site_title'], 'geodirectory') . '</h2>';
2237 2237
                             $field_set_start = 1;
2238 2238
                         }
2239 2239
 
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
 
2406 2406
 							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2407 2407
 							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2408
-                            if(!empty($type['default_value'])){$title = $type['default_value'];}
2408
+                            if (!empty($type['default_value'])) {$title = $type['default_value']; }
2409 2409
 							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2410 2410
 
2411 2411
 
@@ -2518,17 +2518,17 @@  discard block
 block discarded – undo
2518 2518
                                 $date_format = $date_format['date_format'];
2519 2519
                             }
2520 2520
 
2521
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2522
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2521
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
2522
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
2523 2523
 
2524 2524
                             $date_format = str_replace($search, $replace, $date_format);
2525 2525
 
2526 2526
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2527 2527
 
2528 2528
                             $value = '';
2529
-                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2529
+                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']} != "0000-00-00") {
2530 2530
                                 $value = date($date_format, strtotime($post_htmlvar_value));
2531
-                            }else{
2531
+                            } else {
2532 2532
                                 continue;
2533 2533
                             }
2534 2534
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 
2672 2672
                         $html_var = $type['htmlvar_name'];
2673 2673
 
2674
-                        if ((int)$post->$html_var == 1):
2674
+                        if ((int) $post->$html_var == 1):
2675 2675
 
2676 2676
                             if ($post->{$type['htmlvar_name']} == '1'):
2677 2677
                                 $html_val = __('Yes', 'geodirectory');
@@ -2899,8 +2899,8 @@  discard block
 block discarded – undo
2899 2899
                                 $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2900 2900
                                 $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2901 2901
                                 $html .= '</span><span class="geodir-email-address-output">';
2902
-                                $email = stripslashes($post->{$type['htmlvar_name']}) ;
2903
-                                if($e_split = explode('@',$email)){
2902
+                                $email = stripslashes($post->{$type['htmlvar_name']});
2903
+                                if ($e_split = explode('@', $email)) {
2904 2904
                                     /**
2905 2905
                                      * Filter email custom field name output.
2906 2906
                                      *
@@ -2909,10 +2909,10 @@  discard block
 block discarded – undo
2909 2909
                                      * @param string $email The email string being output.
2910 2910
                                      * @param array $type Custom field variables array.
2911 2911
                                      */
2912
-                                    $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2913
-                                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
-                                }else{
2915
-                                    $html .=  $email;
2912
+                                    $email_name = apply_filters('geodir_email_field_name_output', $email, $type);
2913
+                                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
+                                } else {
2915
+                                    $html .= $email;
2916 2916
                                 }
2917 2917
                                 $html .= '</span></div>';
2918 2918
                             }
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
                             if (!empty($files)):
2933 2933
 
2934 2934
                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2935
-							   $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'] : '';
2935
+							   $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'] : '';
2936 2936
 								
2937 2937
 								$file_paths = '';
2938 2938
                                 foreach ($files as $file) {
@@ -2963,7 +2963,7 @@  discard block
 block discarded – undo
2963 2963
                                         // If the uploaded file is image
2964 2964
                                         if (in_array($uploaded_file_type, $image_file_types)) {
2965 2965
                                             $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2966
-                                            $file_paths .= '<a href="'.$file.'">';
2966
+                                            $file_paths .= '<a href="' . $file . '">';
2967 2967
 											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968 2968
 											$file_paths .= '</a>';
2969 2969
                                             //$file_paths .= '<img src="'.$file.'"  />';	
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
                                     $terms = $termsOrdered;
3101 3101
                                 }
3102 3102
                             }
3103
-                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
3103
+                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
3104 3104
 
3105 3105
                             if ($html_value != '') {
3106 3106
                                 if (strpos($field_icon, 'http') !== false) {
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             $geodir_uploadurl = $uploads['url'];
3263 3263
             $sub_dir = $uploads['subdir'];
3264 3264
 			
3265
-			$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'] : '';
3265
+			$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'] : '';
3266 3266
 
3267 3267
             for ($m = 0; $m < count($post_image); $m++) {
3268 3268
 
@@ -3333,8 +3333,8 @@  discard block
 block discarded – undo
3333 3333
         if (!empty($postcurr_images)) {
3334 3334
 
3335 3335
             if ($file_urls != $postcurr_images) {
3336
-                $invalid_files[] = (object)array('src' => $postcurr_images);
3337
-                $invalid_files = (object)$invalid_files;
3336
+                $invalid_files[] = (object) array('src' => $postcurr_images);
3337
+                $invalid_files = (object) $invalid_files;
3338 3338
             }
3339 3339
         }
3340 3340
 
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
         // remove handle custom file uploaddir
3417 3417
         remove_filter('upload_dir', 'geodir_upload_dir');
3418 3418
 
3419
-        if(!isset($status['url']) && isset($status['error'])){
3419
+        if (!isset($status['url']) && isset($status['error'])) {
3420 3420
             print_r($status);
3421 3421
         }
3422 3422
 
@@ -3492,10 +3492,10 @@  discard block
 block discarded – undo
3492 3492
 	 */
3493 3493
 	function geodir_max_upload_size()
3494 3494
     {
3495
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3495
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
3496 3496
 
3497 3497
         if ($max_filesize > 0 && $max_filesize < 1) {
3498
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
3498
+            $max_filesize = (int) ($max_filesize * 1024) . 'kb';
3499 3499
         } else {
3500 3500
             $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
3501 3501
         }
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
         }
3804 3804
 
3805 3805
 
3806
-        return (int)$lastid;
3806
+        return (int) $lastid;
3807 3807
 
3808 3808
     }
3809 3809
 }
@@ -3894,38 +3894,38 @@  discard block
 block discarded – undo
3894 3894
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3895 3895
         
3896 3896
         ?>
3897
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
3898
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
3899
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
3900
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
3897
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
3898
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
3899
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
3900
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
3901 3901
                 <?php
3902 3902
 
3903 3903
                 $nonce = wp_create_nonce('custom_fields_' . $result_str);
3904 3904
                 ?>
3905 3905
 
3906
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
3907
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
3906
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
3907
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
3908 3908
                      class="handlediv close"></div>
3909 3909
 
3910 3910
                 <b style="cursor:pointer;"
3911
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
3911
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')'); ?></b>
3912 3912
 
3913 3913
             </div>
3914 3914
 
3915
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3915
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
3916 3916
                  style="display:<?php if ($field_ins_upd == 'submit') {
3917 3917
                      echo 'block;';
3918 3918
                  } else {
3919 3919
                      echo 'none;';
3920 3920
                  } ?>">
3921 3921
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3922
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3923
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
3924
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
3922
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
3923
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
3924
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
3925 3925
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
3926 3926
                     echo $field_info->data_type;
3927 3927
                 }?>"/>
3928
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
3928
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
3929 3929
 
3930 3930
 
3931 3931
                 <table class="widefat post fixed" border="0" style="width:100%;">
@@ -4007,42 +4007,42 @@  discard block
 block discarded – undo
4007 4007
                     <?php } ?>
4008 4008
 
4009 4009
                     <tr>
4010
-                        <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
4010
+                        <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
4011 4011
                         <td align="left">
4012 4012
                             <select name="is_active" id="is_active">
4013 4013
                                 <option
4014 4014
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
4015 4015
                                     echo 'selected="selected"';
4016
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
4016
+                                }?>><?php _e('Yes', 'geodirectory'); ?></option>
4017 4017
                                 <option
4018 4018
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
4019 4019
                                     echo 'selected="selected"';
4020
-                                }?>><?php _e('No', 'geodirectory');?></option>
4020
+                                }?>><?php _e('No', 'geodirectory'); ?></option>
4021 4021
                             </select>
4022 4022
                             <br/>
4023
-                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
4023
+                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
4024 4024
                         </td>
4025 4025
                     </tr>
4026 4026
 
4027 4027
                     <tr>
4028
-                        <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
4028
+                        <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
4029 4029
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
4030 4030
                                                 value="<?php if (isset($field_info->sort_order)) {
4031 4031
                                                     echo esc_attr($field_info->sort_order);
4032 4032
                                                 }?>" size="50"/>
4033 4033
                             <br/>
4034
-                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
4034
+                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
4035 4035
                         </td>
4036 4036
                     </tr>
4037 4037
 
4038 4038
                     <tr>
4039 4039
                         <td>&nbsp;</td>
4040 4040
                         <td align="left">
4041
-                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
4042
-                                   onclick="save_sort_field('<?php echo $result_str;?>')"/>
4041
+                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
4042
+                                   onclick="save_sort_field('<?php echo $result_str; ?>')"/>
4043 4043
 
4044
-                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
4045
-                                                                onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
4044
+                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
4045
+                                                                onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
4046 4046
                                                                 class="button_n"/></a>
4047 4047
 
4048 4048
                         </td>
@@ -4077,7 +4077,7 @@  discard block
 block discarded – undo
4077 4077
         if (!$package_id || !$field_name || !$post_type) {
4078 4078
             return true;
4079 4079
         }
4080
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
4080
+        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
4081 4081
 
4082 4082
         if ($wpdb->get_var($sql)) {
4083 4083
             return true;
Please login to merge, or discard this patch.
Braces   +369 added lines, -184 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query = " and is_default IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query = " and is_default = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query = " and is_default IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query = " and is_default = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'detail') {
91 93
         $default_query = " and show_on_detail='1' ";
@@ -240,10 +242,12 @@  discard block
 block discarded – undo
240 242
                 }
241 243
 
242 244
                 return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
245
+            } else {
246
+                            return 0;
247
+            }
248
+        } else {
249
+                    return 0;
250
+        }
247 251
     }
248 252
 }
249 253
 
@@ -351,7 +355,9 @@  discard block
 block discarded – undo
351 355
 		}*/
352 356
 
353 357
 
354
-            if ($post_type == '') $post_type = 'gd_place';
358
+            if ($post_type == '') {
359
+                $post_type = 'gd_place';
360
+            }
355 361
 
356 362
 
357 363
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -384,20 +390,23 @@  discard block
 block discarded – undo
384 390
             }
385 391
 
386 392
             $option_values = '';
387
-            if (isset($request_field['option_values']))
388
-                $option_values = $request_field['option_values'];
393
+            if (isset($request_field['option_values'])) {
394
+                            $option_values = $request_field['option_values'];
395
+            }
389 396
 
390 397
             $cat_sort = '';
391
-            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))
392
-                $cat_sort = implode(",", $request_field['cat_sort']);
398
+            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) {
399
+                            $cat_sort = implode(",", $request_field['cat_sort']);
400
+            }
393 401
 
394 402
             $cat_filter = '';
395
-            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))
396
-                $cat_filter = implode(",", $request_field['cat_filter']);
403
+            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) {
404
+                            $cat_filter = implode(",", $request_field['cat_filter']);
405
+            }
397 406
 
398
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
399
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
400
-            else {
407
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
408
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
409
+            } else {
401 410
                 $package_info = array();
402 411
 
403 412
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -405,22 +414,29 @@  discard block
 block discarded – undo
405 414
             }
406 415
 
407 416
 
408
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
409
-                $extra_fields = $request_field['extra'];
417
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
418
+                            $extra_fields = $request_field['extra'];
419
+            }
410 420
 
411
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
412
-                $is_default = $request_field['is_default'];
413
-            else
414
-                $is_default = '0';
421
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
422
+                            $is_default = $request_field['is_default'];
423
+            } else {
424
+                            $is_default = '0';
425
+            }
415 426
 
416
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
417
-                $is_admin = $request_field['is_admin'];
418
-            else
419
-                $is_admin = '0';
427
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
428
+                            $is_admin = $request_field['is_admin'];
429
+            } else {
430
+                            $is_admin = '0';
431
+            }
420 432
 
421 433
 
422
-            if ($is_active == '') $is_active = 1;
423
-            if ($is_required == '') $is_required = 0;
434
+            if ($is_active == '') {
435
+                $is_active = 1;
436
+            }
437
+            if ($is_required == '') {
438
+                $is_required = 0;
439
+            }
424 440
 
425 441
 
426 442
             if ($sort_order == '') {
@@ -688,7 +704,7 @@  discard block
 block discarded – undo
688 704
                             }
689 705
                             if($op_max){$op_size =$op_max; }
690 706
                         }
691
-                    }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                    } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
692 708
                         if(strlen($option_values)){
693 709
                             $op_size =  strlen($option_values);
694 710
                         }
@@ -705,11 +721,13 @@  discard block
 block discarded – undo
705 721
                         return __('Column change failed, you may have too many columns.','geodirectory');
706 722
                     }
707 723
 
708
-                        if (isset($request_field['cat_display_type']))
709
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
710 727
 
711
-                        if (isset($request_field['multi_display_type']))
712
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
713 731
 
714 732
 
715 733
                         break;
@@ -721,8 +739,9 @@  discard block
 block discarded – undo
721 739
                     if($alter_result===false){
722 740
                         return __('Column change failed, you may have too many columns.','geodirectory');
723 741
                     }
724
-                        if (isset($request_field['advanced_editor']))
725
-                            $extra_fields = $request_field['advanced_editor'];
742
+                        if (isset($request_field['advanced_editor'])) {
743
+                                                    $extra_fields = $request_field['advanced_editor'];
744
+                        }
726 745
 
727 746
                         break;
728 747
 
@@ -816,8 +835,9 @@  discard block
 block discarded – undo
816 835
                 );
817 836
 
818 837
 
819
-                if ($cat_sort == '')
820
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
838
+                if ($cat_sort == '') {
839
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
840
+                }
821 841
 
822 842
 
823 843
                 /**
@@ -1184,8 +1204,10 @@  discard block
 block discarded – undo
1184 1204
         }
1185 1205
 
1186 1206
         return $post_meta_info;
1187
-    else:
1188
-        return false;
1207
+    else {
1208
+        :
1209
+        return false;
1210
+    }
1189 1211
     endif;
1190 1212
 }
1191 1213
 
@@ -1238,8 +1260,9 @@  discard block
 block discarded – undo
1238 1260
         if (is_admin()) {
1239 1261
             global $post;
1240 1262
 
1241
-            if (isset($_REQUEST['post']))
1242
-                $_REQUEST['pid'] = $_REQUEST['post'];
1263
+            if (isset($_REQUEST['post'])) {
1264
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1265
+            }
1243 1266
         }
1244 1267
 
1245 1268
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1271,7 +1294,10 @@  discard block
 block discarded – undo
1271 1294
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272 1295
             ?>
1273 1296
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1274
-            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1297
+            <?php if ($admin_desc != '') {
1298
+    echo '<small>( ' . $admin_desc . ' )</small>';
1299
+}
1300
+?></h5>
1275 1301
             <?php
1276 1302
         } else if ($type == 'address') {
1277 1303
             $prefix = $name . '_';
@@ -1308,17 +1334,27 @@  discard block
 block discarded – undo
1308 1334
             }
1309 1335
 
1310 1336
             $location = geodir_get_default_location();
1311
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1312
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1313
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1337
+            if (empty($city)) {
1338
+                $city = isset($location->city) ? $location->city : '';
1339
+            }
1340
+            if (empty($region)) {
1341
+                $region = isset($location->region) ? $location->region : '';
1342
+            }
1343
+            if (empty($country)) {
1344
+                $country = isset($location->country) ? $location->country : '';
1345
+            }
1314 1346
 
1315 1347
             $lat_lng_blank = false;
1316 1348
             if (empty($lat) && empty($lng)) {
1317 1349
                 $lat_lng_blank = true;
1318 1350
             }
1319 1351
 
1320
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1321
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1352
+            if (empty($lat)) {
1353
+                $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1354
+            }
1355
+            if (empty($lng)) {
1356
+                $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1357
+            }
1322 1358
 
1323 1359
             /**
1324 1360
              * Filter the default latitude.
@@ -1342,10 +1378,16 @@  discard block
 block discarded – undo
1342 1378
             ?>
1343 1379
 
1344 1380
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1345
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1381
+                 class="<?php if ($is_required) {
1382
+    echo 'required_field';
1383
+}
1384
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1346 1385
                 <label>
1347 1386
                     <?php _e($address_title, 'geodirectory'); ?>
1348
-                    <?php if ($is_required) echo '<span>*</span>';?>
1387
+                    <?php if ($is_required) {
1388
+    echo '<span>*</span>';
1389
+}
1390
+?>
1349 1391
                 </label>
1350 1392
                 <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1351 1393
                        id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1406,10 +1448,16 @@  discard block
 block discarded – undo
1406 1448
                 /* show lat lng */
1407 1449
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408 1450
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1409
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1451
+                     class="<?php if ($is_required) {
1452
+    echo 'required_field';
1453
+}
1454
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1410 1455
                     <label>
1411 1456
                         <?php echo PLACE_ADDRESS_LAT; ?>
1412
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1457
+                        <?php if ($is_required) {
1458
+    echo '<span>*</span>';
1459
+}
1460
+?>
1413 1461
                     </label>
1414 1462
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1415 1463
                            id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1421,10 +1469,16 @@  discard block
 block discarded – undo
1421 1469
                 </div>
1422 1470
 
1423 1471
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1424
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1472
+                     class="<?php if ($is_required) {
1473
+    echo 'required_field';
1474
+}
1475
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1425 1476
                     <label>
1426 1477
                         <?php echo PLACE_ADDRESS_LNG; ?>
1427
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1478
+                        <?php if ($is_required) {
1479
+    echo '<span>*</span>';
1480
+}
1481
+?>
1428 1482
                     </label>
1429 1483
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1430 1484
                            id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1479,26 +1533,31 @@  discard block
 block discarded – undo
1479 1533
         <?php } elseif ($type == 'text') {
1480 1534
 
1481 1535
             //number and float validation $validation_pattern
1482
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1483
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1536
+            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1484 1537
             //print_r($val);
1485 1538
             //validation
1486 1539
             if(isset($val['validation_pattern']) && $val['validation_pattern']){
1487 1540
                 $validation = 'pattern="'.$val['validation_pattern'].'"';
1488
-            }else{$validation='';}
1541
+            } else{$validation='';}
1489 1542
 
1490 1543
             // validation message
1491 1544
             if(isset($val['validation_msg']) && $val['validation_msg']){
1492 1545
                 $validation_msg = 'title="'.$val['validation_msg'].'"';
1493
-            }else{$validation_msg='';}
1546
+            } else{$validation_msg='';}
1494 1547
             ?>
1495 1548
 
1496 1549
             <div id="<?php echo $name;?>_row"
1497
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1550
+                 class="<?php if ($is_required) {
1551
+    echo 'required_field';
1552
+}
1553
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1498 1554
                 <label>
1499 1555
                     <?php $site_title = __($site_title, 'geodirectory');
1500 1556
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1501
-                    <?php if ($is_required) echo '<span>*</span>';?>
1557
+                    <?php if ($is_required) {
1558
+    echo '<span>*</span>';
1559
+}
1560
+?>
1502 1561
                 </label>
1503 1562
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1504 1563
                        value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -1514,11 +1573,17 @@  discard block
 block discarded – undo
1514 1573
             }?>
1515 1574
 
1516 1575
             <div id="<?php echo $name;?>_row"
1517
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1576
+                 class="<?php if ($is_required) {
1577
+    echo 'required_field';
1578
+}
1579
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1518 1580
                 <label>
1519 1581
                     <?php $site_title = __($site_title, 'geodirectory');
1520 1582
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1521
-                    <?php if ($is_required) echo '<span>*</span>';?>
1583
+                    <?php if ($is_required) {
1584
+    echo '<span>*</span>';
1585
+}
1586
+?>
1522 1587
                 </label>
1523 1588
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1524 1589
                        value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -1534,11 +1599,17 @@  discard block
 block discarded – undo
1534 1599
             } ?>
1535 1600
 
1536 1601
             <div id="<?php echo $name;?>_row"
1537
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1602
+                 class="<?php if ($is_required) {
1603
+    echo 'required_field';
1604
+}
1605
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1538 1606
                 <label>
1539 1607
                     <?php $site_title = __($site_title, 'geodirectory');
1540 1608
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1541
-                    <?php if ($is_required) echo '<span>*</span>';?>
1609
+                    <?php if ($is_required) {
1610
+    echo '<span>*</span>';
1611
+}
1612
+?>
1542 1613
                 </label>
1543 1614
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1544 1615
                        value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -1554,11 +1625,17 @@  discard block
 block discarded – undo
1554 1625
             }?>
1555 1626
 
1556 1627
             <div id="<?php echo $name;?>_row"
1557
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1628
+                 class="<?php if ($is_required) {
1629
+    echo 'required_field';
1630
+}
1631
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1558 1632
                 <label>
1559 1633
                     <?php $site_title = __($site_title, 'geodirectory');
1560 1634
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1561
-                    <?php if ($is_required) echo '<span>*</span>';?>
1635
+                    <?php if ($is_required) {
1636
+    echo '<span>*</span>';
1637
+}
1638
+?>
1562 1639
                 </label>
1563 1640
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1564 1641
                        value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -1573,11 +1650,17 @@  discard block
 block discarded – undo
1573 1650
 
1574 1651
         <?php } elseif ($type == 'radio') { ?>
1575 1652
             <div id="<?php echo $name;?>_row"
1576
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1653
+                 class="<?php if ($is_required) {
1654
+    echo 'required_field';
1655
+}
1656
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1577 1657
                 <label>
1578 1658
                     <?php $site_title = __($site_title, 'geodirectory');
1579 1659
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1580
-                    <?php if ($is_required) echo '<span>*</span>';?>
1660
+                    <?php if ($is_required) {
1661
+    echo '<span>*</span>';
1662
+}
1663
+?>
1581 1664
                 </label>
1582 1665
 				<?php if ($option_values) {
1583 1666
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1602,11 +1685,17 @@  discard block
 block discarded – undo
1602 1685
         <?php } elseif ($type == 'checkbox') { ?>
1603 1686
 
1604 1687
             <div id="<?php echo $name;?>_row"
1605
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1688
+                 class="<?php if ($is_required) {
1689
+    echo 'required_field';
1690
+}
1691
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1606 1692
                 <label>
1607 1693
                     <?php $site_title = __($site_title, 'geodirectory');
1608 1694
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1609
-                    <?php if ($is_required) echo '<span>*</span>';?>
1695
+                    <?php if ($is_required) {
1696
+    echo '<span>*</span>';
1697
+}
1698
+?>
1610 1699
                 </label>
1611 1700
                 <?php if ($value != '1') {
1612 1701
                     $value = '0';
@@ -1626,11 +1715,17 @@  discard block
 block discarded – undo
1626 1715
             ?>
1627 1716
 
1628 1717
             <div id="<?php echo $name;?>_row"
1629
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1718
+                 class="<?php if ($is_required) {
1719
+    echo 'required_field';
1720
+}
1721
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1630 1722
                 <label>
1631 1723
                     <?php $site_title = __($site_title, 'geodirectory');
1632 1724
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1633
-                    <?php if ($is_required) echo '<span>*</span>';?>
1725
+                    <?php if ($is_required) {
1726
+    echo '<span>*</span>';
1727
+}
1728
+?>
1634 1729
                 </label><?php
1635 1730
 
1636 1731
 
@@ -1658,11 +1753,17 @@  discard block
 block discarded – undo
1658 1753
 
1659 1754
         <?php } elseif ($type == 'select') { ?>
1660 1755
             <div id="<?php echo $name;?>_row"
1661
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1756
+                 class="<?php if ($is_required) {
1757
+    echo 'required_field';
1758
+}
1759
+?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1662 1760
                 <label>
1663 1761
                     <?php $site_title = __($site_title, 'geodirectory');
1664 1762
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1665
-                    <?php if ($is_required) echo '<span>*</span>';?>
1763
+                    <?php if ($is_required) {
1764
+    echo '<span>*</span>';
1765
+}
1766
+?>
1666 1767
                 </label>
1667 1768
                 <?php
1668 1769
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1701,11 +1802,17 @@  discard block
 block discarded – undo
1701 1802
             }
1702 1803
             ?>
1703 1804
             <div id="<?php echo $name; ?>_row"
1704
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1805
+                 class="<?php if ($is_required) {
1806
+    echo 'required_field';
1807
+}
1808
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1705 1809
                 <label>
1706 1810
                     <?php $site_title = __($site_title, 'geodirectory');
1707 1811
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1708
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1812
+                    <?php if ($is_required) {
1813
+    echo '<span>*</span>';
1814
+}
1815
+?>
1709 1816
                 </label>
1710 1817
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
1711 1818
                 <?php if ($multi_display == 'select') { ?>
@@ -1775,11 +1882,17 @@  discard block
 block discarded – undo
1775 1882
             ?>
1776 1883
 
1777 1884
             <div id="<?php echo $name; ?>_row"
1778
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1885
+                 class="<?php if ($is_required) {
1886
+    echo 'required_field';
1887
+}
1888
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1779 1889
                 <label>
1780 1890
                     <?php $site_title = __($site_title, 'geodirectory');
1781 1891
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1782
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1892
+                    <?php if ($is_required) {
1893
+    echo '<span>*</span>';
1894
+}
1895
+?>
1783 1896
                 </label>
1784 1897
 
1785 1898
                 <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -1796,8 +1909,9 @@  discard block
 block discarded – undo
1796 1909
             </div>
1797 1910
         <?php } elseif ($type == 'datepicker') {
1798 1911
 
1799
-            if ($extra_fields['date_format'] == '')
1800
-                $extra_fields['date_format'] = 'yy-mm-dd';
1912
+            if ($extra_fields['date_format'] == '') {
1913
+                            $extra_fields['date_format'] = 'yy-mm-dd';
1914
+            }
1801 1915
 
1802 1916
 
1803 1917
             $search = array('dd', 'mm', 'yy');
@@ -1835,12 +1949,18 @@  discard block
 block discarded – undo
1835 1949
 
1836 1950
             </script>
1837 1951
             <div id="<?php echo $name;?>_row"
1838
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1952
+                 class="<?php if ($is_required) {
1953
+    echo 'required_field';
1954
+}
1955
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1839 1956
                 <label>
1840 1957
 
1841 1958
                     <?php $site_title = __($site_title, 'geodirectory');
1842 1959
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1843
-                    <?php if ($is_required) echo '<span>*</span>';?>
1960
+                    <?php if ($is_required) {
1961
+    echo '<span>*</span>';
1962
+}
1963
+?>
1844 1964
                 </label>
1845 1965
 
1846 1966
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1854,8 +1974,9 @@  discard block
 block discarded – undo
1854 1974
 
1855 1975
         <?php } elseif ($type == 'time') {
1856 1976
 
1857
-            if ($value != '')
1858
-                $value = date('H:i', strtotime($value));
1977
+            if ($value != '') {
1978
+                            $value = date('H:i', strtotime($value));
1979
+            }
1859 1980
             ?>
1860 1981
             <script type="text/javascript">
1861 1982
                 jQuery(document).ready(function () {
@@ -1868,12 +1989,18 @@  discard block
 block discarded – undo
1868 1989
                 });
1869 1990
             </script>
1870 1991
             <div id="<?php echo $name;?>_row"
1871
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1992
+                 class="<?php if ($is_required) {
1993
+    echo 'required_field';
1994
+}
1995
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1872 1996
                 <label>
1873 1997
 
1874 1998
                     <?php $site_title = __($site_title, 'geodirectory');
1875 1999
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1876
-                    <?php if ($is_required) echo '<span>*</span>';?>
2000
+                    <?php if ($is_required) {
2001
+    echo '<span>*</span>';
2002
+}
2003
+?>
1877 2004
                 </label>
1878 2005
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1879 2006
                        id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1889,11 +2016,17 @@  discard block
 block discarded – undo
1889 2016
                 $value = '';
1890 2017
             } ?>
1891 2018
             <div id="<?php echo $name;?>_row"
1892
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2019
+                 class="<?php if ($is_required) {
2020
+    echo 'required_field';
2021
+}
2022
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1893 2023
                 <label>
1894 2024
                     <?php $site_title = __($site_title, 'geodirectory');
1895 2025
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1896
-                    <?php if ($is_required) echo '<span>*</span>';?>
2026
+                    <?php if ($is_required) {
2027
+    echo '<span>*</span>';
2028
+}
2029
+?>
1897 2030
                 </label>
1898 2031
 
1899 2032
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1927,8 +2060,9 @@  discard block
 block discarded – undo
1927 2060
                         $post_cat = implode(",", $post_cat[$name]);
1928 2061
 
1929 2062
                     } else {
1930
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1931
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2063
+                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2064
+                                                    $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2065
+                        }
1932 2066
                     }
1933 2067
 
1934 2068
 
@@ -1966,21 +2100,24 @@  discard block
 block discarded – undo
1966 2100
 
1967 2101
                             $cat_display == '';
1968 2102
                             $multiple = '';
1969
-                            if ($cat_display == 'multiselect')
1970
-                                $multiple = 'multiple="multiple"';
2103
+                            if ($cat_display == 'multiselect') {
2104
+                                                            $multiple = 'multiple="multiple"';
2105
+                            }
1971 2106
 
1972 2107
                             echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1973 2108
 
1974 2109
 
1975
-                            if ($cat_display == 'select')
1976
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2110
+                            if ($cat_display == 'select') {
2111
+                                                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2112
+                            }
1977 2113
 
1978 2114
                         }
1979 2115
 
1980 2116
                         echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1981 2117
 
1982
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
1983
-                            echo '</select>';
2118
+                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
2119
+                                                    echo '</select>';
2120
+                        }
1984 2121
 
1985 2122
                     } else {
1986 2123
 
@@ -2010,18 +2147,23 @@  discard block
 block discarded – undo
2010 2147
 
2011 2148
                 $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2012 2149
 
2013
-            } else
2014
-                $file_value = '';
2150
+            } else {
2151
+                            $file_value = '';
2152
+            }
2015 2153
 
2016
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2017
-                $file_multiple = true; // allow multiple files upload
2018
-            else
2019
-                $file_multiple = false;
2154
+            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
2155
+                            $file_multiple = true;
2156
+            }
2157
+            // allow multiple files upload
2158
+            else {
2159
+                            $file_multiple = false;
2160
+            }
2020 2161
 
2021
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2022
-                $file_image_limit = $extra_fields['image_limit'];
2023
-            else
2024
-                $file_image_limit = 1;
2162
+            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
2163
+                            $file_image_limit = $extra_fields['image_limit'];
2164
+            } else {
2165
+                            $file_image_limit = 1;
2166
+            }
2025 2167
 
2026 2168
             $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2027 2169
 
@@ -2029,8 +2171,9 @@  discard block
 block discarded – undo
2029 2171
 
2030 2172
             if (!empty($file_value)) {
2031 2173
                 $curImages = explode(',', $file_value);
2032
-                if (!empty($curImages))
2033
-                    $file_totImg = count($curImages);
2174
+                if (!empty($curImages)) {
2175
+                                    $file_totImg = count($curImages);
2176
+                }
2034 2177
             }
2035 2178
 			
2036 2179
 			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -2045,12 +2188,18 @@  discard block
 block discarded – undo
2045 2188
             ?>
2046 2189
 
2047 2190
             <div id="<?php echo $name;?>_row"
2048
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2191
+                 class="<?php if ($is_required) {
2192
+    echo 'required_field';
2193
+}
2194
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2049 2195
 
2050 2196
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2051 2197
                     <label
2052 2198
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2053
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2199
+                        echo $site_title; ?><?php if ($is_required) {
2200
+                            echo '<span>*</span>';
2201
+                        }
2202
+                        ?></label>
2054 2203
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2055 2204
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2056 2205
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2191,9 +2340,10 @@  discard block
 block discarded – undo
2191 2340
             $field_set_start = 0;
2192 2341
 
2193 2342
 
2194
-            if ($fields_location == 'detail')
2195
-
2196
-                $i = 1;
2343
+            if ($fields_location == 'detail') {
2344
+            
2345
+                $i = 1;
2346
+            }
2197 2347
             foreach ($fields_info as $type) {
2198 2348
 				$type = stripslashes_deep($type); // strip slashes
2199 2349
                 $html = '';
@@ -2210,8 +2360,9 @@  discard block
 block discarded – undo
2210 2360
                     $variables_array['post_id'] = $post->ID;
2211 2361
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
2212 2362
                     $variables_array['value'] = '';
2213
-                    if (isset($post->{$type['htmlvar_name']}))
2214
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2363
+                    if (isset($post->{$type['htmlvar_name']})) {
2364
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
2365
+                    }
2215 2366
                 endif;
2216 2367
 
2217 2368
                 //if($type['field_icon'])
@@ -2338,8 +2489,9 @@  discard block
 block discarded – undo
2338 2489
                             if ($fields_location == 'detail') {
2339 2490
 
2340 2491
                                 $geodir_odd_even = 'geodir_more_info_odd';
2341
-                                if ($i % 2 == 0)
2342
-                                    $geodir_odd_even = 'geodir_more_info_even';
2492
+                                if ($i % 2 == 0) {
2493
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2494
+                                }
2343 2495
 
2344 2496
                                 $i++;
2345 2497
                             }
@@ -2413,8 +2565,9 @@  discard block
 block discarded – undo
2413 2565
                             if ($fields_location == 'detail') {
2414 2566
 
2415 2567
                                 $geodir_odd_even = 'geodir_more_info_odd';
2416
-                                if ($i % 2 == 0)
2417
-                                    $geodir_odd_even = 'geodir_more_info_even';
2568
+                                if ($i % 2 == 0) {
2569
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2570
+                                }
2418 2571
 
2419 2572
                                 $i++;
2420 2573
                             }
@@ -2456,8 +2609,9 @@  discard block
 block discarded – undo
2456 2609
                             if ($fields_location == 'detail') {
2457 2610
 
2458 2611
                                 $geodir_odd_even = 'geodir_more_info_odd';
2459
-                                if ($i % 2 == 0)
2460
-                                    $geodir_odd_even = 'geodir_more_info_even';
2612
+                                if ($i % 2 == 0) {
2613
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2614
+                                }
2461 2615
 
2462 2616
                                 $i++;
2463 2617
                             }
@@ -2477,9 +2631,10 @@  discard block
 block discarded – undo
2477 2631
                         if ($post->{$type['htmlvar_name']}):
2478 2632
 
2479 2633
                             $value = '';
2480
-                            if ($post->{$type['htmlvar_name']} != '')
2481
-                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2482
-                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2634
+                            if ($post->{$type['htmlvar_name']} != '') {
2635
+                                                            //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2636
+                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2637
+                            }
2483 2638
 
2484 2639
                             if (strpos($field_icon, 'http') !== false) {
2485 2640
                                 $field_icon_af = '';
@@ -2494,8 +2649,9 @@  discard block
 block discarded – undo
2494 2649
                             if ($fields_location == 'detail') {
2495 2650
 
2496 2651
                                 $geodir_odd_even = 'geodir_more_info_odd';
2497
-                                if ($i % 2 == 0)
2498
-                                    $geodir_odd_even = 'geodir_more_info_even';
2652
+                                if ($i % 2 == 0) {
2653
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2654
+                                }
2499 2655
 
2500 2656
                                 $i++;
2501 2657
                             }
@@ -2528,7 +2684,7 @@  discard block
 block discarded – undo
2528 2684
                             $value = '';
2529 2685
                             if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2530 2686
                                 $value = date($date_format, strtotime($post_htmlvar_value));
2531
-                            }else{
2687
+                            } else{
2532 2688
                                 continue;
2533 2689
                             }
2534 2690
 
@@ -2545,8 +2701,9 @@  discard block
 block discarded – undo
2545 2701
                             if ($fields_location == 'detail') {
2546 2702
 
2547 2703
                                 $geodir_odd_even = 'geodir_more_info_odd';
2548
-                                if ($i % 2 == 0)
2549
-                                    $geodir_odd_even = 'geodir_more_info_even';
2704
+                                if ($i % 2 == 0) {
2705
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2706
+                                }
2550 2707
 
2551 2708
                                 $i++;
2552 2709
                             }
@@ -2578,8 +2735,9 @@  discard block
 block discarded – undo
2578 2735
                             if ($fields_location == 'detail') {
2579 2736
 
2580 2737
                                 $geodir_odd_even = 'geodir_more_info_odd';
2581
-                                if ($i % 2 == 0)
2582
-                                    $geodir_odd_even = 'geodir_more_info_even';
2738
+                                if ($i % 2 == 0) {
2739
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2740
+                                }
2583 2741
 
2584 2742
                                 $i++;
2585 2743
                             }
@@ -2603,8 +2761,9 @@  discard block
 block discarded – undo
2603 2761
                             if ($fields_location == 'detail') {
2604 2762
 
2605 2763
                                 $geodir_odd_even = 'geodir_more_info_odd';
2606
-                                if ($i % 2 == 0)
2607
-                                    $geodir_odd_even = 'geodir_more_info_even';
2764
+                                if ($i % 2 == 0) {
2765
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2766
+                                }
2608 2767
 
2609 2768
                                 $i++;
2610 2769
                             }
@@ -2654,8 +2813,9 @@  discard block
 block discarded – undo
2654 2813
                             if ($fields_location == 'detail') {
2655 2814
 
2656 2815
                                 $geodir_odd_even = 'geodir_more_info_odd';
2657
-                                if ($i % 2 == 0)
2658
-                                    $geodir_odd_even = 'geodir_more_info_even';
2816
+                                if ($i % 2 == 0) {
2817
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2818
+                                }
2659 2819
 
2660 2820
                                 $i++;
2661 2821
                             }
@@ -2675,8 +2835,10 @@  discard block
 block discarded – undo
2675 2835
 
2676 2836
                             if ($post->{$type['htmlvar_name']} == '1'):
2677 2837
                                 $html_val = __('Yes', 'geodirectory');
2678
-                            else:
2679
-                                $html_val = __('No', 'geodirectory');
2838
+                            else {
2839
+                                :
2840
+                                $html_val = __('No', 'geodirectory');
2841
+                            }
2680 2842
                             endif;
2681 2843
 
2682 2844
                             if (strpos($field_icon, 'http') !== false) {
@@ -2692,8 +2854,9 @@  discard block
 block discarded – undo
2692 2854
                             if ($fields_location == 'detail') {
2693 2855
 
2694 2856
                                 $geodir_odd_even = 'geodir_more_info_odd';
2695
-                                if ($i % 2 == 0)
2696
-                                    $geodir_odd_even = 'geodir_more_info_even';
2857
+                                if ($i % 2 == 0) {
2858
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2859
+                                }
2697 2860
 
2698 2861
                                 $i++;
2699 2862
                             }
@@ -2737,8 +2900,9 @@  discard block
 block discarded – undo
2737 2900
                             if ($fields_location == 'detail') {
2738 2901
 
2739 2902
                                 $geodir_odd_even = 'geodir_more_info_odd';
2740
-                                if ($i % 2 == 0)
2741
-                                    $geodir_odd_even = 'geodir_more_info_even';
2903
+                                if ($i % 2 == 0) {
2904
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2905
+                                }
2742 2906
 
2743 2907
                                 $i++;
2744 2908
                             }
@@ -2789,8 +2953,9 @@  discard block
 block discarded – undo
2789 2953
                             if ($fields_location == 'detail') {
2790 2954
 
2791 2955
                                 $geodir_odd_even = 'geodir_more_info_odd';
2792
-                                if ($i % 2 == 0)
2793
-                                    $geodir_odd_even = 'geodir_more_info_even';
2956
+                                if ($i % 2 == 0) {
2957
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2958
+                                }
2794 2959
 
2795 2960
                                 $i++;
2796 2961
                             }
@@ -2844,8 +3009,9 @@  discard block
 block discarded – undo
2844 3009
                             if ($fields_location == 'detail') {
2845 3010
 
2846 3011
                                 $geodir_odd_even = 'geodir_more_info_odd';
2847
-                                if ($i % 2 == 0)
2848
-                                    $geodir_odd_even = 'geodir_more_info_even';
3012
+                                if ($i % 2 == 0) {
3013
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3014
+                                }
2849 3015
 
2850 3016
                                 $i++;
2851 3017
                             }
@@ -2890,8 +3056,9 @@  discard block
 block discarded – undo
2890 3056
                                 if ($fields_location == 'detail') {
2891 3057
 
2892 3058
                                     $geodir_odd_even = 'geodir_more_info_odd';
2893
-                                    if ($i % 2 == 0)
2894
-                                        $geodir_odd_even = 'geodir_more_info_even';
3059
+                                    if ($i % 2 == 0) {
3060
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3061
+                                    }
2895 3062
 
2896 3063
                                     $i++;
2897 3064
                                 }
@@ -2911,7 +3078,7 @@  discard block
 block discarded – undo
2911 3078
                                      */
2912 3079
                                     $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2913 3080
                                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
-                                }else{
3081
+                                } else{
2915 3082
                                     $html .=  $email;
2916 3083
                                 }
2917 3084
                                 $html .= '</span></div>';
@@ -2989,8 +3156,9 @@  discard block
 block discarded – undo
2989 3156
                                 if ($fields_location == 'detail') {
2990 3157
 
2991 3158
                                     $geodir_odd_even = 'geodir_more_info_odd';
2992
-                                    if ($i % 2 == 0)
2993
-                                        $geodir_odd_even = 'geodir_more_info_even';
3159
+                                    if ($i % 2 == 0) {
3160
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3161
+                                    }
2994 3162
 
2995 3163
                                     $i++;
2996 3164
                                 }
@@ -3024,8 +3192,9 @@  discard block
 block discarded – undo
3024 3192
                             if ($fields_location == 'detail') {
3025 3193
 
3026 3194
                                 $geodir_odd_even = 'geodir_more_info_odd';
3027
-                                if ($i % 2 == 0)
3028
-                                    $geodir_odd_even = 'geodir_more_info_even';
3195
+                                if ($i % 2 == 0) {
3196
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3197
+                                }
3029 3198
 
3030 3199
                                 $i++;
3031 3200
                             }
@@ -3053,8 +3222,9 @@  discard block
 block discarded – undo
3053 3222
                             if ($fields_location == 'detail') {
3054 3223
 
3055 3224
                                 $geodir_odd_even = 'geodir_more_info_odd';
3056
-                                if ($i % 2 == 0)
3057
-                                    $geodir_odd_even = 'geodir_more_info_even';
3225
+                                if ($i % 2 == 0) {
3226
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3227
+                                }
3058 3228
 
3059 3229
                                 $i++;
3060 3230
                             }
@@ -3149,7 +3319,9 @@  discard block
 block discarded – undo
3149 3319
                      * @param string $html Custom field unfiltered HTML.
3150 3320
                      * @param array $variables_array Custom field variables array.
3151 3321
                      */
3152
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3322
+                    if ($html) {
3323
+                        echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3324
+                    }
3153 3325
 
3154 3326
                     /**
3155 3327
                      * Called after a custom fields is output on the frontend.
@@ -3183,10 +3355,11 @@  discard block
 block discarded – undo
3183 3355
 	 */
3184 3356
 	function geodir_default_date_format()
3185 3357
     {
3186
-        if ($format = get_option('date_format'))
3187
-            return $format;
3188
-        else
3189
-            return 'dd-mm-yy';
3358
+        if ($format = get_option('date_format')) {
3359
+                    return $format;
3360
+        } else {
3361
+                    return 'dd-mm-yy';
3362
+        }
3190 3363
     }
3191 3364
 }
3192 3365
 
@@ -3293,11 +3466,13 @@  discard block
 block discarded – undo
3293 3466
                     // Set an array containing a list of acceptable formats
3294 3467
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3295 3468
 
3296
-					if (!function_exists('wp_handle_upload'))
3297
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3469
+					if (!function_exists('wp_handle_upload')) {
3470
+											require_once(ABSPATH . 'wp-admin/includes/file.php');
3471
+					}
3298 3472
 
3299
-					if (!is_dir($geodir_uploadpath))
3300
-						mkdir($geodir_uploadpath);
3473
+					if (!is_dir($geodir_uploadpath)) {
3474
+											mkdir($geodir_uploadpath);
3475
+					}
3301 3476
 
3302 3477
 					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303 3478
 					$explode_sub_dir = explode("/", $sub_dir);
@@ -3310,16 +3485,19 @@  discard block
 block discarded – undo
3310 3485
 					}
3311 3486
 
3312 3487
 					$uploaded_file = '';
3313
-					if (file_exists($img_path))
3314
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3488
+					if (file_exists($img_path)) {
3489
+											$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3490
+					}
3315 3491
 
3316 3492
 					if ($curr_img_dir != $geodir_uploaddir) {
3317
-						if (file_exists($img_path))
3318
-							unlink($img_path);
3493
+						if (file_exists($img_path)) {
3494
+													unlink($img_path);
3495
+						}
3319 3496
 					}
3320 3497
 
3321
-					if (!empty($uploaded_file))
3322
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3498
+					if (!empty($uploaded_file)) {
3499
+											$file_urls = $geodir_uploadurl . '/' . $new_name;
3500
+					}
3323 3501
 
3324 3502
                 } else {
3325 3503
                     $file_urls = $post_image[$m];
@@ -3340,8 +3518,9 @@  discard block
 block discarded – undo
3340 3518
 
3341 3519
         geodir_save_post_meta($post_id, $field_id, $file_urls);
3342 3520
 
3343
-        if (!empty($invalid_files))
3344
-            geodir_remove_attachments($invalid_files);
3521
+        if (!empty($invalid_files)) {
3522
+                    geodir_remove_attachments($invalid_files);
3523
+        }
3345 3524
 
3346 3525
     }
3347 3526
 }
@@ -3567,8 +3746,9 @@  discard block
 block discarded – undo
3567 3746
 
3568 3747
         $all_postypes = geodir_get_posttypes();
3569 3748
 
3570
-        if (!in_array($post_type, $all_postypes))
3571
-            return false;
3749
+        if (!in_array($post_type, $all_postypes)) {
3750
+                    return false;
3751
+        }
3572 3752
 
3573 3753
         $fields = array();
3574 3754
 
@@ -3656,8 +3836,10 @@  discard block
 block discarded – undo
3656 3836
         }
3657 3837
 
3658 3838
         return $field_ids;
3659
-    else:
3660
-        return false;
3839
+    else {
3840
+        :
3841
+        return false;
3842
+    }
3661 3843
     endif;
3662 3844
 }
3663 3845
 
@@ -3830,8 +4012,9 @@  discard block
 block discarded – undo
3830 4012
 
3831 4013
             return $field_id;
3832 4014
 
3833
-        } else
3834
-            return 0;
4015
+        } else {
4016
+                    return 0;
4017
+        }
3835 4018
 
3836 4019
     }
3837 4020
 }
@@ -3873,8 +4056,9 @@  discard block
 block discarded – undo
3873 4056
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3874 4057
 
3875 4058
         $site_title = '';
3876
-        if ($site_title == '')
3877
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4059
+        if ($site_title == '') {
4060
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4061
+        }
3878 4062
 
3879 4063
         if ($site_title == '') {
3880 4064
             $fields = geodir_get_custom_sort_options($post_type);
@@ -3888,8 +4072,9 @@  discard block
 block discarded – undo
3888 4072
             }
3889 4073
         }
3890 4074
 
3891
-        if ($htmlvar_name == '')
3892
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4075
+        if ($htmlvar_name == '') {
4076
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4077
+        }
3893 4078
 
3894 4079
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3895 4080
         
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
  * @param array $package_info Package info array.
154 154
  * @param object|string $post The post object.
155 155
  * @param string $post_type The post type.
156
- * @return object Returns filtered package info as an object.
156
+ * @return string Returns filtered package info as an object.
157 157
  */
158 158
 function geodir_post_package_info($package_info, $post = '', $post_type = '')
159 159
 {
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Custom functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Custom functions
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Front end listing view template selection.
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function geodir_list_view_select() {
20 20
     global $gd_session;
21
-	?>
21
+    ?>
22 22
     <script type="text/javascript">
23 23
 	function geodir_list_view_select(list) {
24 24
 		//alert(listval);
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
     }
93 93
     $out = '';
94 94
 	
95
-	$temp_post = $post;
96
-	$excerpt = get_the_excerpt();
95
+    $temp_post = $post;
96
+    $excerpt = get_the_excerpt();
97 97
 
98 98
     $charlength++;
99 99
     $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             $out .= $excerpt;
141 141
         }
142 142
     }
143
-	$post = $temp_post;
143
+    $post = $temp_post;
144 144
 
145 145
     return $out;
146 146
 }
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
 {
586 586
     global $wp_query;
587 587
 	
588
-	/**
589
-	 * On search pages there should be no sort options, sorting is done by search criteria.
590
-	 *
591
-	 * @since 1.4.4
592
-	 */
593
-	if ( is_search() ) {
594
-		return;
595
-	}
588
+    /**
589
+     * On search pages there should be no sort options, sorting is done by search criteria.
590
+     *
591
+     * @since 1.4.4
592
+     */
593
+    if ( is_search() ) {
594
+        return;
595
+    }
596 596
 
597 597
     $sort_by = '';
598 598
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
     if (!empty($sort_options)) {
609 609
         foreach ($sort_options as $sort) {
610
-			$sort = stripslashes_deep($sort); // strip slashes
610
+            $sort = stripslashes_deep($sort); // strip slashes
611 611
 
612 612
             $label = __($sort->site_title, 'geodirectory');
613 613
 
@@ -760,34 +760,34 @@  discard block
 block discarded – undo
760 760
 
761 761
         /* --- return false in invalid request --- */
762 762
 
763
-       $location_url = '';
763
+        $location_url = '';
764 764
         if ($add_location_filter != '0') {
765 765
             $location_url = array();
766
-			$geodir_show_location_url = get_option('geodir_show_location_url');
766
+            $geodir_show_location_url = get_option('geodir_show_location_url');
767 767
 			
768
-			$gd_city = get_query_var('gd_city');
768
+            $gd_city = get_query_var('gd_city');
769 769
 			
770
-			if ($gd_city) {
771
-				$gd_country = get_query_var('gd_country');
772
-				$gd_region = get_query_var('gd_region');
770
+            if ($gd_city) {
771
+                $gd_country = get_query_var('gd_country');
772
+                $gd_region = get_query_var('gd_region');
773 773
             } else {
774 774
                 $location = geodir_get_default_location();
775 775
 				
776
-				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
777
-				$gd_region = isset($location->region_slug) ? $location->region_slug : '';
778
-				$gd_city = isset($location->city_slug) ? $location->city_slug : '';
776
+                $gd_country = isset($location->country_slug) ? $location->country_slug : '';
777
+                $gd_region = isset($location->region_slug) ? $location->region_slug : '';
778
+                $gd_city = isset($location->city_slug) ? $location->city_slug : '';
779 779
             }
780 780
 			
781
-			if ($geodir_show_location_url == 'all') {
782
-				$location_url[] = $gd_country;
783
-				$location_url[] = $gd_region;
784
-			} else if ($geodir_show_location_url == 'country_city') {
785
-				$location_url[] = $gd_country;
786
-			} else if ($geodir_show_location_url == 'region_city') {
787
-				$location_url[] = $gd_region;
788
-			}
781
+            if ($geodir_show_location_url == 'all') {
782
+                $location_url[] = $gd_country;
783
+                $location_url[] = $gd_region;
784
+            } else if ($geodir_show_location_url == 'country_city') {
785
+                $location_url[] = $gd_country;
786
+            } else if ($geodir_show_location_url == 'region_city') {
787
+                $location_url[] = $gd_region;
788
+            }
789 789
 			
790
-			$location_url[] = $gd_city;
790
+            $location_url[] = $gd_city;
791 791
 
792 792
             $location_url = implode('/', $location_url);
793 793
         }
@@ -946,18 +946,18 @@  discard block
 block discarded – undo
946 946
         return;
947 947
     }// if non GD page, bail
948 948
 
949
-	$use_gd_meta = true;
950
-	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
951
-		$use_gd_meta = false;
949
+    $use_gd_meta = true;
950
+    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
951
+        $use_gd_meta = false;
952 952
 		
953
-		if (geodir_is_page('search')) {
954
-			$use_gd_meta = true;
955
-		}
956
-	}
953
+        if (geodir_is_page('search')) {
954
+            $use_gd_meta = true;
955
+        }
956
+    }
957 957
 	
958
-	if (!$use_gd_meta) {
959
-		return;
960
-	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
958
+    if (!$use_gd_meta) {
959
+        return;
960
+    }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
961 961
 
962 962
     $current_term = $wp_query->get_queried_object();
963 963
 
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 			jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
52 52
 		}
53 53
 
54
-		jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
54
+		jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
55 55
 			//alert(data );
56 56
 		});
57 57
 	}
58 58
     </script>
59 59
     <div class="geodir-list-view-select">
60 60
         <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
61
-            <?php $listing_view = (int)$gd_session->get('gd_listing_view'); ?>
62
-            <option value=""><?php _e('View:', 'geodirectory');?></option>
63
-            <option value="1" <?php selected(1, $listing_view);?>><?php _e('View: List', 'geodirectory');?></option>
64
-            <option value="2" <?php selected(2, $listing_view);?>><?php _e('View: Grid 2', 'geodirectory');?></option>
65
-            <option value="3" <?php selected(3, $listing_view);?>><?php _e('View: Grid 3', 'geodirectory');?></option>
66
-            <option value="4" <?php selected(4, $listing_view);?>><?php _e('View: Grid 4', 'geodirectory');?></option>
67
-            <option value="5" <?php selected(5, $listing_view);?>><?php _e('View: Grid 5', 'geodirectory');?></option>
61
+            <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
62
+            <option value=""><?php _e('View:', 'geodirectory'); ?></option>
63
+            <option value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
64
+            <option value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
65
+            <option value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
66
+            <option value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
67
+            <option value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
68 68
         </select>
69 69
     </div>
70 70
 <?php
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param object|string $post The post object.
185 185
      * @param string $post_type The post type.
186 186
      */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
187
+    return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // strip slashes message
299 299
         $client_message = stripslashes_deep($client_message);
300 300
 
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
301
+        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
302 302
     }
303 303
 
304 304
     /**
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * }
404 404
      */
405 405
     do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
406
+    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
407 407
 
408 408
     /**
409 409
      * Called after the send to friend email is sent.
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @since 1.4.4
592 592
 	 */
593
-	if ( is_search() ) {
593
+	if (is_search()) {
594 594
 		return;
595 595
 	}
596 596
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             if ($sort->field_type == 'random') {
615 615
                 $key = $sort->field_type;
616 616
                 ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
617
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
617
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
618 618
             }
619 619
 
620 620
             if ($sort->htmlvar_name == 'comment_count') {
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                 if ($sort->asc_title)
628 628
                     $label = $sort->asc_title;
629 629
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
630
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
630
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
631 631
             }
632 632
 
633 633
             if ($sort->sort_desc) {
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
                 if ($sort->desc_title)
637 637
                     $label = $sort->desc_title;
638 638
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
639
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
639
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
640 640
             }
641 641
 
642 642
         }
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
652 652
 
653 653
                 <option
654
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
654
+                    value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') echo 'selected="selected"'; ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
655 655
 
656
-                echo $sort_field_options;?>
656
+                echo $sort_field_options; ?>
657 657
 
658 658
             </select>
659 659
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
         $category = array();
723 723
 
724 724
         if (isset($_REQUEST['backandedit'])) {
725
-            $post = (object)$gd_session->get('listing');
725
+            $post = (object) $gd_session->get('listing');
726 726
             $post_type = $post->listing_type;
727 727
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
728 728
                 $post_id = $_REQUEST['pid'];
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
             if ($add_location_filter != '0') {
800 800
                 $geodir_add_location_url = '1';
801 801
             }
802
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
802
+            $viewall_url = get_term_link((int) $category[0], $post_type . $category_taxonomy);
803 803
             $geodir_add_location_url = NULL;
804 804
         }
805 805
         ob_start();
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
         $geodir_post_category_str = serialize($geodir_post_category_str);
897 897
     }
898 898
 
899
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
899
+    $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
900 900
     $script = "var post_category_array = " . json_encode($all_var) . ';';
901 901
     echo '<script>';
902 902
     echo $script;
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
     $location_id = NULL;
1030 1030
     if ($geodir_location_manager) {
1031 1031
         $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1032
-        $location_id = (int)$wpdb->get_var($sql);
1032
+        $location_id = (int) $wpdb->get_var($sql);
1033 1033
         $location_type = geodir_what_is_current_location();
1034 1034
         if ($location_type == 'city') {
1035 1035
             $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
@@ -1090,45 +1090,45 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
 
1092 1092
     $gd_page = '';
1093
-    if(geodir_is_page('home')){
1093
+    if (geodir_is_page('home')) {
1094 1094
         $gd_page = 'home';
1095 1095
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1096 1096
     }
1097
-    elseif(geodir_is_page('detail')){
1097
+    elseif (geodir_is_page('detail')) {
1098 1098
         $gd_page = 'detail';
1099 1099
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1100 1100
     }
1101
-    elseif(geodir_is_page('pt')){
1101
+    elseif (geodir_is_page('pt')) {
1102 1102
         $gd_page = 'pt';
1103 1103
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1104 1104
     }
1105
-    elseif(geodir_is_page('listing')){
1105
+    elseif (geodir_is_page('listing')) {
1106 1106
         $gd_page = 'listing';
1107 1107
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1108 1108
     }
1109
-    elseif(geodir_is_page('location')){
1109
+    elseif (geodir_is_page('location')) {
1110 1110
         $gd_page = 'location';
1111 1111
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1112 1112
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1113 1113
 
1114 1114
     }
1115
-    elseif(geodir_is_page('search')){
1115
+    elseif (geodir_is_page('search')) {
1116 1116
         $gd_page = 'search';
1117 1117
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1118 1118
     }
1119
-    elseif(geodir_is_page('add-listing')){
1119
+    elseif (geodir_is_page('add-listing')) {
1120 1120
         $gd_page = 'add-listing';
1121 1121
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1122 1122
     }
1123
-    elseif(geodir_is_page('author')){
1123
+    elseif (geodir_is_page('author')) {
1124 1124
         $gd_page = 'author';
1125 1125
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1126 1126
     }
1127
-    elseif(geodir_is_page('login')){
1127
+    elseif (geodir_is_page('login')) {
1128 1128
         $gd_page = 'login';
1129 1129
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1130 1130
     }
1131
-    elseif(geodir_is_page('listing-success')){
1131
+    elseif (geodir_is_page('listing-success')) {
1132 1132
         $gd_page = 'listing-success';
1133 1133
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1134 1134
     }
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
          * @param string $title The page description including variables.
1157 1157
          * @param string $gd_page The GeoDirectory page type if any.
1158 1158
          */
1159
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1159
+        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1160 1160
 
1161 1161
         /**
1162 1162
          * Filter SEO meta description.
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
         $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1173 1173
         $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1174 1174
 
1175
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1175
+        $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1176 1176
     } else {
1177 1177
         $posttags = get_the_tags();
1178 1178
         if ($posttags) {
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
     global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1364 1364
 
1365
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1366
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1365
+    $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1366
+    $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1367 1367
     $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1368 1368
 
1369 1369
     if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
         if (!empty($post_images)) {
1399 1399
             foreach ($post_images as $image) {
1400 1400
                 $caption = (!empty($image->caption)) ? $image->caption : '';
1401
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1401
+                $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1402 1402
                 $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1403 1403
                 $thumb_image .= '</a>';
1404 1404
             }
@@ -1477,12 +1477,12 @@  discard block
 block discarded – undo
1477 1477
     }
1478 1478
 
1479 1479
 
1480
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1480
+    $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1481 1481
 
1482 1482
     $active_tab_name = '';
1483
-    foreach($arr_detail_page_tabs as $tabs){
1484
-        if(isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']){
1485
-            $active_tab_name = __($tabs['heading_text'],'geodirectory');
1483
+    foreach ($arr_detail_page_tabs as $tabs) {
1484
+        if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']) {
1485
+            $active_tab_name = __($tabs['heading_text'], 'geodirectory');
1486 1486
         }
1487 1487
     }
1488 1488
     ?>
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 
1492 1492
         <div id="geodir-tab-mobile-menu" >
1493 1493
             <i class="fa fa-bars"></i>
1494
-            <span class="geodir-mobile-active-tab"><?php echo $active_tab_name;?></span>
1494
+            <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
1495 1495
             <i class="fa fa-sort-desc"></i>
1496 1496
         </div>
1497 1497
 
@@ -1511,18 +1511,18 @@  discard block
 block discarded – undo
1511 1511
                 if ($detail_page_tab['is_display']) {
1512 1512
                     ?>
1513 1513
                     <dt></dt> <!-- added to comply with validation -->
1514
-                    <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php }?> >
1515
-                        <a data-tab="#<?php echo $tab_index;?>"
1516
-                           data-status="enable"><?php _e($detail_page_tab['heading_text'],'geodirectory');?></a>
1514
+                    <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php }?> >
1515
+                        <a data-tab="#<?php echo $tab_index; ?>"
1516
+                           data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1517 1517
                     </dd>
1518 1518
 
1519 1519
                     <?php
1520 1520
                     ob_start() // start tab content buffering
1521 1521
                     ?>
1522
-                    <li id="<?php echo $tab_index;?>Tab" <?php if ($tab_index == 'post_profile') {
1522
+                    <li id="<?php echo $tab_index; ?>Tab" <?php if ($tab_index == 'post_profile') {
1523 1523
                         //echo 'itemprop="description"';
1524 1524
                     }?>>
1525
-                        <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1525
+                        <div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1526 1526
                         <?php
1527 1527
                         /**
1528 1528
                          * Called before the details tab content is output per tab.
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
                                 break;
1573 1573
                             case 'post_video':
1574 1574
                                 /** This action is documented in geodirectory_template_actions.php */
1575
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1575
+                                echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1576 1576
                                 break;
1577 1577
                             case 'special_offers':
1578 1578
                                 echo wpautop(stripslashes($special_offers));
@@ -1885,9 +1885,9 @@  discard block
 block discarded – undo
1885 1885
             $comments_echo .= "</span>\n";
1886 1886
 
1887 1887
             $comments_echo .= '<span class="geodir_reviewer_content">';
1888
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1888
+            if ($comment->user_id) {$comments_echo .= '<a href="' . get_author_posts_url($comment->user_id) . '">'; }
1889 1889
             $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1890
-            if($comment->user_id){$comments_echo .= '</a>';}
1890
+            if ($comment->user_id) {$comments_echo .= '</a>'; }
1891 1891
             $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1892 1892
             $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
1893 1893
             $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
@@ -1918,7 +1918,7 @@  discard block
 block discarded – undo
1918 1918
     if (!empty($post_types)) {
1919 1919
         foreach ($post_types as $key => $post_type) {
1920 1920
             $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
1921
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
1921
+            $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
1922 1922
             $taxonomies = geodir_get_taxonomies($key);
1923 1923
             $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
1924 1924
             $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
@@ -2025,10 +2025,10 @@  discard block
 block discarded – undo
2025 2025
             stWidget.addEntry({
2026 2026
                 "service": "sharethis",
2027 2027
                 "element": document.getElementById('st_sharethis'),
2028
-                "url": "<?php echo geodir_curPageURL();?>",
2029
-                "title": "<?php echo $post->post_title;?>",
2028
+                "url": "<?php echo geodir_curPageURL(); ?>",
2029
+                "title": "<?php echo $post->post_title; ?>",
2030 2030
                 "type": "chicklet",
2031
-                "text": "<?php _e( 'Share', 'geodirectory' );?>"
2031
+                "text": "<?php _e('Share', 'geodirectory'); ?>"
2032 2032
             });</script>
2033 2033
 
2034 2034
     </div>
Please login to merge, or discard this patch.
Braces   +61 added lines, -50 removed lines patch added patch discarded remove patch
@@ -526,13 +526,15 @@  discard block
 block discarded – undo
526 526
 
527 527
         $all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+        if (!in_array($post_type, $all_postypes)) {
530
+                    return false;
531
+        }
531 532
 
532 533
         $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 534
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
535
+        if (!empty($sort_field_info)) {
536
+                    return $sort_field_info;
537
+        }
536 538
 
537 539
     }
538 540
 
@@ -556,8 +558,9 @@  discard block
 block discarded – undo
556 558
 
557 559
         $all_postypes = geodir_get_posttypes();
558 560
 
559
-        if (!in_array($post_type, $all_postypes))
560
-            return false;
561
+        if (!in_array($post_type, $all_postypes)) {
562
+                    return false;
563
+        }
561 564
 
562 565
 
563 566
         $sort_field_info = $wpdb->get_results($wpdb->prepare("select * from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and (sort_asc=1 ||	sort_desc=1 || field_type='random') order by sort_order asc", array($post_type, 1)));
@@ -596,7 +599,9 @@  discard block
 block discarded – undo
596 599
 
597 600
     $sort_by = '';
598 601
 
599
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
602
+    if (isset($_REQUEST['sort_by'])) {
603
+        $sort_by = $_REQUEST['sort_by'];
604
+    }
600 605
 
601 606
     $gd_post_type = geodir_get_current_posttype();
602 607
 
@@ -624,8 +629,9 @@  discard block
 block discarded – undo
624 629
             if ($sort->sort_asc) {
625 630
                 $key = $sort->htmlvar_name . '_asc';
626 631
                 $label = $sort->site_title;
627
-                if ($sort->asc_title)
628
-                    $label = $sort->asc_title;
632
+                if ($sort->asc_title) {
633
+                                    $label = $sort->asc_title;
634
+                }
629 635
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
630 636
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
631 637
             }
@@ -633,8 +639,9 @@  discard block
 block discarded – undo
633 639
             if ($sort->sort_desc) {
634 640
                 $key = $sort->htmlvar_name . '_desc';
635 641
                 $label = $sort->site_title;
636
-                if ($sort->desc_title)
637
-                    $label = $sort->desc_title;
642
+                if ($sort->desc_title) {
643
+                                    $label = $sort->desc_title;
644
+                }
638 645
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
639 646
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
640 647
             }
@@ -651,7 +658,10 @@  discard block
 block discarded – undo
651 658
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
652 659
 
653 660
                 <option
654
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
661
+                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') {
662
+    echo 'selected="selected"';
663
+}
664
+?>><?php _e('Sort By', 'geodirectory');?></option><?php
655 665
 
656 666
                 echo $sort_field_options;?>
657 667
 
@@ -724,8 +734,9 @@  discard block
 block discarded – undo
724 734
         if (isset($_REQUEST['backandedit'])) {
725 735
             $post = (object)$gd_session->get('listing');
726 736
             $post_type = $post->listing_type;
727
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
728
-                $post_id = $_REQUEST['pid'];
737
+            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
738
+                            $post_id = $_REQUEST['pid'];
739
+            }
729 740
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
730 741
             $post = geodir_get_post_info($_REQUEST['pid']);
731 742
             $post_type = $post->post_type;
@@ -738,25 +749,29 @@  discard block
 block discarded – undo
738 749
         if ($relate_to == 'category') {
739 750
 
740 751
             $category_taxonomy = $post_type . $relate_to;
741
-            if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '')
742
-                $category = explode(',', trim($post->$category_taxonomy, ','));
752
+            if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '') {
753
+                            $category = explode(',', trim($post->$category_taxonomy, ','));
754
+            }
743 755
 
744 756
         } elseif ($relate_to == 'tags') {
745 757
 
746 758
             $category_taxonomy = $post_type . '_' . $relate_to;
747
-            if ($post->post_tags != '')
748
-                $category = explode(',', trim($post->post_tags, ','));
759
+            if ($post->post_tags != '') {
760
+                            $category = explode(',', trim($post->post_tags, ','));
761
+            }
749 762
             $tax_field = 'name';
750 763
         }
751 764
 
752 765
         /* --- return false in invalid request --- */
753
-        if (empty($category))
754
-            return false;
766
+        if (empty($category)) {
767
+                    return false;
768
+        }
755 769
 
756 770
         $all_postypes = geodir_get_posttypes();
757 771
 
758
-        if (!in_array($post_type, $all_postypes))
759
-            return false;
772
+        if (!in_array($post_type, $all_postypes)) {
773
+                    return false;
774
+        }
760 775
 
761 776
         /* --- return false in invalid request --- */
762 777
 
@@ -914,8 +929,9 @@  discard block
 block discarded – undo
914 929
 function geodir_get_map_default_language()
915 930
 {
916 931
     $geodir_default_map_language = get_option('geodir_default_map_language');
917
-    if (empty($geodir_default_map_language))
918
-        $geodir_default_map_language = 'en';
932
+    if (empty($geodir_default_map_language)) {
933
+            $geodir_default_map_language = 'en';
934
+    }
919 935
     /**
920 936
      * Filter default map language.
921 937
      *
@@ -1093,42 +1109,33 @@  discard block
 block discarded – undo
1093 1109
     if(geodir_is_page('home')){
1094 1110
         $gd_page = 'home';
1095 1111
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1096
-    }
1097
-    elseif(geodir_is_page('detail')){
1112
+    } elseif(geodir_is_page('detail')){
1098 1113
         $gd_page = 'detail';
1099 1114
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1100
-    }
1101
-    elseif(geodir_is_page('pt')){
1115
+    } elseif(geodir_is_page('pt')){
1102 1116
         $gd_page = 'pt';
1103 1117
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1104
-    }
1105
-    elseif(geodir_is_page('listing')){
1118
+    } elseif(geodir_is_page('listing')){
1106 1119
         $gd_page = 'listing';
1107 1120
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1108
-    }
1109
-    elseif(geodir_is_page('location')){
1121
+    } elseif(geodir_is_page('location')){
1110 1122
         $gd_page = 'location';
1111 1123
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1112 1124
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1113 1125
 
1114
-    }
1115
-    elseif(geodir_is_page('search')){
1126
+    } elseif(geodir_is_page('search')){
1116 1127
         $gd_page = 'search';
1117 1128
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1118
-    }
1119
-    elseif(geodir_is_page('add-listing')){
1129
+    } elseif(geodir_is_page('add-listing')){
1120 1130
         $gd_page = 'add-listing';
1121 1131
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1122
-    }
1123
-    elseif(geodir_is_page('author')){
1132
+    } elseif(geodir_is_page('author')){
1124 1133
         $gd_page = 'author';
1125 1134
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1126
-    }
1127
-    elseif(geodir_is_page('login')){
1135
+    } elseif(geodir_is_page('login')){
1128 1136
         $gd_page = 'login';
1129 1137
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1130
-    }
1131
-    elseif(geodir_is_page('listing-success')){
1138
+    } elseif(geodir_is_page('listing-success')){
1132 1139
         $gd_page = 'listing-success';
1133 1140
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1134 1141
     }
@@ -1336,8 +1343,9 @@  discard block
 block discarded – undo
1336 1343
     $tabs_array = geodir_detail_page_tabs_array();
1337 1344
     if (!empty($tabs_excluded)) {
1338 1345
         foreach ($tabs_excluded as $tab) {
1339
-            if (array_key_exists($tab, $tabs_array))
1340
-                unset($tabs_array[$tab]);
1346
+            if (array_key_exists($tab, $tabs_array)) {
1347
+                            unset($tabs_array[$tab]);
1348
+            }
1341 1349
         }
1342 1350
     }
1343 1351
     return $tabs_array;
@@ -1378,8 +1386,9 @@  discard block
 block discarded – undo
1378 1386
         $video = geodir_get_video($post->ID);
1379 1387
         $special_offers = geodir_get_special_offers($post->ID);
1380 1388
         $related_listing_array = array();
1381
-        if (get_option('geodir_add_related_listing_posttypes'))
1382
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1389
+        if (get_option('geodir_add_related_listing_posttypes')) {
1390
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1391
+        }
1383 1392
 
1384 1393
         $related_listing = '';
1385 1394
         if (in_array($post->post_type, $related_listing_array)) {
@@ -1428,11 +1437,13 @@  discard block
 block discarded – undo
1428 1437
         $video = isset($post->geodir_video) ? $post->geodir_video : '';
1429 1438
         $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1430 1439
 
1431
-        if (isset($post->post_images))
1432
-            $post->post_images = trim($post->post_images, ",");
1440
+        if (isset($post->post_images)) {
1441
+                    $post->post_images = trim($post->post_images, ",");
1442
+        }
1433 1443
 
1434
-        if (isset($post->post_images) && !empty($post->post_images))
1435
-            $post_images = explode(",", $post->post_images);
1444
+        if (isset($post->post_images) && !empty($post->post_images)) {
1445
+                    $post_images = explode(",", $post->post_images);
1446
+        }
1436 1447
 
1437 1448
         $thumb_image = '';
1438 1449
         if (!empty($post_images)) {
Please login to merge, or discard this patch.
geodirectory-functions/custom_taxonomy_hooks_actions.php 4 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
  * @global wpdb $wpdb WordPress database abstraction object.
326 326
  * @deprecated 1.5.0 No longer required.
327 327
  * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
328
- * @return array Rewrite rules.
328
+ * @return string Rewrite rules.
329 329
  */
330 330
 function geodir_htaccess_contents($rules)
331 331
 {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
  * @since 1.0.0
351 351
  *
352 352
  * @param array $public_query_vars The array of query variables.
353
- * @return array Query variables.
353
+ * @return string[] Query variables.
354 354
  */
355 355
 function geodir_add_location_var($public_query_vars)
356 356
 {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
  * @since 1.0.0
367 367
  *
368 368
  * @param array $public_query_vars The array of query variables.
369
- * @return array Query variables.
369
+ * @return string[] Query variables.
370 370
  */
371 371
 function geodir_add_geodir_page_var($public_query_vars)
372 372
 {
@@ -793,7 +793,6 @@  discard block
 block discarded – undo
793 793
  *
794 794
  * @since 1.0.0
795 795
  *
796
- * @param object $wp The WordPress object.
797 796
  */
798 797
 function geodir_custom_post_status()
799 798
 {
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Geodirectory custom post types/taxonomies related functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Geodirectory custom post types/taxonomies related functions.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Register the texonomies.
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 function geodir_post_type_args_modify($args, $post_type)
102 102
 {
103 103
     $geodir_location_prefix = isset($_REQUEST['geodir_location_prefix']) ? trim($_REQUEST['geodir_location_prefix']) : get_option('geodir_location_prefix');
104
-	if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
104
+    if (isset($_REQUEST['geodir_listing_prefix']) && $_REQUEST['geodir_listing_prefix'] != '' && geodir_strtolower($_REQUEST['geodir_listing_prefix']) != geodir_strtolower($geodir_location_prefix)) {
105 105
 
106 106
         $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
107 107
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     $taxonomies = get_option('geodir_taxonomies');
199 199
     $detail_url_seprator = get_option('geodir_detailurl_separator');
200 200
     
201
-	// create rules for post listing
201
+    // create rules for post listing
202 202
     if (is_array($taxonomies)):
203 203
         foreach ($taxonomies as $taxonomy => $args):
204 204
             $post_type = $args['object_type'];
@@ -224,47 +224,47 @@  discard block
 block discarded – undo
224 224
     if (!isset($location_prefix))
225 225
         $location_prefix = 'location';
226 226
 
227
-	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
228
-	if ($location_manager) {
229
-		$hide_country_part = get_option('geodir_location_hide_country_part');
230
-		$hide_region_part = get_option('geodir_location_hide_region_part');
231
-	}
232
-	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
227
+    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
228
+    if ($location_manager) {
229
+        $hide_country_part = get_option('geodir_location_hide_country_part');
230
+        $hide_region_part = get_option('geodir_location_hide_region_part');
231
+    }
232
+    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
233 233
 	
234
-	if ($location_manager && ($hide_country_part || $hide_region_part)) {
235
-		$matches2 = '';
236
-		$matches1 = '';
234
+    if ($location_manager && ($hide_country_part || $hide_region_part)) {
235
+        $matches2 = '';
236
+        $matches1 = '';
237 237
 		
238
-		if (!$hide_country_part && $hide_region_part) { // country/city
239
-			$matches1 = 'gd_country';
240
-			$matches2 = 'gd_city';
241
-		} else if ($hide_country_part && !$hide_region_part) { // region/city
242
-			$matches1 = 'gd_region';
243
-			$matches2 = 'gd_city';
244
-		} else { // city
245
-			$matches1 = 'gd_city';
246
-		}
238
+        if (!$hide_country_part && $hide_region_part) { // country/city
239
+            $matches1 = 'gd_country';
240
+            $matches2 = 'gd_city';
241
+        } else if ($hide_country_part && !$hide_region_part) { // region/city
242
+            $matches1 = 'gd_region';
243
+            $matches2 = 'gd_city';
244
+        } else { // city
245
+            $matches1 = 'gd_city';
246
+        }
247 247
 		
248
-		if ($matches2) {
249
-			if ($neighbourhood_active) {
250
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
251
-			}
252
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
253
-		} else {
254
-			if ($neighbourhood_active) {
255
-				$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
256
-			}
257
-		}
248
+        if ($matches2) {
249
+            if ($neighbourhood_active) {
250
+                $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
251
+            }
252
+            $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
253
+        } else {
254
+            if ($neighbourhood_active) {
255
+                $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
256
+            }
257
+        }
258 258
 		
259
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]';
260
-	} else { // country/region/city
261
-		if ($neighbourhood_active) {
262
-			$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
263
-		}
264
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
265
-		$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]';
266
-		$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
267
-	}
259
+        $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&' . $matches1 . '=$matches[1]';
260
+    } else { // country/region/city
261
+        if ($neighbourhood_active) {
262
+            $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
263
+        }
264
+        $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
265
+        $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]&gd_region=$matches[2]';
266
+        $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $location_page . '&gd_country=$matches[1]';
267
+    }
268 268
 
269 269
     if ($location_page && function_exists('icl_object_id')) {
270 270
         foreach(icl_get_languages('skip_missing=N') as $lang){
@@ -273,40 +273,40 @@  discard block
 block discarded – undo
273 273
             if($alt_page_id){
274 274
                 $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
275 275
 
276
-				if ($location_manager && ($hide_country_part || $hide_region_part)) {
277
-					$matches2 = '';
278
-					$matches1 = '';
276
+                if ($location_manager && ($hide_country_part || $hide_region_part)) {
277
+                    $matches2 = '';
278
+                    $matches1 = '';
279 279
 					
280
-					if (!$hide_country_part && $hide_region_part) { // country/city
281
-						$matches1 = 'gd_country';
282
-						$matches2 = 'gd_city';
283
-					} else if ($hide_country_part && !$hide_region_part) { // region/city
284
-						$matches1 = 'gd_region';
285
-						$matches2 = 'gd_city';
286
-					} else { // city
287
-						$matches1 = 'gd_city';
288
-					}
280
+                    if (!$hide_country_part && $hide_region_part) { // country/city
281
+                        $matches1 = 'gd_country';
282
+                        $matches2 = 'gd_city';
283
+                    } else if ($hide_country_part && !$hide_region_part) { // region/city
284
+                        $matches1 = 'gd_region';
285
+                        $matches2 = 'gd_city';
286
+                    } else { // city
287
+                        $matches1 = 'gd_city';
288
+                    }
289 289
 					
290
-					if ($matches2) {
291
-						if ($neighbourhood_active) {
292
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
293
-						}
294
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
295
-					} else {
296
-						if ($neighbourhood_active) {
297
-							$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
298
-						}
299
-					}
290
+                    if ($matches2) {
291
+                        if ($neighbourhood_active) {
292
+                            $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]&gd_neighbourhood=$matches[3]';
293
+                        }
294
+                        $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&' . $matches2 . '=$matches[2]';
295
+                    } else {
296
+                        if ($neighbourhood_active) {
297
+                            $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]&gd_neighbourhood=$matches[2]';
298
+                        }
299
+                    }
300 300
 					
301
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]';
302
-				} else { // country/region/city
303
-					if ($neighbourhood_active) {
304
-						$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
305
-					}
306
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
307
-					$newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
308
-					$newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
309
-				}
301
+                    $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&' . $matches1 . '=$matches[1]';
302
+                } else { // country/region/city
303
+                    if ($neighbourhood_active) {
304
+                        $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]&gd_neighbourhood=$matches[4]';
305
+                    }
306
+                    $newrules[$location_prefix . '/([^/]+)/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]&gd_city=$matches[3]';
307
+                    $newrules[$location_prefix . '/([^/]+)/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]&gd_region=$matches[2]';
308
+                    $newrules[$location_prefix . '/([^/]+)/?$'] = 'index.php?page_id=' . $alt_page_id . '&gd_country=$matches[1]';
309
+                }
310 310
             }
311 311
         }
312 312
     }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
  * @param object $wp The WordPress object.
410 410
  */
411 411
 function geodir_set_location_var_in_session_in_core($wp) {
412
-	global $gd_session;
412
+    global $gd_session;
413 413
 	
414 414
     // Fix for WPML removing page_id query var:
415 415
     if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
@@ -426,16 +426,16 @@  discard block
 block discarded – undo
426 426
         }
427 427
     }
428 428
 	
429
-	// Query Vars will have page_id parameter
430
-	// check if query var has page_id and that page id is location page
429
+    // Query Vars will have page_id parameter
430
+    // check if query var has page_id and that page id is location page
431 431
     geodir_set_is_geodir_page($wp);
432
-	// if is GD homepage set the page ID
433
-	if (geodir_is_page('home')) {
434
-		$wp->query_vars['page_id'] = get_option('page_on_front');
435
-	}
432
+    // if is GD homepage set the page ID
433
+    if (geodir_is_page('home')) {
434
+        $wp->query_vars['page_id'] = get_option('page_on_front');
435
+    }
436 436
 
437
-	// The location url format (all or country_city or region_city or city).
438
-	$geodir_show_location_url = get_option('geodir_show_location_url');
437
+    // The location url format (all or country_city or region_city or city).
438
+    $geodir_show_location_url = get_option('geodir_show_location_url');
439 439
 
440 440
     if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
441 441
         $gd_country = '';
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                 $gd_session->set('gd_region', $gd_region);
495 495
                 $gd_session->set('gd_city', $gd_city);
496 496
                 
497
-				$wp->query_vars['gd_country'] = $gd_country;
497
+                $wp->query_vars['gd_country'] = $gd_country;
498 498
                 $wp->query_vars['gd_region'] = $gd_region;
499 499
                 $wp->query_vars['gd_city'] = $gd_city;
500 500
             } else {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
             // check if this post type is geodirectory post types
511 511
             $post_type_array = geodir_get_posttypes();
512 512
             
513
-			if (in_array($requested_post_type, $post_type_array)) {
513
+            if (in_array($requested_post_type, $post_type_array)) {
514 514
                 // now u can apply geodirectory related manipulation.
515 515
             }
516 516
         }
@@ -520,17 +520,17 @@  discard block
 block discarded – undo
520 520
         $gd_region = '';
521 521
         $gd_city = '';
522 522
         
523
-		$is_geodir_taxonomy = false;
523
+        $is_geodir_taxonomy = false;
524 524
         $is_geodir_taxonomy_term = false; // the last term is real geodirectory taxonomy term or not
525 525
         $is_geodir_location_found = false;
526 526
 		
527
-		$geodir_taxonomy = '';
527
+        $geodir_taxonomy = '';
528 528
         $geodir_post_type = '';
529 529
         $geodir_term = '';
530 530
         $geodir_set_location_session = true;
531 531
         $geodir_taxonomis = geodir_get_taxonomies('', true);
532 532
 		
533
-	    foreach ($geodir_taxonomis as $taxonomy) {
533
+        foreach ($geodir_taxonomis as $taxonomy) {
534 534
             if (array_key_exists($taxonomy, $wp->query_vars)) {
535 535
                 $is_geodir_taxonomy = true;
536 536
                 $geodir_taxonomy = $taxonomy;
@@ -547,52 +547,52 @@  discard block
 block discarded – undo
547 547
         if ($is_geodir_taxonomy) { // do all these only when it is a geodirectory taxonomy
548 548
             $wp->query_vars['post_type'] = $geodir_post_type;
549 549
 
550
-			// now check if last term is a post of geodirectory post types
551
-			$geodir_post = get_posts(array(
552
-				'name' => $geodir_last_term,
553
-				'posts_per_page' => 1,
554
-				'post_type' => $geodir_post_type,
550
+            // now check if last term is a post of geodirectory post types
551
+            $geodir_post = get_posts(array(
552
+                'name' => $geodir_last_term,
553
+                'posts_per_page' => 1,
554
+                'post_type' => $geodir_post_type,
555 555
 
556 556
 
557
-			));
557
+            ));
558 558
 
559
-			if (empty($geodir_post)) {
560
-				$geodir_post = get_posts(array(
561
-					'name' => $geodir_last_term,
562
-					'posts_per_page' => 1,
563
-					'post_type' => $geodir_post_type,
564
-					'post_status' => 'draft',
565
-					'suppress_filters' => false,
559
+            if (empty($geodir_post)) {
560
+                $geodir_post = get_posts(array(
561
+                    'name' => $geodir_last_term,
562
+                    'posts_per_page' => 1,
563
+                    'post_type' => $geodir_post_type,
564
+                    'post_status' => 'draft',
565
+                    'suppress_filters' => false,
566 566
 
567
-				));
568
-			}
567
+                ));
568
+            }
569 569
 
570
-			if (!empty($geodir_post)) {
570
+            if (!empty($geodir_post)) {
571 571
 
572
-				if ($geodir_post[0]->post_status != 'publish') {
573
-					foreach ($wp->query_vars as $key => $vars) {
574
-						unset($wp->query_vars[$key]);
575
-					}
576
-					$wp->query_vars['error'] = '404';
577
-					// set it as 404 if post exists but its status is not published yet
572
+                if ($geodir_post[0]->post_status != 'publish') {
573
+                    foreach ($wp->query_vars as $key => $vars) {
574
+                        unset($wp->query_vars[$key]);
575
+                    }
576
+                    $wp->query_vars['error'] = '404';
577
+                    // set it as 404 if post exists but its status is not published yet
578 578
 
579
-				} else {
580
-					//$wp->query_vars[$geodir_taxonomy] = str_replace( '/'.$geodir_last_term , ''  , $geodir_term);
581
-					$wp->query_vars[$geodir_post_type] = $geodir_last_term;
582
-					$wp->query_vars['name'] = $geodir_last_term;
579
+                } else {
580
+                    //$wp->query_vars[$geodir_taxonomy] = str_replace( '/'.$geodir_last_term , ''  , $geodir_term);
581
+                    $wp->query_vars[$geodir_post_type] = $geodir_last_term;
582
+                    $wp->query_vars['name'] = $geodir_last_term;
583 583
 
584
-				}
584
+                }
585 585
 
586 586
 
587
-				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
588
-				if (!$post_title_replace_count)
589
-					$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
590
-				$geodir_terms = explode('/', $geodir_term);
591
-				$geodir_last_term = end($geodir_terms);
587
+                $geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
588
+                if (!$post_title_replace_count)
589
+                    $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
590
+                $geodir_terms = explode('/', $geodir_term);
591
+                $geodir_last_term = end($geodir_terms);
592 592
 
593
-				$geodir_set_location_session = false;
594
-				//return ;
595
-			}
593
+                $geodir_set_location_session = false;
594
+                //return ;
595
+            }
596 596
 
597 597
             $geodir_location_terms = '';
598 598
             // if last term is not a post then check if last term is a term of the specific texonomy or not
@@ -605,9 +605,9 @@  discard block
 block discarded – undo
605 605
 
606 606
             // now check if there is location parts in the url or not
607 607
             if (get_option('geodir_add_location_url')) {				
608
-				$default_location = geodir_get_default_location();
608
+                $default_location = geodir_get_default_location();
609 609
                 
610
-				if ($geodir_show_location_url == 'all') {
610
+                if ($geodir_show_location_url == 'all') {
611 611
                     if (count($geodir_terms) >= 3) {
612 612
                         $gd_country = urldecode($geodir_terms[0]);
613 613
                         $gd_region = urldecode($geodir_terms[1]);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                     if (!$is_geodir_location_found) {
659 659
                         $gd_city = '';
660 660
                         
661
-						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
661
+                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662 662
                             $is_geodir_location_found = true;
663 663
                     }
664 664
                 }  else if ($geodir_show_location_url == 'region_city') {
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                     if (!$is_geodir_location_found) {
677 677
                         $gd_city = '';
678 678
                         
679
-						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
679
+                        if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
680 680
                             $is_geodir_location_found = true;
681 681
                     }
682 682
                 } else {
@@ -697,14 +697,14 @@  discard block
 block discarded – undo
697 697
                 }
698 698
 
699 699
                 if ($geodir_show_location_url == 'all') {
700
-				} else if ($geodir_show_location_url == 'country_city') {
701
-					$gd_region = '';
702
-				} else if ($geodir_show_location_url == 'region_city') {
703
-					$gd_country = '';
704
-				} else {
705
-					$gd_country = '';
700
+                } else if ($geodir_show_location_url == 'country_city') {
701
+                    $gd_region = '';
702
+                } else if ($geodir_show_location_url == 'region_city') {
703
+                    $gd_country = '';
704
+                } else {
705
+                    $gd_country = '';
706 706
                     $gd_region = '';
707
-				}
707
+                }
708 708
 
709 709
                 if ($is_geodir_location_found) {
710 710
                     $wp->query_vars['gd_country'] = $gd_country;
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
         }
748 748
     }
749 749
 	
750
-	// Unset location session if gd page and location not set.
751
-	if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
752
-		$gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
753
-	}
750
+    // Unset location session if gd page and location not set.
751
+    if (isset($wp->query_vars['gd_is_geodir_page']) && !isset($wp->query_vars['gd_country'])) {
752
+        $gd_session->un_set(array('gd_multi_location', 'gd_city', 'gd_region', 'gd_country'));
753
+    }
754 754
 
755 755
     if ($gd_session->get('gd_multi_location') == 1) {
756 756
         $wp->query_vars['gd_country'] = $gd_session->get('gd_country');
@@ -760,20 +760,20 @@  discard block
 block discarded – undo
760 760
 
761 761
     // now check if there is location parts in the url or not
762 762
     if (get_option('geodir_add_location_url')) {        
763
-		if ($geodir_show_location_url == 'all') {
764
-		} else if ($geodir_show_location_url == 'country_city') {
765
-			 if (isset($wp->query_vars['gd_region']))
763
+        if ($geodir_show_location_url == 'all') {
764
+        } else if ($geodir_show_location_url == 'country_city') {
765
+                if (isset($wp->query_vars['gd_region']))
766 766
                 $wp->query_vars['gd_region'] = '';
767
-		} else if ($geodir_show_location_url == 'region_city') {
768
-			if (isset($wp->query_vars['gd_country']))
767
+        } else if ($geodir_show_location_url == 'region_city') {
768
+            if (isset($wp->query_vars['gd_country']))
769 769
                 $wp->query_vars['gd_country'] = '';
770
-		} else {
771
-			if (isset($wp->query_vars['gd_country']))
770
+        } else {
771
+            if (isset($wp->query_vars['gd_country']))
772 772
                 $wp->query_vars['gd_country'] = '';
773 773
 
774 774
             if (isset($wp->query_vars['gd_region']))
775 775
                 $wp->query_vars['gd_region'] = '';
776
-		}
776
+        }
777 777
     } else {
778 778
         if (isset($wp->query_vars['gd_country']))
779 779
             $wp->query_vars['gd_country'] = '';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
             if (!empty($args['labels'])) {
72 72
                 foreach ($args['labels'] as $key => $val) {
73
-                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
73
+                    $args['labels'][$key] = __($val, 'geodirectory'); // allow translation
74 74
                 }
75 75
             }
76 76
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
             if (array_key_exists('rewrite', $args)) {
113 113
                 if (array_key_exists('slug', $args['rewrite']))
114
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
114
+                    $args['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
115 115
             }
116 116
 
117 117
             $geodir_post_types = get_option('geodir_post_types');
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
                 if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
125 125
                     if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
126
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
126
+                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; // . '/%gd_taxonomy%';
127 127
 
128 128
                 update_option('geodir_post_types', $geodir_post_types);
129 129
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                 $newrules[$listing_slug . '/(.+?)/?$'] = 'index.php?' . $taxonomy . '=$matches[1]';
210 210
             } else {
211 211
                 // use this loop to add paging for details page comments paging
212
-                $newrules[str_replace("/tags","",$listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
212
+                $newrules[str_replace("/tags", "", $listing_slug) . '/(.+?)/comment-page-([0-9]{1,})/?$'] = 'index.php?' . $taxonomy . '=$matches[1]&cpage=$matches[2]';
213 213
             }
214 214
         endforeach;
215 215
     endif;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     // create rules for location listing
218 218
     $location_page = get_option('geodir_location_page');
219 219
 	
220
-    if($location_page) {
220
+    if ($location_page) {
221 221
         global $wpdb;
222 222
         $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
223 223
     }
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 	}
268 268
 
269 269
     if ($location_page && function_exists('icl_object_id')) {
270
-        foreach(icl_get_languages('skip_missing=N') as $lang){
270
+        foreach (icl_get_languages('skip_missing=N') as $lang) {
271 271
             $alt_page_id = '';
272
-            $alt_page_id = icl_object_id($location_page, 'page', false,$lang['language_code']);
273
-            if($alt_page_id){
272
+            $alt_page_id = icl_object_id($location_page, 'page', false, $lang['language_code']);
273
+            if ($alt_page_id) {
274 274
                 $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $alt_page_id));
275 275
 
276 276
 				if ($location_manager && ($hide_country_part || $hide_region_part)) {
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
         global $wpdb;
417 417
 
418 418
         $page_for_posts = get_option('page_for_posts');
419
-        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s",$wp->query_vars['pagename']));
419
+        $real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_name=%s", $wp->query_vars['pagename']));
420 420
 
421 421
         if (function_exists('icl_object_id')) {
422 422
             $real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
423 423
         }
424
-        if ($real_page_id && $real_page_id!=$page_for_posts) {
424
+        if ($real_page_id && $real_page_id != $page_for_posts) {
425 425
             $wp->query_vars['page_id'] = $real_page_id;
426 426
         }
427 427
     }
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662 662
                             $is_geodir_location_found = true;
663 663
                     }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
664
+                } else if ($geodir_show_location_url == 'region_city') {
665 665
                     if (count($geodir_terms) >= 2) {
666 666
                         $gd_region = urldecode($geodir_terms[0]);
667 667
                         $gd_city = urldecode($geodir_terms[1]);
Please login to merge, or discard this patch.
Braces   +103 added lines, -70 removed lines patch added patch discarded remove patch
@@ -106,24 +106,30 @@  discard block
 block discarded – undo
106 106
         $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix']));
107 107
 
108 108
         if ($post_type == 'gd_place') {
109
-            if (array_key_exists('has_archive', $args))
110
-                $args['has_archive'] = $listing_slug;
109
+            if (array_key_exists('has_archive', $args)) {
110
+                            $args['has_archive'] = $listing_slug;
111
+            }
111 112
 
112 113
             if (array_key_exists('rewrite', $args)) {
113
-                if (array_key_exists('slug', $args['rewrite']))
114
-                    $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
114
+                if (array_key_exists('slug', $args['rewrite'])) {
115
+                                    $args['rewrite']['slug'] = $listing_slug;
116
+                }
117
+                // . '/%gd_taxonomy%';
115 118
             }
116 119
 
117 120
             $geodir_post_types = get_option('geodir_post_types');
118 121
 
119 122
             if (array_key_exists($post_type, $geodir_post_types)) {
120 123
 
121
-                if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
122
-                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
124
+                if (array_key_exists('has_archive', $geodir_post_types[$post_type])) {
125
+                                    $geodir_post_types[$post_type]['has_archive'] = $listing_slug;
126
+                }
123 127
 
124
-                if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
125
-                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
126
-                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%';
128
+                if (array_key_exists('rewrite', $geodir_post_types[$post_type])) {
129
+                                    if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
130
+                        $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;
131
+                }
132
+                // . '/%gd_taxonomy%';
127 133
 
128 134
                 update_option('geodir_post_types', $geodir_post_types);
129 135
 
@@ -138,10 +144,11 @@  discard block
 block discarded – undo
138 144
             if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
139 145
                 $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug;
140 146
 
141
-                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
142
-                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
147
+                if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) {
148
+                                    if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
143 149
                         if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
144
-                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
150
+                            $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug;
151
+                }
145 152
 
146 153
                 update_option('geodir_taxonomies', $geodir_taxonomies);
147 154
 
@@ -152,10 +159,11 @@  discard block
 block discarded – undo
152 159
             if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
153 160
                 $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags';
154 161
 
155
-                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
156
-                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
162
+                if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) {
163
+                                    if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
157 164
                         if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
158
-                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
165
+                            $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags';
166
+                }
159 167
 
160 168
                 update_option('geodir_taxonomies', $geodir_taxonomies_tag);
161 169
 
@@ -221,8 +229,9 @@  discard block
 block discarded – undo
221 229
         global $wpdb;
222 230
         $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
223 231
     }
224
-    if (!isset($location_prefix))
225
-        $location_prefix = 'location';
232
+    if (!isset($location_prefix)) {
233
+            $location_prefix = 'location';
234
+    }
226 235
 
227 236
 	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
228 237
 	if ($location_manager) {
@@ -441,14 +450,17 @@  discard block
 block discarded – undo
441 450
         $gd_country = '';
442 451
         $gd_region = '';
443 452
         $gd_city = '';
444
-        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '')
445
-            $gd_country = urldecode($wp->query_vars['gd_country']);
453
+        if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') {
454
+                    $gd_country = urldecode($wp->query_vars['gd_country']);
455
+        }
446 456
 
447
-        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '')
448
-            $gd_region = urldecode($wp->query_vars['gd_region']);
457
+        if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') {
458
+                    $gd_region = urldecode($wp->query_vars['gd_region']);
459
+        }
449 460
 
450
-        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '')
451
-            $gd_city = urldecode($wp->query_vars['gd_city']);
461
+        if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') {
462
+                    $gd_city = urldecode($wp->query_vars['gd_city']);
463
+        }
452 464
 
453 465
         if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
454 466
             $default_location = geodir_get_default_location();
@@ -456,17 +468,19 @@  discard block
 block discarded – undo
456 468
             if (get_option('geodir_add_location_url')) {
457 469
                 if ($geodir_show_location_url != 'all') {
458 470
                     if ($gd_region == '') {
459
-                        if ($gd_ses_region = $gd_session->get('gd_region'))
460
-                            $gd_region = $gd_ses_region;
461
-                        else
462
-                            $gd_region = $default_location->region_slug;
471
+                        if ($gd_ses_region = $gd_session->get('gd_region')) {
472
+                                                    $gd_region = $gd_ses_region;
473
+                        } else {
474
+                                                    $gd_region = $default_location->region_slug;
475
+                        }
463 476
                     }
464 477
 
465 478
                     if ($gd_city == '') {
466
-                        if ($gd_ses_city = $gd_session->get('gd_city'))
467
-                            $gd_city = $gd_ses_city;
468
-                        else
469
-                            $gd_city = $default_location->city_slug;
479
+                        if ($gd_ses_city = $gd_session->get('gd_city')) {
480
+                                                    $gd_city = $gd_ses_city;
481
+                        } else {
482
+                                                    $gd_city = $default_location->city_slug;
483
+                        }
470 484
 
471 485
                         $base_location_link = geodir_get_location_link('base');
472 486
                         wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
@@ -585,8 +599,9 @@  discard block
 block discarded – undo
585 599
 
586 600
 
587 601
 				$geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
588
-				if (!$post_title_replace_count)
589
-					$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
602
+				if (!$post_title_replace_count) {
603
+									$geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count);
604
+				}
590 605
 				$geodir_terms = explode('/', $geodir_term);
591 606
 				$geodir_last_term = end($geodir_terms);
592 607
 
@@ -622,8 +637,9 @@  discard block
 block discarded – undo
622 637
                     if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
623 638
                         geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) &&
624 639
                         geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)
625
-                    )
626
-                        $is_geodir_location_found = true;
640
+                    ) {
641
+                                            $is_geodir_location_found = true;
642
+                    }
627 643
 
628 644
                     // if location has not been found for country , region and city then search for country and region only
629 645
 
@@ -631,8 +647,9 @@  discard block
 block discarded – undo
631 647
                         $gd_city = '';
632 648
                         if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) &&
633 649
                             geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)
634
-                        )
635
-                            $is_geodir_location_found = true;
650
+                        ) {
651
+                                                    $is_geodir_location_found = true;
652
+                        }
636 653
 
637 654
                     }
638 655
 
@@ -640,8 +657,9 @@  discard block
 block discarded – undo
640 657
                     if (!$is_geodir_location_found) {
641 658
                         $gd_city = '';
642 659
                         $gd_region = '';
643
-                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
644
-                            $is_geodir_location_found = true;
660
+                        if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) {
661
+                                                    $is_geodir_location_found = true;
662
+                        }
645 663
                     }
646 664
                 } else if ($geodir_show_location_url == 'country_city') {
647 665
                     if (count($geodir_terms) >= 2) {
@@ -651,17 +669,19 @@  discard block
 block discarded – undo
651 669
                         $gd_country = urldecode($geodir_terms[0]);
652 670
                     }
653 671
 
654
-                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
655
-                        $is_geodir_location_found = true;
672
+                    if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
673
+                                            $is_geodir_location_found = true;
674
+                    }
656 675
 
657 676
                     // if location has not been found for country and city  then search for country only
658 677
                     if (!$is_geodir_location_found) {
659 678
                         $gd_city = '';
660 679
                         
661
-						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country))
662
-                            $is_geodir_location_found = true;
680
+						if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) {
681
+						                            $is_geodir_location_found = true;
682
+						}
663 683
                     }
664
-                }  else if ($geodir_show_location_url == 'region_city') {
684
+                } else if ($geodir_show_location_url == 'region_city') {
665 685
                     if (count($geodir_terms) >= 2) {
666 686
                         $gd_region = urldecode($geodir_terms[0]);
667 687
                         $gd_city = urldecode($geodir_terms[1]);
@@ -669,15 +689,17 @@  discard block
 block discarded – undo
669 689
                         $gd_region = urldecode($geodir_terms[0]);
670 690
                     }
671 691
 
672
-                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city))
673
-                        $is_geodir_location_found = true;
692
+                    if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) {
693
+                                            $is_geodir_location_found = true;
694
+                    }
674 695
 
675 696
                     // if location has not been found for region and city  then search for region only
676 697
                     if (!$is_geodir_location_found) {
677 698
                         $gd_city = '';
678 699
                         
679
-						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region))
680
-                            $is_geodir_location_found = true;
700
+						if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) {
701
+						                            $is_geodir_location_found = true;
702
+						}
681 703
                     }
682 704
                 } else {
683 705
                     $gd_city = $geodir_terms[0];
@@ -719,14 +741,17 @@  discard block
 block discarded – undo
719 741
 
720 742
             $wp->query_vars[$geodir_taxonomy] = $geodir_term;
721 743
             // eliminate location related terms from taxonomy term
722
-            if ($gd_country != '')
723
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
744
+            if ($gd_country != '') {
745
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
746
+            }
724 747
 
725
-            if ($gd_region != '')
726
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
748
+            if ($gd_region != '') {
749
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
750
+            }
727 751
 
728
-            if ($gd_city != '')
729
-                $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
752
+            if ($gd_city != '') {
753
+                            $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
754
+            }
730 755
 
731 756
 
732 757
             $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
@@ -762,27 +787,34 @@  discard block
 block discarded – undo
762 787
     if (get_option('geodir_add_location_url')) {        
763 788
 		if ($geodir_show_location_url == 'all') {
764 789
 		} else if ($geodir_show_location_url == 'country_city') {
765
-			 if (isset($wp->query_vars['gd_region']))
766
-                $wp->query_vars['gd_region'] = '';
790
+			 if (isset($wp->query_vars['gd_region'])) {
791
+			                 $wp->query_vars['gd_region'] = '';
792
+			 }
767 793
 		} else if ($geodir_show_location_url == 'region_city') {
768
-			if (isset($wp->query_vars['gd_country']))
769
-                $wp->query_vars['gd_country'] = '';
794
+			if (isset($wp->query_vars['gd_country'])) {
795
+			                $wp->query_vars['gd_country'] = '';
796
+			}
770 797
 		} else {
771
-			if (isset($wp->query_vars['gd_country']))
772
-                $wp->query_vars['gd_country'] = '';
798
+			if (isset($wp->query_vars['gd_country'])) {
799
+			                $wp->query_vars['gd_country'] = '';
800
+			}
773 801
 
774
-            if (isset($wp->query_vars['gd_region']))
775
-                $wp->query_vars['gd_region'] = '';
802
+            if (isset($wp->query_vars['gd_region'])) {
803
+                            $wp->query_vars['gd_region'] = '';
804
+            }
776 805
 		}
777 806
     } else {
778
-        if (isset($wp->query_vars['gd_country']))
779
-            $wp->query_vars['gd_country'] = '';
807
+        if (isset($wp->query_vars['gd_country'])) {
808
+                    $wp->query_vars['gd_country'] = '';
809
+        }
780 810
 
781
-        if (isset($wp->query_vars['gd_region']))
782
-            $wp->query_vars['gd_region'] = '';
811
+        if (isset($wp->query_vars['gd_region'])) {
812
+                    $wp->query_vars['gd_region'] = '';
813
+        }
783 814
 
784
-        if (isset($wp->query_vars['gd_city']))
785
-            $wp->query_vars['gd_city'] = '';
815
+        if (isset($wp->query_vars['gd_city'])) {
816
+                    $wp->query_vars['gd_city'] = '';
817
+        }
786 818
     }
787 819
 }
788 820
 
@@ -894,8 +926,9 @@  discard block
 block discarded – undo
894 926
 function geodir_exclude_page_where($where)
895 927
 {
896 928
     global $wpdb;
897
-    if (is_admin())
898
-        $where .= " AND $wpdb->posts.post_status != 'virtual'";
929
+    if (is_admin()) {
930
+            $where .= " AND $wpdb->posts.post_status != 'virtual'";
931
+    }
899 932
 
900 933
     return $where;
901 934
 }
Please login to merge, or discard this patch.
geodirectory-functions/general_functions.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1733 1733
  * @global string $table_prefix WordPress Database Table prefix.
1734 1734
  * @param array $query_args The query array.
1735
- * @param  int|bool $count_only If true returns listings count only, otherwise returns array
1735
+ * @param  boolean $count_only If true returns listings count only, otherwise returns array
1736 1736
  * @return mixed Result object.
1737 1737
  */
1738 1738
 function geodir_get_widget_listings($query_args = array(), $count_only = false)
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
  *
3265 3265
  * @since 1.0.0
3266 3266
  * @package GeoDirectory
3267
- * @return bool
3267
+ * @return null|boolean
3268 3268
  */
3269 3269
 function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3270 3270
 {
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin general functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Plugin general functions
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 
10 10
 /**
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
305 305
                 return true;
306 306
 			
307
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
309
-					return true;
310
-				}
311
-			}
307
+            if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308
+                if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
309
+                    return true;
310
+                }
311
+            }
312 312
             break;
313 313
         case 'search':
314 314
             if (is_search() && isset($_REQUEST['geodir_search']))
@@ -664,13 +664,13 @@  discard block
 block discarded – undo
664 664
             $message = get_option('geodir_post_published_email_content');
665 665
         }
666 666
 		
667
-		if (!empty($subject)) {
668
-			$subject = __(stripslashes_deep($subject),'geodirectory');
669
-		}
667
+        if (!empty($subject)) {
668
+            $subject = __(stripslashes_deep($subject),'geodirectory');
669
+        }
670 670
 		
671
-		if (!empty($message)) {
672
-			$message = __(stripslashes_deep($message),'geodirectory');
673
-		}
671
+        if (!empty($message)) {
672
+            $message = __(stripslashes_deep($message),'geodirectory');
673
+        }
674 674
 
675 675
         $to_message = nl2br($to_message);
676 676
         $sitefromEmail = get_option('site_email');
@@ -856,18 +856,18 @@  discard block
 block discarded – undo
856 856
         if (geodir_is_page('detail') || geodir_is_page('listing')) {
857 857
             global $post;
858 858
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
859
-			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
859
+            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
860 860
 				
861
-			if(geodir_is_page('detail') && isset($post->country_slug)){
861
+            if(geodir_is_page('detail') && isset($post->country_slug)){
862 862
                 $location_terms = array(
863 863
                     'gd_country' => $post->country_slug,
864 864
                     'gd_region' => $post->region_slug,
865 865
                     'gd_city' => $post->city_slug
866 866
                 );
867 867
 				
868
-				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
869
-					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
870
-				}
868
+                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
869
+                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
870
+                }
871 871
             }
872 872
 
873 873
             $geodir_show_location_url = get_option('geodir_show_location_url');
@@ -3553,20 +3553,20 @@  discard block
 block discarded – undo
3553 3553
             if (!empty($row->required_msg))
3554 3554
                 $translation_texts[] = stripslashes_deep($row->required_msg);
3555 3555
 			
3556
-			if (!empty($row->default_value))
3556
+            if (!empty($row->default_value))
3557 3557
                 $translation_texts[] = stripslashes_deep($row->default_value);
3558 3558
 			
3559
-			if (!empty($row->option_values)) {
3560
-				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
3559
+            if (!empty($row->option_values)) {
3560
+                $option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
3561 3561
 				
3562
-				if (!empty($option_values)) {
3563
-					foreach ($option_values as $option_value) {
3564
-						if (!empty($option_value['label'])) {
3565
-							$translation_texts[] = $option_value['label'];
3566
-						}
3567
-					}
3568
-				}
3569
-			}
3562
+                if (!empty($option_values)) {
3563
+                    foreach ($option_values as $option_value) {
3564
+                        if (!empty($option_value['label'])) {
3565
+                            $translation_texts[] = $option_value['label'];
3566
+                        }
3567
+                    }
3568
+                }
3569
+            }
3570 3570
         }
3571 3571
     }
3572 3572
 	
@@ -3587,24 +3587,24 @@  discard block
 block discarded – undo
3587 3587
         }
3588 3588
     }
3589 3589
 	
3590
-	// Advance search filter fields table
3591
-	if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
3592
-		$sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
3593
-		$rows = $wpdb->get_results($sql);
3594
-
3595
-		if (!empty($rows)) {
3596
-			foreach($rows as $row) {
3597
-				if (!empty($row->field_site_name))
3598
-					$translation_texts[] = stripslashes_deep($row->field_site_name);
3599
-
3600
-				if (!empty($row->front_search_title))
3601
-					$translation_texts[] = stripslashes_deep($row->front_search_title);
3602
-
3603
-				if (!empty($row->field_desc))
3604
-					$translation_texts[] = stripslashes_deep($row->field_desc);
3605
-			}
3606
-		}
3607
-	}
3590
+    // Advance search filter fields table
3591
+    if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
3592
+        $sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE;
3593
+        $rows = $wpdb->get_results($sql);
3594
+
3595
+        if (!empty($rows)) {
3596
+            foreach($rows as $row) {
3597
+                if (!empty($row->field_site_name))
3598
+                    $translation_texts[] = stripslashes_deep($row->field_site_name);
3599
+
3600
+                if (!empty($row->front_search_title))
3601
+                    $translation_texts[] = stripslashes_deep($row->front_search_title);
3602
+
3603
+                if (!empty($row->field_desc))
3604
+                    $translation_texts[] = stripslashes_deep($row->field_desc);
3605
+            }
3606
+        }
3607
+    }
3608 3608
 
3609 3609
     $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3610 3610
 
Please login to merge, or discard this patch.
Braces   +271 added lines, -190 removed lines patch added patch discarded remove patch
@@ -30,8 +30,10 @@  discard block
 block discarded – undo
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
 
@@ -63,7 +65,9 @@  discard block
 block discarded – undo
63 65
 {
64 66
     $active_plugins = get_option('active_plugins');
65 67
     foreach ($active_plugins as $key => $active_plugin) {
66
-        if (strstr($active_plugin, $plugin)) return true;
68
+        if (strstr($active_plugin, $plugin)) {
69
+            return true;
70
+        }
67 71
     }
68 72
     return false;
69 73
 }
@@ -114,12 +118,25 @@  discard block
 block discarded – undo
114 118
  */
115 119
 function geodir_getlink($url, $params = array(), $use_existing_arguments = false)
116 120
 {
117
-    if ($use_existing_arguments) $params = $params + $_GET;
118
-    if (!$params) return $url;
121
+    if ($use_existing_arguments) {
122
+        $params = $params + $_GET;
123
+    }
124
+    if (!$params) {
125
+        return $url;
126
+    }
119 127
     $link = $url;
120
-    if (strpos($link, '?') === false) $link .= '?'; //If there is no '?' add one at the end
121
-    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) $link .= '&amp;'; //If there is no '&' at the END, add one.
122
-    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) $link .= '&'; //If there is no '&' at the END, add one.
128
+    if (strpos($link, '?') === false) {
129
+        $link .= '?';
130
+    }
131
+    //If there is no '?' add one at the end
132
+    elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
133
+        $link .= '&amp;';
134
+    }
135
+    //If there is no '&' at the END, add one.
136
+    elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
137
+        $link .= '&';
138
+    }
139
+    //If there is no '&' at the END, add one.
123 140
 
124 141
     $params_arr = array();
125 142
     foreach ($params as $key => $value) {
@@ -157,9 +174,10 @@  discard block
 block discarded – undo
157 174
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
158 175
 
159 176
         return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
160
-    } else
161
-        return get_bloginfo('url');
162
-}
177
+    } else {
178
+            return get_bloginfo('url');
179
+    }
180
+    }
163 181
 
164 182
 /**
165 183
  * Get the current page URL.
@@ -264,20 +282,24 @@  discard block
 block discarded – undo
264 282
         case 'preview':
265 283
             if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
266 284
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
267
-            )
268
-                return true;
285
+            ) {
286
+                            return true;
287
+            }
269 288
             break;
270 289
         case 'listing-success':
271
-            if (is_page() && get_query_var('page_id') == geodir_success_page_id())
272
-                return true;
290
+            if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
291
+                            return true;
292
+            }
273 293
             break;
274 294
         case 'detail':
275
-            if (is_single() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
276
-                return true;
295
+            if (is_single() && in_array(get_query_var('post_type'), geodir_get_posttypes())) {
296
+                            return true;
297
+            }
277 298
             break;
278 299
         case 'pt':
279
-            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()) && !is_tax())
280
-                return true;
300
+            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()) && !is_tax()) {
301
+                            return true;
302
+            }
281 303
 
282 304
             break;
283 305
         case 'listing':
@@ -286,23 +308,27 @@  discard block
 block discarded – undo
286 308
 
287 309
                 return true;
288 310
             }
289
-            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes()))
290
-                return true;
311
+            if (is_post_type_archive() && in_array(get_query_var('post_type'), geodir_get_posttypes())) {
312
+                            return true;
313
+            }
291 314
 
292 315
             break;
293 316
         case 'home':
294 317
 
295
-            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home())
296
-                return true;
318
+            if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
319
+                            return true;
320
+            }
297 321
 
298 322
             break;
299 323
         case 'location':
300
-            if (is_page() && get_query_var('page_id') == geodir_location_page_id())
301
-                return true;
324
+            if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
325
+                            return true;
326
+            }
302 327
             break;
303 328
         case 'author':
304
-            if (is_author() && isset($_REQUEST['geodir_dashbord']))
305
-                return true;
329
+            if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
330
+                            return true;
331
+            }
306 332
 			
307 333
 			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308 334
 				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
@@ -311,24 +337,29 @@  discard block
 block discarded – undo
311 337
 			}
312 338
             break;
313 339
         case 'search':
314
-            if (is_search() && isset($_REQUEST['geodir_search']))
315
-                return true;
340
+            if (is_search() && isset($_REQUEST['geodir_search'])) {
341
+                            return true;
342
+            }
316 343
             break;
317 344
         case 'info':
318
-            if (is_page() && get_query_var('page_id') == geodir_info_page_id())
319
-                return true;
345
+            if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
346
+                            return true;
347
+            }
320 348
             break;
321 349
         case 'login':
322
-            if (is_page() && get_query_var('page_id') == geodir_login_page_id())
323
-                return true;
350
+            if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
351
+                            return true;
352
+            }
324 353
             break;
325 354
         case 'checkout':
326
-            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id())
327
-                return true;
355
+            if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
356
+                            return true;
357
+            }
328 358
             break;
329 359
         case 'invoices':
330
-            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id())
331
-                return true;
360
+            if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
361
+                            return true;
362
+            }
332 363
             break;
333 364
         default:
334 365
             return false;
@@ -356,8 +387,9 @@  discard block
 block discarded – undo
356 387
         //$wp->query_vars['gd_is_geodir_page'] = false;
357 388
         //print_r()
358 389
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
359
-            if (get_option('geodir_set_as_home'))
360
-                $wp->query_vars['gd_is_geodir_page'] = true;
390
+            if (get_option('geodir_set_as_home')) {
391
+                            $wp->query_vars['gd_is_geodir_page'] = true;
392
+            }
361 393
             if(geodir_is_page('home')){
362 394
                 $wp->query_vars['gd_is_geodir_page'] = true;
363 395
             }
@@ -376,8 +408,9 @@  discard block
 block discarded – undo
376 408
                 || $wp->query_vars['page_id'] == geodir_login_page_id()
377 409
                 || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
378 410
                 || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
379
-            )
380
-                $wp->query_vars['gd_is_geodir_page'] = true;
411
+            ) {
412
+                            $wp->query_vars['gd_is_geodir_page'] = true;
413
+            }
381 414
         }
382 415
 
383 416
         if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
@@ -394,8 +427,9 @@  discard block
 block discarded – undo
394 427
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
395 428
                     || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
396 429
                 )
397
-            )
398
-                $wp->query_vars['gd_is_geodir_page'] = true;
430
+            ) {
431
+                            $wp->query_vars['gd_is_geodir_page'] = true;
432
+            }
399 433
         }
400 434
 
401 435
 
@@ -418,12 +452,14 @@  discard block
 block discarded – undo
418 452
             }
419 453
         }
420 454
 
421
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord']))
422
-            $wp->query_vars['gd_is_geodir_page'] = true;
455
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
456
+                    $wp->query_vars['gd_is_geodir_page'] = true;
457
+        }
423 458
 
424 459
 
425
-        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search']))
426
-            $wp->query_vars['gd_is_geodir_page'] = true;
460
+        if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
461
+                    $wp->query_vars['gd_is_geodir_page'] = true;
462
+        }
427 463
 
428 464
 
429 465
 //check if homepage
@@ -453,11 +489,12 @@  discard block
 block discarded – undo
453 489
 function geodir_is_geodir_page()
454 490
 {
455 491
     global $wp;
456
-    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page'])
457
-        return true;
458
-    else
459
-        return false;
460
-}
492
+    if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
493
+            return true;
494
+    } else {
495
+            return false;
496
+    }
497
+    }
461 498
 
462 499
 if (!function_exists('geodir_get_imagesize')) {
463 500
     /**
@@ -754,20 +791,16 @@  discard block
 block discarded – undo
754 791
             $subject .= ' - ADMIN BCC COPY';
755 792
             $admin_bcc = true;
756 793
 
757
-        }
758
-        elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
794
+        } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
759 795
             $subject .= ' - ADMIN BCC COPY';
760 796
             $admin_bcc = true;
761
-        }
762
-        elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
797
+        } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
763 798
             $subject .= ' - ADMIN BCC COPY';
764 799
             $admin_bcc = true;
765
-        }
766
-        elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
800
+        } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
767 801
             $subject .= ' - ADMIN BCC COPY';
768 802
             $admin_bcc = true;
769
-        }
770
-        elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
803
+        } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
771 804
             $subject .= ' - ADMIN BCC COPY';
772 805
             $admin_bcc = true;
773 806
         }
@@ -936,21 +969,24 @@  discard block
 block discarded – undo
936 969
             $is_location_last = '';
937 970
             $is_taxonomy_last = '';
938 971
             $breadcrumb .= '<li>';
939
-            if (get_query_var($gd_post_type . 'category'))
940
-                $gd_taxonomy = $gd_post_type . 'category';
941
-            elseif (get_query_var($gd_post_type . '_tags'))
942
-                $gd_taxonomy = $gd_post_type . '_tags';
972
+            if (get_query_var($gd_post_type . 'category')) {
973
+                            $gd_taxonomy = $gd_post_type . 'category';
974
+            } elseif (get_query_var($gd_post_type . '_tags')) {
975
+                            $gd_taxonomy = $gd_post_type . '_tags';
976
+            }
943 977
 
944 978
             $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
945
-            if (!empty($gd_taxonomy) || geodir_is_page('detail'))
946
-                $is_location_last = false;
947
-            else
948
-                $is_location_last = true;
949
-
950
-            if (!empty($gd_taxonomy) && geodir_is_page('listing'))
951
-                $is_taxonomy_last = true;
952
-            else
953
-                $is_taxonomy_last = false;
979
+            if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
980
+                            $is_location_last = false;
981
+            } else {
982
+                            $is_location_last = true;
983
+            }
984
+
985
+            if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
986
+                            $is_taxonomy_last = true;
987
+            } else {
988
+                            $is_taxonomy_last = false;
989
+            }
954 990
 
955 991
             if (!empty($location_terms)) {
956 992
                 $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
@@ -1032,8 +1068,9 @@  discard block
 block discarded – undo
1032 1068
                 {
1033 1069
                     if (get_query_var($gd_post_type . '_tags')) {
1034 1070
                         $cat_link = $listing_link . 'tags/';
1035
-                    } else
1036
-                        $cat_link = $listing_link;
1071
+                    } else {
1072
+                                            $cat_link = $listing_link;
1073
+                    }
1037 1074
 
1038 1075
                     foreach ($location_terms as $key => $location_term) {
1039 1076
                         if ($location_manager && in_array($key, $hide_url_part)) {
@@ -1060,9 +1097,9 @@  discard block
 block discarded – undo
1060 1097
                             $term_link_text = geodir_ucwords(urldecode($term_link_text));
1061 1098
                         }
1062 1099
 
1063
-                        if ($term_index == count($term_array) && $is_taxonomy_last)
1064
-                            $breadcrumb .= $separator . $term_link_text;
1065
-                        else {
1100
+                        if ($term_index == count($term_array) && $is_taxonomy_last) {
1101
+                                                    $breadcrumb .= $separator . $term_link_text;
1102
+                        } else {
1066 1103
                             $cat_link .= $term . '/';
1067 1104
                             $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>';
1068 1105
                         }
@@ -1073,8 +1110,9 @@  discard block
 block discarded – undo
1073 1110
 
1074 1111
             }
1075 1112
 
1076
-            if (geodir_is_page('detail'))
1077
-                $breadcrumb .= $separator . get_the_title();
1113
+            if (geodir_is_page('detail')) {
1114
+                            $breadcrumb .= $separator . get_the_title();
1115
+            }
1078 1116
 
1079 1117
             $breadcrumb .= '</li>';
1080 1118
 
@@ -1111,8 +1149,9 @@  discard block
 block discarded – undo
1111 1149
 
1112 1150
                 $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __(ucfirst($post_type_info->label), 'geodirectory') . '</a>';
1113 1151
                 $breadcrumb .= $separator . ucfirst(__('My', 'geodirectory') . ' ' . $_REQUEST['list']);
1114
-            } else
1115
-                $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1152
+            } else {
1153
+                            $breadcrumb .= $separator . __(ucfirst($post_type_info->label), 'geodirectory');
1154
+            }
1116 1155
 
1117 1156
             $breadcrumb .= '</li>';
1118 1157
         } elseif (is_category() || is_single()) {
@@ -1187,12 +1226,14 @@  discard block
 block discarded – undo
1187 1226
     function geodir_allow_wpadmin()
1188 1227
     {
1189 1228
         global $wpdb;
1190
-        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) // checking action in request to allow ajax request go through
1229
+        if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!isset($_REQUEST['action']))) {
1230
+            // checking action in request to allow ajax request go through
1191 1231
         {
1192 1232
             if (current_user_can('manage_options')) {
1193 1233
             } else {
1194 1234
 
1195
-                wp_redirect(home_url());
1235
+                wp_redirect(home_url());
1236
+        }
1196 1237
                 exit;
1197 1238
             }
1198 1239
 
@@ -1224,8 +1265,9 @@  discard block
 block discarded – undo
1224 1265
     $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : '';
1225 1266
 
1226 1267
     $upload = wp_upload_bits($file_name, 0, '', $post_upload_date);
1227
-    if ($upload['error'])
1228
-        return new WP_Error('upload_dir_error', $upload['error']);
1268
+    if ($upload['error']) {
1269
+            return new WP_Error('upload_dir_error', $upload['error']);
1270
+    }
1229 1271
 
1230 1272
     // fetch the remote url and write it to the placeholder file
1231 1273
     $headers = wp_get_http($url, $upload['file']);
@@ -1239,11 +1281,9 @@  discard block
 block discarded – undo
1239 1281
     // make sure the fetch was successful
1240 1282
     elseif ($headers['response'] != '200') {
1241 1283
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1242
-    }
1243
-    elseif (isset($headers['content-length']) && $filesize != $headers['content-length']) {
1284
+    } elseif (isset($headers['content-length']) && $filesize != $headers['content-length']) {
1244 1285
         $log_message =  __('Remote file is incorrect size', 'geodirectory');
1245
-    }
1246
-    elseif (0 == $filesize) {
1286
+    } elseif (0 == $filesize) {
1247 1287
         $log_message = __('Zero size file downloaded', 'geodirectory');
1248 1288
     }
1249 1289
 
@@ -1295,10 +1335,11 @@  discard block
 block discarded – undo
1295 1335
 function geodir_dummy_folder_exists()
1296 1336
 {
1297 1337
     $path = geodir_plugin_path() . '/geodirectory-admin/dummy/';
1298
-    if (!is_dir($path))
1299
-        return false;
1300
-    else
1301
-        return true;
1338
+    if (!is_dir($path)) {
1339
+            return false;
1340
+    } else {
1341
+            return true;
1342
+    }
1302 1343
 
1303 1344
 }
1304 1345
 
@@ -1516,12 +1557,10 @@  discard block
 block discarded – undo
1516 1557
         if ($message_type == 'registration' && get_option('bcc_new_user')) {
1517 1558
             $subject .= ' - ADMIN BCC COPY';
1518 1559
             $admin_bcc = true;
1519
-        }
1520
-        elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1560
+        } elseif ($message_type == 'send_friend' && get_option('bcc_friend')) {
1521 1561
             $subject .= ' - ADMIN BCC COPY';
1522 1562
             $admin_bcc = true;
1523
-        }
1524
-        elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1563
+        } elseif ($message_type == 'send_enquiry' && get_option('bcc_enquiry')) {
1525 1564
             $subject .= ' - ADMIN BCC COPY';
1526 1565
             $admin_bcc = true;
1527 1566
         }
@@ -1565,7 +1604,9 @@  discard block
 block discarded – undo
1565 1604
         $res = array();
1566 1605
         foreach ($ids_array as $id) {
1567 1606
             $xlat = icl_object_id($id, $type, false);
1568
-            if (!is_null($xlat)) $res[] = $xlat;
1607
+            if (!is_null($xlat)) {
1608
+                $res[] = $xlat;
1609
+            }
1569 1610
         }
1570 1611
         return $res;
1571 1612
     } else {
@@ -1907,8 +1948,9 @@  discard block
 block discarded – undo
1907 1948
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1908 1949
 
1909 1950
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1910
-        if ( !$page )
1911
-            $page = 1;
1951
+        if ( !$page ) {
1952
+                    $page = 1;
1953
+        }
1912 1954
 
1913 1955
         $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1914 1956
 
@@ -2252,7 +2294,7 @@  discard block
 block discarded – undo
2252 2294
     $home_url = str_replace("www.", "", $home_url);
2253 2295
     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')) ) {
2254 2296
         return true;
2255
-    }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')){
2297
+    } 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')){
2256 2298
         return true;
2257 2299
     } else {
2258 2300
         return false;
@@ -2746,8 +2788,9 @@  discard block
 block discarded – undo
2746 2788
                         $name = $postobj->labels->name;
2747 2789
 
2748 2790
                         $selected = '';
2749
-                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing'))
2750
-                            $selected = 'selected="selected"';
2791
+                        if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
2792
+                                                    $selected = 'selected="selected"';
2793
+                        }
2751 2794
 
2752 2795
                         /**
2753 2796
                          * Filter add listing link.
@@ -3214,8 +3257,9 @@  discard block
 block discarded – undo
3214 3257
             $geodir_is_widget_listing = false;
3215 3258
 
3216 3259
             $GLOBALS['post'] = $current_post;
3217
-            if (!empty($current_post))
3218
-                setup_postdata($current_post);
3260
+            if (!empty($current_post)) {
3261
+                            setup_postdata($current_post);
3262
+            }
3219 3263
             $map_jason = $current_map_jason;
3220 3264
             $map_canvas_arr = $current_map_canvas_arr;
3221 3265
             ?>
@@ -3531,11 +3575,15 @@  discard block
 block discarded – undo
3531 3575
 
3532 3576
     $language_file = geodir_plugin_path() . '/db-language.php';
3533 3577
 
3534
-    if(is_file($language_file) && !is_writable($language_file))
3535
-        return false; // Not possible to create.
3578
+    if(is_file($language_file) && !is_writable($language_file)) {
3579
+            return false;
3580
+    }
3581
+    // Not possible to create.
3536 3582
 
3537
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3538
-        return false; // Not possible to create.
3583
+    if(!is_file($language_file) && !is_writable(dirname($language_file))) {
3584
+            return false;
3585
+    }
3586
+    // Not possible to create.
3539 3587
 
3540 3588
     $contents_strings = array();
3541 3589
 
@@ -3578,8 +3626,10 @@  discard block
 block discarded – undo
3578 3626
 
3579 3627
     $contents .= implode(PHP_EOL, $contents_foot);
3580 3628
 
3581
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3582
-        return false; // Failure; could not write file.
3629
+    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE)) {
3630
+            return false;
3631
+    }
3632
+    // Failure; could not write file.
3583 3633
 
3584 3634
     return true;
3585 3635
 }
@@ -3605,23 +3655,29 @@  discard block
 block discarded – undo
3605 3655
 
3606 3656
     if (!empty($rows)) {
3607 3657
         foreach($rows as $row) {
3608
-            if (!empty($row->admin_title))
3609
-                $translation_texts[] = stripslashes_deep($row->admin_title);
3658
+            if (!empty($row->admin_title)) {
3659
+                            $translation_texts[] = stripslashes_deep($row->admin_title);
3660
+            }
3610 3661
 			
3611
-            if (!empty($row->admin_desc))
3612
-                $translation_texts[] = stripslashes_deep($row->admin_desc);
3662
+            if (!empty($row->admin_desc)) {
3663
+                            $translation_texts[] = stripslashes_deep($row->admin_desc);
3664
+            }
3613 3665
 
3614
-            if (!empty($row->site_title))
3615
-                $translation_texts[] = stripslashes_deep($row->site_title);
3666
+            if (!empty($row->site_title)) {
3667
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3668
+            }
3616 3669
 
3617
-            if (!empty($row->clabels))
3618
-                $translation_texts[] = stripslashes_deep($row->clabels);
3670
+            if (!empty($row->clabels)) {
3671
+                            $translation_texts[] = stripslashes_deep($row->clabels);
3672
+            }
3619 3673
 
3620
-            if (!empty($row->required_msg))
3621
-                $translation_texts[] = stripslashes_deep($row->required_msg);
3674
+            if (!empty($row->required_msg)) {
3675
+                            $translation_texts[] = stripslashes_deep($row->required_msg);
3676
+            }
3622 3677
 			
3623
-			if (!empty($row->default_value))
3624
-                $translation_texts[] = stripslashes_deep($row->default_value);
3678
+			if (!empty($row->default_value)) {
3679
+			                $translation_texts[] = stripslashes_deep($row->default_value);
3680
+			}
3625 3681
 			
3626 3682
 			if (!empty($row->option_values)) {
3627 3683
 				$option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values));
@@ -3643,14 +3699,17 @@  discard block
 block discarded – undo
3643 3699
 
3644 3700
     if (!empty($rows)) {
3645 3701
         foreach($rows as $row) {
3646
-            if (!empty($row->site_title))
3647
-                $translation_texts[] = stripslashes_deep($row->site_title);
3702
+            if (!empty($row->site_title)) {
3703
+                            $translation_texts[] = stripslashes_deep($row->site_title);
3704
+            }
3648 3705
 
3649
-            if (!empty($row->asc_title))
3650
-                $translation_texts[] = stripslashes_deep($row->asc_title);
3706
+            if (!empty($row->asc_title)) {
3707
+                            $translation_texts[] = stripslashes_deep($row->asc_title);
3708
+            }
3651 3709
 
3652
-            if (!empty($row->desc_title))
3653
-                $translation_texts[] = stripslashes_deep($row->desc_title);
3710
+            if (!empty($row->desc_title)) {
3711
+                            $translation_texts[] = stripslashes_deep($row->desc_title);
3712
+            }
3654 3713
         }
3655 3714
     }
3656 3715
 	
@@ -3661,14 +3720,17 @@  discard block
 block discarded – undo
3661 3720
 
3662 3721
 		if (!empty($rows)) {
3663 3722
 			foreach($rows as $row) {
3664
-				if (!empty($row->field_site_name))
3665
-					$translation_texts[] = stripslashes_deep($row->field_site_name);
3723
+				if (!empty($row->field_site_name)) {
3724
+									$translation_texts[] = stripslashes_deep($row->field_site_name);
3725
+				}
3666 3726
 
3667
-				if (!empty($row->front_search_title))
3668
-					$translation_texts[] = stripslashes_deep($row->front_search_title);
3727
+				if (!empty($row->front_search_title)) {
3728
+									$translation_texts[] = stripslashes_deep($row->front_search_title);
3729
+				}
3669 3730
 
3670
-				if (!empty($row->field_desc))
3671
-					$translation_texts[] = stripslashes_deep($row->field_desc);
3731
+				if (!empty($row->field_desc)) {
3732
+									$translation_texts[] = stripslashes_deep($row->field_desc);
3733
+				}
3672 3734
 			}
3673 3735
 		}
3674 3736
 	}
@@ -3986,7 +4048,7 @@  discard block
 block discarded – undo
3986 4048
             if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3987 4049
                 $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3988 4050
             }
3989
-        }elseif($gd_page=='add-listing'){
4051
+        } elseif($gd_page=='add-listing'){
3990 4052
             $geodir_post_types = get_option('geodir_post_types');
3991 4053
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3992 4054
             if(!$spt && isset($_REQUEST['pid'])){
@@ -3996,8 +4058,7 @@  discard block
 block discarded – undo
3996 4058
             if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3997 4059
                 $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3998 4060
             }
3999
-        }
4000
-        elseif($post->post_type){
4061
+        } elseif($post->post_type){
4001 4062
             $geodir_post_types = get_option('geodir_post_types');
4002 4063
             if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4003 4064
                 $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
@@ -4016,15 +4077,14 @@  discard block
 block discarded – undo
4016 4077
             if(isset($geodir_post_types[$spt]['labels']['name'])){
4017 4078
                 $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4018 4079
             }
4019
-        }elseif($gd_page=='add-listing'){
4080
+        } elseif($gd_page=='add-listing'){
4020 4081
             $geodir_post_types = get_option('geodir_post_types');
4021 4082
             $spt = esc_attr($_REQUEST['listing_type']);
4022 4083
             if(!$spt){$spt='gd_place';}
4023 4084
             if(isset($geodir_post_types[$spt]['labels']['name'])){
4024 4085
                 $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4025 4086
             }
4026
-        }
4027
-        elseif(isset($post->post_type) && $post->post_type){
4087
+        } elseif(isset($post->post_type) && $post->post_type){
4028 4088
             $geodir_post_types = get_option('geodir_post_types');
4029 4089
             if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4030 4090
                 $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
@@ -4044,7 +4104,7 @@  discard block
 block discarded – undo
4044 4104
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4045 4105
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4046 4106
             }
4047
-        }elseif($gd_page=='listing'){
4107
+        } elseif($gd_page=='listing'){
4048 4108
             $queried_object = get_queried_object();
4049 4109
             if(isset($queried_object->name)){
4050 4110
                 $cat_name = $queried_object->name;
@@ -4061,7 +4121,7 @@  discard block
 block discarded – undo
4061 4121
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4062 4122
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4063 4123
             }
4064
-        }elseif($gd_page=='listing'){
4124
+        } elseif($gd_page=='listing'){
4065 4125
             $queried_object = get_queried_object();
4066 4126
             if(isset($queried_object->name)){
4067 4127
                 $cat_name = $queried_object->name;
@@ -4229,8 +4289,7 @@  discard block
 block discarded – undo
4229 4289
 
4230 4290
     if(strpos($title,'%%name%%') !== false){
4231 4291
         $author_name = '';
4232
-        if($author_name = get_the_author()){}
4233
-        else{
4292
+        if($author_name = get_the_author()){} else{
4234 4293
             $queried_object = get_queried_object();
4235 4294
             if(isset($queried_object->data->user_nicename)){
4236 4295
                 $author_name = $queried_object->data->user_nicename;
@@ -4276,38 +4335,54 @@  discard block
 block discarded – undo
4276 4335
             $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : '';
4277 4336
 
4278 4337
             if (!empty($labels)) {
4279
-                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts))
4280
-                    $translation_texts[] = $labels['name'];
4281
-                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts))
4282
-                    $translation_texts[] = $labels['singular_name'];
4283
-                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts))
4284
-                    $translation_texts[] = $labels['add_new'];
4285
-                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts))
4286
-                    $translation_texts[] = $labels['add_new_item'];
4287
-                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts))
4288
-                    $translation_texts[] = $labels['edit_item'];
4289
-                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts))
4290
-                    $translation_texts[] = $labels['new_item'];
4291
-                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts))
4292
-                    $translation_texts[] = $labels['view_item'];
4293
-                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts))
4294
-                    $translation_texts[] = $labels['search_items'];
4295
-                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts))
4296
-                    $translation_texts[] = $labels['not_found'];
4297
-                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts))
4298
-                    $translation_texts[] = $labels['not_found_in_trash'];
4299
-                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts))
4300
-                    $translation_texts[] = $labels['label_post_profile'];
4301
-                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts))
4302
-                    $translation_texts[] = $labels['label_post_info'];
4303
-                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts))
4304
-                    $translation_texts[] = $labels['label_post_images'];
4305
-                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts))
4306
-                    $translation_texts[] = $labels['label_post_map'];
4307
-                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts))
4308
-                    $translation_texts[] = $labels['label_reviews'];
4309
-                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts))
4310
-                    $translation_texts[] = $labels['label_related_listing'];
4338
+                if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
4339
+                                    $translation_texts[] = $labels['name'];
4340
+                }
4341
+                if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
4342
+                                    $translation_texts[] = $labels['singular_name'];
4343
+                }
4344
+                if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
4345
+                                    $translation_texts[] = $labels['add_new'];
4346
+                }
4347
+                if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
4348
+                                    $translation_texts[] = $labels['add_new_item'];
4349
+                }
4350
+                if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
4351
+                                    $translation_texts[] = $labels['edit_item'];
4352
+                }
4353
+                if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
4354
+                                    $translation_texts[] = $labels['new_item'];
4355
+                }
4356
+                if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
4357
+                                    $translation_texts[] = $labels['view_item'];
4358
+                }
4359
+                if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
4360
+                                    $translation_texts[] = $labels['search_items'];
4361
+                }
4362
+                if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
4363
+                                    $translation_texts[] = $labels['not_found'];
4364
+                }
4365
+                if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
4366
+                                    $translation_texts[] = $labels['not_found_in_trash'];
4367
+                }
4368
+                if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
4369
+                                    $translation_texts[] = $labels['label_post_profile'];
4370
+                }
4371
+                if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
4372
+                                    $translation_texts[] = $labels['label_post_info'];
4373
+                }
4374
+                if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
4375
+                                    $translation_texts[] = $labels['label_post_images'];
4376
+                }
4377
+                if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
4378
+                                    $translation_texts[] = $labels['label_post_map'];
4379
+                }
4380
+                if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
4381
+                                    $translation_texts[] = $labels['label_reviews'];
4382
+                }
4383
+                if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
4384
+                                    $translation_texts[] = $labels['label_related_listing'];
4385
+                }
4311 4386
             }
4312 4387
 
4313 4388
             if ($description != '' && !in_array($description, $translation_texts)) {
@@ -4315,11 +4390,13 @@  discard block
 block discarded – undo
4315 4390
             }
4316 4391
 
4317 4392
             if (!empty($seo)) {
4318
-                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts))
4319
-                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4393
+                if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
4394
+                                    $translation_texts[] = normalize_whitespace($seo['meta_keyword']);
4395
+                }
4320 4396
 
4321
-                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts))
4322
-                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4397
+                if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
4398
+                                    $translation_texts[] = normalize_whitespace($seo['meta_description']);
4399
+                }
4323 4400
             }
4324 4401
         }
4325 4402
     }
@@ -4345,16 +4422,20 @@  discard block
 block discarded – undo
4345 4422
         $hide_region_part = get_option('geodir_location_hide_region_part');
4346 4423
 
4347 4424
         if ($hide_region_part && $hide_country_part) {
4348
-            if (isset($location_terms['gd_country']))
4349
-                unset($location_terms['gd_country']);
4350
-            if (isset($location_terms['gd_region']))
4351
-                unset($location_terms['gd_region']);
4425
+            if (isset($location_terms['gd_country'])) {
4426
+                            unset($location_terms['gd_country']);
4427
+            }
4428
+            if (isset($location_terms['gd_region'])) {
4429
+                            unset($location_terms['gd_region']);
4430
+            }
4352 4431
         } else if ($hide_region_part && !$hide_country_part) {
4353
-            if (isset($location_terms['gd_region']))
4354
-                unset($location_terms['gd_region']);
4432
+            if (isset($location_terms['gd_region'])) {
4433
+                            unset($location_terms['gd_region']);
4434
+            }
4355 4435
         } else if (!$hide_region_part && $hide_country_part) {
4356
-            if (isset($location_terms['gd_country']))
4357
-                unset($location_terms['gd_country']);
4436
+            if (isset($location_terms['gd_country'])) {
4437
+                            unset($location_terms['gd_country']);
4438
+            }
4358 4439
         }
4359 4440
     }
4360 4441
 
Please login to merge, or discard this patch.
Spacing   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         $add_listing_link = get_page_link(geodir_add_listing_page_id());
158 158
 
159
-        return esc_url( add_query_arg(array('listing_type' => $post_type), $add_listing_link) );
159
+        return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
160 160
     } else
161 161
         return get_bloginfo('url');
162 162
 }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 function geodir_is_page($gdpage = '')
249 249
 {
250 250
 
251
-    global $wp_query, $post,$wp;
251
+    global $wp_query, $post, $wp;
252 252
     //if(!is_admin()):
253 253
 
254 254
     switch ($gdpage):
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
             if (is_author() && isset($_REQUEST['geodir_dashbord']))
305 305
                 return true;
306 306
 			
307
-			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int)bp_loggedin_user_id()) {
308
-				if (((bool)bp_is_current_component('listings') || (bool)bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int)bp_displayed_user_id()) {
307
+			if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
308
+				if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
309 309
 					return true;
310 310
 				}
311 311
 			}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array('preview', 'page', 'paged', 'cpage'))) {
359 359
             if (get_option('geodir_set_as_home'))
360 360
                 $wp->query_vars['gd_is_geodir_page'] = true;
361
-            if(geodir_is_page('home')){
361
+            if (geodir_is_page('home')) {
362 362
                 $wp->query_vars['gd_is_geodir_page'] = true;
363 363
             }
364 364
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 
428 428
 
429 429
 //check if homepage
430
-        if(!isset($wp->query_vars['gd_is_geodir_page'])
430
+        if (!isset($wp->query_vars['gd_is_geodir_page'])
431 431
             && !isset($wp->query_vars['page_id'])
432 432
             && !isset($wp->query_vars['pagename'])
433
-            && is_page_geodir_home()){
433
+            && is_page_geodir_home()) {
434 434
             $wp->query_vars['gd_is_geodir_page'] = true;
435 435
         }
436 436
         //echo $wp->query_vars['gd_is_geodir_page'] ;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
     function createRandomString()
532 532
     {
533 533
         $chars = "abcdefghijkmlnopqrstuvwxyz1023456789";
534
-        srand((double)microtime() * 1000000);
534
+        srand((double) microtime() * 1000000);
535 535
         $i = 0;
536 536
         $rstring = '';
537 537
         while ($i <= 25) {
@@ -665,11 +665,11 @@  discard block
 block discarded – undo
665 665
         }
666 666
 		
667 667
 		if (!empty($subject)) {
668
-			$subject = __(stripslashes_deep($subject),'geodirectory');
668
+			$subject = __(stripslashes_deep($subject), 'geodirectory');
669 669
 		}
670 670
 		
671 671
 		if (!empty($message)) {
672
-			$message = __(stripslashes_deep($message),'geodirectory');
672
+			$message = __(stripslashes_deep($message), 'geodirectory');
673 673
 		}
674 674
 
675 675
         $to_message = nl2br($to_message);
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
             $fromEmailName = get_option('site_email_name');
705 705
         }
706 706
 
707
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
708
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
707
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]');
708
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login);
709 709
         $message = str_replace($search_array, $replace_array, $message);
710 710
 
711
-        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#from_email#]','[#user_login#]','[#username#]');
712
-        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date,$fromEmail, $user_login, $user_login);
711
+        $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#from_email#]', '[#user_login#]', '[#username#]');
712
+        $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $fromEmail, $user_login, $user_login);
713 713
         $subject = str_replace($search_array, $replace_array, $subject);
714 714
 
715 715
         $headers = 'MIME-Version: 1.0' . "\r\n";
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
         $to = $toEmail;
721 721
         $sent = wp_mail($to, $subject, $message, $headers);
722 722
 
723
-        if( ! $sent ) {
724
-            if ( is_array( $to ) ) {
725
-                $to = implode( ',', $to );
723
+        if (!$sent) {
724
+            if (is_array($to)) {
725
+                $to = implode(',', $to);
726 726
             }
727 727
             $log_message = sprintf(
728
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
728
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
729 729
                 $message_type,
730
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
730
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
731 731
                 $to,
732 732
                 $subject
733 733
             );
734
-            geodir_error_log( $log_message );
734
+            geodir_error_log($log_message);
735 735
         }
736 736
 
737 737
         ///////// ADMIN BCC EMIALS
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
             $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
744 744
             $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
745 745
 
746
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
746
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#comments#]', '[#login_url#]', '[#login_details#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
747 747
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $to_message, $loginurl_link, $login_details, $toEmailName, $posted_date, $user_login, $user_login);
748 748
             $message = str_replace($search_array, $replace_array, $message);
749 749
 
750
-            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]','[#user_login#]','[#username#]');
750
+            $search_array = array('[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#to_name#]', '[#from_name#]', '[#subject#]', '[#client_name#]', '[#posted_date#]', '[#user_login#]', '[#username#]');
751 751
             $replace_array = array($listingLink, $siteurl_link, $post_id, $sitefromEmailName, $toEmailName, $fromEmailName, $to_subject, $toEmailName, $posted_date, $user_login, $user_login);
752 752
             $subject = str_replace($search_array, $replace_array, $subject);
753 753
 
@@ -772,21 +772,21 @@  discard block
 block discarded – undo
772 772
             $admin_bcc = true;
773 773
         }
774 774
 
775
-        if($admin_bcc===true){
775
+        if ($admin_bcc === true) {
776 776
             $sent = wp_mail($to, $subject, $message, $headers);
777 777
 
778
-            if( ! $sent ) {
779
-                if ( is_array( $to ) ) {
780
-                    $to = implode( ',', $to );
778
+            if (!$sent) {
779
+                if (is_array($to)) {
780
+                    $to = implode(',', $to);
781 781
                 }
782 782
                 $log_message = sprintf(
783
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
783
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
784 784
                     $message_type,
785
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
785
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
786 786
                     $to,
787 787
                     $subject
788 788
                 );
789
-                geodir_error_log( $log_message );
789
+                geodir_error_log($log_message);
790 790
             }
791 791
         }
792 792
 
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
882 882
 			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
883 883
 				
884
-			if(geodir_is_page('detail') && isset($post->country_slug)){
884
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
885 885
                 $location_terms = array(
886 886
                     'gd_country' => $post->country_slug,
887 887
                     'gd_region' => $post->region_slug,
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
             $breadcrumb .= stripslashes_deep($page_title);
1137 1137
             $breadcrumb .= '</li>';
1138 1138
         } else if (is_tag()) {
1139
-            $breadcrumb .=  "<li> " . $separator . single_tag_title('',false) . '</li>';
1139
+            $breadcrumb .= "<li> " . $separator . single_tag_title('', false) . '</li>';
1140 1140
         } else if (is_day()) {
1141 1141
             $breadcrumb .= "<li> " . $separator . __(" Archive for", 'geodirectory') . " ";
1142 1142
             the_time('F jS, Y');
@@ -1241,16 +1241,16 @@  discard block
 block discarded – undo
1241 1241
         $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
1242 1242
     }
1243 1243
     elseif (isset($headers['content-length']) && $filesize != $headers['content-length']) {
1244
-        $log_message =  __('Remote file is incorrect size', 'geodirectory');
1244
+        $log_message = __('Remote file is incorrect size', 'geodirectory');
1245 1245
     }
1246 1246
     elseif (0 == $filesize) {
1247 1247
         $log_message = __('Zero size file downloaded', 'geodirectory');
1248 1248
     }
1249 1249
 
1250
-    if($log_message){
1250
+    if ($log_message) {
1251 1251
         $del = unlink($upload['file']);
1252
-        if(!$del){geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));}
1253
-        return new WP_Error('import_file_error',$log_message );
1252
+        if (!$del) {geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory')); }
1253
+        return new WP_Error('import_file_error', $log_message);
1254 1254
     }
1255 1255
 
1256 1256
 
@@ -1266,10 +1266,10 @@  discard block
 block discarded – undo
1266 1266
  */
1267 1267
 function geodir_max_upload_size()
1268 1268
 {
1269
-    $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
1269
+    $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
1270 1270
 
1271 1271
     if ($max_filesize > 0 && $max_filesize < 1) {
1272
-        $max_filesize = (int)($max_filesize * 1024) . 'kb';
1272
+        $max_filesize = (int) ($max_filesize * 1024) . 'kb';
1273 1273
     } else {
1274 1274
         $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
1275 1275
     }
@@ -1338,35 +1338,35 @@  discard block
 block discarded – undo
1338 1338
     {
1339 1339
         global $wpdb;
1340 1340
         if ($message_type == 'expiration') {
1341
-            $subject = stripslashes(__(get_option('renew_email_subject'),'geodirectory'));
1342
-            $client_message = stripslashes(__(get_option('renew_email_content'),'geodirectory'));
1341
+            $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
1342
+            $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
1343 1343
         } elseif ($message_type == 'post_submited') {
1344
-            $subject = __(get_option('post_submited_success_email_subject_admin'),'geodirectory');
1345
-            $client_message = __(get_option('post_submited_success_email_content_admin'),'geodirectory');
1344
+            $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
1345
+            $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
1346 1346
         } elseif ($message_type == 'renew') {
1347
-            $subject = __(get_option('post_renew_success_email_subject_admin'),'geodirectory');
1348
-            $client_message = __(get_option('post_renew_success_email_content_admin'),'geodirectory');
1347
+            $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
1348
+            $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
1349 1349
         } elseif ($message_type == 'upgrade') {
1350
-            $subject = __(get_option('post_upgrade_success_email_subject_admin'),'geodirectory');
1351
-            $client_message = __(get_option('post_upgrade_success_email_content_admin'),'geodirectory');
1350
+            $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
1351
+            $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
1352 1352
         } elseif ($message_type == 'claim_approved') {
1353
-            $subject = __(get_option('claim_approved_email_subject'),'geodirectory');
1354
-            $client_message = __(get_option('claim_approved_email_content'),'geodirectory');
1353
+            $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
1354
+            $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
1355 1355
         } elseif ($message_type == 'claim_rejected') {
1356
-            $subject = __(get_option('claim_rejected_email_subject'),'geodirectory');
1357
-            $client_message = __(get_option('claim_rejected_email_content'),'geodirectory');
1356
+            $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
1357
+            $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
1358 1358
         } elseif ($message_type == 'claim_requested') {
1359
-            $subject = __(get_option('claim_email_subject_admin'),'geodirectory');
1360
-            $client_message = __(get_option('claim_email_content_admin'),'geodirectory');
1359
+            $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
1360
+            $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
1361 1361
         } elseif ($message_type == 'auto_claim') {
1362
-            $subject = __(get_option('auto_claim_email_subject'),'geodirectory');
1363
-            $client_message = __(get_option('auto_claim_email_content'),'geodirectory');
1362
+            $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
1363
+            $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
1364 1364
         } elseif ($message_type == 'payment_success') {
1365
-            $subject = __(get_option('post_payment_success_admin_email_subject'),'geodirectory');
1366
-            $client_message = __(get_option('post_payment_success_admin_email_content'),'geodirectory');
1365
+            $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
1366
+            $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
1367 1367
         } elseif ($message_type == 'payment_fail') {
1368
-            $subject = __(get_option('post_payment_fail_admin_email_subject'),'geodirectory');
1369
-            $client_message = __(get_option('post_payment_fail_admin_email_content'),'geodirectory');
1368
+            $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
1369
+            $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
1370 1370
         }
1371 1371
         $transaction_details = $custom_1;
1372 1372
         $fromEmail = get_option('site_email');
@@ -1407,18 +1407,18 @@  discard block
 block discarded – undo
1407 1407
         $to = $fromEmail;
1408 1408
         $message = $client_message;
1409 1409
         $sent = wp_mail($to, $subject, $message, $headers);
1410
-        if( ! $sent ) {
1411
-            if ( is_array( $to ) ) {
1412
-                $to = implode( ',', $to );
1410
+        if (!$sent) {
1411
+            if (is_array($to)) {
1412
+                $to = implode(',', $to);
1413 1413
             }
1414 1414
             $log_message = sprintf(
1415
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1415
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1416 1416
                 $message_type,
1417
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1417
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1418 1418
                 $to,
1419 1419
                 $subject
1420 1420
             );
1421
-            geodir_error_log( $log_message );
1421
+            geodir_error_log($log_message);
1422 1422
         }
1423 1423
     }
1424 1424
 }
@@ -1444,18 +1444,18 @@  discard block
 block discarded – undo
1444 1444
     {
1445 1445
         $login_details = '';
1446 1446
         if ($message_type == 'send_friend') {
1447
-            $subject = stripslashes(__(get_option('email_friend_subject'),'geodirectory'));
1448
-            $message = stripslashes(__(get_option('email_friend_content'),'geodirectory'));
1447
+            $subject = stripslashes(__(get_option('email_friend_subject'), 'geodirectory'));
1448
+            $message = stripslashes(__(get_option('email_friend_content'), 'geodirectory'));
1449 1449
         } elseif ($message_type == 'send_enquiry') {
1450
-            $subject = __(get_option('email_enquiry_subject'),'geodirectory');
1451
-            $message = __(get_option('email_enquiry_content'),'geodirectory');
1450
+            $subject = __(get_option('email_enquiry_subject'), 'geodirectory');
1451
+            $message = __(get_option('email_enquiry_content'), 'geodirectory');
1452 1452
         } elseif ($message_type == 'forgot_password') {
1453
-            $subject = __(get_option('forgot_password_subject'),'geodirectory');
1454
-            $message = __(get_option('forgot_password_content'),'geodirectory');
1453
+            $subject = __(get_option('forgot_password_subject'), 'geodirectory');
1454
+            $message = __(get_option('forgot_password_content'), 'geodirectory');
1455 1455
             $login_details = $to_message;
1456 1456
         } elseif ($message_type == 'registration') {
1457
-            $subject = __(get_option('registration_success_email_subject'),'geodirectory');
1458
-            $message = __(get_option('registration_success_email_content'),'geodirectory');
1457
+            $subject = __(get_option('registration_success_email_subject'), 'geodirectory');
1458
+            $message = __(get_option('registration_success_email_content'), 'geodirectory');
1459 1459
             $login_details = $to_message;
1460 1460
         }
1461 1461
         $to_message = nl2br($to_message);
@@ -1489,18 +1489,18 @@  discard block
 block discarded – undo
1489 1489
         $to = $toEmail;
1490 1490
 
1491 1491
         $sent = wp_mail($to, $subject, $message, $headers);
1492
-        if( ! $sent ) {
1493
-            if ( is_array( $to ) ) {
1494
-                $to = implode( ',', $to );
1492
+        if (!$sent) {
1493
+            if (is_array($to)) {
1494
+                $to = implode(',', $to);
1495 1495
             }
1496 1496
             $log_message = sprintf(
1497
-                __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1497
+                __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1498 1498
                 $message_type,
1499
-                date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1499
+                date_i18n('F j Y H:i:s', current_time('timestamp')),
1500 1500
                 $to,
1501 1501
                 $subject
1502 1502
             );
1503
-            geodir_error_log( $log_message );
1503
+            geodir_error_log($log_message);
1504 1504
         }
1505 1505
 
1506 1506
         ///////// ADMIN BCC EMIALS
@@ -1526,20 +1526,20 @@  discard block
 block discarded – undo
1526 1526
             $admin_bcc = true;
1527 1527
         }
1528 1528
 
1529
-        if($admin_bcc === true){
1529
+        if ($admin_bcc === true) {
1530 1530
             $sent = wp_mail($to, $subject, $message, $headers);
1531
-            if( ! $sent ) {
1532
-                if ( is_array( $to ) ) {
1533
-                    $to = implode( ',', $to );
1531
+            if (!$sent) {
1532
+                if (is_array($to)) {
1533
+                    $to = implode(',', $to);
1534 1534
                 }
1535 1535
                 $log_message = sprintf(
1536
-                    __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ),
1536
+                    __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
1537 1537
                     $message_type,
1538
-                    date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ),
1538
+                    date_i18n('F j Y H:i:s', current_time('timestamp')),
1539 1539
                     $to,
1540 1540
                     $subject
1541 1541
                 );
1542
-                geodir_error_log( $log_message );
1542
+                geodir_error_log($log_message);
1543 1543
             }
1544 1544
         }
1545 1545
 
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 function geodir_custom_posts_body_class($classes) {
1588 1588
     global $wpdb, $wp;
1589 1589
     $post_types = geodir_get_posttypes('object');
1590
-    if (!empty($post_types) && count((array)$post_types) > 1) {
1590
+    if (!empty($post_types) && count((array) $post_types) > 1) {
1591 1591
         $classes[] = 'geodir_custom_posts';
1592 1592
     }
1593 1593
 
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
         $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
1882 1882
 			" . $join . "
1883 1883
 			" . $where;
1884
-        $rows = (int)$wpdb->get_var($sql);
1884
+        $rows = (int) $wpdb->get_var($sql);
1885 1885
     } else {
1886 1886
         $orderby = geodir_widget_listings_get_order($query_args);
1887 1887
         /**
@@ -1907,10 +1907,10 @@  discard block
 block discarded – undo
1907 1907
         $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
1908 1908
 
1909 1909
         $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1;
1910
-        if ( !$page )
1910
+        if (!$page)
1911 1911
             $page = 1;
1912 1912
 
1913
-        $limit = (int)$limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int)$limit ) . ", " . (int)$limit : "";
1913
+        $limit = (int) $limit > 0 ? " LIMIT " . absint(($page - 1) * (int) $limit) . ", " . (int) $limit : "";
1914 1914
 
1915 1915
         $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . "
1916 1916
 			" . $join . "
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
     }
2108 2108
 
2109 2109
     if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
2110
-        $limit = (int)$query_args['posts_per_page'];
2110
+        $limit = (int) $query_args['posts_per_page'];
2111 2111
     }
2112 2112
 
2113 2113
     return $limit;
@@ -2250,9 +2250,9 @@  discard block
 block discarded – undo
2250 2250
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
2251 2251
     }
2252 2252
     $home_url = str_replace("www.", "", $home_url);
2253
-    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')) ) {
2253
+    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'))) {
2254 2254
         return true;
2255
-    }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')){
2255
+    }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')) {
2256 2256
         return true;
2257 2257
     } else {
2258 2258
         return false;
@@ -2335,7 +2335,7 @@  discard block
 block discarded – undo
2335 2335
 
2336 2336
     $gd_post_type = geodir_get_current_posttype();
2337 2337
 
2338
-    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int)$instance['category_limit'] : 15;
2338
+    $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15;
2339 2339
     $default_post_type = !empty($gd_post_type) ? $gd_post_type : (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type']) ? $instance['default_post_type'] : '');
2340 2340
 
2341 2341
     $taxonomy = array();
@@ -2368,14 +2368,14 @@  discard block
 block discarded – undo
2368 2368
             foreach ($b_terms as $key => $val) {
2369 2369
                 $ptype = get_post_type_object(str_replace("category", "", $key));
2370 2370
                 $cpt_name = __($ptype->labels->singular_name, 'geodirectory');
2371
-                $tax_change_output .= "<option value='$key' ". selected($key, $default_taxonomy, false) .">" . sprintf(__('%s Categories', 'geodirectory'),$cpt_name) . "</option>";
2371
+                $tax_change_output .= "<option value='$key' " . selected($key, $default_taxonomy, false) . ">" . sprintf(__('%s Categories', 'geodirectory'), $cpt_name) . "</option>";
2372 2372
             }
2373 2373
             $tax_change_output .= "</select>";
2374 2374
         }
2375 2375
 
2376 2376
         if (!empty($b_terms)) {
2377
-            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms);// get the first array
2378
-            global $cat_count;//make global so we can change via function
2377
+            $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array
2378
+            global $cat_count; //make global so we can change via function
2379 2379
             $cat_count = 0;
2380 2380
             ?>
2381 2381
             <div class="geodir-category-list-in clearfix">
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
         $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show';
2440 2440
         $total_post = $cat->count;
2441 2441
 
2442
-        $term_link = get_term_link( $cat, $cat->taxonomy );
2442
+        $term_link = get_term_link($cat, $cat->taxonomy);
2443 2443
         /**
2444 2444
          * Filer the category term link.
2445 2445
          *
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
          * @param int    $cat->term_id The term id.
2449 2449
          * @param string $post_type Wordpress post type.
2450 2450
          */
2451
-        $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type );
2451
+        $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
2452 2452
 
2453 2453
         echo '<li class="' . $class_row . '"><a href="' . $term_link . '">';
2454 2454
         echo '<img alt="' . esc_attr($cat->name) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; echo geodir_ucwords($cat->name) . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
@@ -2582,28 +2582,28 @@  discard block
 block discarded – undo
2582 2582
                 itemWidth: 75,
2583 2583
                 itemMargin: 5,
2584 2584
                 asNavFor: '#geodir_widget_slider',
2585
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2585
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2586 2586
             });
2587 2587
 
2588 2588
             jQuery('#geodir_widget_slider').flexslider({
2589
-                animation: "<?php echo $animation;?>",
2589
+                animation: "<?php echo $animation; ?>",
2590 2590
                 selector: ".geodir-slides > li",
2591 2591
                 namespace: "geodir-",
2592 2592
                 controlNav: true,
2593
-                animationLoop: <?php echo $animationLoop;?>,
2594
-                slideshow: <?php echo $slideshow;?>,
2595
-                slideshowSpeed: <?php echo $slideshowSpeed;?>,
2596
-                animationSpeed: <?php echo $animationSpeed;?>,
2597
-                directionNav: <?php echo $directionNav;?>,
2598
-                maxItems: <?php echo $max_show;?>,
2599
-                <?php if($slide_width){ echo "itemWidth: ".$slide_width.",";}?>
2593
+                animationLoop: <?php echo $animationLoop; ?>,
2594
+                slideshow: <?php echo $slideshow; ?>,
2595
+                slideshowSpeed: <?php echo $slideshowSpeed; ?>,
2596
+                animationSpeed: <?php echo $animationSpeed; ?>,
2597
+                directionNav: <?php echo $directionNav; ?>,
2598
+                maxItems: <?php echo $max_show; ?>,
2599
+                <?php if ($slide_width) { echo "itemWidth: " . $slide_width . ","; }?>
2600 2600
                 sync: "#geodir_widget_carousel",
2601 2601
                 start: function (slider) {
2602 2602
                     jQuery('.geodir-listing-flex-loader').hide();
2603 2603
                     jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
2604 2604
                     jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
2605 2605
                 },
2606
-                rtl: <?php echo ( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?>
2606
+                rtl: <?php echo (is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?>
2607 2607
             });
2608 2608
         });
2609 2609
     </script>
@@ -2644,7 +2644,7 @@  discard block
 block discarded – undo
2644 2644
 
2645 2645
         global $post;
2646 2646
 
2647
-        $current_post = $post;// keep current post info
2647
+        $current_post = $post; // keep current post info
2648 2648
 
2649 2649
         $widget_main_slides = '';
2650 2650
         $nav_slides = '';
@@ -3087,7 +3087,7 @@  discard block
 block discarded – undo
3087 3087
             $geodir_add_location_url = '1';
3088 3088
         }
3089 3089
 
3090
-        $viewall_url = get_term_link((int)$category[0], $post_type . 'category');
3090
+        $viewall_url = get_term_link((int) $category[0], $post_type . 'category');
3091 3091
 
3092 3092
         $geodir_add_location_url = NULL;
3093 3093
     }
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
         $gd_session->set('gd_multi_location', 1);
3096 3096
     }
3097 3097
 
3098
-    if(is_wp_error( $viewall_url  )){$viewall_url = '';}
3098
+    if (is_wp_error($viewall_url)) {$viewall_url = ''; }
3099 3099
 
3100 3100
     $query_args = array(
3101 3101
         'posts_per_page' => $post_number,
@@ -3333,14 +3333,14 @@  discard block
 block discarded – undo
3333 3333
  * @package GeoDirectory
3334 3334
  * @return bool
3335 3335
  */
3336
-function geodir_term_review_count_force_update($new_status, $old_status='', $post='')
3336
+function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '')
3337 3337
 {
3338
-    if(isset($_REQUEST['action']) && $_REQUEST['action']=='geodir_import_export'){return;}//do not run if importing listings
3338
+    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {return; }//do not run if importing listings
3339 3339
 
3340
-    if(isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')){
3340
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
3341 3341
         return;
3342 3342
     }
3343
-    if($new_status!=$old_status) {
3343
+    if ($new_status != $old_status) {
3344 3344
         geodir_count_reviews_by_terms(true);
3345 3345
     }
3346 3346
     return true;
@@ -3505,7 +3505,7 @@  discard block
 block discarded – undo
3505 3505
          */
3506 3506
         try {
3507 3507
             require_once($language_file);
3508
-        } catch(Exception $e) {
3508
+        } catch (Exception $e) {
3509 3509
             error_log('Language Error: ' . $e->getMessage());
3510 3510
         }
3511 3511
     }
@@ -3523,18 +3523,18 @@  discard block
 block discarded – undo
3523 3523
  */
3524 3524
 function geodirectory_load_db_language() {
3525 3525
     global $wp_filesystem;
3526
-    if( empty( $wp_filesystem ) ) {
3527
-        require_once( ABSPATH .'/wp-admin/includes/file.php' );
3526
+    if (empty($wp_filesystem)) {
3527
+        require_once(ABSPATH . '/wp-admin/includes/file.php');
3528 3528
         WP_Filesystem();
3529 3529
         global $wp_filesystem;
3530 3530
     }
3531 3531
 
3532 3532
     $language_file = geodir_plugin_path() . '/db-language.php';
3533 3533
 
3534
-    if(is_file($language_file) && !is_writable($language_file))
3534
+    if (is_file($language_file) && !is_writable($language_file))
3535 3535
         return false; // Not possible to create.
3536 3536
 
3537
-    if(!is_file($language_file) && !is_writable(dirname($language_file)))
3537
+    if (!is_file($language_file) && !is_writable(dirname($language_file)))
3538 3538
         return false; // Not possible to create.
3539 3539
 
3540 3540
     $contents_strings = array();
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
     $contents = implode(PHP_EOL, $contents_head);
3569 3569
 
3570 3570
     if (!empty($contents_strings)) {
3571
-        foreach ( $contents_strings as $string ) {
3571
+        foreach ($contents_strings as $string) {
3572 3572
             if (is_scalar($string) && $string != '') {
3573 3573
                 $string = str_replace("'", "\'", $string);
3574 3574
                 $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
@@ -3578,7 +3578,7 @@  discard block
 block discarded – undo
3578 3578
 
3579 3579
     $contents .= implode(PHP_EOL, $contents_foot);
3580 3580
 
3581
-    if($wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE))
3581
+    if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE))
3582 3582
         return false; // Failure; could not write file.
3583 3583
 
3584 3584
     return true;
@@ -3604,7 +3604,7 @@  discard block
 block discarded – undo
3604 3604
     $rows = $wpdb->get_results($sql);
3605 3605
 
3606 3606
     if (!empty($rows)) {
3607
-        foreach($rows as $row) {
3607
+        foreach ($rows as $row) {
3608 3608
             if (!empty($row->admin_title))
3609 3609
                 $translation_texts[] = stripslashes_deep($row->admin_title);
3610 3610
 			
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
     $rows = $wpdb->get_results($sql);
3643 3643
 
3644 3644
     if (!empty($rows)) {
3645
-        foreach($rows as $row) {
3645
+        foreach ($rows as $row) {
3646 3646
             if (!empty($row->site_title))
3647 3647
                 $translation_texts[] = stripslashes_deep($row->site_title);
3648 3648
 
@@ -3660,7 +3660,7 @@  discard block
 block discarded – undo
3660 3660
 		$rows = $wpdb->get_results($sql);
3661 3661
 
3662 3662
 		if (!empty($rows)) {
3663
-			foreach($rows as $row) {
3663
+			foreach ($rows as $row) {
3664 3664
 				if (!empty($row->field_site_name))
3665 3665
 					$translation_texts[] = stripslashes_deep($row->field_site_name);
3666 3666
 
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
      *
3696 3696
      * @param array $geodir_allowed_mime_types and file extensions.
3697 3697
      */
3698
-    return apply_filters( 'geodir_allowed_mime_types', array(
3698
+    return apply_filters('geodir_allowed_mime_types', array(
3699 3699
             'Image' => array( // Image formats.
3700 3700
                 'jpg' => 'image/jpeg',
3701 3701
                 'jpe' => 'image/jpeg',
@@ -3784,13 +3784,13 @@  discard block
 block discarded – undo
3784 3784
 
3785 3785
 
3786 3786
 
3787
-add_filter('wpseo_replacements','geodir_wpseo_replacements',10,1);
3787
+add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
3788 3788
 /*
3789 3789
  * Add location variables to wpseo replacements.
3790 3790
  *
3791 3791
  * @since 1.5.4
3792 3792
  */
3793
-function geodir_wpseo_replacements($vars){
3793
+function geodir_wpseo_replacements($vars) {
3794 3794
 
3795 3795
     global $wp;
3796 3796
     $title = '';
@@ -3805,12 +3805,12 @@  discard block
 block discarded – undo
3805 3805
      * @param array $location_array The array of location variables.
3806 3806
      * @param array $vars The page title variables.
3807 3807
      */
3808
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo',$location_array, $vars);
3808
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
3809 3809
     $location_titles = array();
3810
-    if(get_query_var( 'gd_country_full' )){
3811
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
3812
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
3813
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
3810
+    if (get_query_var('gd_country_full')) {
3811
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
3812
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
3813
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
3814 3814
     }
3815 3815
     $location_single = '';
3816 3816
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -3882,23 +3882,23 @@  discard block
 block discarded – undo
3882 3882
     }
3883 3883
 
3884 3884
 
3885
-    if(!empty($location_titles)) {
3885
+    if (!empty($location_titles)) {
3886 3886
         $vars['%%location%%'] = implode(", ", $location_titles);
3887 3887
     }
3888 3888
 
3889 3889
 
3890
-    if(!empty($location_titles)) {
3890
+    if (!empty($location_titles)) {
3891 3891
         $vars['%%in_location%%'] = __('in ', 'geodirectory') . implode(", ", $location_titles);
3892 3892
     }
3893 3893
 
3894 3894
 
3895 3895
 
3896
-    if($location_single) {
3897
-        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' .$location_single;
3896
+    if ($location_single) {
3897
+        $vars['%%in_location_single%%'] = __('in', 'geodirectory') . ' ' . $location_single;
3898 3898
     }
3899 3899
 
3900 3900
 
3901
-    if($location_single) {
3901
+    if ($location_single) {
3902 3902
         $vars['%%location_single%%'] = $location_single;
3903 3903
     }
3904 3904
 
@@ -3910,17 +3910,17 @@  discard block
 block discarded – undo
3910 3910
      * @param string $vars The title with variables.
3911 3911
      * @param array $location_array The array of location variables.
3912 3912
      */
3913
-    return apply_filters('geodir_wpseo_replacements_vars',$vars,$location_array);
3913
+    return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
3914 3914
 }
3915 3915
 
3916 3916
 
3917
-add_filter('geodir_seo_meta_title','geodir_filter_title_variables',10,3);
3918
-add_filter('geodir_seo_page_title','geodir_filter_title_variables',10,2);
3919
-add_filter('geodir_seo_meta_description_pre','geodir_filter_title_variables',10,3);
3920
-function geodir_filter_title_variables($title, $gd_page, $sep=''){
3917
+add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
3918
+add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
3919
+add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
3920
+function geodir_filter_title_variables($title, $gd_page, $sep = '') {
3921 3921
 
3922 3922
 
3923
-    if(!$gd_page || !$title){return $title;}// if no a GD page then bail.
3923
+    if (!$gd_page || !$title) {return $title; }// if no a GD page then bail.
3924 3924
     global $post;
3925 3925
     //print_r($post);
3926 3926
     /*
@@ -3962,119 +3962,119 @@  discard block
 block discarded – undo
3962 3962
     }
3963 3963
 
3964 3964
 
3965
-    if(strpos($title,'%%title%%') !== false){
3966
-        $title = str_replace("%%title%%",$post->post_title,$title);
3965
+    if (strpos($title, '%%title%%') !== false) {
3966
+        $title = str_replace("%%title%%", $post->post_title, $title);
3967 3967
     }
3968 3968
 
3969
-    if(strpos($title,'%%sitename%%') !== false){
3970
-        $title = str_replace("%%sitename%%",get_bloginfo('name'),$title);
3969
+    if (strpos($title, '%%sitename%%') !== false) {
3970
+        $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
3971 3971
     }
3972 3972
 
3973
-    if(strpos($title,'%%sitedesc%%') !== false){
3974
-        $title = str_replace("%%sitedesc%%",get_bloginfo('description'),$title);
3973
+    if (strpos($title, '%%sitedesc%%') !== false) {
3974
+        $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
3975 3975
     }
3976 3976
 
3977
-    if(strpos($title,'%%excerpt%%') !== false){
3978
-        $title = str_replace("%%excerpt%%",strip_tags(get_the_excerpt()),$title);
3977
+    if (strpos($title, '%%excerpt%%') !== false) {
3978
+        $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
3979 3979
     }
3980 3980
 
3981
-    if(strpos($title,'%%pt_single%%') !== false){
3981
+    if (strpos($title, '%%pt_single%%') !== false) {
3982 3982
         $single_name = '';
3983
-        if($gd_page=='search' || $gd_page=='author'){
3983
+        if ($gd_page == 'search' || $gd_page == 'author') {
3984 3984
             $geodir_post_types = get_option('geodir_post_types');
3985 3985
             $spt = esc_attr($_REQUEST['stype']);
3986
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3987
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3986
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
3987
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
3988 3988
             }
3989
-        }elseif($gd_page=='add-listing'){
3989
+        }elseif ($gd_page == 'add-listing') {
3990 3990
             $geodir_post_types = get_option('geodir_post_types');
3991 3991
             $spt = isset($_REQUEST['listing_type']) ? esc_attr($_REQUEST['listing_type']) : '';
3992
-            if(!$spt && isset($_REQUEST['pid'])){
3993
-                $spt = get_post_type( $_REQUEST['pid'] );
3992
+            if (!$spt && isset($_REQUEST['pid'])) {
3993
+                $spt = get_post_type($_REQUEST['pid']);
3994 3994
             }
3995
-            if(!$spt){$spt='gd_place';}
3996
-            if(isset($geodir_post_types[$spt]['labels']['singular_name'])){
3997
-                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'],'geodirectory');
3995
+            if (!$spt) {$spt = 'gd_place'; }
3996
+            if (isset($geodir_post_types[$spt]['labels']['singular_name'])) {
3997
+                $single_name = __($geodir_post_types[$spt]['labels']['singular_name'], 'geodirectory');
3998 3998
             }
3999 3999
         }
4000
-        elseif($post->post_type){
4000
+        elseif ($post->post_type) {
4001 4001
             $geodir_post_types = get_option('geodir_post_types');
4002
-            if(isset($geodir_post_types[$post->post_type]['labels']['singular_name'])){
4003
-                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'],'geodirectory');
4002
+            if (isset($geodir_post_types[$post->post_type]['labels']['singular_name'])) {
4003
+                $single_name = __($geodir_post_types[$post->post_type]['labels']['singular_name'], 'geodirectory');
4004 4004
             }
4005 4005
 
4006 4006
 
4007 4007
         }
4008
-        $title = str_replace("%%pt_single%%",$single_name,$title);
4008
+        $title = str_replace("%%pt_single%%", $single_name, $title);
4009 4009
     }
4010 4010
 
4011
-    if(strpos($title,'%%pt_plural%%') !== false){
4011
+    if (strpos($title, '%%pt_plural%%') !== false) {
4012 4012
         $plural_name = '';
4013
-        if($gd_page=='search' || $gd_page=='author'){
4013
+        if ($gd_page == 'search' || $gd_page == 'author') {
4014 4014
             $geodir_post_types = get_option('geodir_post_types');
4015 4015
             $spt = esc_attr($_REQUEST['stype']);
4016
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4017
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4016
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4017
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4018 4018
             }
4019
-        }elseif($gd_page=='add-listing'){
4019
+        }elseif ($gd_page == 'add-listing') {
4020 4020
             $geodir_post_types = get_option('geodir_post_types');
4021 4021
             $spt = esc_attr($_REQUEST['listing_type']);
4022
-            if(!$spt){$spt='gd_place';}
4023
-            if(isset($geodir_post_types[$spt]['labels']['name'])){
4024
-                $plural_name = __($geodir_post_types[$spt]['labels']['name'],'geodirectory');
4022
+            if (!$spt) {$spt = 'gd_place'; }
4023
+            if (isset($geodir_post_types[$spt]['labels']['name'])) {
4024
+                $plural_name = __($geodir_post_types[$spt]['labels']['name'], 'geodirectory');
4025 4025
             }
4026 4026
         }
4027
-        elseif(isset($post->post_type) && $post->post_type){
4027
+        elseif (isset($post->post_type) && $post->post_type) {
4028 4028
             $geodir_post_types = get_option('geodir_post_types');
4029
-            if(isset($geodir_post_types[$post->post_type]['labels']['name'])){
4030
-                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'],'geodirectory');
4029
+            if (isset($geodir_post_types[$post->post_type]['labels']['name'])) {
4030
+                $plural_name = __($geodir_post_types[$post->post_type]['labels']['name'], 'geodirectory');
4031 4031
             }
4032 4032
 
4033 4033
         }
4034
-        $title = str_replace("%%pt_plural%%",$plural_name,$title);
4034
+        $title = str_replace("%%pt_plural%%", $plural_name, $title);
4035 4035
     }
4036 4036
 
4037 4037
 
4038 4038
 
4039
-    if(strpos($title,'%%category%%') !== false){
4039
+    if (strpos($title, '%%category%%') !== false) {
4040 4040
         $cat_name = '';
4041 4041
 
4042
-        if($gd_page=='detail') {
4042
+        if ($gd_page == 'detail') {
4043 4043
             if ($post->default_category) {
4044 4044
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4045 4045
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4046 4046
             }
4047
-        }elseif($gd_page=='listing'){
4047
+        }elseif ($gd_page == 'listing') {
4048 4048
             $queried_object = get_queried_object();
4049
-            if(isset($queried_object->name)){
4049
+            if (isset($queried_object->name)) {
4050 4050
                 $cat_name = $queried_object->name;
4051 4051
             }
4052 4052
         }
4053
-        $title = str_replace("%%category%%",$cat_name,$title);
4053
+        $title = str_replace("%%category%%", $cat_name, $title);
4054 4054
     }
4055 4055
 
4056
-    if(strpos($title,'%%tag%%') !== false){
4056
+    if (strpos($title, '%%tag%%') !== false) {
4057 4057
         $cat_name = '';
4058 4058
 
4059
-        if($gd_page=='detail') {
4059
+        if ($gd_page == 'detail') {
4060 4060
             if ($post->default_category) {
4061 4061
                 $cat = get_term($post->default_category, $post->post_type . 'category');
4062 4062
                 $cat_name = (isset($cat->name)) ? $cat->name : '';
4063 4063
             }
4064
-        }elseif($gd_page=='listing'){
4064
+        }elseif ($gd_page == 'listing') {
4065 4065
             $queried_object = get_queried_object();
4066
-            if(isset($queried_object->name)){
4066
+            if (isset($queried_object->name)) {
4067 4067
                 $cat_name = $queried_object->name;
4068 4068
             }
4069 4069
         }
4070
-        $title = str_replace("%%tag%%",$cat_name,$title);
4070
+        $title = str_replace("%%tag%%", $cat_name, $title);
4071 4071
     }
4072 4072
 
4073 4073
 
4074 4074
 
4075
-    if(strpos($title,'%%id%%') !== false){
4075
+    if (strpos($title, '%%id%%') !== false) {
4076 4076
         $ID = (isset($post->ID)) ? $post->ID : '';
4077
-        $title = str_replace("%%id%%",$ID,$title);
4077
+        $title = str_replace("%%id%%", $ID, $title);
4078 4078
     }
4079 4079
 
4080 4080
     /*
@@ -4087,8 +4087,8 @@  discard block
 block discarded – undo
4087 4087
         }
4088 4088
     */
4089 4089
 
4090
-    if(strpos($title,'%%sep%%') !== false){
4091
-        $title = str_replace("%%sep%%",$sep,$title);
4090
+    if (strpos($title, '%%sep%%') !== false) {
4091
+        $title = str_replace("%%sep%%", $sep, $title);
4092 4092
     }
4093 4093
 
4094 4094
 
@@ -4106,12 +4106,12 @@  discard block
 block discarded – undo
4106 4106
      * @param string $gd_page The page being filtered.
4107 4107
      * @param string $sep The separator, default: `|`.
4108 4108
      */
4109
-    $location_array = apply_filters('geodir_filter_title_variables_location_arr',$location_array,$title, $gd_page, $sep);
4109
+    $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
4110 4110
     $location_titles = array();
4111
-    if($gd_page=='location' && get_query_var( 'gd_country_full' )){
4112
-        if(get_query_var( 'gd_country_full' )){$location_array['gd_country'] = get_query_var( 'gd_country_full' );}
4113
-        if(get_query_var( 'gd_region_full' )){$location_array['gd_region'] = get_query_var( 'gd_region_full' );}
4114
-        if(get_query_var( 'gd_city_full' )){$location_array['gd_city'] = get_query_var( 'gd_city_full' );}
4111
+    if ($gd_page == 'location' && get_query_var('gd_country_full')) {
4112
+        if (get_query_var('gd_country_full')) {$location_array['gd_country'] = get_query_var('gd_country_full'); }
4113
+        if (get_query_var('gd_region_full')) {$location_array['gd_region'] = get_query_var('gd_region_full'); }
4114
+        if (get_query_var('gd_city_full')) {$location_array['gd_city'] = get_query_var('gd_city_full'); }
4115 4115
     }
4116 4116
     $location_single = '';
4117 4117
     $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
@@ -4183,65 +4183,65 @@  discard block
 block discarded – undo
4183 4183
     }
4184 4184
 
4185 4185
 
4186
-    if(strpos($title,'%%location%%') !== false){
4186
+    if (strpos($title, '%%location%%') !== false) {
4187 4187
         $location = '';
4188
-        if($location_titles) {
4188
+        if ($location_titles) {
4189 4189
             $location = implode(", ", $location_titles);
4190 4190
         }
4191
-        $title = str_replace("%%location%%",$location,$title);
4191
+        $title = str_replace("%%location%%", $location, $title);
4192 4192
     }
4193 4193
 
4194
-    if(strpos($title,'%%in_location%%') !== false){
4194
+    if (strpos($title, '%%in_location%%') !== false) {
4195 4195
         $location = '';
4196
-        if($location_titles) {
4196
+        if ($location_titles) {
4197 4197
             $location = __('in ', 'geodirectory') . implode(", ", $location_titles);
4198 4198
         }
4199
-        $title = str_replace("%%in_location%%",$location,$title);
4199
+        $title = str_replace("%%in_location%%", $location, $title);
4200 4200
     }
4201 4201
 
4202
-    if(strpos($title,'%%in_location_single%%') !== false){
4203
-        if($location_single) {
4204
-            $location_single = __('in', 'geodirectory') . ' ' .$location_single;
4202
+    if (strpos($title, '%%in_location_single%%') !== false) {
4203
+        if ($location_single) {
4204
+            $location_single = __('in', 'geodirectory') . ' ' . $location_single;
4205 4205
         }
4206
-        $title = str_replace("%%in_location_single%%",$location_single,$title);
4206
+        $title = str_replace("%%in_location_single%%", $location_single, $title);
4207 4207
     }
4208 4208
 
4209
-    if(strpos($title,'%%location_single%%') !== false){
4210
-        $title = str_replace("%%location_single%%",$location_single,$title);
4209
+    if (strpos($title, '%%location_single%%') !== false) {
4210
+        $title = str_replace("%%location_single%%", $location_single, $title);
4211 4211
     }
4212 4212
 
4213 4213
 
4214
-    if(strpos($title,'%%search_term%%') !== false){
4214
+    if (strpos($title, '%%search_term%%') !== false) {
4215 4215
         $search_term = '';
4216
-        if(isset($_REQUEST['s'])){
4216
+        if (isset($_REQUEST['s'])) {
4217 4217
             $search_term = esc_attr($_REQUEST['s']);
4218 4218
         }
4219
-        $title = str_replace("%%search_term%%",$search_term,$title);
4219
+        $title = str_replace("%%search_term%%", $search_term, $title);
4220 4220
     }
4221 4221
 
4222
-    if(strpos($title,'%%search_near%%') !== false){
4222
+    if (strpos($title, '%%search_near%%') !== false) {
4223 4223
         $search_term = '';
4224
-        if(isset($_REQUEST['snear'])){
4224
+        if (isset($_REQUEST['snear'])) {
4225 4225
             $search_term = esc_attr($_REQUEST['snear']);
4226 4226
         }
4227
-        $title = str_replace("%%search_near%%",$search_term,$title);
4227
+        $title = str_replace("%%search_near%%", $search_term, $title);
4228 4228
     }
4229 4229
 
4230
-    if(strpos($title,'%%name%%') !== false){
4230
+    if (strpos($title, '%%name%%') !== false) {
4231 4231
         $author_name = '';
4232
-        if($author_name = get_the_author()){}
4233
-        else{
4232
+        if ($author_name = get_the_author()) {}
4233
+        else {
4234 4234
             $queried_object = get_queried_object();
4235
-            if(isset($queried_object->data->user_nicename)){
4235
+            if (isset($queried_object->data->user_nicename)) {
4236 4236
                 $author_name = $queried_object->data->user_nicename;
4237 4237
             }
4238 4238
         }
4239
-        $title = str_replace("%%name%%",$author_name,$title);
4239
+        $title = str_replace("%%name%%", $author_name, $title);
4240 4240
     }
4241 4241
 
4242
-    $title = wptexturize( $title );
4243
-    $title = convert_chars( $title );
4244
-    $title = esc_html( $title );
4242
+    $title = wptexturize($title);
4243
+    $title = convert_chars($title);
4244
+    $title = esc_html($title);
4245 4245
 
4246 4246
     /**
4247 4247
      * Filter the title variables after standard ones have been filtered.
@@ -4254,7 +4254,7 @@  discard block
 block discarded – undo
4254 4254
      * @param string $sep The separator, default: `|`.
4255 4255
      */
4256 4256
 
4257
-    return apply_filters('geodir_filter_title_variables_vars',$title,$location_array, $gd_page, $sep);
4257
+    return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
4258 4258
 }
4259 4259
 
4260 4260
 /**
Please login to merge, or discard this patch.
geodirectory-functions/geodir-class-session.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 1.5.7
152 152
 	 *
153 153
 	 * @param string|array $key Session key.
154
-	 * @param integer $value Session variable.
155
-	 * @return string Session variable.
154
+	 * @return boolean Session variable.
156 155
 	 */
157 156
 	public function un_set( $key ) {
158 157
 		if ( empty( $key ) ) {
@@ -188,8 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * @since 1.5.7
189 188
 	 *
190 189
 	 * @param string $key Session key.
191
-	 * @param integer $value Session variable.
192
-	 * @return string Session variable.
190
+	 * @return boolean Session variable.
193 191
 	 */
194 192
 	public function is_set( $key ) {
195 193
 		$key = sanitize_key( $key );
Please login to merge, or discard this patch.
Indentation   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -8,294 +8,294 @@
 block discarded – undo
8 8
  * @since 1.5.7
9 9
  */
10 10
 class Geodir_Session {
11
-	/**
12
-	 * Holds our session data.
13
-	 *
14
-	 * @var array
15
-	 * @access private
16
-	 * @since 1.5.7
17
-	 */
18
-	private $session;
19
-
20
-	/**
21
-	 * Whether to use PHP $_SESSION or WP_Session.
22
-	 *
23
-	 * @var bool
24
-	 * @access private
25
-	 * @since 1.5.7
26
-	 */
27
-	private $use_php_sessions = false;
28
-
29
-	/**
30
-	 * Session index prefix.
31
-	 *
32
-	 * @var string
33
-	 * @access private
34
-	 * @since 1.5.7
35
-	 */
36
-	private $prefix = '';
37
-
38
-	/**
39
-	 * Get things started.
40
-	 *
41
-	 * Defines our WP_Session constants, includes the necessary libraries and
42
-	 * retrieves the WP Session instance.
43
-	 *
44
-	 * @since 1.5.7
45
-	 */
46
-	public function __construct() {
47
-		$this->use_php_sessions = $this->use_php_sessions();
48
-
49
-		if ( $this->use_php_sessions ) {
50
-			if ( is_multisite() ) {
51
-				$this->prefix = '_' . get_current_blog_id();
52
-			}
53
-
54
-			// Use PHP SESSION (must be enabled via the GEODIR_USE_PHP_SESSIONS constant)
55
-			add_action( 'init', array( $this, 'maybe_start_session' ), -2 );
56
-		} else {
57
-			// Use WP_Session (default)
58
-			if ( !defined( 'WP_SESSION_COOKIE' ) ) {
59
-				define( 'WP_SESSION_COOKIE', 'geodir_wp_session' );
60
-			}
61
-
62
-			if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
63
-				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-recursive-arrayaccess.php';
64
-			}
65
-
66
-			if ( !class_exists( 'WP_Session' ) ) {
67
-				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-wp-session.php';
68
-				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/wp-session.php';
69
-			}
70
-
71
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
72
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
73
-		}
74
-
75
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
76
-			add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
77
-		} else {
78
-			add_action( 'init', array( $this, 'init' ), -1 );
79
-		}
80
-	}
81
-
82
-	/**
83
-	 * Setup the WP_Session instance.
84
-	 *
85
-	 * @access public
86
-	 * @since 1.5.7
87
-	 * @return void
88
-	 */
89
-	public function init() {
90
-		if ( $this->use_php_sessions ) {
91
-			$this->session = isset( $_SESSION['gd' . $this->prefix ] ) && is_array( $_SESSION['gd' . $this->prefix ] ) ? $_SESSION['gd' . $this->prefix ] : array();
92
-		} else {
93
-			$this->session = WP_Session::get_instance();
94
-		}
95
-
96
-		return $this->session;
97
-	}
98
-
99
-	/**
100
-	 * Retrieve session ID.
101
-	 *
102
-	 * @access public
103
-	 * @since 1.5.7
104
-	 * @return string Session ID
105
-	 */
106
-	public function get_id() {
107
-		return $this->session->session_id;
108
-	}
109
-
110
-	/**
111
-	 * Retrieve a session variable.
112
-	 *
113
-	 * @access public
114
-	 * @since 1.5.7
115
-	 * @param string $key Session key
116
-	 * @return string Session variable
117
-	 */
118
-	public function get( $key ) {
119
-		$key = sanitize_key( $key );
120
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
121
-	}
122
-
123
-	/**
124
-	 * Set a session variable
125
-	 *
126
-	 * @since 1.5.7
127
-	 *
128
-	 * @param string $key Session key
129
-	 * @param integer $value Session variable
130
-	 * @return string Session variable
131
-	 */
132
-	public function set( $key, $value ) {
133
-		$key = sanitize_key( $key );
134
-
135
-		if ( is_array( $value ) ) {
136
-			$this->session[ $key ] = maybe_serialize( $value );
137
-		} else {
138
-			$this->session[ $key ] = $value;
139
-		}
140
-
141
-		if ( $this->use_php_sessions ) {
142
-			$_SESSION['gd' . $this->prefix ] = $this->session;
143
-		}
144
-
145
-		return $this->session[ $key ];
146
-	}
11
+    /**
12
+     * Holds our session data.
13
+     *
14
+     * @var array
15
+     * @access private
16
+     * @since 1.5.7
17
+     */
18
+    private $session;
19
+
20
+    /**
21
+     * Whether to use PHP $_SESSION or WP_Session.
22
+     *
23
+     * @var bool
24
+     * @access private
25
+     * @since 1.5.7
26
+     */
27
+    private $use_php_sessions = false;
28
+
29
+    /**
30
+     * Session index prefix.
31
+     *
32
+     * @var string
33
+     * @access private
34
+     * @since 1.5.7
35
+     */
36
+    private $prefix = '';
37
+
38
+    /**
39
+     * Get things started.
40
+     *
41
+     * Defines our WP_Session constants, includes the necessary libraries and
42
+     * retrieves the WP Session instance.
43
+     *
44
+     * @since 1.5.7
45
+     */
46
+    public function __construct() {
47
+        $this->use_php_sessions = $this->use_php_sessions();
48
+
49
+        if ( $this->use_php_sessions ) {
50
+            if ( is_multisite() ) {
51
+                $this->prefix = '_' . get_current_blog_id();
52
+            }
53
+
54
+            // Use PHP SESSION (must be enabled via the GEODIR_USE_PHP_SESSIONS constant)
55
+            add_action( 'init', array( $this, 'maybe_start_session' ), -2 );
56
+        } else {
57
+            // Use WP_Session (default)
58
+            if ( !defined( 'WP_SESSION_COOKIE' ) ) {
59
+                define( 'WP_SESSION_COOKIE', 'geodir_wp_session' );
60
+            }
61
+
62
+            if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
63
+                require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-recursive-arrayaccess.php';
64
+            }
65
+
66
+            if ( !class_exists( 'WP_Session' ) ) {
67
+                require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-wp-session.php';
68
+                require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/wp-session.php';
69
+            }
70
+
71
+            add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
72
+            add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
73
+        }
74
+
75
+        if ( empty( $this->session ) && ! $this->use_php_sessions ) {
76
+            add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
77
+        } else {
78
+            add_action( 'init', array( $this, 'init' ), -1 );
79
+        }
80
+    }
81
+
82
+    /**
83
+     * Setup the WP_Session instance.
84
+     *
85
+     * @access public
86
+     * @since 1.5.7
87
+     * @return void
88
+     */
89
+    public function init() {
90
+        if ( $this->use_php_sessions ) {
91
+            $this->session = isset( $_SESSION['gd' . $this->prefix ] ) && is_array( $_SESSION['gd' . $this->prefix ] ) ? $_SESSION['gd' . $this->prefix ] : array();
92
+        } else {
93
+            $this->session = WP_Session::get_instance();
94
+        }
95
+
96
+        return $this->session;
97
+    }
98
+
99
+    /**
100
+     * Retrieve session ID.
101
+     *
102
+     * @access public
103
+     * @since 1.5.7
104
+     * @return string Session ID
105
+     */
106
+    public function get_id() {
107
+        return $this->session->session_id;
108
+    }
109
+
110
+    /**
111
+     * Retrieve a session variable.
112
+     *
113
+     * @access public
114
+     * @since 1.5.7
115
+     * @param string $key Session key
116
+     * @return string Session variable
117
+     */
118
+    public function get( $key ) {
119
+        $key = sanitize_key( $key );
120
+        return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
121
+    }
122
+
123
+    /**
124
+     * Set a session variable
125
+     *
126
+     * @since 1.5.7
127
+     *
128
+     * @param string $key Session key
129
+     * @param integer $value Session variable
130
+     * @return string Session variable
131
+     */
132
+    public function set( $key, $value ) {
133
+        $key = sanitize_key( $key );
134
+
135
+        if ( is_array( $value ) ) {
136
+            $this->session[ $key ] = maybe_serialize( $value );
137
+        } else {
138
+            $this->session[ $key ] = $value;
139
+        }
140
+
141
+        if ( $this->use_php_sessions ) {
142
+            $_SESSION['gd' . $this->prefix ] = $this->session;
143
+        }
144
+
145
+        return $this->session[ $key ];
146
+    }
147 147
 	
148
-	/**
149
-	 * Unset a session variable.
150
-	 *
151
-	 * @since 1.5.7
152
-	 *
153
-	 * @param string|array $key Session key.
154
-	 * @param integer $value Session variable.
155
-	 * @return string Session variable.
156
-	 */
157
-	public function un_set( $key ) {
158
-		if ( empty( $key ) ) {
159
-			return false;
160
-		}
148
+    /**
149
+     * Unset a session variable.
150
+     *
151
+     * @since 1.5.7
152
+     *
153
+     * @param string|array $key Session key.
154
+     * @param integer $value Session variable.
155
+     * @return string Session variable.
156
+     */
157
+    public function un_set( $key ) {
158
+        if ( empty( $key ) ) {
159
+            return false;
160
+        }
161 161
 		
162
-		if ( is_array( $key ) ) {
163
-			foreach ($key as $index) {
164
-				$index = sanitize_key( $index );
162
+        if ( is_array( $key ) ) {
163
+            foreach ($key as $index) {
164
+                $index = sanitize_key( $index );
165 165
 			
166
-				if ( $index && isset( $this->session[ $index ] ) ) {
167
-					unset( $this->session[ $index ] );
168
-				}
169
-			}
170
-		} else {
171
-			$key = sanitize_key( $key );
166
+                if ( $index && isset( $this->session[ $index ] ) ) {
167
+                    unset( $this->session[ $index ] );
168
+                }
169
+            }
170
+        } else {
171
+            $key = sanitize_key( $key );
172 172
 			
173
-			if ( isset( $this->session[ $key ] ) ) {
174
-				unset( $this->session[ $key ] );
175
-			}
176
-		}
173
+            if ( isset( $this->session[ $key ] ) ) {
174
+                unset( $this->session[ $key ] );
175
+            }
176
+        }
177 177
 
178
-		if ( $this->use_php_sessions ) {
179
-			$_SESSION['gd' . $this->prefix ] = $this->session;
180
-		}
178
+        if ( $this->use_php_sessions ) {
179
+            $_SESSION['gd' . $this->prefix ] = $this->session;
180
+        }
181 181
 
182
-		return true;
183
-	}
182
+        return true;
183
+    }
184 184
 	
185
-	/**
186
-	 * Check a session variable is set or not.
187
-	 *
188
-	 * @since 1.5.7
189
-	 *
190
-	 * @param string $key Session key.
191
-	 * @param integer $value Session variable.
192
-	 * @return string Session variable.
193
-	 */
194
-	public function is_set( $key ) {
195
-		$key = sanitize_key( $key );
185
+    /**
186
+     * Check a session variable is set or not.
187
+     *
188
+     * @since 1.5.7
189
+     *
190
+     * @param string $key Session key.
191
+     * @param integer $value Session variable.
192
+     * @return string Session variable.
193
+     */
194
+    public function is_set( $key ) {
195
+        $key = sanitize_key( $key );
196 196
 		
197
-		if ( empty( $key ) ) {
198
-			return false;
199
-		}
200
-
201
-		if ( isset( $this->session[ $key ] ) ) {
202
-			return true;
203
-		}
204
-
205
-		return false;
206
-	}
207
-
208
-	/**
209
-	 * Force the cookie expiration variant time to 23 hours
210
-	 *
211
-	 * @access public
212
-	 * @since 1.5.7
213
-	 * @param int $exp Default expiration (1 hour)
214
-	 * @return int
215
-	 */
216
-	public function set_expiration_variant_time( $exp ) {
217
-		return ( 30 * 60 * 23 );
218
-	}
219
-
220
-	/**
221
-	 * Force the cookie expiration time to 24 hours
222
-	 *
223
-	 * @access public
224
-	 * @since 1.5.7
225
-	 * @param int $exp Default expiration (1 hour)
226
-	 * @return int
227
-	 */
228
-	public function set_expiration_time( $exp ) {
229
-		return ( 30 * 60 * 24 );
230
-	}
231
-
232
-	/**
233
-	 * Starts a new session if one hasn't started yet.
234
-	 *
235
-	 * @return boolean
236
-	 * Checks to see if the server supports PHP sessions
237
-	 * or if the GEODIR_USE_PHP_SESSIONS constant is defined
238
-	 *
239
-	 * @access public
240
-	 * @since 1.5.7
241
-	 * @return boolean $ret True if we are using PHP sessions, false otherwise
242
-	 */
243
-	public function use_php_sessions() {
244
-		$ret = false;
245
-
246
-		// If the database variable is already set, no need to run autodetection
247
-		$geodir_use_php_sessions = (bool)get_option( 'geodir_use_php_sessions' );
248
-
249
-		if (!$geodir_use_php_sessions ) {
250
-			// Attempt to detect if the server supports PHP sessions
251
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
252
-				$this->set( 'geodir_use_php_sessions', 1 );
197
+        if ( empty( $key ) ) {
198
+            return false;
199
+        }
200
+
201
+        if ( isset( $this->session[ $key ] ) ) {
202
+            return true;
203
+        }
204
+
205
+        return false;
206
+    }
207
+
208
+    /**
209
+     * Force the cookie expiration variant time to 23 hours
210
+     *
211
+     * @access public
212
+     * @since 1.5.7
213
+     * @param int $exp Default expiration (1 hour)
214
+     * @return int
215
+     */
216
+    public function set_expiration_variant_time( $exp ) {
217
+        return ( 30 * 60 * 23 );
218
+    }
219
+
220
+    /**
221
+     * Force the cookie expiration time to 24 hours
222
+     *
223
+     * @access public
224
+     * @since 1.5.7
225
+     * @param int $exp Default expiration (1 hour)
226
+     * @return int
227
+     */
228
+    public function set_expiration_time( $exp ) {
229
+        return ( 30 * 60 * 24 );
230
+    }
231
+
232
+    /**
233
+     * Starts a new session if one hasn't started yet.
234
+     *
235
+     * @return boolean
236
+     * Checks to see if the server supports PHP sessions
237
+     * or if the GEODIR_USE_PHP_SESSIONS constant is defined
238
+     *
239
+     * @access public
240
+     * @since 1.5.7
241
+     * @return boolean $ret True if we are using PHP sessions, false otherwise
242
+     */
243
+    public function use_php_sessions() {
244
+        $ret = false;
245
+
246
+        // If the database variable is already set, no need to run autodetection
247
+        $geodir_use_php_sessions = (bool)get_option( 'geodir_use_php_sessions' );
248
+
249
+        if (!$geodir_use_php_sessions ) {
250
+            // Attempt to detect if the server supports PHP sessions
251
+            if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
252
+                $this->set( 'geodir_use_php_sessions', 1 );
253 253
 				
254
-				if ( $this->get( 'geodir_use_php_sessions' ) ) {
255
-					$ret = true;
256
-
257
-					// Set the database option
258
-					update_option( 'geodir_use_php_sessions', true );
259
-				}
260
-			}
261
-		} else {
262
-			$ret = $geodir_use_php_sessions;
263
-		}
264
-
265
-		// Enable or disable PHP Sessions based on the GEODIR_USE_PHP_SESSIONS constant
266
-		if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && GEODIR_USE_PHP_SESSIONS ) {
267
-			$ret = true;
268
-		} else if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && ! GEODIR_USE_PHP_SESSIONS ) {
269
-			$ret = false;
270
-		}
271
-
272
-		return (bool) apply_filters( 'geodir_use_php_sessions', $ret );
273
-	}
274
-
275
-	/**
276
-	 * Starts a new session if one hasn't started yet.
277
-	 */
278
-	public function maybe_start_session() {
279
-		if ( !session_id() && !headers_sent() ) {
280
-			session_start();
281
-		}
282
-	}
283
-
284
-	/**
285
-	 * Determines if a user has set the GEODIR_USE_CART_COOKIE
286
-	 *
287
-	 * @since  1.5.7
288
-	 * @return bool If the store should use the geodir_items_in_cart cookie to help avoid caching
289
-	 */
290
-	public function use_cart_cookie() {
291
-		$ret = true;
292
-
293
-		if ( defined( 'GEODIR_USE_CART_COOKIE' ) && ! GEODIR_USE_CART_COOKIE ) {
294
-			$ret = false;
295
-		}
296
-
297
-		return (bool) apply_filters( 'geodir_use_cart_cookie', $ret );
298
-	}
254
+                if ( $this->get( 'geodir_use_php_sessions' ) ) {
255
+                    $ret = true;
256
+
257
+                    // Set the database option
258
+                    update_option( 'geodir_use_php_sessions', true );
259
+                }
260
+            }
261
+        } else {
262
+            $ret = $geodir_use_php_sessions;
263
+        }
264
+
265
+        // Enable or disable PHP Sessions based on the GEODIR_USE_PHP_SESSIONS constant
266
+        if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && GEODIR_USE_PHP_SESSIONS ) {
267
+            $ret = true;
268
+        } else if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && ! GEODIR_USE_PHP_SESSIONS ) {
269
+            $ret = false;
270
+        }
271
+
272
+        return (bool) apply_filters( 'geodir_use_php_sessions', $ret );
273
+    }
274
+
275
+    /**
276
+     * Starts a new session if one hasn't started yet.
277
+     */
278
+    public function maybe_start_session() {
279
+        if ( !session_id() && !headers_sent() ) {
280
+            session_start();
281
+        }
282
+    }
283
+
284
+    /**
285
+     * Determines if a user has set the GEODIR_USE_CART_COOKIE
286
+     *
287
+     * @since  1.5.7
288
+     * @return bool If the store should use the geodir_items_in_cart cookie to help avoid caching
289
+     */
290
+    public function use_cart_cookie() {
291
+        $ret = true;
292
+
293
+        if ( defined( 'GEODIR_USE_CART_COOKIE' ) && ! GEODIR_USE_CART_COOKIE ) {
294
+            $ret = false;
295
+        }
296
+
297
+        return (bool) apply_filters( 'geodir_use_cart_cookie', $ret );
298
+    }
299 299
 }
300 300
 
301 301
 global $gd_session;
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5 5
 /**
6 6
  * Geodir_Session Class.
@@ -46,36 +46,36 @@  discard block
 block discarded – undo
46 46
 	public function __construct() {
47 47
 		$this->use_php_sessions = $this->use_php_sessions();
48 48
 
49
-		if ( $this->use_php_sessions ) {
50
-			if ( is_multisite() ) {
49
+		if ($this->use_php_sessions) {
50
+			if (is_multisite()) {
51 51
 				$this->prefix = '_' . get_current_blog_id();
52 52
 			}
53 53
 
54 54
 			// Use PHP SESSION (must be enabled via the GEODIR_USE_PHP_SESSIONS constant)
55
-			add_action( 'init', array( $this, 'maybe_start_session' ), -2 );
55
+			add_action('init', array($this, 'maybe_start_session'), -2);
56 56
 		} else {
57 57
 			// Use WP_Session (default)
58
-			if ( !defined( 'WP_SESSION_COOKIE' ) ) {
59
-				define( 'WP_SESSION_COOKIE', 'geodir_wp_session' );
58
+			if (!defined('WP_SESSION_COOKIE')) {
59
+				define('WP_SESSION_COOKIE', 'geodir_wp_session');
60 60
 			}
61 61
 
62
-			if ( !class_exists( 'Recursive_ArrayAccess' ) ) {
62
+			if (!class_exists('Recursive_ArrayAccess')) {
63 63
 				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-recursive-arrayaccess.php';
64 64
 			}
65 65
 
66
-			if ( !class_exists( 'WP_Session' ) ) {
66
+			if (!class_exists('WP_Session')) {
67 67
 				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/class-wp-session.php';
68 68
 				require_once GEODIRECTORY_PLUGIN_DIR . 'wp-session/wp-session.php';
69 69
 			}
70 70
 
71
-			add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
72
-			add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
71
+			add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999);
72
+			add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999);
73 73
 		}
74 74
 
75
-		if ( empty( $this->session ) && ! $this->use_php_sessions ) {
76
-			add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
75
+		if (empty($this->session) && !$this->use_php_sessions) {
76
+			add_action('plugins_loaded', array($this, 'init'), -1);
77 77
 		} else {
78
-			add_action( 'init', array( $this, 'init' ), -1 );
78
+			add_action('init', array($this, 'init'), -1);
79 79
 		}
80 80
 	}
81 81
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * @return void
88 88
 	 */
89 89
 	public function init() {
90
-		if ( $this->use_php_sessions ) {
91
-			$this->session = isset( $_SESSION['gd' . $this->prefix ] ) && is_array( $_SESSION['gd' . $this->prefix ] ) ? $_SESSION['gd' . $this->prefix ] : array();
90
+		if ($this->use_php_sessions) {
91
+			$this->session = isset($_SESSION['gd' . $this->prefix]) && is_array($_SESSION['gd' . $this->prefix]) ? $_SESSION['gd' . $this->prefix] : array();
92 92
 		} else {
93 93
 			$this->session = WP_Session::get_instance();
94 94
 		}
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 	 * @param string $key Session key
116 116
 	 * @return string Session variable
117 117
 	 */
118
-	public function get( $key ) {
119
-		$key = sanitize_key( $key );
120
-		return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
118
+	public function get($key) {
119
+		$key = sanitize_key($key);
120
+		return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false;
121 121
 	}
122 122
 
123 123
 	/**
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 * @param integer $value Session variable
130 130
 	 * @return string Session variable
131 131
 	 */
132
-	public function set( $key, $value ) {
133
-		$key = sanitize_key( $key );
132
+	public function set($key, $value) {
133
+		$key = sanitize_key($key);
134 134
 
135
-		if ( is_array( $value ) ) {
136
-			$this->session[ $key ] = maybe_serialize( $value );
135
+		if (is_array($value)) {
136
+			$this->session[$key] = maybe_serialize($value);
137 137
 		} else {
138
-			$this->session[ $key ] = $value;
138
+			$this->session[$key] = $value;
139 139
 		}
140 140
 
141
-		if ( $this->use_php_sessions ) {
142
-			$_SESSION['gd' . $this->prefix ] = $this->session;
141
+		if ($this->use_php_sessions) {
142
+			$_SESSION['gd' . $this->prefix] = $this->session;
143 143
 		}
144 144
 
145
-		return $this->session[ $key ];
145
+		return $this->session[$key];
146 146
 	}
147 147
 	
148 148
 	/**
@@ -154,29 +154,29 @@  discard block
 block discarded – undo
154 154
 	 * @param integer $value Session variable.
155 155
 	 * @return string Session variable.
156 156
 	 */
157
-	public function un_set( $key ) {
158
-		if ( empty( $key ) ) {
157
+	public function un_set($key) {
158
+		if (empty($key)) {
159 159
 			return false;
160 160
 		}
161 161
 		
162
-		if ( is_array( $key ) ) {
162
+		if (is_array($key)) {
163 163
 			foreach ($key as $index) {
164
-				$index = sanitize_key( $index );
164
+				$index = sanitize_key($index);
165 165
 			
166
-				if ( $index && isset( $this->session[ $index ] ) ) {
167
-					unset( $this->session[ $index ] );
166
+				if ($index && isset($this->session[$index])) {
167
+					unset($this->session[$index]);
168 168
 				}
169 169
 			}
170 170
 		} else {
171
-			$key = sanitize_key( $key );
171
+			$key = sanitize_key($key);
172 172
 			
173
-			if ( isset( $this->session[ $key ] ) ) {
174
-				unset( $this->session[ $key ] );
173
+			if (isset($this->session[$key])) {
174
+				unset($this->session[$key]);
175 175
 			}
176 176
 		}
177 177
 
178
-		if ( $this->use_php_sessions ) {
179
-			$_SESSION['gd' . $this->prefix ] = $this->session;
178
+		if ($this->use_php_sessions) {
179
+			$_SESSION['gd' . $this->prefix] = $this->session;
180 180
 		}
181 181
 
182 182
 		return true;
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	 * @param integer $value Session variable.
192 192
 	 * @return string Session variable.
193 193
 	 */
194
-	public function is_set( $key ) {
195
-		$key = sanitize_key( $key );
194
+	public function is_set($key) {
195
+		$key = sanitize_key($key);
196 196
 		
197
-		if ( empty( $key ) ) {
197
+		if (empty($key)) {
198 198
 			return false;
199 199
 		}
200 200
 
201
-		if ( isset( $this->session[ $key ] ) ) {
201
+		if (isset($this->session[$key])) {
202 202
 			return true;
203 203
 		}
204 204
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @param int $exp Default expiration (1 hour)
214 214
 	 * @return int
215 215
 	 */
216
-	public function set_expiration_variant_time( $exp ) {
217
-		return ( 30 * 60 * 23 );
216
+	public function set_expiration_variant_time($exp) {
217
+		return (30 * 60 * 23);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 * @param int $exp Default expiration (1 hour)
226 226
 	 * @return int
227 227
 	 */
228
-	public function set_expiration_time( $exp ) {
229
-		return ( 30 * 60 * 24 );
228
+	public function set_expiration_time($exp) {
229
+		return (30 * 60 * 24);
230 230
 	}
231 231
 
232 232
 	/**
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 		$ret = false;
245 245
 
246 246
 		// If the database variable is already set, no need to run autodetection
247
-		$geodir_use_php_sessions = (bool)get_option( 'geodir_use_php_sessions' );
247
+		$geodir_use_php_sessions = (bool) get_option('geodir_use_php_sessions');
248 248
 
249
-		if (!$geodir_use_php_sessions ) {
249
+		if (!$geodir_use_php_sessions) {
250 250
 			// Attempt to detect if the server supports PHP sessions
251
-			if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) {
252
-				$this->set( 'geodir_use_php_sessions', 1 );
251
+			if (function_exists('session_start') && !ini_get('safe_mode')) {
252
+				$this->set('geodir_use_php_sessions', 1);
253 253
 				
254
-				if ( $this->get( 'geodir_use_php_sessions' ) ) {
254
+				if ($this->get('geodir_use_php_sessions')) {
255 255
 					$ret = true;
256 256
 
257 257
 					// Set the database option
258
-					update_option( 'geodir_use_php_sessions', true );
258
+					update_option('geodir_use_php_sessions', true);
259 259
 				}
260 260
 			}
261 261
 		} else {
@@ -263,20 +263,20 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		// Enable or disable PHP Sessions based on the GEODIR_USE_PHP_SESSIONS constant
266
-		if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && GEODIR_USE_PHP_SESSIONS ) {
266
+		if (defined('GEODIR_USE_PHP_SESSIONS') && GEODIR_USE_PHP_SESSIONS) {
267 267
 			$ret = true;
268
-		} else if ( defined( 'GEODIR_USE_PHP_SESSIONS' ) && ! GEODIR_USE_PHP_SESSIONS ) {
268
+		} else if (defined('GEODIR_USE_PHP_SESSIONS') && !GEODIR_USE_PHP_SESSIONS) {
269 269
 			$ret = false;
270 270
 		}
271 271
 
272
-		return (bool) apply_filters( 'geodir_use_php_sessions', $ret );
272
+		return (bool) apply_filters('geodir_use_php_sessions', $ret);
273 273
 	}
274 274
 
275 275
 	/**
276 276
 	 * Starts a new session if one hasn't started yet.
277 277
 	 */
278 278
 	public function maybe_start_session() {
279
-		if ( !session_id() && !headers_sent() ) {
279
+		if (!session_id() && !headers_sent()) {
280 280
 			session_start();
281 281
 		}
282 282
 	}
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 	public function use_cart_cookie() {
291 291
 		$ret = true;
292 292
 
293
-		if ( defined( 'GEODIR_USE_CART_COOKIE' ) && ! GEODIR_USE_CART_COOKIE ) {
293
+		if (defined('GEODIR_USE_CART_COOKIE') && !GEODIR_USE_CART_COOKIE) {
294 294
 			$ret = false;
295 295
 		}
296 296
 
297
-		return (bool) apply_filters( 'geodir_use_cart_cookie', $ret );
297
+		return (bool) apply_filters('geodir_use_cart_cookie', $ret);
298 298
 	}
299 299
 }
300 300
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly.
3
-if (!defined( 'ABSPATH' ) ) exit;
3
+if (!defined( 'ABSPATH' ) ) {
4
+    exit;
5
+}
4 6
 
5 7
 /**
6 8
  * Geodir_Session Class.
Please login to merge, or discard this patch.