@@ -23,8 +23,12 @@ |
||
23 | 23 | |
24 | 24 | $collate = ''; |
25 | 25 | if ($wpdb->has_cap('collation')) { |
26 | - if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
27 | - if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate"; |
|
26 | + if (!empty($wpdb->charset)) { |
|
27 | + $collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
28 | + } |
|
29 | + if (!empty($wpdb->collate)) { |
|
30 | + $collate .= " COLLATE $wpdb->collate"; |
|
31 | + } |
|
28 | 32 | } |
29 | 33 | |
30 | 34 | /** |
@@ -177,8 +177,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
2781 | 2880 | data-placeholder="<?php _e('Choose countries…', '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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -40,8 +40,9 @@ |
||
40 | 40 | $geodir_active_nav_locations = get_nav_menu_locations(); |
41 | 41 | if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) { |
42 | 42 | foreach ($geodir_active_nav_locations as $key => $theme_location) { |
43 | - if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) |
|
44 | - $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
43 | + if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) { |
|
44 | + $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | } |
47 | 48 |
@@ -11,10 +11,11 @@ discard block |
||
11 | 11 | $image_array = array(); |
12 | 12 | $post_meta = array(); |
13 | 13 | |
14 | -if (geodir_dummy_folder_exists()) |
|
15 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
|
16 | -else |
|
17 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
|
14 | +if (geodir_dummy_folder_exists()) { |
|
15 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
|
16 | +} else { |
|
17 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
|
18 | +} |
|
18 | 19 | |
19 | 20 | switch ($dummy_post_index) { |
20 | 21 | |
@@ -1807,16 +1808,18 @@ discard block |
||
1807 | 1808 | |
1808 | 1809 | foreach ($post_info as $post_info) { |
1809 | 1810 | $default_location = geodir_get_default_location(); |
1810 | - if ($city_bound_lat1 > $city_bound_lat2) |
|
1811 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
1812 | - else |
|
1813 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
1814 | - |
|
1815 | - |
|
1816 | - if ($city_bound_lng1 > $city_bound_lng2) |
|
1817 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
1818 | - else |
|
1819 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
1811 | + if ($city_bound_lat1 > $city_bound_lat2) { |
|
1812 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
1813 | + } else { |
|
1814 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
1815 | + } |
|
1816 | + |
|
1817 | + |
|
1818 | + if ($city_bound_lng1 > $city_bound_lng2) { |
|
1819 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
1820 | + } else { |
|
1821 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
1822 | + } |
|
1820 | 1823 | $post_address = array(); |
1821 | 1824 | $postal_code = ''; |
1822 | 1825 | $address = ''; |
@@ -1831,28 +1834,32 @@ discard block |
||
1831 | 1834 | } |
1832 | 1835 | |
1833 | 1836 | if ($add_value->types[0] == 'street_number') { |
1834 | - if ($address != '') |
|
1835 | - $address .= ',' . $add_value->long_name; |
|
1836 | - else |
|
1837 | - $address .= $add_value->long_name; |
|
1837 | + if ($address != '') { |
|
1838 | + $address .= ',' . $add_value->long_name; |
|
1839 | + } else { |
|
1840 | + $address .= $add_value->long_name; |
|
1841 | + } |
|
1838 | 1842 | } |
1839 | 1843 | if ($add_value->types[0] == 'route') { |
1840 | - if ($address != '') |
|
1841 | - $address .= ',' . $add_value->long_name; |
|
1842 | - else |
|
1843 | - $address .= $add_value->long_name; |
|
1844 | + if ($address != '') { |
|
1845 | + $address .= ',' . $add_value->long_name; |
|
1846 | + } else { |
|
1847 | + $address .= $add_value->long_name; |
|
1848 | + } |
|
1844 | 1849 | } |
1845 | 1850 | if ($add_value->types[0] == 'neighborhood') { |
1846 | - if ($address != '') |
|
1847 | - $address .= ',' . $add_value->long_name; |
|
1848 | - else |
|
1849 | - $address .= $add_value->long_name; |
|
1851 | + if ($address != '') { |
|
1852 | + $address .= ',' . $add_value->long_name; |
|
1853 | + } else { |
|
1854 | + $address .= $add_value->long_name; |
|
1855 | + } |
|
1850 | 1856 | } |
1851 | 1857 | if ($add_value->types[0] == 'sublocality') { |
1852 | - if ($address != '') |
|
1853 | - $address .= ',' . $add_value->long_name; |
|
1854 | - else |
|
1855 | - $address .= $add_value->long_name; |
|
1858 | + if ($address != '') { |
|
1859 | + $address .= ',' . $add_value->long_name; |
|
1860 | + } else { |
|
1861 | + $address .= $add_value->long_name; |
|
1862 | + } |
|
1856 | 1863 | } |
1857 | 1864 | |
1858 | 1865 | } |
@@ -126,10 +126,11 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') { |
129 | - if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) |
|
130 | - geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
131 | - else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) |
|
132 | - geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
129 | + if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) { |
|
130 | + geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
131 | + } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) { |
|
132 | + geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
133 | + } |
|
133 | 134 | } |
134 | 135 | |
135 | 136 | if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) { |
@@ -151,22 +152,25 @@ discard block |
||
151 | 152 | if (current_user_can('manage_options')) { |
152 | 153 | switch ($_REQUEST['geodir_autofill']): |
153 | 154 | case "geodir_dummy_delete" : |
154 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) |
|
155 | - return; |
|
155 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) { |
|
156 | + return; |
|
157 | + } |
|
156 | 158 | |
157 | - if (isset($_REQUEST['posttype'])) |
|
158 | - /** |
|
159 | + if (isset($_REQUEST['posttype'])) { |
|
160 | + /** |
|
159 | 161 | * Used to delete the dummy post data per post type. |
160 | 162 | * |
161 | 163 | * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype']. |
162 | 164 | * |
163 | 165 | * @since 1.0.0 |
164 | 166 | */ |
165 | - do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); |
|
167 | + do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); |
|
168 | + } |
|
166 | 169 | break; |
167 | 170 | case "geodir_dummy_insert" : |
168 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) |
|
169 | - return; |
|
171 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) { |
|
172 | + return; |
|
173 | + } |
|
170 | 174 | |
171 | 175 | global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
172 | 176 | $dummy_post_index = $_REQUEST['insert_dummy_post_index']; |
@@ -175,15 +179,16 @@ discard block |
||
175 | 179 | $city_bound_lat2 = $_REQUEST['city_bound_lat2']; |
176 | 180 | $city_bound_lng2 = $_REQUEST['city_bound_lng2']; |
177 | 181 | |
178 | - if (isset($_REQUEST['posttype'])) |
|
179 | - /** |
|
182 | + if (isset($_REQUEST['posttype'])) { |
|
183 | + /** |
|
180 | 184 | * Used to insert the dummy post data per post type. |
181 | 185 | * |
182 | 186 | * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype']. |
183 | 187 | * |
184 | 188 | * @since 1.0.0 |
185 | 189 | */ |
186 | - do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); |
|
190 | + do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); |
|
191 | + } |
|
187 | 192 | |
188 | 193 | break; |
189 | 194 | endswitch; |
@@ -204,8 +209,9 @@ discard block |
||
204 | 209 | |
205 | 210 | if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') { |
206 | 211 | |
207 | - if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') |
|
208 | - require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'); |
|
212 | + if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') { |
|
213 | + require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'); |
|
214 | + } |
|
209 | 215 | |
210 | 216 | exit; |
211 | 217 | } |
@@ -266,8 +272,9 @@ discard block |
||
266 | 272 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
267 | 273 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
268 | 274 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
269 | - } else |
|
270 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
275 | + } else { |
|
276 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
277 | + } |
|
271 | 278 | |
272 | 279 | wp_redirect($redirect_to); |
273 | 280 | } else { |
@@ -280,9 +287,9 @@ discard block |
||
280 | 287 | |
281 | 288 | $gd_session->un_set('listing'); |
282 | 289 | |
283 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) |
|
284 | - wp_redirect(get_permalink($_REQUEST['pid'])); |
|
285 | - else { |
|
290 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) { |
|
291 | + wp_redirect(get_permalink($_REQUEST['pid'])); |
|
292 | + } else { |
|
286 | 293 | geodir_remove_temp_images(); |
287 | 294 | wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type']))); |
288 | 295 | } |
@@ -310,8 +317,9 @@ discard block |
||
310 | 317 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
311 | 318 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
312 | 319 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); |
313 | - } else |
|
314 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
320 | + } else { |
|
321 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
322 | + } |
|
315 | 323 | |
316 | 324 | $gd_session->un_set('listing'); |
317 | 325 | wp_redirect($redirect_to); |
@@ -333,8 +341,9 @@ discard block |
||
333 | 341 | $lastid = wp_delete_post($_REQUEST['pid']); |
334 | 342 | } |
335 | 343 | |
336 | - if ($lastid && !is_wp_error($lastid)) |
|
337 | - wp_redirect($_SERVER['HTTP_REFERER']); |
|
344 | + if ($lastid && !is_wp_error($lastid)) { |
|
345 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
346 | + } |
|
338 | 347 | |
339 | 348 | //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) ); |
340 | 349 | } |
@@ -102,8 +102,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -204,8 +204,9 @@ discard block |
||
204 | 204 | ############################################################# |
205 | 205 | function manage_category_custom_fields($deprecated, $column_name, $term_id) |
206 | 206 | { |
207 | - if ($column_name == 'cat_ID_num') |
|
208 | - echo $term_id; |
|
207 | + if ($column_name == 'cat_ID_num') { |
|
208 | + echo $term_id; |
|
209 | + } |
|
209 | 210 | |
210 | 211 | if ($column_name == 'cat_icon') { |
211 | 212 | $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon'); |
@@ -214,9 +215,9 @@ discard block |
||
214 | 215 | |
215 | 216 | $file_info = pathinfo($term_icon_url['src']); |
216 | 217 | |
217 | - if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
218 | - $sub_dir = $file_info['dirname']; |
|
219 | - else{$sub_dir = '';} |
|
218 | + if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
219 | + $sub_dir = $file_info['dirname']; |
|
220 | + } else{$sub_dir = '';} |
|
220 | 221 | |
221 | 222 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
222 | 223 | $uploads_baseurl = $uploads['baseurl']; |
@@ -236,8 +237,9 @@ discard block |
||
236 | 237 | |
237 | 238 | if ($column_name == 'cat_default_img') { |
238 | 239 | $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img'); |
239 | - if ($cat_default_img != '') |
|
240 | - echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; |
|
240 | + if ($cat_default_img != '') { |
|
241 | + echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; |
|
242 | + } |
|
241 | 243 | |
242 | 244 | } |
243 | 245 | } |
@@ -245,11 +247,12 @@ discard block |
||
245 | 247 | function geodir_get_default_catimage($term_id, $post_type = 'gd_place') |
246 | 248 | { |
247 | 249 | |
248 | - if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) |
|
249 | - return $cat_default_img; |
|
250 | - else |
|
251 | - return false; |
|
252 | -} |
|
250 | + if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) { |
|
251 | + return $cat_default_img; |
|
252 | + } else { |
|
253 | + return false; |
|
254 | + } |
|
255 | + } |
|
253 | 256 | |
254 | 257 | //Clear custom fields |
255 | 258 | add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field'); |
@@ -248,8 +248,9 @@ discard block |
||
248 | 248 | |
249 | 249 | $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; |
250 | 250 | |
251 | - if (!empty($comment_info)) |
|
252 | - $status = $comment_info->comment_approved; |
|
251 | + if (!empty($comment_info)) { |
|
252 | + $status = $comment_info->comment_approved; |
|
253 | + } |
|
253 | 254 | |
254 | 255 | if ($status == 'approve' || $status == 1) { |
255 | 256 | $status = 1; |
@@ -381,12 +382,14 @@ discard block |
||
381 | 382 | function geodir_wrap_comment_text($content, $comment = '') |
382 | 383 | { |
383 | 384 | $rating = 0; |
384 | - if (!empty($comment)) |
|
385 | - $rating = geodir_get_commentoverall($comment->comment_ID); |
|
385 | + if (!empty($comment)) { |
|
386 | + $rating = geodir_get_commentoverall($comment->comment_ID); |
|
387 | + } |
|
386 | 388 | if ($rating != 0 && !is_admin()) { |
387 | 389 | return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>'; |
388 | - } else |
|
389 | - return $content; |
|
390 | + } else { |
|
391 | + return $content; |
|
392 | + } |
|
390 | 393 | |
391 | 394 | } |
392 | 395 | |
@@ -475,11 +478,12 @@ discard block |
||
475 | 478 | $post_ratings = get_post_meta($post_id, 'overall_rating'); |
476 | 479 | } |
477 | 480 | |
478 | - if ($post_ratings) |
|
479 | - return $post_ratings; |
|
480 | - else |
|
481 | - return false; |
|
482 | -} |
|
481 | + if ($post_ratings) { |
|
482 | + return $post_ratings; |
|
483 | + } else { |
|
484 | + return false; |
|
485 | + } |
|
486 | + } |
|
483 | 487 | |
484 | 488 | |
485 | 489 | /** |
@@ -504,11 +508,12 @@ discard block |
||
504 | 508 | ) |
505 | 509 | ); |
506 | 510 | |
507 | - if (!empty($reatings)) |
|
508 | - return $reatings; |
|
509 | - else |
|
510 | - return false; |
|
511 | -} |
|
511 | + if (!empty($reatings)) { |
|
512 | + return $reatings; |
|
513 | + } else { |
|
514 | + return false; |
|
515 | + } |
|
516 | + } |
|
512 | 517 | |
513 | 518 | /** |
514 | 519 | * Get review total of a Post. |
@@ -532,11 +537,12 @@ discard block |
||
532 | 537 | ) |
533 | 538 | ); |
534 | 539 | |
535 | - if (!empty($results)) |
|
536 | - return $results; |
|
537 | - else |
|
538 | - return false; |
|
539 | -} |
|
540 | + if (!empty($results)) { |
|
541 | + return $results; |
|
542 | + } else { |
|
543 | + return false; |
|
544 | + } |
|
545 | + } |
|
540 | 546 | |
541 | 547 | /** |
542 | 548 | * Get review count by user ID. |
@@ -559,11 +565,12 @@ discard block |
||
559 | 565 | ) |
560 | 566 | ); |
561 | 567 | |
562 | - if (!empty($results)) |
|
563 | - return $results; |
|
564 | - else |
|
565 | - return false; |
|
566 | -} |
|
568 | + if (!empty($results)) { |
|
569 | + return $results; |
|
570 | + } else { |
|
571 | + return false; |
|
572 | + } |
|
573 | + } |
|
567 | 574 | |
568 | 575 | /** |
569 | 576 | * Get average overall rating of a Post. |
@@ -597,11 +604,12 @@ discard block |
||
597 | 604 | ) |
598 | 605 | ); |
599 | 606 | |
600 | - if (!empty($results)) |
|
601 | - return $results; |
|
602 | - else |
|
603 | - return false; |
|
604 | -} |
|
607 | + if (!empty($results)) { |
|
608 | + return $results; |
|
609 | + } else { |
|
610 | + return false; |
|
611 | + } |
|
612 | + } |
|
605 | 613 | |
606 | 614 | /** |
607 | 615 | * Get review count of a Post. |
@@ -625,11 +633,12 @@ discard block |
||
625 | 633 | ) |
626 | 634 | ); |
627 | 635 | |
628 | - if (!empty($results)) |
|
629 | - return $results; |
|
630 | - else |
|
631 | - return false; |
|
632 | -} |
|
636 | + if (!empty($results)) { |
|
637 | + return $results; |
|
638 | + } else { |
|
639 | + return false; |
|
640 | + } |
|
641 | + } |
|
633 | 642 | |
634 | 643 | /** |
635 | 644 | * Get comments count of a Post. |
@@ -655,11 +664,12 @@ discard block |
||
655 | 664 | ); |
656 | 665 | |
657 | 666 | |
658 | - if (!empty($results)) |
|
659 | - return $results; |
|
660 | - else |
|
661 | - return false; |
|
662 | -} |
|
667 | + if (!empty($results)) { |
|
668 | + return $results; |
|
669 | + } else { |
|
670 | + return false; |
|
671 | + } |
|
672 | + } |
|
663 | 673 | |
664 | 674 | /** |
665 | 675 | * Get overall rating of a comment. |
@@ -683,11 +693,12 @@ discard block |
||
683 | 693 | ) |
684 | 694 | ); |
685 | 695 | |
686 | - if ($reatings) |
|
687 | - return $reatings; |
|
688 | - else |
|
689 | - return false; |
|
690 | -} |
|
696 | + if ($reatings) { |
|
697 | + return $reatings; |
|
698 | + } else { |
|
699 | + return false; |
|
700 | + } |
|
701 | + } |
|
691 | 702 | |
692 | 703 | /** |
693 | 704 | * Returns average overall rating of a Post. Depreciated since ver 1.3.6. |
@@ -930,8 +941,9 @@ discard block |
||
930 | 941 | $active_tabs = get_option('geodir_detail_page_tabs_excluded'); |
931 | 942 | |
932 | 943 | $is_display = true; |
933 | - if (!empty($active_tabs) && in_array('reviews', $active_tabs)) |
|
934 | - $is_display = false; |
|
944 | + if (!empty($active_tabs) && in_array('reviews', $active_tabs)) { |
|
945 | + $is_display = false; |
|
946 | + } |
|
935 | 947 | |
936 | 948 | /** |
937 | 949 | * Filter to change display value. |
@@ -126,8 +126,10 @@ |
||
126 | 126 | $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
127 | 127 | if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
128 | 128 | return $matches[0]; |
129 | - } else return ''; |
|
130 | -} |
|
129 | + } else { |
|
130 | + return ''; |
|
131 | + } |
|
132 | + } |
|
131 | 133 | |
132 | 134 | |
133 | 135 | /** |