Passed
Pull Request — master (#227)
by Kiran
10:25
created
geodirectory-admin/admin_functions.php 1 patch
Braces   +231 added lines, -127 removed lines patch added patch discarded remove patch
@@ -183,8 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
         $thumb_img_arr = array();
185 185
 
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
186
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
187
+                    $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+        }
188 189
 
189 190
         $totImg = '';
190 191
         $image_limit = '';
@@ -235,7 +236,9 @@  discard block
 block discarded – undo
235 236
     {
236 237
         global $menu, $geodirectory;
237 238
 
238
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
239
+        if (current_user_can('manage_options')) {
240
+        	$menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
241
+        }
239 242
 
240 243
         add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
241 244
 
@@ -299,7 +302,9 @@  discard block
 block discarded – undo
299 302
      */
300 303
     function geodir_admin_custom_menu_order()
301 304
     {
302
-        if (!current_user_can('manage_options')) return false;
305
+        if (!current_user_can('manage_options')) {
306
+        	return false;
307
+        }
303 308
         return true;
304 309
     }
305 310
 }
@@ -330,10 +335,11 @@  discard block
 block discarded – undo
330 335
 			case 'fail':
331 336
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
332 337
 				
333
-				if ($gderr == 21)
334
-			    	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>';
335
-				else
336
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
338
+				if ($gderr == 21) {
339
+							    	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>';
340
+				} else {
341
+									echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
342
+				}
337 343
                 break;
338 344
         }
339 345
     }
@@ -370,8 +376,12 @@  discard block
 block discarded – undo
370 376
         include_once('option-pages/' . $current_tab . '_array.php');
371 377
     }
372 378
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
373
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
374
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
379
+        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) {
380
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
381
+        }
382
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) {
383
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
+        }
375 385
 		
376 386
 		/**
377 387
 		 * Fires before updating geodirectory admin settings.
@@ -383,8 +393,9 @@  discard block
 block discarded – undo
383 393
 		 */
384 394
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
385 395
 		
386
-        if (!empty($geodir_settings[$current_tab]))
387
-            geodir_update_options($geodir_settings[$current_tab]);
396
+        if (!empty($geodir_settings[$current_tab])) {
397
+                    geodir_update_options($geodir_settings[$current_tab]);
398
+        }
388 399
 
389 400
         /**
390 401
          * Called after GeoDirectory options settings are updated.
@@ -452,8 +463,9 @@  discard block
 block discarded – undo
452 463
                 $options_list = '';
453 464
                 for ($option = 1; $option <= 30; $option++) {
454 465
                     $selected = '';
455
-                    if ($option == 10)
456
-                        $selected = 'selected="selected"';
466
+                    if ($option == 10) {
467
+                                            $selected = 'selected="selected"';
468
+                    }
457 469
 
458 470
                     $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
459 471
                 }
@@ -649,10 +661,11 @@  discard block
 block discarded – undo
649 661
                     }
650 662
 
651 663
 
652
-                    if (geodir_dummy_folder_exists())
653
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
654
-                    else
655
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
664
+                    if (geodir_dummy_folder_exists()) {
665
+                                            $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
+                    } else {
667
+                                            $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668
+                    }
656 669
 
657 670
                     $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
658 671
 
@@ -693,10 +706,11 @@  discard block
 block discarded – undo
693 706
             if (!term_exists($catname, 'gd_placecategory')) {
694 707
                 $last_catid = wp_insert_term($catname, 'gd_placecategory');
695 708
 
696
-                if (geodir_dummy_folder_exists())
697
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
698
-                else
699
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
709
+                if (geodir_dummy_folder_exists()) {
710
+                                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
711
+                } else {
712
+                                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
713
+                }
700 714
 
701 715
                 $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
702 716
 
@@ -748,11 +762,14 @@  discard block
 block discarded – undo
748 762
  * @return bool Returns true if saved.
749 763
  */
750 764
 function geodir_update_options($options, $dummy = false) {
751
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
765
+    if ((!isset($_POST) || !$_POST) && !$dummy) {
766
+    	return false;
767
+    }
752 768
 
753 769
     foreach ($options as $value) {
754
-        if ($dummy && isset($value['std']))
755
-            $_POST[$value['id']] = $value['std'];
770
+        if ($dummy && isset($value['std'])) {
771
+                    $_POST[$value['id']] = $value['std'];
772
+        }
756 773
 
757 774
 
758 775
         if (isset($value['type']) && $value['type'] == 'checkbox') :
@@ -761,25 +778,23 @@  discard block
 block discarded – undo
761 778
                 update_option($value['id'], $_POST[$value['id']]);
762 779
             } else {
763 780
                 update_option($value['id'], 0);
764
-            }
765
-
766
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
781
+            } elseif (isset($value['type']) && $value['type'] == 'image_width') :
767 782
 
768 783
             if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
769 784
                 update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
770 785
                 update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
771 786
                 if (isset($_POST[$value['id'] . '_crop'])) :
772 787
                     update_option($value['id'] . '_crop', 1);
773
-                else :
774
-                    update_option($value['id'] . '_crop', 0);
788
+                else {
789
+                	:
790
+                    update_option($value['id'] . '_crop', 0);
791
+                }
775 792
                 endif;
776 793
             } else {
777 794
                 update_option($value['id'] . '_width', $value['std']);
778 795
                 update_option($value['id'] . '_height', $value['std']);
779 796
                 update_option($value['id'] . '_crop', 1);
780
-            }
781
-
782
-        elseif (isset($value['type']) && $value['type'] == 'map') :
797
+            } elseif (isset($value['type']) && $value['type'] == 'map') :
783 798
             $post_types = array();
784 799
             $categories = array();
785 800
 
@@ -824,8 +839,9 @@  discard block
 block discarded – undo
824 839
                     $image_name_arr = explode('/', get_option($value['id']));
825 840
                     $noimg_name = end($image_name_arr);
826 841
                     $img_path = $uploads['path'] . '/' . $noimg_name;
827
-                    if (file_exists($img_path))
828
-                        unlink($img_path);
842
+                    if (file_exists($img_path)) {
843
+                                            unlink($img_path);
844
+                    }
829 845
                 }
830 846
 
831 847
                 update_option($value['id'], '');
@@ -841,8 +857,10 @@  discard block
 block discarded – undo
841 857
                 foreach ($uploadedfile as $key => $uplaod):
842 858
                     if ($key == 'name'):
843 859
                         $uplaods[$key] = $filename;
844
-                    else :
845
-                        $uplaods[$key] = $uplaod;
860
+                    else {
861
+                    	:
862
+                        $uplaods[$key] = $uplaod;
863
+                    }
846 864
                     endif;
847 865
                 endforeach;
848 866
 
@@ -852,8 +870,9 @@  discard block
 block discarded – undo
852 870
                     $image_name_arr = explode('/', get_option($value['id']));
853 871
                     $noimg_name = end($image_name_arr);
854 872
                     $img_path = $uploads['path'] . '/' . $noimg_name;
855
-                    if (file_exists($img_path))
856
-                        unlink($img_path);
873
+                    if (file_exists($img_path)) {
874
+                                            unlink($img_path);
875
+                    }
857 876
                 }
858 877
 
859 878
                 $upload_overrides = array('test_form' => false);
@@ -868,10 +887,12 @@  discard block
 block discarded – undo
868 887
             endif;
869 888
 
870 889
 
871
-        else :
890
+        else {
891
+        	:
872 892
             // same menu setting per theme.
873 893
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
874
-                $theme = wp_get_theme();
894
+                $theme = wp_get_theme();
895
+        }
875 896
                 update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
876 897
             }
877 898
 
@@ -883,8 +904,9 @@  discard block
 block discarded – undo
883 904
 
884 905
         endif;
885 906
     }
886
-    if ($dummy)
887
-        $_POST = array();
907
+    if ($dummy) {
908
+            $_POST = array();
909
+    }
888 910
     return true;
889 911
 
890 912
 }
@@ -1029,9 +1051,12 @@  discard block
 block discarded – undo
1029 1051
         $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1030 1052
             'categorys' => __('Categories', 'geodirectory'));
1031 1053
 
1032
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1054
+        if (($offset = array_search('author', array_keys($columns))) === false) {
1055
+        	// if the key doesn't exist
1033 1056
         {
1034
-            $offset = 0; // should we prepend $array with $data?
1057
+            $offset = 0;
1058
+        }
1059
+        // should we prepend $array with $data?
1035 1060
             $offset = count($columns); // or should we append $array with $data? lets pick this one...
1036 1061
         }
1037 1062
 
@@ -1091,11 +1116,13 @@  discard block
 block discarded – undo
1091 1116
                     $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1092 1117
                 }
1093 1118
                 /* If no expire_date is found, output a default message. */
1094
-                if (empty($expire_date))
1095
-                    echo __('Unknown', 'geodirectory');
1119
+                if (empty($expire_date)) {
1120
+                                    echo __('Unknown', 'geodirectory');
1121
+                }
1096 1122
                 /* If there is a expire_date, append 'days left' to the text string. */
1097
-                else
1098
-                    echo $expire_date . $date_diff_text;
1123
+                else {
1124
+                                    echo $expire_date . $date_diff_text;
1125
+                }
1099 1126
                 break;
1100 1127
 
1101 1128
             /* If displaying the 'categorys' column. */
@@ -1168,21 +1195,26 @@  discard block
 block discarded – undo
1168 1195
 
1169 1196
     $geodir_posttypes = geodir_get_posttypes();
1170 1197
 
1171
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1172
-        return;
1198
+    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
1199
+            return;
1200
+    }
1173 1201
 
1174 1202
     if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1175
-        if (isset($_REQUEST['_status']))
1176
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1203
+        if (isset($_REQUEST['_status'])) {
1204
+                    geodir_change_post_status($post_id, $_REQUEST['_status']);
1205
+        }
1177 1206
 
1178
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1179
-            return;
1207
+        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) {
1208
+                    return;
1209
+        }
1180 1210
 
1181
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1182
-            return;
1211
+        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) {
1212
+                    return;
1213
+        }
1183 1214
 
1184
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1185
-            return;
1215
+        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) {
1216
+                    return;
1217
+        }
1186 1218
 
1187 1219
         geodir_save_listing($_REQUEST);
1188 1220
     }
@@ -1207,10 +1239,18 @@  discard block
 block discarded – undo
1207 1239
     $tab_id = '';
1208 1240
     $i = 0;
1209 1241
     foreach ($options as $value) :
1210
-        if (!isset($value['name'])) $value['name'] = '';
1211
-        if (!isset($value['class'])) $value['class'] = '';
1212
-        if (!isset($value['css'])) $value['css'] = '';
1213
-        if (!isset($value['std'])) $value['std'] = '';
1242
+        if (!isset($value['name'])) {
1243
+        	$value['name'] = '';
1244
+        }
1245
+        if (!isset($value['class'])) {
1246
+        	$value['class'] = '';
1247
+        }
1248
+        if (!isset($value['css'])) {
1249
+        	$value['css'] = '';
1250
+        }
1251
+        if (!isset($value['std'])) {
1252
+        	$value['std'] = '';
1253
+        }
1214 1254
         $desc = '';
1215 1255
         switch ($value['type']) :
1216 1256
             case 'dummy_installer':
@@ -1226,11 +1266,13 @@  discard block
 block discarded – undo
1226 1266
 
1227 1267
                 $i++;
1228 1268
 
1229
-                if (isset($value['id']) && $value['id'])
1230
-                    $tab_id = $value['id'];
1269
+                if (isset($value['id']) && $value['id']) {
1270
+                                    $tab_id = $value['id'];
1271
+                }
1231 1272
 
1232
-                if (isset($value['desc']) && $value['desc'])
1233
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1273
+                if (isset($value['desc']) && $value['desc']) {
1274
+                                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1275
+                }
1234 1276
 
1235 1277
                 if (isset($value['name']) && $value['name']) {
1236 1278
                     if ($first_title === true) {
@@ -1261,10 +1303,12 @@  discard block
 block discarded – undo
1261 1303
                 break;
1262 1304
 
1263 1305
             case 'sectionstart':
1264
-                if (isset($value['desc']) && $value['desc'])
1265
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1266
-                if (isset($value['name']) && $value['name'])
1267
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1306
+                if (isset($value['desc']) && $value['desc']) {
1307
+                                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1308
+                }
1309
+                if (isset($value['name']) && $value['name']) {
1310
+                                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1311
+                }
1268 1312
                 /**
1269 1313
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1270 1314
                  *
@@ -1272,7 +1316,9 @@  discard block
 block discarded – undo
1272 1316
                  *
1273 1317
                  * @since 1.0.0
1274 1318
                  */
1275
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1319
+                if (isset($value['id']) && $value['id']) {
1320
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1321
+                }
1276 1322
                 echo '<table class="form-table">' . "\n\n";
1277 1323
 
1278 1324
                 break;
@@ -1284,7 +1330,9 @@  discard block
 block discarded – undo
1284 1330
                  *
1285 1331
                  * @since 1.0.0
1286 1332
                  */
1287
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1333
+                if (isset($value['id']) && $value['id']) {
1334
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1335
+                }
1288 1336
                 echo '</table>';
1289 1337
                 /**
1290 1338
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1293,7 +1341,9 @@  discard block
 block discarded – undo
1293 1341
                  *
1294 1342
                  * @since 1.0.0
1295 1343
                  */
1296
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1344
+                if (isset($value['id']) && $value['id']) {
1345
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1346
+                }
1297 1347
                 break;
1298 1348
             case 'text':
1299 1349
                 ?>
@@ -1365,17 +1415,32 @@  discard block
 block discarded – undo
1365 1415
                     <?php _e('Width', 'geodirectory'); ?> <input
1366 1416
                         name="<?php echo esc_attr($value['id']); ?>_width"
1367 1417
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1368
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1418
+                        value="<?php if ($size = get_option($value['id'] . '_width')) {
1419
+	echo stripslashes($size);
1420
+} else {
1421
+	echo $value['std'];
1422
+}
1423
+?>"/>
1369 1424
 
1370 1425
                     <?php _e('Height', 'geodirectory'); ?> <input
1371 1426
                         name="<?php echo esc_attr($value['id']); ?>_height"
1372 1427
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1373
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1428
+                        value="<?php if ($size = get_option($value['id'] . '_height')) {
1429
+	echo stripslashes($size);
1430
+} else {
1431
+	echo $value['std'];
1432
+}
1433
+?>"/>
1374 1434
 
1375 1435
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1376 1436
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1377 1437
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1378
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1438
+                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') {
1439
+	checked(get_option($value['id'] . '_crop'), 1);
1440
+} else {
1441
+	checked(1);
1442
+}
1443
+?> /></label>
1379 1444
 
1380 1445
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1381 1446
                 </tr><?php
@@ -1389,17 +1454,22 @@  discard block
 block discarded – undo
1389 1454
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
1390 1455
                                             id="<?php echo esc_attr($value['id']); ?>"
1391 1456
                                             style="<?php echo esc_attr($value['css']); ?>"
1392
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1457
+                                            class="<?php if (isset($value['class'])) {
1458
+	echo $value['class'];
1459
+}
1460
+?>"
1393 1461
                                             option-ajaxchosen="false">
1394 1462
                         <?php
1395 1463
                         foreach ($value['options'] as $key => $val) {
1396 1464
                             $geodir_select_value = '';
1397 1465
                             if ($option_value != '') {
1398
-                                if ($option_value != '' && $option_value == $key)
1399
-                                    $geodir_select_value = ' selected="selected" ';
1466
+                                if ($option_value != '' && $option_value == $key) {
1467
+                                                                    $geodir_select_value = ' selected="selected" ';
1468
+                                }
1400 1469
                             } else {
1401
-                                if ($value['std'] == $key)
1402
-                                    $geodir_select_value = ' selected="selected" ';
1470
+                                if ($value['std'] == $key) {
1471
+                                                                    $geodir_select_value = ' selected="selected" ';
1472
+                                }
1403 1473
                             }
1404 1474
                             ?>
1405 1475
                             <option
@@ -1424,8 +1494,14 @@  discard block
 block discarded – undo
1424 1494
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
1425 1495
                                             id="<?php echo esc_attr($value['id']); ?>"
1426 1496
                                             style="<?php echo esc_attr($value['css']); ?>"
1427
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1428
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1497
+                                            class="<?php if (isset($value['class'])) {
1498
+	echo $value['class'];
1499
+}
1500
+?>"
1501
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) {
1502
+	echo $value['placeholder_text'];
1503
+}
1504
+?>"
1429 1505
                                             option-ajaxchosen="false">
1430 1506
                         <?php
1431 1507
                         foreach ($value['options'] as $key => $val) {
@@ -1452,7 +1528,10 @@  discard block
 block discarded – undo
1452 1528
                 <td class="forminp">
1453 1529
                     <input type="file" name="<?php echo esc_attr($value['id']); ?>"
1454 1530
                            id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>"
1455
-                           class="<?php if (isset($value['class'])) echo $value['class']; ?>"/>
1531
+                           class="<?php if (isset($value['class'])) {
1532
+	echo $value['class'];
1533
+}
1534
+?>"/>
1456 1535
                     <?php if (get_option($value['id'])) { ?>
1457 1536
                         <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove"
1458 1537
                                id="<?php echo esc_attr($value['id']); ?>_remove" value="0">
@@ -1533,13 +1612,15 @@  discard block
 block discarded – undo
1533 1612
                                 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1534 1613
                             );
1535 1614
                             $geodir_default_map_language = get_option('geodir_default_map_language');
1536
-                            if (empty($geodir_default_map_language))
1537
-                                $geodir_default_map_language = 'en';
1615
+                            if (empty($geodir_default_map_language)) {
1616
+                                                            $geodir_default_map_language = 'en';
1617
+                            }
1538 1618
                             foreach ($arr_map_langages as $language_key => $language_txt) {
1539
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1540
-                                    $geodir_default_language_selected = "selected='selected'";
1541
-                                else
1542
-                                    $geodir_default_language_selected = '';
1619
+                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) {
1620
+                                                                    $geodir_default_language_selected = "selected='selected'";
1621
+                                } else {
1622
+                                                                    $geodir_default_language_selected = '';
1623
+                                }
1543 1624
 
1544 1625
                                 ?>
1545 1626
                                 <option
@@ -1559,14 +1640,16 @@  discard block
 block discarded – undo
1559 1640
                             <?php
1560 1641
                             $post_types = geodir_get_posttypes('array');
1561 1642
                             $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1562
-                            if (empty($geodir_default_map_search_pt))
1563
-                                $geodir_default_map_search_pt = 'gd_place';
1643
+                            if (empty($geodir_default_map_search_pt)) {
1644
+                                                            $geodir_default_map_search_pt = 'gd_place';
1645
+                            }
1564 1646
                             if (is_array($post_types)) {
1565 1647
                                 foreach ($post_types as $key => $post_types_obj) {
1566
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1567
-                                        $geodir_search_pt_selected = "selected='selected'";
1568
-                                    else
1569
-                                        $geodir_search_pt_selected = '';
1648
+                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) {
1649
+                                                                            $geodir_search_pt_selected = "selected='selected'";
1650
+                                    } else {
1651
+                                                                            $geodir_search_pt_selected = '';
1652
+                                    }
1570 1653
 
1571 1654
                                     ?>
1572 1655
                                     <option
@@ -1686,7 +1769,7 @@  discard block
 block discarded – undo
1686 1769
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1687 1770
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1688 1771
                             echo 'checked="checked"';
1689
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1772
+                        } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1690 1773
                         <?php echo $value['desc']; ?></label><br>
1691 1774
                 </fieldset>
1692 1775
                 <?php
@@ -1706,10 +1789,18 @@  discard block
 block discarded – undo
1706 1789
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1707 1790
                 <td class="forminp">
1708 1791
                     <textarea
1709
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1792
+                        <?php if (isset($value['args'])) {
1793
+	echo $value['args'] . ' ';
1794
+}
1795
+?>name="<?php echo esc_attr($value['id']); ?>"
1710 1796
                         id="<?php echo esc_attr($value['id']); ?>"
1711 1797
                         <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1712
-                        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
1798
+                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) {
1799
+	echo esc_textarea(stripslashes(get_option($value['id'])));
1800
+} else {
1801
+	echo esc_textarea($value['std']);
1802
+}
1803
+?></textarea><span
1713 1804
                         class="description"><?php echo $value['desc'] ?></span>
1714 1805
 
1715 1806
                 </td>
@@ -1721,10 +1812,11 @@  discard block
 block discarded – undo
1721 1812
                 <tr valign="top">
1722 1813
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1723 1814
                 <td class="forminp"><?php
1724
-                    if (get_option($value['id']))
1725
-                        $content = stripslashes(get_option($value['id']));
1726
-                    else
1727
-                        $content = $value['std'];
1815
+                    if (get_option($value['id'])) {
1816
+                                            $content = stripslashes(get_option($value['id']));
1817
+                    } else {
1818
+                                            $content = $value['std'];
1819
+                    }
1728 1820
 
1729 1821
                     $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1730 1822
 
@@ -1764,7 +1856,9 @@  discard block
 block discarded – undo
1764 1856
                     'echo' => false,
1765 1857
                     'selected' => $page_setting);
1766 1858
 
1767
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1859
+                if (isset($value['args'])) {
1860
+                	$args = wp_parse_args($value['args'], $args);
1861
+                }
1768 1862
 
1769 1863
                 ?>
1770 1864
                 <tr valign="top" class="single_select_page">
@@ -1783,8 +1877,10 @@  discard block
 block discarded – undo
1783 1877
                 if (strstr($country_setting, ':')) :
1784 1878
                     $country = current(explode(':', $country_setting));
1785 1879
                     $state = end(explode(':', $country_setting));
1786
-                else :
1787
-                    $country = $country_setting;
1880
+                else {
1881
+                	:
1882
+                    $country = $country_setting;
1883
+                }
1788 1884
                     $state = '*';
1789 1885
                 endif;
1790 1886
                 ?>
@@ -1811,8 +1907,10 @@  discard block
 block discarded – undo
1811 1907
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1812 1908
                             title="Country" class="chosen_select">
1813 1909
                         <?php
1814
-                        if ($countries) foreach ($countries as $key => $val) :
1815
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1910
+                        if ($countries) {
1911
+                        	foreach ($countries as $key => $val) :
1912
+                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1913
+                        }
1816 1914
                         endforeach;
1817 1915
                         ?>
1818 1916
                     </select>
@@ -2063,8 +2161,9 @@  discard block
 block discarded – undo
2063 2161
         endforeach;
2064 2162
     endif;
2065 2163
 
2066
-    if (!empty($place_img_array))
2067
-        $curImages = implode(',', $place_img_array);
2164
+    if (!empty($place_img_array)) {
2165
+            $curImages = implode(',', $place_img_array);
2166
+    }
2068 2167
 
2069 2168
 
2070 2169
     // adjust values here
@@ -2411,16 +2510,17 @@  discard block
 block discarded – undo
2411 2510
 	
2412 2511
 	$post_type = NULL;
2413 2512
 	
2414
-	if ($post && isset($post->post_type))
2415
-		$post_type = $post->post_type;
2416
-	elseif ($typenow)
2417
-		$post_type = $typenow;
2418
-	elseif ($current_screen && isset($current_screen->post_type))
2419
-		$post_type = $current_screen->post_type;
2420
-	elseif (isset($_REQUEST['post_type']))
2421
-		$post_type = sanitize_key($_REQUEST['post_type']);
2422
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2423
-		$post_type = get_post_type($_REQUEST['post']);
2513
+	if ($post && isset($post->post_type)) {
2514
+			$post_type = $post->post_type;
2515
+	} elseif ($typenow) {
2516
+			$post_type = $typenow;
2517
+	} elseif ($current_screen && isset($current_screen->post_type)) {
2518
+			$post_type = $current_screen->post_type;
2519
+	} elseif (isset($_REQUEST['post_type'])) {
2520
+			$post_type = sanitize_key($_REQUEST['post_type']);
2521
+	} elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
2522
+			$post_type = get_post_type($_REQUEST['post']);
2523
+	}
2424 2524
 
2425 2525
 	return $post_type;
2426 2526
 }
@@ -2479,9 +2579,10 @@  discard block
 block discarded – undo
2479 2579
 function geodir_hide_admin_preview_button() {
2480 2580
     global $post_type;
2481 2581
     $post_types = geodir_get_posttypes();
2482
-    if(in_array($post_type, $post_types))
2483
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2484
-}
2582
+    if(in_array($post_type, $post_types)) {
2583
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2584
+    }
2585
+    }
2485 2586
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2486 2587
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2487 2588
 
@@ -5522,8 +5623,9 @@  discard block
 block discarded – undo
5522 5623
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5523 5624
     global $wpdb, $plugin_prefix;
5524 5625
 
5525
-    if ( ! post_type_exists( $post_type ) )
5526
-        return new stdClass;
5626
+    if ( ! post_type_exists( $post_type ) ) {
5627
+            return new stdClass;
5628
+    }
5527 5629
         
5528 5630
     $table = $plugin_prefix . $post_type . '_detail';
5529 5631
 
@@ -6314,7 +6416,9 @@  discard block
 block discarded – undo
6314 6416
 
6315 6417
     if ($page_found) :
6316 6418
         // Page exists
6317
-        if (!$option_value) update_option($option, $page_found);
6419
+        if (!$option_value) {
6420
+        	update_option($option, $page_found);
6421
+        }
6318 6422
         return;
6319 6423
     endif;
6320 6424
 
Please login to merge, or discard this patch.