@@ -26,7 +26,7 @@ |
||
26 | 26 | add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 5); //CPT manager |
27 | 27 | if(defined("GEODIRLOCATION_VERSION")){ |
28 | 28 | add_action('geodir_listings_content', 'geodir_location_action_listings_description', 5); |
29 | - }else{ |
|
29 | + } else{ |
|
30 | 30 | add_action('geodir_listings_content', 'geodir_action_listings_description', 5); |
31 | 31 | } |
32 | 32 | add_action('geodir_listings_content', 'geodir_action_listings_title', 9); |
@@ -184,8 +184,9 @@ discard block |
||
184 | 184 | |
185 | 185 | $thumb_img_arr = array(); |
186 | 186 | |
187 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
188 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
187 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
188 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
189 | + } |
|
189 | 190 | |
190 | 191 | $totImg = ''; |
191 | 192 | $image_limit = ''; |
@@ -236,7 +237,9 @@ discard block |
||
236 | 237 | { |
237 | 238 | global $menu, $geodirectory; |
238 | 239 | |
239 | - if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory'); |
|
240 | + if (current_user_can('manage_options')) { |
|
241 | + $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory'); |
|
242 | + } |
|
240 | 243 | |
241 | 244 | add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984'); |
242 | 245 | |
@@ -300,7 +303,9 @@ discard block |
||
300 | 303 | */ |
301 | 304 | function geodir_admin_custom_menu_order() |
302 | 305 | { |
303 | - if (!current_user_can('manage_options')) return false; |
|
306 | + if (!current_user_can('manage_options')) { |
|
307 | + return false; |
|
308 | + } |
|
304 | 309 | return true; |
305 | 310 | } |
306 | 311 | } |
@@ -331,10 +336,11 @@ discard block |
||
331 | 336 | case 'fail': |
332 | 337 | $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : ''; |
333 | 338 | |
334 | - if ($gderr == 21) |
|
335 | - 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>'; |
|
336 | - else |
|
337 | - echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
339 | + if ($gderr == 21) { |
|
340 | + 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>'; |
|
341 | + } else { |
|
342 | + echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>'; |
|
343 | + } |
|
338 | 344 | break; |
339 | 345 | } |
340 | 346 | } |
@@ -385,8 +391,12 @@ discard block |
||
385 | 391 | include_once('option-pages/' . $current_tab . '_array.php'); |
386 | 392 | } |
387 | 393 | if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') : |
388 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
389 | - if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
394 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) { |
|
395 | + die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
396 | + } |
|
397 | + if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) { |
|
398 | + die(__('Action failed. Please refresh the page and retry.', 'geodirectory')); |
|
399 | + } |
|
390 | 400 | |
391 | 401 | /** |
392 | 402 | * Fires before updating geodirectory admin settings. |
@@ -398,8 +408,9 @@ discard block |
||
398 | 408 | */ |
399 | 409 | do_action('geodir_before_update_options', $current_tab, $geodir_settings); |
400 | 410 | |
401 | - if (!empty($geodir_settings[$current_tab])) |
|
402 | - geodir_update_options($geodir_settings[$current_tab]); |
|
411 | + if (!empty($geodir_settings[$current_tab])) { |
|
412 | + geodir_update_options($geodir_settings[$current_tab]); |
|
413 | + } |
|
403 | 414 | |
404 | 415 | /** |
405 | 416 | * Called after GeoDirectory options settings are updated. |
@@ -447,11 +458,14 @@ discard block |
||
447 | 458 | * @return bool Returns true if saved. |
448 | 459 | */ |
449 | 460 | function geodir_update_options($options, $dummy = false) { |
450 | - if ((!isset($_POST) || !$_POST) && !$dummy) return false; |
|
461 | + if ((!isset($_POST) || !$_POST) && !$dummy) { |
|
462 | + return false; |
|
463 | + } |
|
451 | 464 | |
452 | 465 | foreach ($options as $value) { |
453 | - if ($dummy && isset($value['std'])) |
|
454 | - $_POST[$value['id']] = $value['std']; |
|
466 | + if ($dummy && isset($value['std'])) { |
|
467 | + $_POST[$value['id']] = $value['std']; |
|
468 | + } |
|
455 | 469 | |
456 | 470 | |
457 | 471 | if (isset($value['type']) && $value['type'] == 'checkbox') : |
@@ -460,25 +474,23 @@ discard block |
||
460 | 474 | update_option($value['id'], $_POST[$value['id']]); |
461 | 475 | } else { |
462 | 476 | update_option($value['id'], 0); |
463 | - } |
|
464 | - |
|
465 | - elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
477 | + } elseif (isset($value['type']) && $value['type'] == 'image_width') : |
|
466 | 478 | |
467 | 479 | if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) { |
468 | 480 | update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']); |
469 | 481 | update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']); |
470 | 482 | if (isset($_POST[$value['id'] . '_crop'])) : |
471 | 483 | update_option($value['id'] . '_crop', 1); |
472 | - else : |
|
473 | - update_option($value['id'] . '_crop', 0); |
|
484 | + else { |
|
485 | + : |
|
486 | + update_option($value['id'] . '_crop', 0); |
|
487 | + } |
|
474 | 488 | endif; |
475 | 489 | } else { |
476 | 490 | update_option($value['id'] . '_width', $value['std']); |
477 | 491 | update_option($value['id'] . '_height', $value['std']); |
478 | 492 | update_option($value['id'] . '_crop', 1); |
479 | - } |
|
480 | - |
|
481 | - elseif (isset($value['type']) && $value['type'] == 'map') : |
|
493 | + } elseif (isset($value['type']) && $value['type'] == 'map') : |
|
482 | 494 | $post_types = array(); |
483 | 495 | $categories = array(); |
484 | 496 | |
@@ -523,8 +535,9 @@ discard block |
||
523 | 535 | $image_name_arr = explode('/', get_option($value['id'])); |
524 | 536 | $noimg_name = end($image_name_arr); |
525 | 537 | $img_path = $uploads['path'] . '/' . $noimg_name; |
526 | - if (file_exists($img_path)) |
|
527 | - unlink($img_path); |
|
538 | + if (file_exists($img_path)) { |
|
539 | + unlink($img_path); |
|
540 | + } |
|
528 | 541 | } |
529 | 542 | |
530 | 543 | update_option($value['id'], ''); |
@@ -540,8 +553,10 @@ discard block |
||
540 | 553 | foreach ($uploadedfile as $key => $uplaod): |
541 | 554 | if ($key == 'name'): |
542 | 555 | $uplaods[$key] = $filename; |
543 | - else : |
|
544 | - $uplaods[$key] = $uplaod; |
|
556 | + else { |
|
557 | + : |
|
558 | + $uplaods[$key] = $uplaod; |
|
559 | + } |
|
545 | 560 | endif; |
546 | 561 | endforeach; |
547 | 562 | |
@@ -551,8 +566,9 @@ discard block |
||
551 | 566 | $image_name_arr = explode('/', get_option($value['id'])); |
552 | 567 | $noimg_name = end($image_name_arr); |
553 | 568 | $img_path = $uploads['path'] . '/' . $noimg_name; |
554 | - if (file_exists($img_path)) |
|
555 | - unlink($img_path); |
|
569 | + if (file_exists($img_path)) { |
|
570 | + unlink($img_path); |
|
571 | + } |
|
556 | 572 | } |
557 | 573 | |
558 | 574 | $upload_overrides = array('test_form' => false); |
@@ -567,10 +583,12 @@ discard block |
||
567 | 583 | endif; |
568 | 584 | |
569 | 585 | |
570 | - else : |
|
586 | + else { |
|
587 | + : |
|
571 | 588 | // same menu setting per theme. |
572 | 589 | if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) { |
573 | - $theme = wp_get_theme(); |
|
590 | + $theme = wp_get_theme(); |
|
591 | + } |
|
574 | 592 | update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]); |
575 | 593 | } |
576 | 594 | |
@@ -582,8 +600,9 @@ discard block |
||
582 | 600 | |
583 | 601 | endif; |
584 | 602 | } |
585 | - if ($dummy) |
|
586 | - $_POST = array(); |
|
603 | + if ($dummy) { |
|
604 | + $_POST = array(); |
|
605 | + } |
|
587 | 606 | return true; |
588 | 607 | |
589 | 608 | } |
@@ -729,9 +748,12 @@ discard block |
||
729 | 748 | $new_columns = array('location' => __('Location (ID)', 'geodirectory'), |
730 | 749 | 'categorys' => __('Categories', 'geodirectory')); |
731 | 750 | |
732 | - if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist |
|
751 | + if (($offset = array_search('author', array_keys($columns))) === false) { |
|
752 | + // if the key doesn't exist |
|
733 | 753 | { |
734 | - $offset = 0; // should we prepend $array with $data? |
|
754 | + $offset = 0; |
|
755 | + } |
|
756 | + // should we prepend $array with $data? |
|
735 | 757 | $offset = count($columns); // or should we append $array with $data? lets pick this one... |
736 | 758 | } |
737 | 759 | |
@@ -791,11 +813,13 @@ discard block |
||
791 | 813 | $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>'; |
792 | 814 | } |
793 | 815 | /* If no expire_date is found, output a default message. */ |
794 | - if (empty($expire_date)) |
|
795 | - echo __('Unknown', 'geodirectory'); |
|
816 | + if (empty($expire_date)) { |
|
817 | + echo __('Unknown', 'geodirectory'); |
|
818 | + } |
|
796 | 819 | /* If there is a expire_date, append 'days left' to the text string. */ |
797 | - else |
|
798 | - echo $expire_date . $date_diff_text; |
|
820 | + else { |
|
821 | + echo $expire_date . $date_diff_text; |
|
822 | + } |
|
799 | 823 | break; |
800 | 824 | |
801 | 825 | /* If displaying the 'categorys' column. */ |
@@ -868,21 +892,26 @@ discard block |
||
868 | 892 | |
869 | 893 | $geodir_posttypes = geodir_get_posttypes(); |
870 | 894 | |
871 | - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
872 | - return; |
|
895 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
896 | + return; |
|
897 | + } |
|
873 | 898 | |
874 | 899 | if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) { |
875 | - if (isset($_REQUEST['_status'])) |
|
876 | - geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
900 | + if (isset($_REQUEST['_status'])) { |
|
901 | + geodir_change_post_status($post_id, $_REQUEST['_status']); |
|
902 | + } |
|
877 | 903 | |
878 | - if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) |
|
879 | - return; |
|
904 | + if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) { |
|
905 | + return; |
|
906 | + } |
|
880 | 907 | |
881 | - if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) |
|
882 | - return; |
|
908 | + if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) { |
|
909 | + return; |
|
910 | + } |
|
883 | 911 | |
884 | - if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) |
|
885 | - return; |
|
912 | + if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) { |
|
913 | + return; |
|
914 | + } |
|
886 | 915 | |
887 | 916 | geodir_save_listing($_REQUEST); |
888 | 917 | } |
@@ -907,10 +936,18 @@ discard block |
||
907 | 936 | $tab_id = ''; |
908 | 937 | $i = 0; |
909 | 938 | foreach ($options as $value) : |
910 | - if (!isset($value['name'])) $value['name'] = ''; |
|
911 | - if (!isset($value['class'])) $value['class'] = ''; |
|
912 | - if (!isset($value['css'])) $value['css'] = ''; |
|
913 | - if (!isset($value['std'])) $value['std'] = ''; |
|
939 | + if (!isset($value['name'])) { |
|
940 | + $value['name'] = ''; |
|
941 | + } |
|
942 | + if (!isset($value['class'])) { |
|
943 | + $value['class'] = ''; |
|
944 | + } |
|
945 | + if (!isset($value['css'])) { |
|
946 | + $value['css'] = ''; |
|
947 | + } |
|
948 | + if (!isset($value['std'])) { |
|
949 | + $value['std'] = ''; |
|
950 | + } |
|
914 | 951 | $desc = ''; |
915 | 952 | switch ($value['type']) : |
916 | 953 | case 'dummy_installer': |
@@ -926,11 +963,13 @@ discard block |
||
926 | 963 | |
927 | 964 | $i++; |
928 | 965 | |
929 | - if (isset($value['id']) && $value['id']) |
|
930 | - $tab_id = $value['id']; |
|
966 | + if (isset($value['id']) && $value['id']) { |
|
967 | + $tab_id = $value['id']; |
|
968 | + } |
|
931 | 969 | |
932 | - if (isset($value['desc']) && $value['desc']) |
|
933 | - $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
970 | + if (isset($value['desc']) && $value['desc']) { |
|
971 | + $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>'; |
|
972 | + } |
|
934 | 973 | |
935 | 974 | if (isset($value['name']) && $value['name']) { |
936 | 975 | if ($first_title === true) { |
@@ -961,10 +1000,12 @@ discard block |
||
961 | 1000 | break; |
962 | 1001 | |
963 | 1002 | case 'sectionstart': |
964 | - if (isset($value['desc']) && $value['desc']) |
|
965 | - $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
966 | - if (isset($value['name']) && $value['name']) |
|
967 | - echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
1003 | + if (isset($value['desc']) && $value['desc']) { |
|
1004 | + $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>'; |
|
1005 | + } |
|
1006 | + if (isset($value['name']) && $value['name']) { |
|
1007 | + echo '<h3>' . $value['name'] . $desc . '</h3>'; |
|
1008 | + } |
|
968 | 1009 | /** |
969 | 1010 | * Called after a GeoDirectory settings sectionstart is output in the GD settings page. |
970 | 1011 | * |
@@ -972,7 +1013,9 @@ discard block |
||
972 | 1013 | * |
973 | 1014 | * @since 1.0.0 |
974 | 1015 | */ |
975 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start'); |
|
1016 | + if (isset($value['id']) && $value['id']) { |
|
1017 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_start'); |
|
1018 | + } |
|
976 | 1019 | echo '<table class="form-table">' . "\n\n"; |
977 | 1020 | |
978 | 1021 | break; |
@@ -984,7 +1027,9 @@ discard block |
||
984 | 1027 | * |
985 | 1028 | * @since 1.0.0 |
986 | 1029 | */ |
987 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end'); |
|
1030 | + if (isset($value['id']) && $value['id']) { |
|
1031 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_end'); |
|
1032 | + } |
|
988 | 1033 | echo '</table>'; |
989 | 1034 | /** |
990 | 1035 | * Called after a GeoDirectory settings sectionend is output in the GD settings page. |
@@ -993,7 +1038,9 @@ discard block |
||
993 | 1038 | * |
994 | 1039 | * @since 1.0.0 |
995 | 1040 | */ |
996 | - if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after'); |
|
1041 | + if (isset($value['id']) && $value['id']) { |
|
1042 | + do_action('geodir_settings_' . sanitize_title($value['id']) . '_after'); |
|
1043 | + } |
|
997 | 1044 | break; |
998 | 1045 | case 'text': |
999 | 1046 | ?> |
@@ -1084,17 +1131,32 @@ discard block |
||
1084 | 1131 | <?php _e('Width', 'geodirectory'); ?> <input |
1085 | 1132 | name="<?php echo esc_attr($value['id']); ?>_width" |
1086 | 1133 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
1087 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1134 | + value="<?php if ($size = get_option($value['id'] . '_width')) { |
|
1135 | + echo stripslashes($size); |
|
1136 | +} else { |
|
1137 | + echo $value['std']; |
|
1138 | +} |
|
1139 | +?>"/> |
|
1088 | 1140 | |
1089 | 1141 | <?php _e('Height', 'geodirectory'); ?> <input |
1090 | 1142 | name="<?php echo esc_attr($value['id']); ?>_height" |
1091 | 1143 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
1092 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
1144 | + value="<?php if ($size = get_option($value['id'] . '_height')) { |
|
1145 | + echo stripslashes($size); |
|
1146 | +} else { |
|
1147 | + echo $value['std']; |
|
1148 | +} |
|
1149 | +?>"/> |
|
1093 | 1150 | |
1094 | 1151 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input |
1095 | 1152 | name="<?php echo esc_attr($value['id']); ?>_crop" |
1096 | 1153 | id="<?php echo esc_attr($value['id']); ?>_crop" |
1097 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
1154 | + type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') { |
|
1155 | + checked(get_option($value['id'] . '_crop'), 1); |
|
1156 | +} else { |
|
1157 | + checked(1); |
|
1158 | +} |
|
1159 | +?> /></label> |
|
1098 | 1160 | |
1099 | 1161 | <span class="description"><?php echo $value['desc'] ?></span></td> |
1100 | 1162 | </tr><?php |
@@ -1108,17 +1170,22 @@ discard block |
||
1108 | 1170 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
1109 | 1171 | id="<?php echo esc_attr($value['id']); ?>" |
1110 | 1172 | style="<?php echo esc_attr($value['css']); ?>" |
1111 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
1173 | + class="<?php if (isset($value['class'])) { |
|
1174 | + echo $value['class']; |
|
1175 | +} |
|
1176 | +?>" |
|
1112 | 1177 | option-ajaxchosen="false"> |
1113 | 1178 | <?php |
1114 | 1179 | foreach ($value['options'] as $key => $val) { |
1115 | 1180 | $geodir_select_value = ''; |
1116 | 1181 | if ($option_value != '') { |
1117 | - if ($option_value != '' && $option_value == $key) |
|
1118 | - $geodir_select_value = ' selected="selected" '; |
|
1182 | + if ($option_value != '' && $option_value == $key) { |
|
1183 | + $geodir_select_value = ' selected="selected" '; |
|
1184 | + } |
|
1119 | 1185 | } else { |
1120 | - if ($value['std'] == $key) |
|
1121 | - $geodir_select_value = ' selected="selected" '; |
|
1186 | + if ($value['std'] == $key) { |
|
1187 | + $geodir_select_value = ' selected="selected" '; |
|
1188 | + } |
|
1122 | 1189 | } |
1123 | 1190 | ?> |
1124 | 1191 | <option |
@@ -1143,8 +1210,14 @@ discard block |
||
1143 | 1210 | <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" |
1144 | 1211 | id="<?php echo esc_attr($value['id']); ?>" |
1145 | 1212 | style="<?php echo esc_attr($value['css']); ?>" |
1146 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
1147 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
1213 | + class="<?php if (isset($value['class'])) { |
|
1214 | + echo $value['class']; |
|
1215 | +} |
|
1216 | +?>" |
|
1217 | + data-placeholder="<?php if (isset($value['placeholder_text'])) { |
|
1218 | + echo $value['placeholder_text']; |
|
1219 | +} |
|
1220 | +?>" |
|
1148 | 1221 | option-ajaxchosen="false"> |
1149 | 1222 | <?php |
1150 | 1223 | foreach ($value['options'] as $key => $val) { |
@@ -1172,7 +1245,10 @@ discard block |
||
1172 | 1245 | <td class="forminp"> |
1173 | 1246 | <input type="file" name="<?php echo esc_attr($value['id']); ?>" |
1174 | 1247 | id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>" |
1175 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>"/> |
|
1248 | + class="<?php if (isset($value['class'])) { |
|
1249 | + echo $value['class']; |
|
1250 | +} |
|
1251 | +?>"/> |
|
1176 | 1252 | <?php if (get_option($value['id'])) { ?> |
1177 | 1253 | <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove" |
1178 | 1254 | id="<?php echo esc_attr($value['id']); ?>_remove" value="0"> |
@@ -1253,13 +1329,15 @@ discard block |
||
1253 | 1329 | 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'), |
1254 | 1330 | ); |
1255 | 1331 | $geodir_default_map_language = get_option('geodir_default_map_language'); |
1256 | - if (empty($geodir_default_map_language)) |
|
1257 | - $geodir_default_map_language = 'en'; |
|
1332 | + if (empty($geodir_default_map_language)) { |
|
1333 | + $geodir_default_map_language = 'en'; |
|
1334 | + } |
|
1258 | 1335 | foreach ($arr_map_langages as $language_key => $language_txt) { |
1259 | - if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
1260 | - $geodir_default_language_selected = "selected='selected'"; |
|
1261 | - else |
|
1262 | - $geodir_default_language_selected = ''; |
|
1336 | + if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) { |
|
1337 | + $geodir_default_language_selected = "selected='selected'"; |
|
1338 | + } else { |
|
1339 | + $geodir_default_language_selected = ''; |
|
1340 | + } |
|
1263 | 1341 | |
1264 | 1342 | ?> |
1265 | 1343 | <option |
@@ -1279,14 +1357,16 @@ discard block |
||
1279 | 1357 | <?php |
1280 | 1358 | $post_types = geodir_get_posttypes('array'); |
1281 | 1359 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
1282 | - if (empty($geodir_default_map_search_pt)) |
|
1283 | - $geodir_default_map_search_pt = 'gd_place'; |
|
1360 | + if (empty($geodir_default_map_search_pt)) { |
|
1361 | + $geodir_default_map_search_pt = 'gd_place'; |
|
1362 | + } |
|
1284 | 1363 | if (is_array($post_types)) { |
1285 | 1364 | foreach ($post_types as $key => $post_types_obj) { |
1286 | - if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
1287 | - $geodir_search_pt_selected = "selected='selected'"; |
|
1288 | - else |
|
1289 | - $geodir_search_pt_selected = ''; |
|
1365 | + if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) { |
|
1366 | + $geodir_search_pt_selected = "selected='selected'"; |
|
1367 | + } else { |
|
1368 | + $geodir_search_pt_selected = ''; |
|
1369 | + } |
|
1290 | 1370 | |
1291 | 1371 | ?> |
1292 | 1372 | <option |
@@ -1406,7 +1486,7 @@ discard block |
||
1406 | 1486 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
1407 | 1487 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) { |
1408 | 1488 | echo 'checked="checked"'; |
1409 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> /> |
|
1489 | + } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> /> |
|
1410 | 1490 | <?php echo $value['desc']; ?></label><br> |
1411 | 1491 | </fieldset> |
1412 | 1492 | <?php |
@@ -1426,10 +1506,18 @@ discard block |
||
1426 | 1506 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
1427 | 1507 | <td class="forminp"> |
1428 | 1508 | <textarea |
1429 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
1509 | + <?php if (isset($value['args'])) { |
|
1510 | + echo $value['args'] . ' '; |
|
1511 | +} |
|
1512 | +?>name="<?php echo esc_attr($value['id']); ?>" |
|
1430 | 1513 | id="<?php echo esc_attr($value['id']); ?>" |
1431 | 1514 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?> |
1432 | - 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 |
|
1515 | + style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) { |
|
1516 | + echo esc_textarea(stripslashes(get_option($value['id']))); |
|
1517 | +} else { |
|
1518 | + echo esc_textarea($value['std']); |
|
1519 | +} |
|
1520 | +?></textarea><span |
|
1433 | 1521 | class="description"><?php echo $value['desc'] ?></span> |
1434 | 1522 | |
1435 | 1523 | </td> |
@@ -1441,10 +1529,11 @@ discard block |
||
1441 | 1529 | <tr valign="top"> |
1442 | 1530 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
1443 | 1531 | <td class="forminp"><?php |
1444 | - if (get_option($value['id'])) |
|
1445 | - $content = stripslashes(get_option($value['id'])); |
|
1446 | - else |
|
1447 | - $content = $value['std']; |
|
1532 | + if (get_option($value['id'])) { |
|
1533 | + $content = stripslashes(get_option($value['id'])); |
|
1534 | + } else { |
|
1535 | + $content = $value['std']; |
|
1536 | + } |
|
1448 | 1537 | |
1449 | 1538 | $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); |
1450 | 1539 | |
@@ -1484,7 +1573,9 @@ discard block |
||
1484 | 1573 | 'echo' => false, |
1485 | 1574 | 'selected' => $page_setting); |
1486 | 1575 | |
1487 | - if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
1576 | + if (isset($value['args'])) { |
|
1577 | + $args = wp_parse_args($value['args'], $args); |
|
1578 | + } |
|
1488 | 1579 | |
1489 | 1580 | ?> |
1490 | 1581 | <tr valign="top" class="single_select_page"> |
@@ -1503,8 +1594,10 @@ discard block |
||
1503 | 1594 | if (strstr($country_setting, ':')) : |
1504 | 1595 | $country = current(explode(':', $country_setting)); |
1505 | 1596 | $state = end(explode(':', $country_setting)); |
1506 | - else : |
|
1507 | - $country = $country_setting; |
|
1597 | + else { |
|
1598 | + : |
|
1599 | + $country = $country_setting; |
|
1600 | + } |
|
1508 | 1601 | $state = '*'; |
1509 | 1602 | endif; |
1510 | 1603 | ?> |
@@ -1531,8 +1624,10 @@ discard block |
||
1531 | 1624 | data-placeholder="<?php _e('Choose countries…', 'geodirectory'); ?>" |
1532 | 1625 | title="Country" class="chosen_select"> |
1533 | 1626 | <?php |
1534 | - if ($countries) foreach ($countries as $key => $val) : |
|
1535 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
1627 | + if ($countries) { |
|
1628 | + foreach ($countries as $key => $val) : |
|
1629 | + echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
1630 | + } |
|
1536 | 1631 | endforeach; |
1537 | 1632 | ?> |
1538 | 1633 | </select> |
@@ -1770,8 +1865,9 @@ discard block |
||
1770 | 1865 | endforeach; |
1771 | 1866 | endif; |
1772 | 1867 | |
1773 | - if (!empty($place_img_array)) |
|
1774 | - $curImages = implode(',', $place_img_array); |
|
1868 | + if (!empty($place_img_array)) { |
|
1869 | + $curImages = implode(',', $place_img_array); |
|
1870 | + } |
|
1775 | 1871 | |
1776 | 1872 | |
1777 | 1873 | // adjust values here |
@@ -2117,16 +2213,17 @@ discard block |
||
2117 | 2213 | global $post, $typenow, $current_screen; |
2118 | 2214 | |
2119 | 2215 | $post_type = NULL; |
2120 | - if (isset($_REQUEST['post_type'])) |
|
2121 | - $post_type = sanitize_key($_REQUEST['post_type']); |
|
2122 | - elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
2123 | - $post_type = get_post_type($_REQUEST['post']); |
|
2124 | - elseif ($post && isset($post->post_type)) |
|
2125 | - $post_type = $post->post_type; |
|
2126 | - elseif ($typenow) |
|
2127 | - $post_type = $typenow; |
|
2128 | - elseif ($current_screen && isset($current_screen->post_type)) |
|
2129 | - $post_type = $current_screen->post_type; |
|
2216 | + if (isset($_REQUEST['post_type'])) { |
|
2217 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
2218 | + } elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) { |
|
2219 | + $post_type = get_post_type($_REQUEST['post']); |
|
2220 | + } elseif ($post && isset($post->post_type)) { |
|
2221 | + $post_type = $post->post_type; |
|
2222 | + } elseif ($typenow) { |
|
2223 | + $post_type = $typenow; |
|
2224 | + } elseif ($current_screen && isset($current_screen->post_type)) { |
|
2225 | + $post_type = $current_screen->post_type; |
|
2226 | + } |
|
2130 | 2227 | |
2131 | 2228 | |
2132 | 2229 | |
@@ -2187,9 +2284,10 @@ discard block |
||
2187 | 2284 | function geodir_hide_admin_preview_button() { |
2188 | 2285 | global $post_type; |
2189 | 2286 | $post_types = geodir_get_posttypes(); |
2190 | - if(in_array($post_type, $post_types)) |
|
2191 | - echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>'; |
|
2192 | -} |
|
2287 | + if(in_array($post_type, $post_types)) { |
|
2288 | + echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>'; |
|
2289 | + } |
|
2290 | + } |
|
2193 | 2291 | add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
2194 | 2292 | add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
2195 | 2293 | |
@@ -5419,8 +5517,9 @@ discard block |
||
5419 | 5517 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) { |
5420 | 5518 | global $wpdb, $plugin_prefix; |
5421 | 5519 | |
5422 | - if ( ! post_type_exists( $post_type ) ) |
|
5423 | - return new stdClass; |
|
5520 | + if ( ! post_type_exists( $post_type ) ) { |
|
5521 | + return new stdClass; |
|
5522 | + } |
|
5424 | 5523 | |
5425 | 5524 | $table = $plugin_prefix . $post_type . '_detail'; |
5426 | 5525 | |
@@ -6077,7 +6176,9 @@ discard block |
||
6077 | 6176 | |
6078 | 6177 | if ($page_found) : |
6079 | 6178 | // Page exists |
6080 | - if (!$option_value) update_option($option, $page_found); |
|
6179 | + if (!$option_value) { |
|
6180 | + update_option($option, $page_found); |
|
6181 | + } |
|
6081 | 6182 | return; |
6082 | 6183 | endif; |
6083 | 6184 | |
@@ -6488,7 +6589,7 @@ discard block |
||
6488 | 6589 | |
6489 | 6590 | if(is_array($accounts)){ |
6490 | 6591 | $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts); |
6491 | - }elseif(get_option('geodir_ga_account_id')){ |
|
6592 | + } elseif(get_option('geodir_ga_account_id')){ |
|
6492 | 6593 | $accounts = array(); |
6493 | 6594 | $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')'; |
6494 | 6595 | } |
@@ -6509,14 +6610,16 @@ discard block |
||
6509 | 6610 | } |
6510 | 6611 | |
6511 | 6612 | # Create a new Gdata call |
6512 | - if ( trim(get_option('geodir_ga_auth_code')) != '' ) |
|
6513 | - $stats = new GDGoogleAnalyticsStats(); |
|
6514 | - else |
|
6515 | - return false; |
|
6613 | + if ( trim(get_option('geodir_ga_auth_code')) != '' ) { |
|
6614 | + $stats = new GDGoogleAnalyticsStats(); |
|
6615 | + } else { |
|
6616 | + return false; |
|
6617 | + } |
|
6516 | 6618 | |
6517 | 6619 | # Check if Google sucessfully logged in |
6518 | - if ( ! $stats->checkLogin() ) |
|
6519 | - return false; |
|
6620 | + if ( ! $stats->checkLogin() ) { |
|
6621 | + return false; |
|
6622 | + } |
|
6520 | 6623 | |
6521 | 6624 | # Get a list of accounts |
6522 | 6625 | try { |
@@ -6533,10 +6636,10 @@ discard block |
||
6533 | 6636 | if ( count($accounts) > 0 ){ |
6534 | 6637 | update_option('geodir_gd_uids',$accounts); |
6535 | 6638 | return $accounts; |
6639 | + } else { |
|
6640 | + return false; |
|
6641 | + } |
|
6536 | 6642 | } |
6537 | - else |
|
6538 | - return false; |
|
6539 | -} |
|
6540 | 6643 | |
6541 | 6644 | add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' ); |
6542 | 6645 | function geodir_ga_deauthorize(){ |