@@ -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 | |
@@ -24,8 +24,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -436,8 +441,9 @@ discard block |
||
| 436 | 441 | ); |
| 437 | 442 | |
| 438 | 443 | $display = ''; |
| 439 | - if ($check_html_variable) |
|
| 440 | - $display = ' style="display:none;"'; |
|
| 444 | + if ($check_html_variable) { |
|
| 445 | + $display = ' style="display:none;"'; |
|
| 446 | + } |
|
| 441 | 447 | |
| 442 | 448 | |
| 443 | 449 | ?> |
@@ -744,8 +750,9 @@ discard block |
||
| 744 | 750 | |
| 745 | 751 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 746 | 752 | |
| 747 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 748 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 753 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) { |
|
| 754 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
| 755 | + } |
|
| 749 | 756 | |
| 750 | 757 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 751 | 758 | |
@@ -771,15 +778,17 @@ discard block |
||
| 771 | 778 | $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
| 772 | 779 | switch ($geodir_admin_ajax_action) {
|
| 773 | 780 | case 'diagnosis' : |
| 774 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 775 | - $diagnose_this = $_REQUEST['diagnose_this']; |
|
| 781 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 782 | + $diagnose_this = $_REQUEST['diagnose_this']; |
|
| 783 | + } |
|
| 776 | 784 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 777 | 785 | exit(); |
| 778 | 786 | break; |
| 779 | 787 | |
| 780 | 788 | case 'diagnosis-fix' : |
| 781 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 782 | - $diagnose_this = $_REQUEST['diagnose_this']; |
|
| 789 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 790 | + $diagnose_this = $_REQUEST['diagnose_this']; |
|
| 791 | + } |
|
| 783 | 792 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 784 | 793 | exit(); |
| 785 | 794 | break; |
@@ -1337,11 +1346,11 @@ discard block |
||
| 1337 | 1346 | ////////////////////////////////// |
| 1338 | 1347 | $option_value = get_option('geodir_home_page');
|
| 1339 | 1348 | $page = get_post($option_value); |
| 1340 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1349 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1341 | 1350 | |
| 1342 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1343 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1344 | - else {
|
|
| 1351 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1352 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1353 | + } else {
|
|
| 1345 | 1354 | $is_error_during_diagnose = true; |
| 1346 | 1355 | $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
| 1347 | 1356 | if ($fix) {
|
@@ -1362,11 +1371,11 @@ discard block |
||
| 1362 | 1371 | ////////////////////////////////// |
| 1363 | 1372 | $option_value = get_option('geodir_add_listing_page');
|
| 1364 | 1373 | $page = get_post($option_value); |
| 1365 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1374 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1366 | 1375 | |
| 1367 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1368 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1369 | - else {
|
|
| 1376 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1377 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1378 | + } else {
|
|
| 1370 | 1379 | $is_error_during_diagnose = true; |
| 1371 | 1380 | $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
| 1372 | 1381 | if ($fix) {
|
@@ -1388,11 +1397,11 @@ discard block |
||
| 1388 | 1397 | ////////////////////////////////// |
| 1389 | 1398 | $option_value = get_option('geodir_preview_page');
|
| 1390 | 1399 | $page = get_post($option_value); |
| 1391 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1400 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1392 | 1401 | |
| 1393 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1394 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1395 | - else {
|
|
| 1402 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1403 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1404 | + } else {
|
|
| 1396 | 1405 | $is_error_during_diagnose = true; |
| 1397 | 1406 | $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
| 1398 | 1407 | if ($fix) {
|
@@ -1413,11 +1422,11 @@ discard block |
||
| 1413 | 1422 | ////////////////////////////////// |
| 1414 | 1423 | $option_value = get_option('geodir_success_page');
|
| 1415 | 1424 | $page = get_post($option_value); |
| 1416 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1425 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1417 | 1426 | |
| 1418 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1419 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1420 | - else {
|
|
| 1427 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1428 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1429 | + } else {
|
|
| 1421 | 1430 | $is_error_during_diagnose = true; |
| 1422 | 1431 | $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
| 1423 | 1432 | if ($fix) {
|
@@ -1438,11 +1447,11 @@ discard block |
||
| 1438 | 1447 | ////////////////////////////////// |
| 1439 | 1448 | $option_value = get_option('geodir_info_page');
|
| 1440 | 1449 | $page = get_post($option_value); |
| 1441 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1450 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1442 | 1451 | |
| 1443 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1444 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1445 | - else {
|
|
| 1452 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1453 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1454 | + } else {
|
|
| 1446 | 1455 | $is_error_during_diagnose = true; |
| 1447 | 1456 | $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
| 1448 | 1457 | if ($fix) {
|
@@ -1463,11 +1472,11 @@ discard block |
||
| 1463 | 1472 | ////////////////////////////////// |
| 1464 | 1473 | $option_value = get_option('geodir_login_page');
|
| 1465 | 1474 | $page = get_post($option_value); |
| 1466 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1475 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1467 | 1476 | |
| 1468 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1469 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1470 | - else {
|
|
| 1477 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1478 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1479 | + } else {
|
|
| 1471 | 1480 | $is_error_during_diagnose = true; |
| 1472 | 1481 | $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
| 1473 | 1482 | if ($fix) {
|
@@ -1488,11 +1497,11 @@ discard block |
||
| 1488 | 1497 | ////////////////////////////////// |
| 1489 | 1498 | $option_value = get_option('geodir_location_page');
|
| 1490 | 1499 | $page = get_post($option_value); |
| 1491 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1500 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1492 | 1501 | |
| 1493 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1494 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1495 | - else {
|
|
| 1502 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1503 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1504 | + } else {
|
|
| 1496 | 1505 | $is_error_during_diagnose = true; |
| 1497 | 1506 | $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
| 1498 | 1507 | if ($fix) {
|
@@ -1936,8 +1945,9 @@ discard block |
||
| 1936 | 1945 | ); |
| 1937 | 1946 | |
| 1938 | 1947 | $post_location_info = $request_info['post_location']; |
| 1939 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 1940 | - $post_location_id = $location_id; |
|
| 1948 | + if ($location_id = geodir_add_new_location($post_location_info)) { |
|
| 1949 | + $post_location_id = $location_id; |
|
| 1950 | + } |
|
| 1941 | 1951 | } else {
|
| 1942 | 1952 | $post_location_id = 0; |
| 1943 | 1953 | } |
@@ -2000,8 +2010,9 @@ discard block |
||
| 2000 | 2010 | $attachment_set = ''; |
| 2001 | 2011 | |
| 2002 | 2012 | foreach ($attachment as $key => $val) {
|
| 2003 | - if ($val != '') |
|
| 2004 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2013 | + if ($val != '') { |
|
| 2014 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2015 | + } |
|
| 2005 | 2016 | } |
| 2006 | 2017 | $attachment_set = trim($attachment_set, ", "); |
| 2007 | 2018 | |
@@ -2097,8 +2108,7 @@ discard block |
||
| 2097 | 2108 | |
| 2098 | 2109 | $parts = json_decode($response['body']); |
| 2099 | 2110 | //print_r($parts); |
| 2100 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2101 | - else{
|
|
| 2111 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
|
|
| 2102 | 2112 | |
| 2103 | 2113 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2104 | 2114 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2106,17 +2116,16 @@ discard block |
||
| 2106 | 2116 | } |
| 2107 | 2117 | |
| 2108 | 2118 | |
| 2109 | - } |
|
| 2110 | - elseif(!empty($response['response']['code'])) {
|
|
| 2119 | + } elseif(!empty($response['response']['code'])) {
|
|
| 2111 | 2120 | $parts = json_decode($response['body']); |
| 2112 | 2121 | |
| 2113 | 2122 | if(isset($parts->error)){
|
| 2114 | 2123 | echo $parts->error.": ".$parts->error_description;exit; |
| 2115 | - }else{
|
|
| 2124 | + } else{
|
|
| 2116 | 2125 | echo $error_msg." - #2";exit; |
| 2117 | 2126 | } |
| 2118 | 2127 | |
| 2119 | - }else{
|
|
| 2128 | + } else{
|
|
| 2120 | 2129 | |
| 2121 | 2130 | echo $error_msg." - #3";exit; |
| 2122 | 2131 | |
@@ -74,17 +74,20 @@ discard block |
||
| 74 | 74 | $tab_link = $args['url']; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (!empty($args['request'])) |
|
| 78 | - $tab_link = geodir_getlink($tab_link, $args['request']); |
|
| 77 | + if (!empty($args['request'])) { |
|
| 78 | + $tab_link = geodir_getlink($tab_link, $args['request']); |
|
| 79 | + } |
|
| 79 | 80 | |
| 80 | 81 | if (isset($args['target']) && $args['target'] != '') {
|
| 81 | 82 | $tab_target = " target='" . $args['target'] . "' "; |
| 82 | - } else |
|
| 83 | - $tab_target = ''; |
|
| 83 | + } else { |
|
| 84 | + $tab_target = ''; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | $tab_active = ''; |
| 86 | - if ($current_tab == $name) |
|
| 87 | - $tab_active = ' class="tab-active" '; |
|
| 88 | + if ($current_tab == $name) { |
|
| 89 | + $tab_active = ' class="tab-active" '; |
|
| 90 | + } |
|
| 88 | 91 | /** |
| 89 | 92 | * Called before the individual settings tabs are output. |
| 90 | 93 | * |
@@ -123,8 +126,9 @@ discard block |
||
| 123 | 126 | |
| 124 | 127 | <?php |
| 125 | 128 | unset($subtabs); |
| 126 | - if (isset($tabs[$current_tab]['subtabs'])) |
|
| 127 | - $subtabs = $tabs[$current_tab]['subtabs']; |
|
| 129 | + if (isset($tabs[$current_tab]['subtabs'])) { |
|
| 130 | + $subtabs = $tabs[$current_tab]['subtabs']; |
|
| 131 | + } |
|
| 128 | 132 | $form_action = ''; |
| 129 | 133 | |
| 130 | 134 | if (!empty($subtabs)):?> |
@@ -200,7 +204,10 @@ discard block |
||
| 200 | 204 | return false;*/ |
| 201 | 205 | }); |
| 202 | 206 | |
| 203 | - <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery("ul.subsubsub li a[href=#'.$_GET['subtab'].']").click();'; ?>
|
|
| 207 | + <?php if (isset($_GET['subtab']) && $_GET['subtab']) { |
|
| 208 | + echo 'jQuery("ul.subsubsub li a[href=#'.$_GET['subtab'].']").click();'; |
|
| 209 | +} |
|
| 210 | +?> |
|
| 204 | 211 | |
| 205 | 212 | // Countries |
| 206 | 213 | jQuery('select#geodirectory_allowed_countries').change(function () {
|
@@ -324,10 +331,11 @@ discard block |
||
| 324 | 331 | geodir_register_defaults(); |
| 325 | 332 | }*/ |
| 326 | 333 | |
| 327 | - if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) |
|
| 328 | - $hide_save_button = "style='display:none;'"; |
|
| 329 | - else |
|
| 330 | - $hide_save_button = ''; |
|
| 334 | + if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) { |
|
| 335 | + $hide_save_button = "style='display:none;'"; |
|
| 336 | + } else { |
|
| 337 | + $hide_save_button = ''; |
|
| 338 | + } |
|
| 331 | 339 | |
| 332 | 340 | /** |
| 333 | 341 | * Filter weather the default save button in the GD admin settings pages should be shown. |
@@ -7,8 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | $data_type = ''; |
| 9 | 9 | |
| 10 | -if (isset($_REQUEST['data_type'])) |
|
| 10 | +if (isset($_REQUEST['data_type'])) { |
|
| 11 | 11 | $data_type = trim($_REQUEST['data_type']); |
| 12 | +} |
|
| 12 | 13 | |
| 13 | 14 | $field_type = isset($_REQUEST['field_type']) ? trim($_REQUEST['field_type']) : ''; |
| 14 | 15 | |
@@ -44,8 +45,9 @@ discard block |
||
| 44 | 45 | |
| 45 | 46 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 46 | 47 | |
| 47 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 48 | - return; |
|
| 48 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | echo geodir_custom_field_delete($field_id); |
| 51 | 53 | |
@@ -54,8 +56,9 @@ discard block |
||
| 54 | 56 | |
| 55 | 57 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 56 | 58 | |
| 57 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 58 | - return; |
|
| 59 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
| 60 | + return; |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | echo geodir_custom_sort_field_delete($field_id); |
| 61 | 64 | |
@@ -65,8 +68,9 @@ discard block |
||
| 65 | 68 | |
| 66 | 69 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 67 | 70 | |
| 68 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 69 | - return; |
|
| 71 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
| 72 | + return; |
|
| 73 | + } |
|
| 70 | 74 | |
| 71 | 75 | |
| 72 | 76 | foreach ($_REQUEST as $pkey => $pval) { |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | |
| 98 | 102 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 99 | 103 | |
| 100 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 101 | - return; |
|
| 104 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) { |
|
| 105 | + return; |
|
| 106 | + } |
|
| 102 | 107 | |
| 103 | 108 | |
| 104 | 109 | foreach ($_REQUEST as $pkey => $pval) { |
@@ -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; |