@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | global $sitepress; |
| 246 | 246 | $default_lang = $sitepress->get_default_language(); |
| 247 | 247 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
| 248 | - }else{
|
|
| 248 | + } else{
|
|
| 249 | 249 | $term_id = $cat_term->term_id; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
@@ -273,8 +273,9 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | return $out; |
| 275 | 275 | } else {
|
| 276 | - if ($cat_parent == 0) |
|
| 277 | - return _e('No category', 'geodirectory');
|
|
| 276 | + if ($cat_parent == 0) { |
|
| 277 | + return _e('No category', 'geodirectory'); |
|
| 278 | + } |
|
| 278 | 279 | } |
| 279 | 280 | return; |
| 280 | 281 | } |
@@ -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,11 +152,12 @@ 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_insert_noncename')) |
|
| 155 | - return; |
|
| 155 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_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']. |
@@ -164,11 +166,13 @@ discard block |
||
| 164 | 166 | * @param string $posttype The post type to insert. |
| 165 | 167 | * @param string $datatype The type of dummy data to insert. |
| 166 | 168 | */ |
| 167 | - do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),sanitize_key(['datatype']));
|
|
| 169 | + do_action('geodir_delete_dummy_posts' ,sanitize_key($_REQUEST['posttype']),sanitize_key(['datatype'])); |
|
| 170 | + } |
|
| 168 | 171 | break; |
| 169 | 172 | case "geodir_dummy_insert" : |
| 170 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) |
|
| 171 | - return; |
|
| 173 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 172 | 176 | |
| 173 | 177 | global $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
| 174 | 178 | $city_bound_lat1 = $_REQUEST['city_bound_lat1']; |
@@ -267,8 +271,9 @@ discard block |
||
| 267 | 271 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 268 | 272 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
| 269 | 273 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
|
| 270 | - } else |
|
| 271 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 274 | + } else { |
|
| 275 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 276 | + } |
|
| 272 | 277 | |
| 273 | 278 | wp_redirect($redirect_to); |
| 274 | 279 | } else {
|
@@ -281,9 +286,9 @@ discard block |
||
| 281 | 286 | |
| 282 | 287 | $gd_session->un_set('listing');
|
| 283 | 288 | |
| 284 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) |
|
| 285 | - wp_redirect(get_permalink($_REQUEST['pid'])); |
|
| 286 | - else {
|
|
| 289 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) { |
|
| 290 | + wp_redirect(get_permalink($_REQUEST['pid'])); |
|
| 291 | + } else {
|
|
| 287 | 292 | geodir_remove_temp_images(); |
| 288 | 293 | wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
|
| 289 | 294 | } |
@@ -311,8 +316,9 @@ discard block |
||
| 311 | 316 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 312 | 317 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
| 313 | 318 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
|
| 314 | - } else |
|
| 315 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 319 | + } else { |
|
| 320 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 321 | + } |
|
| 316 | 322 | |
| 317 | 323 | $gd_session->un_set('listing');
|
| 318 | 324 | wp_redirect($redirect_to); |
@@ -333,8 +339,9 @@ discard block |
||
| 333 | 339 | $lastid = wp_delete_post($_REQUEST['pid']); |
| 334 | 340 | } |
| 335 | 341 | |
| 336 | - if ($lastid && !is_wp_error($lastid)) |
|
| 337 | - wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 342 | + if ($lastid && !is_wp_error($lastid)) { |
|
| 343 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 344 | + } |
|
| 338 | 345 | |
| 339 | 346 | //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
|
| 340 | 347 | } |
@@ -232,10 +232,11 @@ discard block |
||
| 232 | 232 | update_option($post_type.'_dummy_data_type','property_rent'); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | -if (geodir_dummy_folder_exists()) |
|
| 235 | +if (geodir_dummy_folder_exists()) { |
|
| 236 | 236 | $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
| 237 | -else |
|
| 237 | +} else { |
|
| 238 | 238 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
| 239 | +} |
|
| 239 | 240 | |
| 240 | 241 | $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url); |
| 241 | 242 | |
@@ -692,16 +693,18 @@ discard block |
||
| 692 | 693 | |
| 693 | 694 | foreach ($post_info as $post_info) { |
| 694 | 695 | $default_location = geodir_get_default_location(); |
| 695 | - if ($city_bound_lat1 > $city_bound_lat2) |
|
| 696 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 697 | - else |
|
| 698 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 696 | + if ($city_bound_lat1 > $city_bound_lat2) { |
|
| 697 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 698 | + } else { |
|
| 699 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 700 | + } |
|
| 699 | 701 | |
| 700 | 702 | |
| 701 | - if ($city_bound_lng1 > $city_bound_lng2) |
|
| 702 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 703 | - else |
|
| 704 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 703 | + if ($city_bound_lng1 > $city_bound_lng2) { |
|
| 704 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 705 | + } else { |
|
| 706 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 707 | + } |
|
| 705 | 708 | |
| 706 | 709 | $load_map = get_option('geodir_load_map'); |
| 707 | 710 | |
@@ -231,10 +231,11 @@ discard block |
||
| 231 | 231 | update_option($post_type.'_dummy_data_type','property_sale'); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | -if (geodir_dummy_folder_exists()) |
|
| 234 | +if (geodir_dummy_folder_exists()) { |
|
| 235 | 235 | $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
| 236 | -else |
|
| 236 | +} else { |
|
| 237 | 237 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
| 238 | +} |
|
| 238 | 239 | |
| 239 | 240 | $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url); |
| 240 | 241 | |
@@ -691,16 +692,18 @@ discard block |
||
| 691 | 692 | |
| 692 | 693 | foreach ($post_info as $post_info) { |
| 693 | 694 | $default_location = geodir_get_default_location(); |
| 694 | - if ($city_bound_lat1 > $city_bound_lat2) |
|
| 695 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 696 | - else |
|
| 697 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 695 | + if ($city_bound_lat1 > $city_bound_lat2) { |
|
| 696 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 697 | + } else { |
|
| 698 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 699 | + } |
|
| 698 | 700 | |
| 699 | 701 | |
| 700 | - if ($city_bound_lng1 > $city_bound_lng2) |
|
| 701 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 702 | - else |
|
| 703 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 702 | + if ($city_bound_lng1 > $city_bound_lng2) { |
|
| 703 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 704 | + } else { |
|
| 705 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 706 | + } |
|
| 704 | 707 | |
| 705 | 708 | $load_map = get_option('geodir_load_map'); |
| 706 | 709 | |
@@ -17,10 +17,11 @@ discard block |
||
| 17 | 17 | update_option($post_type.'_dummy_data_type','standard_places'); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (geodir_dummy_folder_exists()) |
|
| 20 | +if (geodir_dummy_folder_exists()) { |
|
| 21 | 21 | $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
| 22 | -else |
|
| 22 | +} else { |
|
| 23 | 23 | $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | $dummy_image_url = apply_filters('place_dummy_image_url', $dummy_image_url); |
| 26 | 27 | |
@@ -1815,16 +1816,18 @@ discard block |
||
| 1815 | 1816 | echo '###4.1'; |
| 1816 | 1817 | foreach ($post_info as $post_info) {echo '###5'; |
| 1817 | 1818 | $default_location = geodir_get_default_location(); |
| 1818 | - if ($city_bound_lat1 > $city_bound_lat2) |
|
| 1819 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 1820 | - else |
|
| 1821 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 1819 | + if ($city_bound_lat1 > $city_bound_lat2) { |
|
| 1820 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 1821 | + } else { |
|
| 1822 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 1823 | + } |
|
| 1822 | 1824 | |
| 1823 | 1825 | |
| 1824 | - if ($city_bound_lng1 > $city_bound_lng2) |
|
| 1825 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 1826 | - else |
|
| 1827 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 1826 | + if ($city_bound_lng1 > $city_bound_lng2) { |
|
| 1827 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 1828 | + } else { |
|
| 1829 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 1830 | + } |
|
| 1828 | 1831 | |
| 1829 | 1832 | $load_map = get_option('geodir_load_map'); |
| 1830 | 1833 | |
@@ -42,10 +42,11 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - if (geodir_dummy_folder_exists()) |
|
| 46 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | - else |
|
| 48 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 45 | + if (geodir_dummy_folder_exists()) { |
|
| 46 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 47 | + } else { |
|
| 48 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 51 | 52 | |
@@ -86,10 +87,11 @@ discard block |
||
| 86 | 87 | if (!term_exists($catname, $post_type.'category')) { |
| 87 | 88 | $last_catid = wp_insert_term($catname, $post_type.'category'); |
| 88 | 89 | |
| 89 | - if (geodir_dummy_folder_exists()) |
|
| 90 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 91 | - else |
|
| 92 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 90 | + if (geodir_dummy_folder_exists()) { |
|
| 91 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon"; |
|
| 92 | + } else { |
|
| 93 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon'; |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url); |
| 95 | 97 | |
@@ -218,7 +220,7 @@ discard block |
||
| 218 | 220 | * @package GeoDirectory |
| 219 | 221 | */ |
| 220 | 222 | include_once( 'dummy-data/standard_places.php' ); |
| 221 | - }elseif($key=='property_sale'){ |
|
| 223 | + } elseif($key=='property_sale'){ |
|
| 222 | 224 | /** |
| 223 | 225 | * Contains dummy property for sale post content. |
| 224 | 226 | * |
@@ -226,7 +228,7 @@ discard block |
||
| 226 | 228 | * @package GeoDirectory |
| 227 | 229 | */ |
| 228 | 230 | include_once( 'dummy-data/property_sale.php' ); |
| 229 | - }elseif($key=='property_rent'){ |
|
| 231 | + } elseif($key=='property_rent'){ |
|
| 230 | 232 | /** |
| 231 | 233 | * Contains dummy property for sale post content. |
| 232 | 234 | * |
@@ -330,7 +332,7 @@ discard block |
||
| 330 | 332 | |
| 331 | 333 | if($post_counts > 0){ |
| 332 | 334 | echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
| 333 | - }else{ |
|
| 335 | + } else{ |
|
| 334 | 336 | echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>'; |
| 335 | 337 | } |
| 336 | 338 | |
@@ -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 | ?> |
@@ -1065,17 +1112,32 @@ discard block |
||
| 1065 | 1112 | <?php _e('Width', 'geodirectory'); ?> <input
|
| 1066 | 1113 | name="<?php echo esc_attr($value['id']); ?>_width" |
| 1067 | 1114 | id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3" |
| 1068 | - value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1115 | + value="<?php if ($size = get_option($value['id'] . '_width')) { |
|
| 1116 | + echo stripslashes($size); |
|
| 1117 | +} else { |
|
| 1118 | + echo $value['std']; |
|
| 1119 | +} |
|
| 1120 | +?>"/> |
|
| 1069 | 1121 | |
| 1070 | 1122 | <?php _e('Height', 'geodirectory'); ?> <input
|
| 1071 | 1123 | name="<?php echo esc_attr($value['id']); ?>_height" |
| 1072 | 1124 | id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3" |
| 1073 | - value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/> |
|
| 1125 | + value="<?php if ($size = get_option($value['id'] . '_height')) { |
|
| 1126 | + echo stripslashes($size); |
|
| 1127 | +} else { |
|
| 1128 | + echo $value['std']; |
|
| 1129 | +} |
|
| 1130 | +?>"/> |
|
| 1074 | 1131 | |
| 1075 | 1132 | <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
|
| 1076 | 1133 | name="<?php echo esc_attr($value['id']); ?>_crop" |
| 1077 | 1134 | id="<?php echo esc_attr($value['id']); ?>_crop" |
| 1078 | - type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label> |
|
| 1135 | + type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') { |
|
| 1136 | + checked(get_option($value['id'] . '_crop'), 1); |
|
| 1137 | +} else { |
|
| 1138 | + checked(1); |
|
| 1139 | +} |
|
| 1140 | +?> /></label> |
|
| 1079 | 1141 | |
| 1080 | 1142 | <span class="description"><?php echo $value['desc'] ?></span></td> |
| 1081 | 1143 | </tr><?php |
@@ -1089,17 +1151,22 @@ discard block |
||
| 1089 | 1151 | <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>" |
| 1090 | 1152 | id="<?php echo esc_attr($value['id']); ?>" |
| 1091 | 1153 | style="<?php echo esc_attr($value['css']); ?>" |
| 1092 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
| 1154 | + class="<?php if (isset($value['class'])) { |
|
| 1155 | + echo $value['class']; |
|
| 1156 | +} |
|
| 1157 | +?>" |
|
| 1093 | 1158 | option-ajaxchosen="false"> |
| 1094 | 1159 | <?php |
| 1095 | 1160 | foreach ($value['options'] as $key => $val) {
|
| 1096 | 1161 | $geodir_select_value = ''; |
| 1097 | 1162 | if ($option_value != '') {
|
| 1098 | - if ($option_value != '' && $option_value == $key) |
|
| 1099 | - $geodir_select_value = ' selected="selected" '; |
|
| 1163 | + if ($option_value != '' && $option_value == $key) { |
|
| 1164 | + $geodir_select_value = ' selected="selected" '; |
|
| 1165 | + } |
|
| 1100 | 1166 | } else {
|
| 1101 | - if ($value['std'] == $key) |
|
| 1102 | - $geodir_select_value = ' selected="selected" '; |
|
| 1167 | + if ($value['std'] == $key) { |
|
| 1168 | + $geodir_select_value = ' selected="selected" '; |
|
| 1169 | + } |
|
| 1103 | 1170 | } |
| 1104 | 1171 | ?> |
| 1105 | 1172 | <option |
@@ -1124,8 +1191,14 @@ discard block |
||
| 1124 | 1191 | <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]" |
| 1125 | 1192 | id="<?php echo esc_attr($value['id']); ?>" |
| 1126 | 1193 | style="<?php echo esc_attr($value['css']); ?>" |
| 1127 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>" |
|
| 1128 | - data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>" |
|
| 1194 | + class="<?php if (isset($value['class'])) { |
|
| 1195 | + echo $value['class']; |
|
| 1196 | +} |
|
| 1197 | +?>" |
|
| 1198 | + data-placeholder="<?php if (isset($value['placeholder_text'])) { |
|
| 1199 | + echo $value['placeholder_text']; |
|
| 1200 | +} |
|
| 1201 | +?>" |
|
| 1129 | 1202 | option-ajaxchosen="false"> |
| 1130 | 1203 | <?php |
| 1131 | 1204 | foreach ($value['options'] as $key => $val) {
|
@@ -1152,7 +1225,10 @@ discard block |
||
| 1152 | 1225 | <td class="forminp"> |
| 1153 | 1226 | <input type="file" name="<?php echo esc_attr($value['id']); ?>" |
| 1154 | 1227 | id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>" |
| 1155 | - class="<?php if (isset($value['class'])) echo $value['class']; ?>"/> |
|
| 1228 | + class="<?php if (isset($value['class'])) { |
|
| 1229 | + echo $value['class']; |
|
| 1230 | +} |
|
| 1231 | +?>"/> |
|
| 1156 | 1232 | <?php if (get_option($value['id'])) { ?>
|
| 1157 | 1233 | <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove" |
| 1158 | 1234 | id="<?php echo esc_attr($value['id']); ?>_remove" value="0"> |
@@ -1233,13 +1309,15 @@ discard block |
||
| 1233 | 1309 | 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
|
| 1234 | 1310 | ); |
| 1235 | 1311 | $geodir_default_map_language = get_option('geodir_default_map_language');
|
| 1236 | - if (empty($geodir_default_map_language)) |
|
| 1237 | - $geodir_default_map_language = 'en'; |
|
| 1312 | + if (empty($geodir_default_map_language)) { |
|
| 1313 | + $geodir_default_map_language = 'en'; |
|
| 1314 | + } |
|
| 1238 | 1315 | foreach ($arr_map_langages as $language_key => $language_txt) {
|
| 1239 | - if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) |
|
| 1240 | - $geodir_default_language_selected = "selected='selected'"; |
|
| 1241 | - else |
|
| 1242 | - $geodir_default_language_selected = ''; |
|
| 1316 | + if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) { |
|
| 1317 | + $geodir_default_language_selected = "selected='selected'"; |
|
| 1318 | + } else { |
|
| 1319 | + $geodir_default_language_selected = ''; |
|
| 1320 | + } |
|
| 1243 | 1321 | |
| 1244 | 1322 | ?> |
| 1245 | 1323 | <option |
@@ -1259,14 +1337,16 @@ discard block |
||
| 1259 | 1337 | <?php |
| 1260 | 1338 | $post_types = geodir_get_posttypes('array');
|
| 1261 | 1339 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
| 1262 | - if (empty($geodir_default_map_search_pt)) |
|
| 1263 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 1340 | + if (empty($geodir_default_map_search_pt)) { |
|
| 1341 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 1342 | + } |
|
| 1264 | 1343 | if (is_array($post_types)) {
|
| 1265 | 1344 | foreach ($post_types as $key => $post_types_obj) {
|
| 1266 | - if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) |
|
| 1267 | - $geodir_search_pt_selected = "selected='selected'"; |
|
| 1268 | - else |
|
| 1269 | - $geodir_search_pt_selected = ''; |
|
| 1345 | + if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) { |
|
| 1346 | + $geodir_search_pt_selected = "selected='selected'"; |
|
| 1347 | + } else { |
|
| 1348 | + $geodir_search_pt_selected = ''; |
|
| 1349 | + } |
|
| 1270 | 1350 | |
| 1271 | 1351 | ?> |
| 1272 | 1352 | <option |
@@ -1386,7 +1466,7 @@ discard block |
||
| 1386 | 1466 | id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio" |
| 1387 | 1467 | value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
|
| 1388 | 1468 | echo 'checked="checked"'; |
| 1389 | - }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1469 | + } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
|
|
| 1390 | 1470 | <?php echo $value['desc']; ?></label><br> |
| 1391 | 1471 | </fieldset> |
| 1392 | 1472 | <?php |
@@ -1406,10 +1486,18 @@ discard block |
||
| 1406 | 1486 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1407 | 1487 | <td class="forminp"> |
| 1408 | 1488 | <textarea |
| 1409 | - <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1489 | + <?php if (isset($value['args'])) { |
|
| 1490 | + echo $value['args'] . ' '; |
|
| 1491 | +} |
|
| 1492 | +?>name="<?php echo esc_attr($value['id']); ?>" |
|
| 1410 | 1493 | id="<?php echo esc_attr($value['id']); ?>" |
| 1411 | 1494 | <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
|
| 1412 | - 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 |
|
| 1495 | + style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) { |
|
| 1496 | + echo esc_textarea(stripslashes(get_option($value['id']))); |
|
| 1497 | +} else { |
|
| 1498 | + echo esc_textarea($value['std']); |
|
| 1499 | +} |
|
| 1500 | +?></textarea><span |
|
| 1413 | 1501 | class="description"><?php echo $value['desc'] ?></span> |
| 1414 | 1502 | |
| 1415 | 1503 | </td> |
@@ -1421,10 +1509,11 @@ discard block |
||
| 1421 | 1509 | <tr valign="top"> |
| 1422 | 1510 | <th scope="row" class="titledesc"><?php echo $value['name'] ?></th> |
| 1423 | 1511 | <td class="forminp"><?php |
| 1424 | - if (get_option($value['id'])) |
|
| 1425 | - $content = stripslashes(get_option($value['id'])); |
|
| 1426 | - else |
|
| 1427 | - $content = $value['std']; |
|
| 1512 | + if (get_option($value['id'])) { |
|
| 1513 | + $content = stripslashes(get_option($value['id'])); |
|
| 1514 | + } else { |
|
| 1515 | + $content = $value['std']; |
|
| 1516 | + } |
|
| 1428 | 1517 | |
| 1429 | 1518 | $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
| 1430 | 1519 | |
@@ -1464,7 +1553,9 @@ discard block |
||
| 1464 | 1553 | 'echo' => false, |
| 1465 | 1554 | 'selected' => $page_setting); |
| 1466 | 1555 | |
| 1467 | - if (isset($value['args'])) $args = wp_parse_args($value['args'], $args); |
|
| 1556 | + if (isset($value['args'])) { |
|
| 1557 | + $args = wp_parse_args($value['args'], $args); |
|
| 1558 | + } |
|
| 1468 | 1559 | |
| 1469 | 1560 | ?> |
| 1470 | 1561 | <tr valign="top" class="single_select_page"> |
@@ -1483,8 +1574,10 @@ discard block |
||
| 1483 | 1574 | if (strstr($country_setting, ':')) : |
| 1484 | 1575 | $country = current(explode(':', $country_setting));
|
| 1485 | 1576 | $state = end(explode(':', $country_setting));
|
| 1486 | - else : |
|
| 1487 | - $country = $country_setting; |
|
| 1577 | + else { |
|
| 1578 | + : |
|
| 1579 | + $country = $country_setting; |
|
| 1580 | + } |
|
| 1488 | 1581 | $state = '*'; |
| 1489 | 1582 | endif; |
| 1490 | 1583 | ?> |
@@ -1511,8 +1604,10 @@ discard block |
||
| 1511 | 1604 | data-placeholder="<?php _e('Choose countries…', 'geodirectory'); ?>"
|
| 1512 | 1605 | title="Country" class="chosen_select"> |
| 1513 | 1606 | <?php |
| 1514 | - if ($countries) foreach ($countries as $key => $val) : |
|
| 1515 | - echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1607 | + if ($countries) { |
|
| 1608 | + foreach ($countries as $key => $val) : |
|
| 1609 | + echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>'; |
|
| 1610 | + } |
|
| 1516 | 1611 | endforeach; |
| 1517 | 1612 | ?> |
| 1518 | 1613 | </select> |
@@ -1763,8 +1858,9 @@ discard block |
||
| 1763 | 1858 | endforeach; |
| 1764 | 1859 | endif; |
| 1765 | 1860 | |
| 1766 | - if (!empty($place_img_array)) |
|
| 1767 | - $curImages = implode(',', $place_img_array);
|
|
| 1861 | + if (!empty($place_img_array)) { |
|
| 1862 | + $curImages = implode(',', $place_img_array); |
|
| 1863 | + } |
|
| 1768 | 1864 | |
| 1769 | 1865 | |
| 1770 | 1866 | // adjust values here |
@@ -2110,16 +2206,17 @@ discard block |
||
| 2110 | 2206 | global $post, $typenow, $current_screen; |
| 2111 | 2207 | |
| 2112 | 2208 | $post_type = NULL; |
| 2113 | - if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) |
|
| 2114 | - $post_type = get_post_type($_REQUEST['post']); |
|
| 2115 | - elseif ($post && isset($post->post_type)) |
|
| 2116 | - $post_type = $post->post_type; |
|
| 2117 | - elseif ($typenow) |
|
| 2118 | - $post_type = $typenow; |
|
| 2119 | - elseif ($current_screen && isset($current_screen->post_type)) |
|
| 2120 | - $post_type = $current_screen->post_type; |
|
| 2121 | - elseif (isset($_REQUEST['post_type'])) |
|
| 2122 | - $post_type = sanitize_key($_REQUEST['post_type']); |
|
| 2209 | + if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) { |
|
| 2210 | + $post_type = get_post_type($_REQUEST['post']); |
|
| 2211 | + } elseif ($post && isset($post->post_type)) { |
|
| 2212 | + $post_type = $post->post_type; |
|
| 2213 | + } elseif ($typenow) { |
|
| 2214 | + $post_type = $typenow; |
|
| 2215 | + } elseif ($current_screen && isset($current_screen->post_type)) { |
|
| 2216 | + $post_type = $current_screen->post_type; |
|
| 2217 | + } elseif (isset($_REQUEST['post_type'])) { |
|
| 2218 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
| 2219 | + } |
|
| 2123 | 2220 | |
| 2124 | 2221 | |
| 2125 | 2222 | return $post_type; |
@@ -2179,9 +2276,10 @@ discard block |
||
| 2179 | 2276 | function geodir_hide_admin_preview_button() {
|
| 2180 | 2277 | global $post_type; |
| 2181 | 2278 | $post_types = geodir_get_posttypes(); |
| 2182 | - if(in_array($post_type, $post_types)) |
|
| 2183 | - echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
|
|
| 2184 | -} |
|
| 2279 | + if(in_array($post_type, $post_types)) { |
|
| 2280 | + echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>'; |
|
| 2281 | + } |
|
| 2282 | + } |
|
| 2185 | 2283 | add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' ); |
| 2186 | 2284 | add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' ); |
| 2187 | 2285 | |
@@ -5383,8 +5481,9 @@ discard block |
||
| 5383 | 5481 | function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
|
| 5384 | 5482 | global $wpdb, $plugin_prefix; |
| 5385 | 5483 | |
| 5386 | - if ( ! post_type_exists( $post_type ) ) |
|
| 5387 | - return new stdClass; |
|
| 5484 | + if ( ! post_type_exists( $post_type ) ) { |
|
| 5485 | + return new stdClass; |
|
| 5486 | + } |
|
| 5388 | 5487 | |
| 5389 | 5488 | $table = $plugin_prefix . $post_type . '_detail'; |
| 5390 | 5489 | |
@@ -6219,7 +6318,9 @@ discard block |
||
| 6219 | 6318 | |
| 6220 | 6319 | if ($page_found) : |
| 6221 | 6320 | // Page exists |
| 6222 | - if (!$option_value) update_option($option, $page_found); |
|
| 6321 | + if (!$option_value) { |
|
| 6322 | + update_option($option, $page_found); |
|
| 6323 | + } |
|
| 6223 | 6324 | return; |
| 6224 | 6325 | endif; |
| 6225 | 6326 | |