Test Failed
Push — master ( 4cd501...1b9ce5 )
by Stiofan
07:38
created
geodirectory.php 1 patch
Braces   +41 added lines, -13 removed lines patch added patch discarded remove patch
@@ -79,43 +79,71 @@
 block discarded – undo
79 79
 /**
80 80
  * Do not store any revisions (except the one autosave per post).
81 81
  */
82
-if (!defined('WP_POST_REVISIONS')) define('WP_POST_REVISIONS', 0);
82
+if (!defined('WP_POST_REVISIONS')) {
83
+	define('WP_POST_REVISIONS', 0);
84
+}
83 85
 
84 86
 /**
85 87
  * Define constants
86 88
  */
87
-if(!defined('GEODIRECTORY_PLUGIN_DIR')) define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
89
+if(!defined('GEODIRECTORY_PLUGIN_DIR')) {
90
+	define('GEODIRECTORY_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
91
+}
88 92
 
89 93
 /*
90 94
  * Declare database table names. All since version 1.0.0
91 95
  */
92 96
 
93 97
 /** Define the database name for the countries table. */
94
-if (!defined('GEODIR_COUNTRIES_TABLE')) define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
98
+if (!defined('GEODIR_COUNTRIES_TABLE')) {
99
+	define('GEODIR_COUNTRIES_TABLE', $plugin_prefix . 'countries');
100
+}
95 101
 /** Define the database name for the custom fields table. */
96
-if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
102
+if (!defined('GEODIR_CUSTOM_FIELDS_TABLE')) {
103
+	define('GEODIR_CUSTOM_FIELDS_TABLE', $plugin_prefix . 'custom_fields');
104
+}
97 105
 /** Define the database name for the icons table. */
98
-if (!defined('GEODIR_ICON_TABLE')) define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
106
+if (!defined('GEODIR_ICON_TABLE')) {
107
+	define('GEODIR_ICON_TABLE', $plugin_prefix . 'post_icon');
108
+}
99 109
 /** Define the database name for the attachments table. */
100
-if (!defined('GEODIR_ATTACHMENT_TABLE')) define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
110
+if (!defined('GEODIR_ATTACHMENT_TABLE')) {
111
+	define('GEODIR_ATTACHMENT_TABLE', $plugin_prefix . 'attachments');
112
+}
101 113
 /** Define the database name for the review table. */
102
-if (!defined('GEODIR_REVIEW_TABLE')) define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
114
+if (!defined('GEODIR_REVIEW_TABLE')) {
115
+	define('GEODIR_REVIEW_TABLE', $plugin_prefix . 'post_review');
116
+}
103 117
 /** Define the database name for the custom sort fields table. */
104
-if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
118
+if (!defined('GEODIR_CUSTOM_SORT_FIELDS_TABLE')) {
119
+	define('GEODIR_CUSTOM_SORT_FIELDS_TABLE', $plugin_prefix . 'custom_sort_fields');
120
+}
105 121
 
106 122
 /*
107 123
  * Define our Google Analytic app settings
108 124
  */
109
-if (!defined('GEODIR_GA_CLIENTID')) define('GEODIR_GA_CLIENTID', '687912069872-sdpsjssrdt7t3ao1dnv1ib71hkckbt5s.apps.googleusercontent.com');
110
-if (!defined('GEODIR_GA_CLIENTSECRET')) define('GEODIR_GA_CLIENTSECRET', 'yBVkDpqJ1B9nAETHy738Zn8C'); //don't worry - this don't need to be secret in our case
111
-if (!defined('GEODIR_GA_REDIRECT')) define('GEODIR_GA_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
112
-if (!defined('GEODIR_GA_SCOPE')) define('GEODIR_GA_SCOPE', 'https://www.googleapis.com/auth/analytics');//.readonly
125
+if (!defined('GEODIR_GA_CLIENTID')) {
126
+	define('GEODIR_GA_CLIENTID', '687912069872-sdpsjssrdt7t3ao1dnv1ib71hkckbt5s.apps.googleusercontent.com');
127
+}
128
+if (!defined('GEODIR_GA_CLIENTSECRET')) {
129
+	define('GEODIR_GA_CLIENTSECRET', 'yBVkDpqJ1B9nAETHy738Zn8C');
130
+}
131
+//don't worry - this don't need to be secret in our case
132
+if (!defined('GEODIR_GA_REDIRECT')) {
133
+	define('GEODIR_GA_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
134
+}
135
+if (!defined('GEODIR_GA_SCOPE')) {
136
+	define('GEODIR_GA_SCOPE', 'https://www.googleapis.com/auth/analytics');
137
+}
138
+//.readonly
113 139
 
114 140
 
115 141
 /*
116 142
  * Localisation items.
117 143
  */
118
-if (!defined('GEODIRECTORY_TEXTDOMAIN')) define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
144
+if (!defined('GEODIRECTORY_TEXTDOMAIN')) {
145
+	define('GEODIRECTORY_TEXTDOMAIN', 'geodirectory');
146
+}
119 147
 
120 148
 // Load geodirectory plugin textdomain.
121 149
 add_action( 'init', 'geodir_load_textdomain' );
Please login to merge, or discard this patch.
geodirectory_template_tags.php 1 patch
Braces   +38 added lines, -20 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         </script>
255 255
 
256 256
 <?php
257
-    }elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
257
+    } elseif(get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){
258 258
         echo stripslashes(get_option('geodir_ga_tracking_code'));
259 259
     }
260 260
 
@@ -281,13 +281,14 @@  discard block
 block discarded – undo
281 281
  */
282 282
 function geodir_add_async_forscript($url)
283 283
 {
284
-    if (strpos($url, '#asyncload')===false)
285
-        return $url;
286
-    else if (is_admin())
287
-        return str_replace('#asyncload', '', $url);
288
-    else
289
-        return str_replace('#asyncload', '', $url)."' async='async";
290
-}
284
+    if (strpos($url, '#asyncload')===false) {
285
+            return $url;
286
+    } else if (is_admin()) {
287
+            return str_replace('#asyncload', '', $url);
288
+    } else {
289
+            return str_replace('#asyncload', '', $url)."' async='async";
290
+    }
291
+    }
291 292
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
292 293
 
293 294
 /**
@@ -354,8 +355,10 @@  discard block
 block discarded – undo
354 355
 
355 356
     $half_pages_to_show = round($pages_to_show / 2);
356 357
 
357
-    if (geodir_is_page('home')) // dont apply default  pagination for geodirectory home page.
358
-        return;
358
+    if (geodir_is_page('home')) {
359
+    	// dont apply default  pagination for geodirectory home page.
360
+        return;
361
+    }
359 362
 
360 363
     if (!is_single()) {
361 364
         if (function_exists('geodir_location_geo_home_link')) {
@@ -475,11 +478,21 @@  discard block
 block discarded – undo
475 478
     }
476 479
     $dist_dif = 1000;
477 480
 
478
-    if ($dist <= 5000) $dist_dif = 500;
479
-    if ($dist <= 1000) $dist_dif = 100;
480
-    if ($dist <= 500) $dist_dif = 50;
481
-    if ($dist <= 100) $dist_dif = 10;
482
-    if ($dist <= 50) $dist_dif = 5;
481
+    if ($dist <= 5000) {
482
+    	$dist_dif = 500;
483
+    }
484
+    if ($dist <= 1000) {
485
+    	$dist_dif = 100;
486
+    }
487
+    if ($dist <= 500) {
488
+    	$dist_dif = 50;
489
+    }
490
+    if ($dist <= 100) {
491
+    	$dist_dif = 10;
492
+    }
493
+    if ($dist <= 50) {
494
+    	$dist_dif = 5;
495
+    }
483 496
 
484 497
     ?>
485 498
     <script type="text/javascript">
@@ -541,18 +554,23 @@  discard block
 block discarded – undo
541 554
 {
542 555
 
543 556
     $default_search_for_text = SEARCH_FOR_TEXT;
544
-    if (get_option('geodir_search_field_default_text'))
545
-        $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
557
+    if (get_option('geodir_search_field_default_text')) {
558
+            $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
559
+    }
546 560
 
547 561
     $default_near_text = NEAR_TEXT;
548
-    if (get_option('geodir_near_field_default_text'))
549
-        $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
562
+    if (get_option('geodir_near_field_default_text')) {
563
+            $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
564
+    }
550 565
 
551 566
     ?>
552 567
 
553 568
 
554 569
     <script type="text/javascript">
555
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
570
+        var default_location = '<?php if($search_location = geodir_get_default_location()) {
571
+	echo $search_location->city ;
572
+}
573
+?>';
556 574
         var latlng;
557 575
         var address;
558 576
         var dist = 0;
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Braces   +230 added lines, -127 removed lines patch added patch discarded remove patch
@@ -184,8 +184,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
1511 1604
                             data-placeholder="<?php _e('Choose countries&hellip;', '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>
@@ -1747,8 +1842,9 @@  discard block
 block discarded – undo
1747 1842
         endforeach;
1748 1843
     endif;
1749 1844
 
1750
-    if (!empty($place_img_array))
1751
-        $curImages = implode(',', $place_img_array);
1845
+    if (!empty($place_img_array)) {
1846
+            $curImages = implode(',', $place_img_array);
1847
+    }
1752 1848
 
1753 1849
 
1754 1850
     // adjust values here
@@ -2094,16 +2190,17 @@  discard block
 block discarded – undo
2094 2190
 	global $post, $typenow, $current_screen;
2095 2191
 	
2096 2192
 	$post_type = NULL;
2097
-    if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2098
-		$post_type = get_post_type($_REQUEST['post']);
2099
-    elseif ($post && isset($post->post_type))
2100
-		$post_type = $post->post_type;
2101
-	elseif ($typenow)
2102
-		$post_type = $typenow;
2103
-	elseif ($current_screen && isset($current_screen->post_type))
2104
-		$post_type = $current_screen->post_type;
2105
-	elseif (isset($_REQUEST['post_type']))
2106
-		$post_type = sanitize_key($_REQUEST['post_type']);
2193
+    if (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
2194
+    		$post_type = get_post_type($_REQUEST['post']);
2195
+    } elseif ($post && isset($post->post_type)) {
2196
+    		$post_type = $post->post_type;
2197
+    } elseif ($typenow) {
2198
+			$post_type = $typenow;
2199
+	} elseif ($current_screen && isset($current_screen->post_type)) {
2200
+			$post_type = $current_screen->post_type;
2201
+	} elseif (isset($_REQUEST['post_type'])) {
2202
+			$post_type = sanitize_key($_REQUEST['post_type']);
2203
+	}
2107 2204
 
2108 2205
 
2109 2206
 	return $post_type;
@@ -2163,9 +2260,10 @@  discard block
 block discarded – undo
2163 2260
 function geodir_hide_admin_preview_button() {
2164 2261
     global $post_type;
2165 2262
     $post_types = geodir_get_posttypes();
2166
-    if(in_array($post_type, $post_types))
2167
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2168
-}
2263
+    if(in_array($post_type, $post_types)) {
2264
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2265
+    }
2266
+    }
2169 2267
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2170 2268
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2171 2269
 
@@ -5367,8 +5465,9 @@  discard block
 block discarded – undo
5367 5465
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5368 5466
     global $wpdb, $plugin_prefix;
5369 5467
 
5370
-    if ( ! post_type_exists( $post_type ) )
5371
-        return new stdClass;
5468
+    if ( ! post_type_exists( $post_type ) ) {
5469
+            return new stdClass;
5470
+    }
5372 5471
         
5373 5472
     $table = $plugin_prefix . $post_type . '_detail';
5374 5473
 
@@ -6203,7 +6302,9 @@  discard block
 block discarded – undo
6203 6302
 
6204 6303
     if ($page_found) :
6205 6304
         // Page exists
6206
-        if (!$option_value) update_option($option, $page_found);
6305
+        if (!$option_value) {
6306
+        	update_option($option, $page_found);
6307
+        }
6207 6308
         return;
6208 6309
     endif;
6209 6310
 
@@ -6578,7 +6679,7 @@  discard block
 block discarded – undo
6578 6679
         $accounts = geodir_ga_get_analytics_accounts();
6579 6680
         if(is_array($accounts)){
6580 6681
             $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6581
-        }elseif(get_option('geodir_ga_account_id')){
6682
+        } elseif(get_option('geodir_ga_account_id')){
6582 6683
             $accounts = array();
6583 6684
             $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6584 6685
         }
@@ -6599,14 +6700,16 @@  discard block
 block discarded – undo
6599 6700
 
6600 6701
     
6601 6702
     # Create a new Gdata call
6602
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6603
-        $stats = new GDGoogleAnalyticsStats();
6604
-    else
6605
-        return false;
6703
+    if ( trim(get_option('geodir_ga_auth_code')) != '' ) {
6704
+            $stats = new GDGoogleAnalyticsStats();
6705
+    } else {
6706
+            return false;
6707
+    }
6606 6708
 
6607 6709
     # Check if Google sucessfully logged in
6608
-    if ( ! $stats->checkLogin() )
6609
-        return false;
6710
+    if ( ! $stats->checkLogin() ) {
6711
+            return false;
6712
+    }
6610 6713
 
6611 6714
     # Get a list of accounts
6612 6715
     $accounts = $stats->getAllProfiles();
@@ -6617,8 +6720,8 @@  discard block
 block discarded – undo
6617 6720
     if ( count($accounts) > 0 ){
6618 6721
         update_option('geodir_gd_uids',$accounts);
6619 6722
         return $accounts;
6723
+    } else {
6724
+            return false;
6725
+    }
6620 6726
     }
6621
-    else
6622
-        return false;
6623
-}
6624 6727
 
Please login to merge, or discard this patch.
geodirectory-admin/class.analytics.stats.php 1 patch
Braces   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
             try {
50 50
                     $this->analytics = new Google_AnalyticsService($this->client);
51
-                }
52
-            catch (Google_ServiceException $e)
51
+                } catch (Google_ServiceException $e)
53 52
                 {
54 53
                     print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
55 54
 					return false;
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
 				try
66 65
                 {
67 66
                     $this->client->setAccessToken($ga_google_authtoken);
68
-				}
69
-				catch( Google_AuthException $e )
67
+				} catch( Google_AuthException $e )
70 68
                 {
71 69
                     print '(cas:72) GeoDirectory was unable to authenticate you with
72 70
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -76,18 +74,18 @@  discard block
 block discarded – undo
76 74
 
77 75
                     return false;
78 76
                 }
79
-            }
80
-            else
77
+            } else
81 78
             {
82 79
                 $authCode = get_option('geodir_ga_auth_code');
83 80
 
84
-                if (empty($authCode)) return false;
81
+                if (empty($authCode)) {
82
+                	return false;
83
+                }
85 84
 
86 85
                 try
87 86
                 {
88 87
                     $accessToken = $this->client->authenticate($authCode);
89
-                }
90
-                catch( Exception $e )
88
+                } catch( Exception $e )
91 89
                 {
92 90
                     print '(cas:72) GeoDirectory was unable to authenticate you with
93 91
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -102,8 +100,7 @@  discard block
 block discarded – undo
102 100
                 {
103 101
                     $this->client->setAccessToken($accessToken);
104 102
                     update_option('geodir_ga_auth_token', $accessToken);
105
-                }
106
-                else
103
+                } else
107 104
                 {
108 105
                     return false;
109 106
                 }
@@ -124,19 +121,22 @@  discard block
 block discarded – undo
124 121
             $webproperty_id = get_option('geodir_ga_account_id');
125 122
             list($pre, $account_id, $post) = explode('-',$webproperty_id);
126 123
 
127
-            if (empty($webproperty_id)) return false;
124
+            if (empty($webproperty_id)) {
125
+            	return false;
126
+            }
128 127
 
129 128
             try {
130 129
                 $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
131
-            }
132
-            catch (Google_ServiceException $e)
130
+            } catch (Google_ServiceException $e)
133 131
             {
134 132
                 print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
135 133
                 return false;
136 134
             }
137 135
 
138 136
             $profile_id = $profiles->items[0]->id;
139
-            if (empty($profile_id)) return false;
137
+            if (empty($profile_id)) {
138
+            	return false;
139
+            }
140 140
 
141 141
             $account_array = array();
142 142
             array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
@@ -149,8 +149,7 @@  discard block
 block discarded – undo
149 149
             
150 150
             try {
151 151
                     $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
152
-                }
153
-                catch (Google_ServiceException $e)
152
+                } catch (Google_ServiceException $e)
154 153
                 {
155 154
                     print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
156 155
                 }
@@ -262,7 +261,7 @@  discard block
 block discarded – undo
262 261
 				$metric,
263 262
 				$params
264 263
 			);
265
-		}else{
264
+		} else{
266 265
 			return $analytics->data_ga->get(
267 266
 				'ga:'.$filtered_id,
268 267
 				$startDate,
@@ -286,10 +285,11 @@  discard block
 block discarded – undo
286 285
 	 **/
287 286
 	function verifyStartDate($date)
288 287
 	{
289
-		if ( strtotime($date) > strtotime('2005-01-01') )
290
-			return $date;
291
-		else
292
-			return '2005-01-01';
288
+		if ( strtotime($date) > strtotime('2005-01-01') ) {
289
+					return $date;
290
+		} else {
291
+					return '2005-01-01';
292
+		}
293 293
 	}
294 294
 
295 295
 } // END class	
296 296
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/external/URITemplateParser.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,9 @@
 block discarded – undo
143 143
           }
144 144
           $part .= $val;
145 145
         }
146
-        if (! $exp->one_var_defined) $part = '';
146
+        if (! $exp->one_var_defined) {
147
+        	$part = '';
148
+        }
147 149
         $this->expansion = str_replace($exp->expression, $part, $this->expansion);
148 150
       }
149 151
 
Please login to merge, or discard this patch.
google-api-php-client/src/service/Google_ServiceResource.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,8 +196,7 @@
 block discarded – undo
196 196
     foreach ($o as $k => $v) {
197 197
       if ($v === null || strstr($k, "\0*\0__")) {
198 198
         unset($o[$k]);
199
-      }
200
-      elseif (is_object($v) || is_array($v)) {
199
+      } elseif (is_object($v) || is_array($v)) {
201 200
         $this->stripNull($o[$k]);
202 201
       }
203 202
     }
Please login to merge, or discard this patch.
google-api-php-client/src/service/Google_MediaFileUpload.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,9 +119,7 @@  discard block
 block discarded – undo
119 119
       // This is a simple media upload.
120 120
       $payload['content-type'] = $mimeType;
121 121
       $payload['postBody'] = $data;
122
-    }
123
-
124
-    elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
122
+    } elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
125 123
       // This is a multipart/related upload.
126 124
       $boundary = isset($params['boundary']['value']) ? $params['boundary']['value'] : mt_rand();
127 125
       $boundary = str_replace('"', '', $boundary);
@@ -148,7 +146,9 @@  discard block
 block discarded – undo
148 146
    * @visible For testing.
149 147
    */
150 148
   public static function processFileUpload($file, $mime) {
151
-    if (!$file) return array();
149
+    if (!$file) {
150
+    	return array();
151
+    }
152 152
     if (substr($file, 0, 1) != '@') {
153 153
       $file = '@' . $file;
154 154
     }
Please login to merge, or discard this patch.
geodirectory-functions/google_analytics.php 1 patch
Braces   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,28 +74,25 @@  discard block
 block discarded – undo
74 74
         $start_date = date('Y-m-d', strtotime("-6 day"));
75 75
         $end_date = date('Y-m-d');
76 76
         $dimensions = "ga:date,ga:nthDay";
77
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
77
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
78 78
         $start_date = date('Y-m-d', strtotime("-13 day"));
79 79
         $end_date = date('Y-m-d', strtotime("-7 day"));
80 80
         $dimensions = "ga:date,ga:nthDay";
81
-    }
82
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
81
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
83 82
         $start_date = date('Y')."-01-01";
84 83
         $end_date = date('Y-m-d');
85 84
         $dimensions = "ga:month,ga:nthMonth";
86
-    }
87
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
85
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
88 86
         $start_date = date('Y', strtotime("-1 year"))."-01-01";
89 87
         $end_date = date('Y', strtotime("-1 year"))."-12-31";
90 88
         $dimensions = "ga:month,ga:nthMonth";
91
-    }
92
-    elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
89
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
93 90
         $start_date = "14daysAgo";
94 91
         $end_date = "yesterday";
95 92
         $dimensions = "ga:country";
96 93
         $sort = "ga:pageviews";
97 94
         $limit  = 5;
98
-    }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
95
+    } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='realtime'){
99 96
         $metrics = "rt:activeUsers";
100 97
         $realtime = true;
101 98
     }
@@ -126,8 +123,7 @@  discard block
 block discarded – undo
126 123
     # Get the metrics needed to build the visits graph;
127 124
     try {
128 125
         $stats = $gaApi->getMetrics($metrics, $start_date, $end_date, $dimensions, $sort, $filters, $limit , $realtime);
129
-    }
130
-    catch (Exception $e) {
126
+    } catch (Exception $e) {
131 127
         print 'GA Summary Widget - there was a service error ' . $e->getCode() . ':' . $e->getMessage();
132 128
     }
133 129
 
@@ -148,7 +144,7 @@  discard block
 block discarded – undo
148 144
     if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
149 145
 
150 146
     return $at;
151
-    }else{//else get new access token
147
+    } else{//else get new access token
152 148
 
153 149
         $refresh_at = get_option('gd_ga_refresh_token');
154 150
         if(!$refresh_at){
@@ -171,7 +167,7 @@  discard block
 block discarded – undo
171 167
             update_option('gd_ga_access_token', $parts->access_token);
172 168
             return $parts->access_token;
173 169
 
174
-        }else{
170
+        } else{
175 171
             echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
176 172
         }
177 173
 
Please login to merge, or discard this patch.