Passed
Pull Request — master (#204)
by Kiran
08:01
created
geodirectory-functions/post_functions.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      * @param int $post_id The post ID.
722 722
      * @param string $postmeta Detail table column name.
723 723
      * @param string $meta_value Detail table column value.
724
-     * @return void|bool
724
+     * @return null|false
725 725
      */
726 726
     function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727 727
     {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      * @param string $postmeta Detail table column name.
776 776
      * @todo check if this is depreciated
777 777
      * @todo Fix unknown variable mval
778
-     * @return bool
778
+     * @return boolean|null
779 779
      */
780 780
     function geodir_delete_post_meta($post_id, $postmeta)
781 781
     {
@@ -2140,7 +2140,7 @@  discard block
 block discarded – undo
2140 2140
      * @global string $plugin_prefix Geodirectory plugin table prefix.
2141 2141
      * @param int $deleted_postid The post ID.
2142 2142
      * @param bool $force Optional. Do you want to force delete it? Default: false.
2143
-     * @return bool|void
2143
+     * @return null|false
2144 2144
      */
2145 2145
     function geodir_delete_listing_info($deleted_postid, $force = false)
2146 2146
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @global object $wpdb WordPress Database object.
80 80
      * @global object $post The current post object.
81 81
      * @global object $current_user Current user object.
82
-	 * @global object $gd_session GeoDirectory Session object.
82
+     * @global object $gd_session GeoDirectory Session object.
83 83
      * @param array $request_info {
84 84
      *    Array of request info arguments.
85 85
      *
@@ -2554,9 +2554,9 @@  discard block
 block discarded – undo
2554 2554
 function geodir_excerpt_length($length)
2555 2555
 {
2556 2556
     global $wp_query, $geodir_is_widget_listing;
2557
-	if ($geodir_is_widget_listing) {
2558
-		return $length;
2559
-	}
2557
+    if ($geodir_is_widget_listing) {
2558
+        return $length;
2559
+    }
2560 2560
 	
2561 2561
     if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2562 2562
         $length = get_option('geodir_desc_word_limit');
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     if (!isset($default_cat) || empty($default_cat)) {
28 28
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
29
+    } else {
30
+        if (!is_int($default_cat)) {
31 31
             $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
32
+            if (isset($category->term_id)) {
33
+                $default_cat = $category->term_id;
34 34
             }
35 35
         }
36 36
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $send_post_submit_mail = false;
228 228
 
229 229
         // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
230
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
231 231
 
232 232
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
233 233
             $post['ID'] = $request_info['pid'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         }
252 252
 
253 253
         // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
254
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
         $post_tags = '';
257 257
         if (!isset($request_info['post_tags'])) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $payment_info = array();
276 276
         $package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+        $package_info = (array) geodir_post_package_info($package_info, $post);
279 279
 
280 280
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $tmpimgArr = trim($request_info['post_images'], ",");
475 475
                 $tmpimgArr = explode(",", $tmpimgArr);
476 476
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
477
+            } else {
478 478
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479 479
             }
480 480
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
             $post_meta_set_query = trim($post_meta_set_query, ", ");
660 660
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
661
+            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
662 662
 
663 663
             /**
664 664
              * Called before saving the listing info.
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 $file_path = '';
929 929
                 /* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
932 932
 
933 933
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
                         }
986 986
 
987 987
                         $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
988
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
989 989
                         } else {
990 990
                             $external_img = true;
991 991
                         }
992 992
 
993 993
                         if ($dummy || $external_img) {
994 994
                             $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
995
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
996 996
 
997 997
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 998
                                 $new_name = basename($uploaded['file']);
999 999
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1000
+                            } else {
1001
+                                print_r($uploaded); exit;
1002 1002
                             }
1003 1003
                             $external_img = false;
1004 1004
                         } else {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                                 $file_path = $sub_dir . '/' . $new_name;
1032 1032
                             }
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'] . $file_path);
1035 1035
 
1036 1036
                             if ($menu_order == 1) {
1037 1037
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
                 } else {
1070 1070
                     $valid_file_ids[] = $find_image;
1071 1071
 
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1073 1073
 
1074 1074
                     $wpdb->query(
1075 1075
                         $wpdb->prepare(
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
                 foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+                        $invalid_files[] = (object) array('src' => $img->src);
1109 1109
 
1110 1110
                     }
1111 1111
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
             }
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1116
+            $invalid_files = (object) $invalid_files;
1117 1117
         }
1118 1118
 
1119 1119
         $remove_files[] = $post_id;
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
         }
1249 1249
 
1250 1250
         if (!in_array($post_type, geodir_get_posttypes())) {
1251
-            return false;// if not a GD CPT return;
1251
+            return false; // if not a GD CPT return;
1252 1252
         }
1253 1253
 
1254 1254
         $table = $plugin_prefix . $post_type . '_detail';
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
              * @param string $uploads_url The server upload directory url.
1288 1288
              * @param string $uploads_baseurl The uploads dir base url.
1289 1289
              */
1290
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1290
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1291 1291
             $img_arr['path'] = $uploads_path . '/' . $file_name;
1292 1292
             @list($width, $height) = getimagesize($img_arr['path']);
1293 1293
             $img_arr['width'] = $width;
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
         }
1345 1345
 
1346 1346
         if (!empty($img_arr))
1347
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1347
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1348 1348
         else
1349 1349
             return false;
1350 1350
 
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
                 * @param string $uploads_url The server upload directory url.
1451 1451
                 * @param string $uploads_baseurl The uploads dir base url.
1452 1452
                 */
1453
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1453
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1454 1454
                 $img_arr['path'] = $uploads_path . '/' . $file_name;
1455 1455
                 @list($width, $height) = getimagesize($img_arr['path']);
1456 1456
                 $img_arr['width'] = $width;
@@ -1462,13 +1462,13 @@  discard block
 block discarded – undo
1462 1462
                 $img_arr['content'] = $attechment->content; // add the description to the array
1463 1463
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1464 1464
 
1465
-                $return_arr[] = (object)$img_arr;
1465
+                $return_arr[] = (object) $img_arr;
1466 1466
 
1467 1467
 
1468 1468
                 $counter++;
1469 1469
 
1470 1470
             }
1471
-            return (object)$return_arr;
1471
+            return (object) $return_arr;
1472 1472
         } else if ($no_images) {
1473 1473
             $default_img = '';
1474 1474
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
                 $img_arr['title'] = $file_name; // add the title to the array
1503 1503
                 $img_arr['content'] = $file_name; // add the description to the array
1504 1504
 
1505
-                $return_arr[] = (object)$img_arr;
1505
+                $return_arr[] = (object) $img_arr;
1506 1506
 
1507 1507
                 return $return_arr;
1508 1508
 
@@ -1535,21 +1535,21 @@  discard block
 block discarded – undo
1535 1535
         $html = '';
1536 1536
         if (!empty($request)) {
1537 1537
 
1538
-            if (!is_object($request)){
1539
-                $request = (object)$request;
1538
+            if (!is_object($request)) {
1539
+                $request = (object) $request;
1540 1540
             }
1541 1541
 
1542 1542
 
1543
-            if(isset($request->src) && !isset($request->path)){$request->path = $request->src;}
1543
+            if (isset($request->src) && !isset($request->path)) {$request->path = $request->src; }
1544 1544
 
1545 1545
             /*
1546 1546
              * getimagesize() works faster from path than url so we try and get path if we can.
1547 1547
              */
1548 1548
             $upload_dir = wp_upload_dir();
1549
-            $img_no_http = str_replace(array("http://","https://"),"",$request->path);
1550
-            $upload_no_http = str_replace(array("http://","https://"),"",$upload_dir['baseurl']);
1551
-            if (strpos($img_no_http ,$upload_no_http ) !== false) {
1552
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'],$request->path);
1549
+            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1550
+            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1551
+            if (strpos($img_no_http, $upload_no_http) !== false) {
1552
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1553 1553
             }
1554 1554
 
1555 1555
             @list($width, $height) = getimagesize($request->path);
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
             $image->width = $width;
1558 1558
             $image->height = $height;
1559 1559
 
1560
-            $max_size = (object)geodir_get_imagesize($size);
1560
+            $max_size = (object) geodir_get_imagesize($size);
1561 1561
 
1562 1562
             if (!is_wp_error($max_size)) {
1563 1563
 
@@ -1571,10 +1571,10 @@  discard block
 block discarded – undo
1571 1571
                         $width_per = 100;
1572 1572
                 }
1573 1573
 
1574
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1574
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1575 1575
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1576 1576
                 }
1577
-                else{
1577
+                else {
1578 1578
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1579 1579
                 }
1580 1580
 
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1904 1904
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1905 1905
                             <?php
1906
-                            }else{
1906
+                            } else {
1907 1907
                                 echo '<div class="geodir-bubble_image"></div>';
1908 1908
                             }
1909 1909
                         } else {
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
                                 ?>
1912 1912
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1913 1913
                             <?php
1914
-                            }else{
1914
+                            } else {
1915 1915
                                 echo '<div class="geodir-bubble_image"></div>';
1916 1916
                             }
1917 1917
                         }
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
                              * @param object $postinfo_obj The posts info as an object.
1946 1946
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1947 1947
                              */
1948
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1948
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
1949 1949
                             ?>
1950 1950
                         </div>
1951 1951
                         <?php
@@ -1957,10 +1957,10 @@  discard block
 block discarded – undo
1957 1957
                             <div class="geodir-bubble-meta-fade"></div>
1958 1958
 
1959 1959
                             <div class="geodir-bubble-meta-bottom">
1960
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
1960
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
1961 1961
 
1962 1962
                                 <span
1963
-                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
1963
+                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
1964 1964
                   <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"
1965 1965
                                                          class="geodir-pcomments"><i class="fa fa-comments"></i>
1966 1966
                           <?php echo get_comments_number($ID); ?>
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
          */
2256 2256
         do_action('geodir_before_add_from_favorite', $post_id);
2257 2257
 
2258
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2258
+        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="' . $favourite_icon . '"></i> ' . $unfavourite_text . '</a>';
2259 2259
 
2260 2260
         /**
2261 2261
          * Called after adding the post from favourites.
@@ -2335,7 +2335,7 @@  discard block
 block discarded – undo
2335 2335
          */
2336 2336
         do_action('geodir_before_remove_from_favorite', $post_id);
2337 2337
 
2338
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2338
+        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="' . $favourite_icon . '"></i> ' . $favourite_text . '</a>';
2339 2339
 
2340 2340
         /**
2341 2341
          * Called after removing the post from favourites.
@@ -2430,10 +2430,10 @@  discard block
 block discarded – undo
2430 2430
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2431 2431
 
2432 2432
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2433
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2433
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2434 2434
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2435
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2436
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2435
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2436
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2437 2437
             </a>   </span><?php
2438 2438
 
2439 2439
         } else {
@@ -2443,11 +2443,11 @@  discard block
 block discarded – undo
2443 2443
             } else
2444 2444
                 $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2445 2445
 
2446
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2446
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2447 2447
                                                                                         href="javascript:void(0);"
2448
-                                                                                        onclick="<?php echo $script_text;?>"
2449
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2450
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2448
+                                                                                        onclick="<?php echo $script_text; ?>"
2449
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2450
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2451 2451
         <?php }
2452 2452
     }
2453 2453
 }
@@ -3046,15 +3046,15 @@  discard block
 block discarded – undo
3046 3046
  * @since 1.4.9
3047 3047
  * @package GeoDirectory
3048 3048
  */
3049
-function geodir_fb_like_thumbnail(){
3049
+function geodir_fb_like_thumbnail() {
3050 3050
 
3051 3051
     // return if not a single post
3052
-    if(!is_single()){return;}
3052
+    if (!is_single()) {return; }
3053 3053
 
3054 3054
     global $post;
3055
-    if(isset($post->featured_image) && $post->featured_image){
3055
+    if (isset($post->featured_image) && $post->featured_image) {
3056 3056
         $upload_dir = wp_upload_dir();
3057
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3057
+        $thumb = $upload_dir['baseurl'] . $post->featured_image;
3058 3058
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3059 3059
 
3060 3060
     }
Please login to merge, or discard this patch.
Braces   +176 added lines, -125 removed lines patch added patch discarded remove patch
@@ -21,12 +21,13 @@  discard block
 block discarded – undo
21 21
 {
22 22
 
23 23
     $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
24
+    if (!empty($post_cat_ids)) {
25
+            $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+    }
26 27
 
27 28
     if (!isset($default_cat) || empty($default_cat)) {
28 29
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
+    } else{
30 31
         if(!is_int($default_cat)){
31 32
             $category = get_term_by('name', $default_cat, $taxonomy);
32 33
             if(isset($category->term_id)){
@@ -372,8 +373,9 @@  discard block
 block discarded – undo
372 373
             } elseif (trim($type) == 'file') {
373 374
                 if (isset($request_info[$name])) {
374 375
                     $request_files = array();
375
-                    if ($request_info[$name] != '')
376
-                        $request_files = explode(",", $request_info[$name]);
376
+                    if ($request_info[$name] != '') {
377
+                                            $request_files = explode(",", $request_info[$name]);
378
+                    }
377 379
 
378 380
                     $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
379 381
                     geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
@@ -428,15 +430,17 @@  discard block
 block discarded – undo
428 430
 
429 431
             foreach ($request_info['post_category'] as $taxonomy => $cat) {
430 432
 
431
-                if ($dummy)
432
-                    $post_category = $cat;
433
-                else {
433
+                if ($dummy) {
434
+                                    $post_category = $cat;
435
+                } else {
434 436
 
435
-                    if (!is_array($cat) && strstr($cat, ','))
436
-                        $cat = explode(',', $cat);
437
+                    if (!is_array($cat) && strstr($cat, ',')) {
438
+                                            $cat = explode(',', $cat);
439
+                    }
437 440
 
438
-                    if (!empty($cat) && is_array($cat))
439
-                        $post_category = array_map('intval', $cat);
441
+                    if (!empty($cat) && is_array($cat)) {
442
+                                            $post_category = array_map('intval', $cat);
443
+                    }
440 444
                 }
441 445
 
442 446
                 wp_set_object_terms($last_post_id, $post_category, $taxonomy);
@@ -454,11 +458,13 @@  discard block
 block discarded – undo
454 458
         if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
455 459
             $post_tags = explode(",", $request_info['post_tags']);
456 460
         } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
457
-            if ($dummy)
458
-                $post_tags = $request_info['post_tags'];
461
+            if ($dummy) {
462
+                            $post_tags = $request_info['post_tags'];
463
+            }
459 464
         } else {
460
-            if ($dummy)
461
-                $post_tags = array($request_info['post_title']);
465
+            if ($dummy) {
466
+                            $post_tags = array($request_info['post_title']);
467
+            }
462 468
         }
463 469
 
464 470
         if (is_array($post_tags)) {
@@ -545,15 +551,17 @@  discard block
 block discarded – undo
545 551
 
546 552
     global $wpdb, $plugin_prefix, $post, $post_info;
547 553
 
548
-    if ($post_id == '' && !empty($post))
549
-        $post_id = $post->ID;
554
+    if ($post_id == '' && !empty($post)) {
555
+            $post_id = $post->ID;
556
+    }
550 557
 
551 558
     $post_type = get_post_type($post_id);
552 559
 
553 560
     $all_postypes = geodir_get_posttypes();
554 561
 
555
-    if (!in_array($post_type, $all_postypes))
556
-        return false;
562
+    if (!in_array($post_type, $all_postypes)) {
563
+            return false;
564
+    }
557 565
 
558 566
     $table = $plugin_prefix . $post_type . '_detail';
559 567
 
@@ -703,8 +711,9 @@  discard block
 block discarded – undo
703 711
             do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
704 712
 
705 713
             return true;
706
-        } else
707
-            return false;
714
+        } else {
715
+                    return false;
716
+        }
708 717
 
709 718
     }
710 719
 }
@@ -758,8 +767,9 @@  discard block
 block discarded – undo
758 767
             }
759 768
 
760 769
 
761
-        } else
762
-            return false;
770
+        } else {
771
+                    return false;
772
+        }
763 773
     }
764 774
 }
765 775
 
@@ -790,8 +800,9 @@  discard block
 block discarded – undo
790 800
             $post_meta_set_query = '';
791 801
 
792 802
             foreach ($postmeta as $mkey) {
793
-                if ($mval != '')
794
-                    $post_meta_set_query .= $mkey . " = '', ";
803
+                if ($mval != '') {
804
+                                    $post_meta_set_query .= $mkey . " = '', ";
805
+                }
795 806
             }
796 807
 
797 808
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -821,8 +832,9 @@  discard block
 block discarded – undo
821 832
                 return true;
822 833
             }
823 834
 
824
-        } else
825
-            return false;
835
+        } else {
836
+                    return false;
837
+        }
826 838
     }
827 839
 }
828 840
 
@@ -852,8 +864,9 @@  discard block
 block discarded – undo
852 864
 
853 865
         $post_type = get_post_type($post_id);
854 866
 
855
-        if (!in_array($post_type, $all_postypes))
856
-            return false;
867
+        if (!in_array($post_type, $all_postypes)) {
868
+                    return false;
869
+        }
857 870
 
858 871
         $table = $plugin_prefix . $post_type . '_detail';
859 872
 
@@ -862,11 +875,13 @@  discard block
 block discarded – undo
862 875
             if ($meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)))) {
863 876
                 $meta_value = maybe_serialize($meta_value);
864 877
                 return $meta_value;
865
-            } else
866
-                return false;
878
+            } else {
879
+                            return false;
880
+            }
867 881
 
868
-        } else
869
-            return false;
882
+        } else {
883
+                    return false;
884
+        }
870 885
     }
871 886
 }
872 887
 
@@ -997,7 +1012,7 @@  discard block
 block discarded – undo
997 1012
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 1013
                                 $new_name = basename($uploaded['file']);
999 1014
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1015
+                            } else{
1001 1016
                                 print_r($uploaded);exit;
1002 1017
                             }
1003 1018
                             $external_img = false;
@@ -1022,8 +1037,9 @@  discard block
 block discarded – undo
1022 1037
                                 $file_path = $curr_img_dir . '/' . $filename;
1023 1038
                             }
1024 1039
 
1025
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1026
-                                unlink($img_path);
1040
+                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path)) {
1041
+                                                            unlink($img_path);
1042
+                            }
1027 1043
                         }
1028 1044
 
1029 1045
                         if (!empty($uploaded_file)) {
@@ -1052,8 +1068,9 @@  discard block
 block discarded – undo
1052 1068
                             $attachment_set = '';
1053 1069
 
1054 1070
                             foreach ($attachment as $key => $val) {
1055
-                                if ($val != '')
1056
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1071
+                                if ($val != '') {
1072
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1073
+                                }
1057 1074
                             }
1058 1075
 
1059 1076
                             $attachment_set = trim($attachment_set, ", ");
@@ -1078,8 +1095,9 @@  discard block
 block discarded – undo
1078 1095
                         )
1079 1096
                     );
1080 1097
 
1081
-                    if ($menu_order == 1)
1082
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1098
+                    if ($menu_order == 1) {
1099
+                                            $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1100
+                    }
1083 1101
 
1084 1102
                 }
1085 1103
 
@@ -1120,8 +1138,9 @@  discard block
 block discarded – undo
1120 1138
 
1121 1139
         $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1122 1140
 
1123
-        if (!empty($invalid_files))
1124
-            geodir_remove_attachments($invalid_files);
1141
+        if (!empty($invalid_files)) {
1142
+                    geodir_remove_attachments($invalid_files);
1143
+        }
1125 1144
     }
1126 1145
 
1127 1146
 }
@@ -1174,16 +1193,19 @@  discard block
 block discarded – undo
1174 1193
 function geodir_delete_directory($dirname)
1175 1194
 {
1176 1195
     $dir_handle = '';
1177
-    if (is_dir($dirname))
1178
-        $dir_handle = opendir($dirname);
1179
-    if (!$dir_handle)
1180
-        return false;
1196
+    if (is_dir($dirname)) {
1197
+            $dir_handle = opendir($dirname);
1198
+    }
1199
+    if (!$dir_handle) {
1200
+            return false;
1201
+    }
1181 1202
     while ($file = readdir($dir_handle)) {
1182 1203
         if ($file != "." && $file != "..") {
1183
-            if (!is_dir($dirname . "/" . $file))
1184
-                unlink($dirname . "/" . $file);
1185
-            else
1186
-                geodir_delete_directory($dirname . '/' . $file);
1204
+            if (!is_dir($dirname . "/" . $file)) {
1205
+                            unlink($dirname . "/" . $file);
1206
+            } else {
1207
+                            geodir_delete_directory($dirname . '/' . $file);
1208
+            }
1187 1209
         }
1188 1210
     }
1189 1211
     closedir($dir_handle);
@@ -1212,8 +1234,9 @@  discard block
 block discarded – undo
1212 1234
             foreach ($postcurr_images as $postimg) {
1213 1235
                 $image_name_arr = explode('/', $postimg->src);
1214 1236
                 $filename = end($image_name_arr);
1215
-                if (file_exists($uploads_dir . '/' . $filename))
1216
-                    unlink($uploads_dir . '/' . $filename);
1237
+                if (file_exists($uploads_dir . '/' . $filename)) {
1238
+                                    unlink($uploads_dir . '/' . $filename);
1239
+                }
1217 1240
             }
1218 1241
 
1219 1242
         } // endif
@@ -1267,8 +1290,9 @@  discard block
 block discarded – undo
1267 1290
 
1268 1291
             $file_info = pathinfo($file);
1269 1292
             $sub_dir = '';
1270
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1271
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1293
+            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1294
+                            $sub_dir = stripslashes_deep($file_info['dirname']);
1295
+            }
1272 1296
 
1273 1297
             $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1274 1298
             $uploads_baseurl = $uploads['baseurl'];
@@ -1312,9 +1336,9 @@  discard block
 block discarded – undo
1312 1336
                 $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1313 1337
             }
1314 1338
 
1315
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1316
-                $default_img = $default_catimg['src'];
1317
-            elseif ($no_image) {
1339
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1340
+                            $default_img = $default_catimg['src'];
1341
+            } elseif ($no_image) {
1318 1342
                 $default_img = get_option('geodir_listing_no_img');
1319 1343
             }
1320 1344
 
@@ -1343,10 +1367,13 @@  discard block
 block discarded – undo
1343 1367
 
1344 1368
         }
1345 1369
 
1346
-        if (!empty($img_arr))
1347
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1348
-        else
1349
-            return false;
1370
+        if (!empty($img_arr)) {
1371
+                    return (object)$img_arr;
1372
+        }
1373
+        //return (object)array( 'src' => $file_url, 'path' => $file_path );
1374
+        else {
1375
+                    return false;
1376
+        }
1350 1377
 
1351 1378
     }
1352 1379
 }
@@ -1376,8 +1403,9 @@  discard block
 block discarded – undo
1376 1403
             echo $html;
1377 1404
         } elseif (!empty($html)) {
1378 1405
             return $html;
1379
-        } else
1380
-            return false;
1406
+        } else {
1407
+                    return false;
1408
+        }
1381 1409
 
1382 1410
     }
1383 1411
 }
@@ -1407,8 +1435,9 @@  discard block
 block discarded – undo
1407 1435
         }
1408 1436
         $not_featured = '';
1409 1437
         $sub_dir = '';
1410
-        if (!$add_featured)
1411
-            $not_featured = " AND is_featured = 0 ";
1438
+        if (!$add_featured) {
1439
+                    $not_featured = " AND is_featured = 0 ";
1440
+        }
1412 1441
 
1413 1442
         $arrImages = $wpdb->get_results(
1414 1443
             $wpdb->prepare(
@@ -1430,8 +1459,9 @@  discard block
 block discarded – undo
1430 1459
 
1431 1460
                 $file_info = pathinfo($attechment->file);
1432 1461
 
1433
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1434
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1462
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1463
+                                    $sub_dir = stripslashes_deep($file_info['dirname']);
1464
+                }
1435 1465
 
1436 1466
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1437 1467
                 $uploads_baseurl = $uploads['baseurl'];
@@ -1473,9 +1503,9 @@  discard block
 block discarded – undo
1473 1503
             $default_img = '';
1474 1504
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1475 1505
             $post_type = get_post_type($post_id);
1476
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1477
-                $default_img = $default_catimg['src'];
1478
-            elseif ($no_images) {
1506
+            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type)) {
1507
+                            $default_img = $default_catimg['src'];
1508
+            } elseif ($no_images) {
1479 1509
                 $default_img = get_option('geodir_listing_no_img');
1480 1510
             }
1481 1511
 
@@ -1506,8 +1536,9 @@  discard block
 block discarded – undo
1506 1536
 
1507 1537
                 return $return_arr;
1508 1538
 
1509
-            } else
1510
-                return false;
1539
+            } else {
1540
+                            return false;
1541
+            }
1511 1542
 
1512 1543
         }
1513 1544
 
@@ -1567,14 +1598,14 @@  discard block
 block discarded – undo
1567 1598
                         $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1568 1599
                     } elseif ($image->width < ($max_size->h)) {
1569 1600
                         $width_per = round((($image->width / $max_size->w) * 100), 2);
1570
-                    } else
1571
-                        $width_per = 100;
1601
+                    } else {
1602
+                                            $width_per = 100;
1603
+                    }
1572 1604
                 }
1573 1605
 
1574 1606
                 if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1575 1607
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1576
-                }
1577
-                else{
1608
+                } else{
1578 1609
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1579 1610
                 }
1580 1611
 
@@ -1586,8 +1617,9 @@  discard block
 block discarded – undo
1586 1617
             echo $html;
1587 1618
         } elseif (!empty($html)) {
1588 1619
             return $html;
1589
-        } else
1590
-            return false;
1620
+        } else {
1621
+                    return false;
1622
+        }
1591 1623
 
1592 1624
     }
1593 1625
 }
@@ -1626,8 +1658,9 @@  discard block
 block discarded – undo
1626 1658
                 $post_obj = get_post($post_id);
1627 1659
 
1628 1660
                 $cat_ids = array('0');
1629
-                if (is_array($tt_ids))
1630
-                    $cat_ids = $tt_ids;
1661
+                if (is_array($tt_ids)) {
1662
+                                    $cat_ids = $tt_ids;
1663
+                }
1631 1664
 
1632 1665
 
1633 1666
                 if (!empty($cat_ids)) {
@@ -1684,8 +1717,9 @@  discard block
 block discarded – undo
1684 1717
                         $json .= '}';
1685 1718
 
1686 1719
 
1687
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1688
-                            $post_marker_json = $json;
1720
+                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true)) {
1721
+                                                    $post_marker_json = $json;
1722
+                        }
1689 1723
 
1690 1724
 
1691 1725
                         if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
@@ -1716,10 +1750,13 @@  discard block
 block discarded – undo
1716 1750
                 if (!empty($post_term) && is_array($post_term)) {
1717 1751
                     $categories = implode(',', $post_term);
1718 1752
 
1719
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1753
+                    if ($categories != '' && $categories != 0) {
1754
+                        $categories = ',' . $categories . ',';
1755
+                    }
1720 1756
 
1721
-                    if (empty($post_marker_json))
1722
-                        $post_marker_json = isset($json) ? $json : '';
1757
+                    if (empty($post_marker_json)) {
1758
+                                            $post_marker_json = isset($json) ? $json : '';
1759
+                    }
1723 1760
 
1724 1761
                     if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1725 1762
 
@@ -1758,8 +1795,9 @@  discard block
 block discarded – undo
1758 1795
 
1759 1796
                                 }
1760 1797
 
1761
-                                if ($default_category == '')
1762
-                                    $default_category = $categories[0];
1798
+                                if ($default_category == '') {
1799
+                                                                    $default_category = $categories[0];
1800
+                                }
1763 1801
 
1764 1802
                                 geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1765 1803
 
@@ -1903,7 +1941,7 @@  discard block
 block discarded – undo
1903 1941
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1904 1942
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1905 1943
                             <?php
1906
-                            }else{
1944
+                            } else{
1907 1945
                                 echo '<div class="geodir-bubble_image"></div>';
1908 1946
                             }
1909 1947
                         } else {
@@ -1911,7 +1949,7 @@  discard block
 block discarded – undo
1911 1949
                                 ?>
1912 1950
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1913 1951
                             <?php
1914
-                            }else{
1952
+                            } else{
1915 1953
                                 echo '<div class="geodir-bubble_image"></div>';
1916 1954
                             }
1917 1955
                         }
@@ -2002,10 +2040,11 @@  discard block
 block discarded – undo
2002 2040
      */
2003 2041
     function geodir_new_post_default_status()
2004 2042
     {
2005
-        if (get_option('geodir_new_post_default_status'))
2006
-            return get_option('geodir_new_post_default_status');
2007
-        else
2008
-            return 'publish';
2043
+        if (get_option('geodir_new_post_default_status')) {
2044
+                    return get_option('geodir_new_post_default_status');
2045
+        } else {
2046
+                    return 'publish';
2047
+        }
2009 2048
 
2010 2049
     }
2011 2050
 }
@@ -2156,8 +2195,9 @@  discard block
 block discarded – undo
2156 2195
 
2157 2196
         $all_postypes = geodir_get_posttypes();
2158 2197
 
2159
-        if (!in_array($post_type, $all_postypes))
2160
-            return false;
2198
+        if (!in_array($post_type, $all_postypes)) {
2199
+                    return false;
2200
+        }
2161 2201
 
2162 2202
         $table = $plugin_prefix . $post_type . '_detail';
2163 2203
 
@@ -2426,8 +2466,9 @@  discard block
 block discarded – undo
2426 2466
         $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2427 2467
 
2428 2468
         $user_meta_data = '';
2429
-        if (isset($current_user->data->ID))
2430
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2469
+        if (isset($current_user->data->ID)) {
2470
+                    $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2471
+        }
2431 2472
 
2432 2473
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2433 2474
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
@@ -2440,8 +2481,9 @@  discard block
 block discarded – undo
2440 2481
 
2441 2482
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2442 2483
                 $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2443
-            } else
2444
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2484
+            } else {
2485
+                            $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2486
+            }
2445 2487
 
2446 2488
             ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2447 2489
                                                                                         href="javascript:void(0);"
@@ -2504,14 +2546,16 @@  discard block
 block discarded – undo
2504 2546
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2505 2547
 
2506 2548
             $cat_post_count = $wpdb->get_var($count_query);
2507
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2508
-                $cat_post_count = 0;
2549
+            if (empty($cat_post_count) || is_wp_error($cat_post_count)) {
2550
+                            $cat_post_count = 0;
2551
+            }
2509 2552
 
2510 2553
             return $cat_post_count;
2511 2554
 
2512
-        } else
2513
-
2514
-            return $term->count;
2555
+        } else {
2556
+        
2557
+            return $term->count;
2558
+        }
2515 2559
     }
2516 2560
     return false;
2517 2561
 
@@ -2558,13 +2602,15 @@  discard block
 block discarded – undo
2558 2602
 		return $length;
2559 2603
 	}
2560 2604
 	
2561
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2562
-        $length = get_option('geodir_desc_word_limit');
2563
-    elseif (get_query_var('excerpt_length'))
2564
-        $length = get_query_var('excerpt_length');
2605
+    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit')) {
2606
+            $length = get_option('geodir_desc_word_limit');
2607
+    } elseif (get_query_var('excerpt_length')) {
2608
+            $length = get_query_var('excerpt_length');
2609
+    }
2565 2610
 
2566
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2567
-        $length = get_option('geodir_author_desc_word_limit');
2611
+    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit')) {
2612
+            $length = get_option('geodir_author_desc_word_limit');
2613
+    }
2568 2614
 
2569 2615
     return $length;
2570 2616
 }
@@ -2697,10 +2743,11 @@  discard block
 block discarded – undo
2697 2743
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2698 2744
 {
2699 2745
     $listing_author_id = geodir_get_listing_author($listing_id);
2700
-    if ($listing_author_id == $user_id)
2701
-        return true;
2702
-    else
2703
-        return false;
2746
+    if ($listing_author_id == $user_id) {
2747
+            return true;
2748
+    } else {
2749
+            return false;
2750
+    }
2704 2751
 
2705 2752
 }
2706 2753
 
@@ -2749,10 +2796,11 @@  discard block
 block discarded – undo
2749 2796
     $pattern = '/-\d+x\d+\./';
2750 2797
     preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2751 2798
 
2752
-    if (empty($matches))
2753
-        return '';
2754
-    else
2755
-        return $file;
2799
+    if (empty($matches)) {
2800
+            return '';
2801
+    } else {
2802
+            return $file;
2803
+    }
2756 2804
 
2757 2805
 }
2758 2806
 
@@ -2837,8 +2885,9 @@  discard block
 block discarded – undo
2837 2885
     } else {
2838 2886
         //set_post_thumbnail($post_id,-1);
2839 2887
 
2840
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2841
-            wp_delete_attachment($post_thumbnail_id);
2888
+        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2889
+                    wp_delete_attachment($post_thumbnail_id);
2890
+        }
2842 2891
 
2843 2892
     }
2844 2893
 }
@@ -2923,8 +2972,9 @@  discard block
 block discarded – undo
2923 2972
 
2924 2973
     global $wpdb;
2925 2974
 
2926
-    if ($listing_type == '')
2927
-        $listing_type = 'gd_place';
2975
+    if ($listing_type == '') {
2976
+            $listing_type = 'gd_place';
2977
+    }
2928 2978
 
2929 2979
     $fields_info = array();
2930 2980
 
@@ -2947,8 +2997,9 @@  discard block
 block discarded – undo
2947 2997
 
2948 2998
                 $fields_info[$prefix . 'address'] = $data->field_type;
2949 2999
 
2950
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
2951
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
3000
+                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
3001
+                                    $fields_info[$prefix . 'zip'] = $data->field_type;
3002
+                }
2952 3003
 
2953 3004
             } else {
2954 3005
 
Please login to merge, or discard this patch.
geodirectory-functions/shortcode_functions.php 3 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,6 @@  discard block
 block discarded – undo
46 46
  * @since 1.0.0
47 47
  * @since 1.5.2 Added TERRAIN map type.
48 48
  *
49
- * @param string $value Input value to validate measurement.
50 49
  * @return string The measurement valud in valid format.
51 50
  */
52 51
 function gdsc_validate_map_args($params)
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
  * @param mixed $in The variable to check
96 95
  * @param bool $strict If set to false, consider everything that is not false to be true.
97 96
  *
98
- * @return bool The boolean equivalent or null
97
+ * @return null|boolean The boolean equivalent or null
99 98
  */
100 99
 function gdsc_to_bool_val($in, $strict = false)
101 100
 {
Please login to merge, or discard this patch.
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * All shortcode related functions
4
- *
5
- * @since 1.0.0
6
- *
7
- * @package GeoDirectory
8
- */
3
+     * All shortcode related functions
4
+     *
5
+     * @since 1.0.0
6
+     *
7
+     * @package GeoDirectory
8
+     */
9 9
  
10 10
 // If this file is called directly, abort.
11 11
 if (!defined('WPINC')) {
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 // @todo: Extract this
285 285
 // This is wrong, it should be in JS and CSS files.
286 286
 if (!(function_exists('geodir_home_map_add_script'))) {
287
-	/**
288
-	 * Adds the script in the page footer for the home page google map.
289
-	 *
290
-	 * @since 1.0.0
287
+    /**
288
+     * Adds the script in the page footer for the home page google map.
289
+     *
290
+     * @since 1.0.0
291 291
      * @return string Print the script in page footer.
292
-	 */
293
-	function geodir_home_map_add_script()
292
+     */
293
+    function geodir_home_map_add_script()
294 294
     {
295 295
         ?>
296 296
         <script type="text/javascript">
@@ -554,32 +554,32 @@  discard block
 block discarded – undo
554 554
  */
555 555
 function geodir_sc_gd_listings_output($args = array()) {
556 556
     $title				 = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';
557
-	$post_type 			 = !empty($args['post_type']) ? $args['post_type'] : 'gd_place';
558
-	$category 			 = !empty($args['category']) ? $args['category'] : '0';
559
-	$post_number		 = !empty($args['post_number']) ? $args['post_number'] : 10;
560
-	$add_location_filter = !empty($args['add_location_filter']) ? true : false;
561
-	$list_sort 			 = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';
562
-	$character_count	 = isset($args['character_count']) ? $args['character_count'] : '';
563
-	$layout 			 = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
564
-	$with_pagination 	 = !empty($args['with_pagination']) ? true : false;
565
-	$event_type 	 	 = !empty($args['event_type']) ? $args['event_type'] : '';
557
+    $post_type 			 = !empty($args['post_type']) ? $args['post_type'] : 'gd_place';
558
+    $category 			 = !empty($args['category']) ? $args['category'] : '0';
559
+    $post_number		 = !empty($args['post_number']) ? $args['post_number'] : 10;
560
+    $add_location_filter = !empty($args['add_location_filter']) ? true : false;
561
+    $list_sort 			 = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';
562
+    $character_count	 = isset($args['character_count']) ? $args['character_count'] : '';
563
+    $layout 			 = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
564
+    $with_pagination 	 = !empty($args['with_pagination']) ? true : false;
565
+    $event_type 	 	 = !empty($args['event_type']) ? $args['event_type'] : '';
566 566
 		
567
-	$top_pagination 	 = $with_pagination && !empty($args['top_pagination']) ? true : false;
568
-	$bottom_pagination 	 = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
567
+    $top_pagination 	 = $with_pagination && !empty($args['top_pagination']) ? true : false;
568
+    $bottom_pagination 	 = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
569 569
 	
570
-	$shortcode_atts		 = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();
570
+    $shortcode_atts		 = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();
571 571
 
572
-	// ajax mode
573
-	$geodir_ajax		 = !empty($args['geodir_ajax']) ? true : false;
574
-	$pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
572
+    // ajax mode
573
+    $geodir_ajax		 = !empty($args['geodir_ajax']) ? true : false;
574
+    $pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
575 575
 	
576
-	$query_args = array(
576
+    $query_args = array(
577 577
         'posts_per_page' => $post_number,
578 578
         'is_geodir_loop' => true,
579 579
         'gd_location' => $add_location_filter,
580 580
         'post_type' => $post_type,
581 581
         'order_by' => $list_sort,
582
-		'pageno' => $pageno
582
+        'pageno' => $pageno
583 583
     );
584 584
 
585 585
     if ($character_count >= 0) {
@@ -625,32 +625,32 @@  discard block
 block discarded – undo
625 625
     global $gridview_columns_widget, $geodir_is_widget_listing;
626 626
 
627 627
     if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
628
-		global $geodir_event_widget_listview;
629
-		$geodir_event_widget_listview = true;
628
+        global $geodir_event_widget_listview;
629
+        $geodir_event_widget_listview = true;
630 630
 		
631
-		if ($event_type && in_array($event_type, array('past', 'today', 'upcoming'))) {
632
-			$query_args['geodir_event_type'] = $event_type;
633
-		}
631
+        if ($event_type && in_array($event_type, array('past', 'today', 'upcoming'))) {
632
+            $query_args['geodir_event_type'] = $event_type;
633
+        }
634 634
 				
635
-		$total_posts = geodir_event_get_widget_events($query_args, true);
636
-		$widget_listings = $total_posts > 0 ? geodir_event_get_widget_events($query_args) : array();
635
+        $total_posts = geodir_event_get_widget_events($query_args, true);
636
+        $widget_listings = $total_posts > 0 ? geodir_event_get_widget_events($query_args) : array();
637 637
 		
638
-	} else {
639
-		$total_posts = geodir_get_widget_listings($query_args, true);
640
-		$widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();
641
-	}
642
-	$current_gridview_columns_widget = $gridview_columns_widget;
638
+    } else {
639
+        $total_posts = geodir_get_widget_listings($query_args, true);
640
+        $widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();
641
+    }
642
+    $current_gridview_columns_widget = $gridview_columns_widget;
643 643
 
644 644
     ob_start();
645
-	if (!empty($widget_listings) || $with_no_results) {
646
-		if (!$geodir_ajax) {
645
+    if (!empty($widget_listings) || $with_no_results) {
646
+        if (!$geodir_ajax) {
647 647
         /**
648 648
          * Called before the shortcode [gd_listings] content is output.
649 649
          *
650 650
          * @since 1.0.0
651 651
          */
652 652
         do_action('geodir_before_sc_gd_listings');
653
-		?>
653
+        ?>
654 654
         <div class="geodir_locations geodir_location_listing geodir-sc-gd-listings">
655 655
 		<?php } ?>
656 656
             <?php if ($title != '') { ?>
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
             }
669 669
 
670 670
             /**
671
-			 * Filter the widget listing listview template.
672
-			 *
673
-			 * @since 1.0.0
674
-			 *
675
-			 * @param string The template file to display listing.
676
-			 */
677
-			$template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
671
+             * Filter the widget listing listview template.
672
+             *
673
+             * @since 1.0.0
674
+             *
675
+             * @param string The template file to display listing.
676
+             */
677
+            $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
678 678
             			
679 679
             global $post, $map_jason, $map_canvas_arr, $gd_session;
680 680
 
@@ -682,38 +682,38 @@  discard block
 block discarded – undo
682 682
             $current_map_jason = $map_jason;
683 683
             $current_map_canvas_arr = $map_canvas_arr;
684 684
             $geodir_is_widget_listing = true;
685
-			$gd_session->un_set('gd_listing_view');
685
+            $gd_session->un_set('gd_listing_view');
686 686
 
687 687
             if ($with_pagination && $top_pagination) {				
688
-				echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
689
-			}
688
+                echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
689
+            }
690 690
 
691 691
             /**
692 692
              * Includes listing listview template.
693 693
              *
694 694
              * @since 1.0.0
695 695
              */
696
-			include($template);
696
+            include($template);
697 697
 			
698
-			if ($with_pagination && $bottom_pagination) {				
699
-				echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
700
-			}
698
+            if ($with_pagination && $bottom_pagination) {				
699
+                echo geodir_sc_listings_pagination($total_posts, $post_number, $pageno);
700
+            }
701 701
 
702 702
             $geodir_is_widget_listing = false;
703 703
 
704 704
             $GLOBALS['post'] = $current_post;
705
-			if (!empty($current_post)) {
706
-            	setup_postdata($current_post);
707
-			}
705
+            if (!empty($current_post)) {
706
+                setup_postdata($current_post);
707
+            }
708 708
             $map_jason = $current_map_jason;
709 709
             $map_canvas_arr = $current_map_canvas_arr;
710
-			global $gridview_columns_widget;
711
-			$gridview_columns_widget = $current_gridview_columns_widget;
712
-			?>
710
+            global $gridview_columns_widget;
711
+            $gridview_columns_widget = $current_gridview_columns_widget;
712
+            ?>
713 713
 			<p class="geodir-sclisting-loading" style="display:none;"><i class="fa fa-cog fa-spin"></i></p>
714 714
 			<?php
715 715
             if (!$geodir_ajax) { 
716
-			?>
716
+            ?>
717 717
         </div>
718 718
 		<script type="text/javascript">
719 719
 		  function gd_sc_gopage(obj, pid) {
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		<?php } ?>
751 751
     <?php
752 752
     }
753
-	$output = ob_get_contents();
753
+    $output = ob_get_contents();
754 754
     ob_end_clean();
755 755
 
756 756
     return trim($output);
@@ -790,60 +790,60 @@  discard block
 block discarded – undo
790 790
 
791 791
     $half_pages_to_show = round($pages_to_show / 2);
792 792
 
793
-	$numposts = $total_posts;
793
+    $numposts = $total_posts;
794 794
 
795
-	$max_page = ceil($numposts / $posts_per_page);
795
+    $max_page = ceil($numposts / $posts_per_page);
796 796
 
797
-	if (empty($pageno)) {
798
-		$pageno = 1;
799
-	}
797
+    if (empty($pageno)) {
798
+        $pageno = 1;
799
+    }
800 800
 
801
-	ob_start();
802
-	if ($max_page > 1 || $always_show) {
803
-		// Extra pagination info
804
-		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
805
-		$start_no = ( $pageno - 1 ) * $posts_per_page + 1;
806
-		$end_no = min($pageno * $posts_per_page, $numposts);
801
+    ob_start();
802
+    if ($max_page > 1 || $always_show) {
803
+        // Extra pagination info
804
+        $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
805
+        $start_no = ( $pageno - 1 ) * $posts_per_page + 1;
806
+        $end_no = min($pageno * $posts_per_page, $numposts);
807 807
 		
808
-		if ($geodir_pagination_more_info != '') {
809
-			$pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
808
+        if ($geodir_pagination_more_info != '') {
809
+            $pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
810 810
 			
811
-			if ($geodir_pagination_more_info == 'before') {
812
-				$before = $before . $pagination_info;
813
-			} else if ($geodir_pagination_more_info == 'after') {
814
-				$after = $pagination_info . $after;
815
-			}
816
-		}
811
+            if ($geodir_pagination_more_info == 'before') {
812
+                $before = $before . $pagination_info;
813
+            } else if ($geodir_pagination_more_info == 'after') {
814
+                $after = $pagination_info . $after;
815
+            }
816
+        }
817 817
 			
818
-		echo "$before <div class='Navi geodir-ajax-pagination'>";		
819
-		if ($pageno > 1) {
820
-			echo '<a class="gd-page-sc-fst" href="javascript:void(0);" onclick="gd_sc_gopage(this, 1);">&laquo;</a>&nbsp;';
821
-		}
818
+        echo "$before <div class='Navi geodir-ajax-pagination'>";		
819
+        if ($pageno > 1) {
820
+            echo '<a class="gd-page-sc-fst" href="javascript:void(0);" onclick="gd_sc_gopage(this, 1);">&laquo;</a>&nbsp;';
821
+        }
822 822
 		
823
-		if (($pageno - 1) > 0) {
824
-			echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a>&nbsp;';
825
-		}
823
+        if (($pageno - 1) > 0) {
824
+            echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a>&nbsp;';
825
+        }
826 826
 		
827
-		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
828
-			if ($i >= 1 && $i <= $max_page) {
829
-				if ($i == $pageno) {
830
-					echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";
831
-				} else {
832
-					echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$i . ');">' . $i . '</a> ';
833
-				}
834
-			}
835
-		}
827
+        for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
828
+            if ($i >= 1 && $i <= $max_page) {
829
+                if ($i == $pageno) {
830
+                    echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";
831
+                } else {
832
+                    echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$i . ');">' . $i . '</a> ';
833
+                }
834
+            }
835
+        }
836 836
 		
837
-		if (($pageno + 1) <= $max_page) {
838
-			echo '&nbsp;<a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>';
839
-		}
837
+        if (($pageno + 1) <= $max_page) {
838
+            echo '&nbsp;<a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>';
839
+        }
840 840
 		
841
-		if ($pageno < $max_page) {
842
-			echo '&nbsp;<a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$max_page . ');">&raquo;</a>';
843
-		}
844
-		echo "</div> $after";
845
-	}
846
-	$output = ob_get_contents();
841
+        if ($pageno < $max_page) {
842
+            echo '&nbsp;<a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$max_page . ');">&raquo;</a>';
843
+        }
844
+        echo "</div> $after";
845
+    }
846
+    $output = ob_get_contents();
847 847
     ob_end_clean();
848 848
 
849 849
     return trim($output);
@@ -862,16 +862,16 @@  discard block
 block discarded – undo
862 862
     $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
863 863
     $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
864 864
 	
865
-	$shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
865
+    $shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
866 866
 	
867
-	if (!empty($shortcode_atts) && is_array($shortcode_atts)) {
868
-		$shortcode_atts['pageno'] = $pageno;
869
-		$shortcode_atts['geodir_ajax'] = true;
867
+    if (!empty($shortcode_atts) && is_array($shortcode_atts)) {
868
+        $shortcode_atts['pageno'] = $pageno;
869
+        $shortcode_atts['geodir_ajax'] = true;
870 870
 		
871
-		echo geodir_sc_gd_listings($shortcode_atts);
872
-	} else {
873
-		echo 0;
874
-	}
871
+        echo geodir_sc_gd_listings($shortcode_atts);
872
+    } else {
873
+        echo 0;
874
+    }
875 875
     wp_die();
876 876
 }
877 877
 add_action('wp_ajax_geodir_sclistings', 'geodir_sclistings_callback');
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
 	$post_number		 = !empty($args['post_number']) ? $args['post_number'] : 10;
560 560
 	$add_location_filter = !empty($args['add_location_filter']) ? true : false;
561 561
 	$list_sort 			 = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';
562
-	$character_count	 = isset($args['character_count']) ? $args['character_count'] : '';
563
-	$layout 			 = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
564
-	$with_pagination 	 = !empty($args['with_pagination']) ? true : false;
565
-	$event_type 	 	 = !empty($args['event_type']) ? $args['event_type'] : '';
562
+	$character_count = isset($args['character_count']) ? $args['character_count'] : '';
563
+	$layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
564
+	$with_pagination = !empty($args['with_pagination']) ? true : false;
565
+	$event_type = !empty($args['event_type']) ? $args['event_type'] : '';
566 566
 		
567 567
 	$top_pagination 	 = $with_pagination && !empty($args['top_pagination']) ? true : false;
568
-	$bottom_pagination 	 = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
568
+	$bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
569 569
 	
570 570
 	$shortcode_atts		 = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();
571 571
 
572 572
 	// ajax mode
573
-	$geodir_ajax		 = !empty($args['geodir_ajax']) ? true : false;
574
-	$pageno 	 		 = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
573
+	$geodir_ajax = !empty($args['geodir_ajax']) ? true : false;
574
+	$pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
575 575
 	
576 576
 	$query_args = array(
577 577
         'posts_per_page' => $post_number,
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			if(!pid > 0 || !(container && typeof container != 'undefined')) {
723 723
 			  return false;
724 724
 			}
725
-			var scatts = "<?php echo addslashes(json_encode($shortcode_atts));?>";
725
+			var scatts = "<?php echo addslashes(json_encode($shortcode_atts)); ?>";
726 726
 			
727 727
 			var data = {
728 728
 			  'action': 'geodir_sclistings',
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	if ($max_page > 1 || $always_show) {
803 803
 		// Extra pagination info
804 804
 		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
805
-		$start_no = ( $pageno - 1 ) * $posts_per_page + 1;
805
+		$start_no = ($pageno - 1) * $posts_per_page + 1;
806 806
 		$end_no = min($pageno * $posts_per_page, $numposts);
807 807
 		
808 808
 		if ($geodir_pagination_more_info != '') {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		}
822 822
 		
823 823
 		if (($pageno - 1) > 0) {
824
-			echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a>&nbsp;';
824
+			echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno - 1) . ');">' . $prelabel . '</a>&nbsp;';
825 825
 		}
826 826
 		
827 827
 		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
@@ -829,17 +829,17 @@  discard block
 block discarded – undo
829 829
 				if ($i == $pageno) {
830 830
 					echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";
831 831
 				} else {
832
-					echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$i . ');">' . $i . '</a> ';
832
+					echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $i . ');">' . $i . '</a> ';
833 833
 				}
834 834
 			}
835 835
 		}
836 836
 		
837 837
 		if (($pageno + 1) <= $max_page) {
838
-			echo '&nbsp;<a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>';
838
+			echo '&nbsp;<a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) ($pageno + 1) . ');">' . $nxtlabel . '</a>';
839 839
 		}
840 840
 		
841 841
 		if ($pageno < $max_page) {
842
-			echo '&nbsp;<a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int)$max_page . ');">&raquo;</a>';
842
+			echo '&nbsp;<a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_sc_gopage(this, ' . (int) $max_page . ');">&raquo;</a>';
843 843
 		}
844 844
 		echo "</div> $after";
845 845
 	}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
     $scatts = isset($_POST['scatts']) ? $_POST['scatts'] : NULL;
863 863
     $pageno = isset($_POST['pageno']) ? absint($_POST['pageno']) : 1;
864 864
 	
865
-	$shortcode_atts = !empty($scatts) ? (array)json_decode(stripslashes_deep($scatts)) : NULL;
865
+	$shortcode_atts = !empty($scatts) ? (array) json_decode(stripslashes_deep($scatts)) : NULL;
866 866
 	
867 867
 	if (!empty($shortcode_atts) && is_array($shortcode_atts)) {
868 868
 		$shortcode_atts['pageno'] = $pageno;
Please login to merge, or discard this patch.
geodirectory-functions/signup_function.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @package GeoDirectory
14 14
  * @global object $current_user Current user object.
15 15
  * @param bool $redirect Optional. Do you want to redirect to signup page, if user not logged in? Default: false.
16
- * @return bool
16
+ * @return null|boolean
17 17
  */
18 18
 function geodir_is_login($redirect = false)
19 19
 {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @since 1.0.0
71 71
  * @package GeoDirectory
72
- * @return string|mixed|void The email ID.
72
+ * @return string The email ID.
73 73
  */
74 74
 function geodir_get_site_email_id()
75 75
 {
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Account Signup functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Account Signup functions.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Check whether the user is logged in or not.
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         if ($redirect) {
23 23
             ?>
24 24
             <script type="text/javascript">
25
-                window.location.href = '<?php echo geodir_login_url();?>';
25
+                window.location.href = '<?php echo geodir_login_url(); ?>';
26 26
             </script>
27 27
         <?php
28 28
         } else
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     $message = apply_filters('password_reset_message', $message, $new_pass);
238 238
     //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
239
+    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email
240 240
 
241 241
     return true;
242 242
 }
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
         /////////////customer email//////////////
398 398
         //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
399
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
399
+        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email
400 400
         //////REGISTRATION EMAIL END////////
401 401
     }
402 402
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 exit();
508 508
             }
509 509
 
510
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
510
+            wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
511 511
             exit();
512 512
 
513 513
             break;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                 if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
726 726
                     wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
727 727
                 } else {
728
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
728
+                    wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
729 729
                 }
730 730
                 exit;
731 731
             }
Please login to merge, or discard this patch.
Braces   +74 added lines, -48 removed lines patch added patch discarded remove patch
@@ -25,11 +25,13 @@  discard block
 block discarded – undo
25 25
                 window.location.href = '<?php echo geodir_login_url();?>';
26 26
             </script>
27 27
         <?php
28
-        } else
29
-            return false;
30
-    } else
31
-        return true;
32
-}
28
+        } else {
29
+                    return false;
30
+        }
31
+    } else {
32
+            return true;
33
+    }
34
+    }
33 35
 
34 36
 /**
35 37
  * Redirect to SSL url, if SSL is being used.
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
      * @param string $message Login message.
61 63
      */
62 64
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
65
+    if (!empty($message)) {
66
+        echo $message . "\n";
67
+    }
64 68
 
65 69
 }
66 70
 
@@ -141,14 +145,16 @@  discard block
 block discarded – undo
141 145
     global $wpdb;
142 146
 
143 147
     $errors = new WP_Error();
144
-    if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
-        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
148
+    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
149
+            $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
150
+    }
146 151
 
147 152
     if (strpos($_POST['user_login'], '@')) {
148 153
         //$user_data = get_user_by_email(trim($_POST['user_login']));
149 154
         $user_data = get_user_by('email', trim($_POST['user_login']));
150
-        if (empty($user_data))
151
-            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
155
+        if (empty($user_data)) {
156
+                    $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
157
+        }
152 158
     } else {
153 159
         $login = trim($_POST['user_login']);
154 160
         $user_data = get_user_by('email', $login);
@@ -161,8 +167,9 @@  discard block
 block discarded – undo
161 167
      */
162 168
     do_action('lostpassword_post');
163 169
 
164
-    if ($errors->get_error_code())
165
-        return $errors;
170
+    if ($errors->get_error_code()) {
171
+            return $errors;
172
+    }
166 173
 
167 174
     if (!$user_data) {
168 175
         $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
@@ -192,8 +199,9 @@  discard block
 block discarded – undo
192 199
         )
193 200
     );
194 201
 
195
-    if (empty($user))
196
-        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
202
+    if (empty($user)) {
203
+            return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
204
+    }
197 205
 
198 206
     $new_pass = wp_generate_password(12, false);
199 207
 
@@ -282,13 +290,14 @@  discard block
 block discarded – undo
282 290
     }
283 291
 
284 292
     // Check the username
285
-    if ($user_login == '')
286
-        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
-    elseif (!validate_username($user_login)) {
293
+    if ($user_login == '') {
294
+            $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
295
+    } elseif (!validate_username($user_login)) {
288 296
         $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289 297
         $user_login = '';
290
-    } elseif (username_exists($user_login))
291
-        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
298
+    } elseif (username_exists($user_login)) {
299
+            $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
300
+    }
292 301
 
293 302
     // Check the e-mail address
294 303
     if ($user_email == '') {
@@ -296,8 +305,9 @@  discard block
 block discarded – undo
296 305
     } elseif (!is_email($user_email)) {
297 306
         $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298 307
         $user_email = '';
299
-    } elseif (email_exists($user_email))
300
-        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
308
+    } elseif (email_exists($user_email)) {
309
+            $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
310
+    }
301 311
 
302 312
     /**
303 313
      * Called when registering a new user.
@@ -317,8 +327,9 @@  discard block
 block discarded – undo
317 327
      */
318 328
     $errors = apply_filters('registration_errors', $errors);
319 329
 
320
-    if ($errors->get_error_code())
321
-        return $errors;
330
+    if ($errors->get_error_code()) {
331
+            return $errors;
332
+    }
322 333
 
323 334
 
324 335
     if (!isset($user_pass) || $user_pass == '') {
@@ -423,28 +434,33 @@  discard block
 block discarded – undo
423 434
 
424 435
     $errors = new WP_Error();
425 436
 
426
-    if (isset($_GET['key']))
427
-        $action = 'resetpass';
437
+    if (isset($_GET['key'])) {
438
+            $action = 'resetpass';
439
+    }
428 440
 
429 441
     // validate action so as to default to the login screen
430
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
431
-        $action = 'login';
442
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) {
443
+            $action = 'login';
444
+    }
432 445
 
433 446
     nocache_headers();
434 447
 
435 448
     if (defined('RELOCATE')) { // Move flag is set
436
-        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
437
-            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
449
+        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) {
450
+                    $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
451
+        }
438 452
 
439 453
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
440
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
441
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
454
+        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) {
455
+                    update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
456
+        }
442 457
     }
443 458
 
444 459
     //Set a cookie now to see if they are supported by the browser.
445 460
     //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
446
-    if (SITECOOKIEPATH != COOKIEPATH)
447
-        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
461
+    if (SITECOOKIEPATH != COOKIEPATH) {
462
+            setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
463
+    }
448 464
 
449 465
     /**
450 466
      * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
@@ -465,8 +481,9 @@  discard block
 block discarded – undo
465 481
 
466 482
             $redirect_to = $_SERVER['HTTP_REFERER'];
467 483
             //$redirect_to = home_url().'/?ptype=login&loggedout=true';
468
-            if (isset($_REQUEST['redirect_to']))
469
-                $redirect_to = $_REQUEST['redirect_to'];
484
+            if (isset($_REQUEST['redirect_to'])) {
485
+                            $redirect_to = $_REQUEST['redirect_to'];
486
+            }
470 487
             $redirect_to = home_url();
471 488
             wp_safe_redirect($redirect_to);
472 489
             exit();
@@ -486,7 +503,9 @@  discard block
 block discarded – undo
486 503
                     exit();
487 504
                 }
488 505
             }
489
-            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
506
+            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
507
+                $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
508
+            }
490 509
         /**
491 510
          * Called in the geodir_user_signup() function during the lostpassword case.
492 511
          *
@@ -582,8 +601,9 @@  discard block
 block discarded – undo
582 601
                     }
583 602
 
584 603
 
585
-                    if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
586
-                        $secure_cookie = false;
604
+                    if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
605
+                                            $secure_cookie = false;
606
+                    }
587 607
 
588 608
                     $user = wp_signon('', $secure_cookie);
589 609
 
@@ -652,22 +672,26 @@  discard block
 block discarded – undo
652 672
                     $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
653 673
 
654 674
                     $_REQUEST['redirect_to'] = $default_author_link;
655
-                else:
656
-                    $_REQUEST['redirect_to'] = home_url();
675
+                else {
676
+                    :
677
+                    $_REQUEST['redirect_to'] = home_url();
678
+                }
657 679
                 endif;
658 680
 
659 681
             }
660 682
             if (isset($_REQUEST['redirect_to'])) {
661 683
                 $redirect_to = $_REQUEST['redirect_to'];
662 684
                 // Redirect to https if user wants ssl
663
-                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
664
-                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
685
+                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
686
+                                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
687
+                }
665 688
             } else {
666 689
                 $redirect_to = admin_url();
667 690
             }
668 691
 
669
-            if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
670
-                $secure_cookie = false;
692
+            if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
693
+                            $secure_cookie = false;
694
+            }
671 695
             $user = wp_signon('', $secure_cookie);
672 696
 
673 697
 
@@ -702,11 +726,13 @@  discard block
 block discarded – undo
702 726
             $errors = $user;
703 727
 
704 728
             // Clear errors if loggedout is set.
705
-            if (!empty($_GET['loggedout']))
706
-                $errors = new WP_Error();
729
+            if (!empty($_GET['loggedout'])) {
730
+                            $errors = new WP_Error();
731
+            }
707 732
             // If cookies are disabled we can't log in even with a valid user+pass
708
-            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
709
-                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
733
+            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
734
+                            $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
735
+            }
710 736
 
711 737
             // Some parts of this script use the main login form to display a message
712 738
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@
 block discarded – undo
393 393
  * @global object $post The current post object.
394 394
  * @global object $geodirectory Not yet implemented.
395 395
  * @param string $slug The template slug.
396
- * @param null $name The template name.
396
+ * @param string $name The template name.
397 397
  */
398 398
 function geodir_get_template_part($slug = '', $name = NULL)
399 399
 {
Please login to merge, or discard this patch.
Braces   +58 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,16 +47,19 @@  discard block
 block discarded – undo
47 47
 
48 48
             if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49 49
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
50
-            )
51
-                $post_type = $_REQUEST['listing_type'];
50
+            ) {
51
+                            $post_type = $_REQUEST['listing_type'];
52
+            }
52 53
             if (empty($post_type) && !isset($_REQUEST['pid'])) {
53 54
                 $pagename = $wp->query_vars['pagename'];
54 55
                 $post_types = geodir_get_posttypes();
55
-                if (!empty($post_types))
56
-                    $post_type = $post_types[0];
56
+                if (!empty($post_types)) {
57
+                                    $post_type = $post_types[0];
58
+                }
57 59
 					
58
-				if($sc_post_type != '' )
59
-					$post_type = $sc_post_type;
60
+				if($sc_post_type != '' ) {
61
+									$post_type = $sc_post_type;
62
+				}
60 63
 				
61 64
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
62 65
 					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
@@ -71,14 +74,16 @@  discard block
 block discarded – undo
71 74
             $success_page_id = geodir_success_page_id();
72 75
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
73 76
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
74
-            )
75
-                $post_type = $_REQUEST['listing_type'];
77
+            ) {
78
+                            $post_type = $_REQUEST['listing_type'];
79
+            }
76 80
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
77 81
             break;
78 82
         case 'detail':
79 83
         case 'preview':
80
-            if (in_array(get_post_type(), geodir_get_posttypes()))
81
-                $post_type = get_post_type();
84
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
85
+                            $post_type = get_post_type();
86
+            }
82 87
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
83 88
             break;
84 89
         case 'listing':
@@ -184,7 +189,9 @@  discard block
 block discarded – undo
184 189
 
185 190
         $template = geodir_locate_template('signup');
186 191
 
187
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
192
+        if (!$template) {
193
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
194
+        }
188 195
 
189 196
         /**
190 197
          * Filter the signup template path.
@@ -202,7 +209,9 @@  discard block
 block discarded – undo
202 209
 
203 210
             $template = geodir_locate_template('information');
204 211
 
205
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
212
+            if (!$template) {
213
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
214
+            }
206 215
             /**
207 216
              * Filter the information template path.
208 217
              *
@@ -219,7 +228,9 @@  discard block
 block discarded – undo
219 228
             if (!$is_current_user_owner) {
220 229
                 $template = geodir_locate_template('information');
221 230
 
222
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
231
+                if (!$template) {
232
+                    $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
233
+                }
223 234
                 /**
224 235
                  * Filter the information template path.
225 236
                  *
@@ -241,7 +252,9 @@  discard block
 block discarded – undo
241 252
 
242 253
         $template = geodir_locate_template('add-listing');
243 254
 
244
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
255
+        if (!$template) {
256
+            $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
257
+        }
245 258
         /**
246 259
          * Filter the add listing template path.
247 260
          *
@@ -258,7 +271,9 @@  discard block
 block discarded – undo
258 271
 
259 272
         $template = geodir_locate_template('preview');
260 273
 
261
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
274
+        if (!$template) {
275
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
276
+        }
262 277
         /**
263 278
          * Filter the preview template path.
264 279
          *
@@ -274,7 +289,9 @@  discard block
 block discarded – undo
274 289
 
275 290
         $template = geodir_locate_template('success');
276 291
 
277
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
292
+        if (!$template) {
293
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
294
+        }
278 295
         /**
279 296
          * Filter the success template path.
280 297
          *
@@ -289,7 +306,9 @@  discard block
 block discarded – undo
289 306
 
290 307
         $template = geodir_locate_template('detail');
291 308
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
309
+        if (!$template) {
310
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
311
+        }
293 312
         /**
294 313
          * Filter the detail template path.
295 314
          *
@@ -304,7 +323,9 @@  discard block
 block discarded – undo
304 323
 
305 324
         $template = geodir_locate_template('listing');
306 325
 
307
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
326
+        if (!$template) {
327
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
328
+        }
308 329
         /**
309 330
          * Filter the listing template path.
310 331
          *
@@ -319,7 +340,9 @@  discard block
 block discarded – undo
319 340
 
320 341
         $template = geodir_locate_template('search');
321 342
 
322
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
343
+        if (!$template) {
344
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
345
+        }
323 346
         /**
324 347
          * Filter the search template path.
325 348
          *
@@ -334,7 +357,9 @@  discard block
 block discarded – undo
334 357
 
335 358
         $template = geodir_locate_template('author');
336 359
 
337
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
360
+        if (!$template) {
361
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
362
+        }
338 363
         /**
339 364
          * Filter the author template path.
340 365
          *
@@ -355,7 +380,9 @@  discard block
 block discarded – undo
355 380
 
356 381
             $template = geodir_locate_template('geodir-home');
357 382
 
358
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
383
+            if (!$template) {
384
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
385
+            }
359 386
             /**
360 387
              * Filter the home page template path.
361 388
              *
@@ -368,7 +395,9 @@  discard block
 block discarded – undo
368 395
 
369 396
             $template = geodir_locate_template('location');
370 397
 
371
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
398
+            if (!$template) {
399
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
400
+            }
372 401
             /**
373 402
              * Filter the location template path.
374 403
              *
@@ -377,8 +406,9 @@  discard block
 block discarded – undo
377 406
              */
378 407
             return $template = apply_filters('geodir_template_location', $template);
379 408
 
380
-        } else
381
-            return $template;
409
+        } else {
410
+                    return $template;
411
+        }
382 412
 
383 413
     }
384 414
 
@@ -432,8 +462,10 @@  discard block
 block discarded – undo
432 462
          * @since 1.0.0
433 463
          */
434 464
         include($template);
435
-    else:
436
-        locate_template(array("geodirectory/" . $template_name), true, false);
465
+    else {
466
+        :
467
+        locate_template(array("geodirectory/" . $template_name), true, false);
468
+    }
437 469
     endif;
438 470
 
439 471
 }
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Template functions
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Locates template based on the template type.
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
         case 'add-listing':
30 30
 
31 31
             $sc_post_type = '';
32
-			if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
32
+            if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
33 33
                 $listing_page_id = $post->ID;
34 34
 				
35
-				$regex_pattern = get_shortcode_regex();
36
-				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
35
+                $regex_pattern = get_shortcode_regex();
36
+                preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
37 37
 				
38
-				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39
-					$shortcode_atts = shortcode_parse_atts($regex_matches[3]);
40
-					$sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
41
-				}
38
+                if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39
+                    $shortcode_atts = shortcode_parse_atts($regex_matches[3]);
40
+                    $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
41
+                }
42 42
             } else {
43 43
                 $listing_page_id = geodir_add_listing_page_id();
44 44
             }
45 45
 			
46
-			$is_wpml = function_exists('icl_object_id') ? true : false;
46
+            $is_wpml = function_exists('icl_object_id') ? true : false;
47 47
 
48 48
             if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49 49
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
                 if (!empty($post_types))
56 56
                     $post_type = $post_types[0];
57 57
 					
58
-				if($sc_post_type != '' )
59
-					$post_type = $sc_post_type;
58
+                if($sc_post_type != '' )
59
+                    $post_type = $sc_post_type;
60 60
 				
61 61
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
62
-					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
63
-				} else {
64
-					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
65
-				}
62
+                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
63
+                } else {
64
+                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
65
+                }
66 66
                 exit();
67 67
             }
68 68
             return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
@@ -481,21 +481,21 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
483 483
     if ($favorite) {
484
-		$message = __('No favorite listings found which match your selection.', 'geodirectory');
485
-	} else {
486
-		$message = __('No listings found which match your selection.', 'geodirectory');
487
-	}
484
+        $message = __('No favorite listings found which match your selection.', 'geodirectory');
485
+    } else {
486
+        $message = __('No listings found which match your selection.', 'geodirectory');
487
+    }
488 488
 	
489
-	/**
490
-	 * Filter the no listing found message.
491
-	 *
492
-	 * @since 1.5.5
493
-	 * @param string $template_listview Listing listview template.
494
-	 * @param bool $favorite Are favorite listings results?
495
-	 */
496
-	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
489
+    /**
490
+     * Filter the no listing found message.
491
+     *
492
+     * @since 1.5.5
493
+     * @param string $template_listview Listing listview template.
494
+     * @param bool $favorite Are favorite listings results?
495
+     */
496
+    $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
497 497
 	
498
-	echo '<li class="no-listing">' . $message . '</li>';
498
+    echo '<li class="no-listing">' . $message . '</li>';
499 499
 }
500 500
 
501 501
 /**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
  * @return string Breadcrumb HTML.
510 510
  */
511 511
 function geodir_strip_breadcrumb_li_wrappers($breadcrumb, $separator) {
512
-	$breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb);
512
+    $breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb);
513 513
 	
514
-	return $breadcrumb;
514
+    return $breadcrumb;
515 515
 }
516 516
 
517 517
 /**
@@ -522,30 +522,30 @@  discard block
 block discarded – undo
522 522
  * @return string Listing listview class.
523 523
  */
524 524
 function geodir_convert_listing_view_class($columns = '') {
525
-	$class = '';
525
+    $class = '';
526 526
 	
527
-	switch ((int)$columns) {
528
-		case 1:
529
-			$class = '';
530
-		break;
531
-		case 2:
532
-			$class = 'gridview_onehalf';
533
-		break;
534
-		case 3:
535
-			$class = 'gridview_onethird';
536
-		break;
537
-		case 4:
538
-			$class = 'gridview_onefourth';
539
-		break;
540
-		case 5:
541
-			$class = 'gridview_onefifth';
542
-		break;
543
-		default:
544
-			$class = '';
545
-		break;
546
-	}
527
+    switch ((int)$columns) {
528
+        case 1:
529
+            $class = '';
530
+        break;
531
+        case 2:
532
+            $class = 'gridview_onehalf';
533
+        break;
534
+        case 3:
535
+            $class = 'gridview_onethird';
536
+        break;
537
+        case 4:
538
+            $class = 'gridview_onefourth';
539
+        break;
540
+        case 5:
541
+            $class = 'gridview_onefifth';
542
+        break;
543
+        default:
544
+            $class = '';
545
+        break;
546
+    }
547 547
 	
548
-	return $class;
548
+    return $class;
549 549
 }
550 550
 
551 551
 /**
@@ -558,18 +558,18 @@  discard block
 block discarded – undo
558 558
  * @return bool Modified value for display the excerpt.
559 559
  */
560 560
 function geodir_show_listing_post_excerpt($display, $view, $post) {
561
-	if ($view == 'listview') {
562
-		if (geodir_is_page('author')) {
563
-			$word_limit = get_option('geodir_author_desc_word_limit');
564
-		} else {
565
-			$word_limit = get_option('geodir_desc_word_limit');
566
-		}
561
+    if ($view == 'listview') {
562
+        if (geodir_is_page('author')) {
563
+            $word_limit = get_option('geodir_author_desc_word_limit');
564
+        } else {
565
+            $word_limit = get_option('geodir_desc_word_limit');
566
+        }
567 567
 		
568
-		if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) {
569
-			$display = false;
570
-		}
571
-	}
572
-	return $display;
568
+        if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) {
569
+            $display = false;
570
+        }
571
+    }
572
+    return $display;
573 573
 }
574 574
 
575 575
 /**
@@ -584,24 +584,24 @@  discard block
 block discarded – undo
584 584
  * @return string Rating icons html content.
585 585
  */
586 586
 function geodir_font_awesome_rating_form_html($html, $star_texts = array(), $default = '') {
587
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
588
-		$html = '<select class="gd-fa-rating">';
589
-		$html .= '<option value=""></option>';
590
-		if (!empty($star_texts) && is_array($star_texts)) {
591
-			foreach ($star_texts as $i => $text) {
592
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
593
-			}
594
-		} else {
595
-			$html .= '<option value="1">1</option>';
596
-			$html .= '<option value="2">2</option>';
597
-			$html .= '<option value="3">3</option>';
598
-			$html .= '<option value="4">4</option>';
599
-			$html .= '<option value="5">5</option>';
600
-		}
601
-		$html .= '</select>';
602
-	}
603
-
604
-	return $html;
587
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
588
+        $html = '<select class="gd-fa-rating">';
589
+        $html .= '<option value=""></option>';
590
+        if (!empty($star_texts) && is_array($star_texts)) {
591
+            foreach ($star_texts as $i => $text) {
592
+                $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
593
+            }
594
+        } else {
595
+            $html .= '<option value="1">1</option>';
596
+            $html .= '<option value="2">2</option>';
597
+            $html .= '<option value="3">3</option>';
598
+            $html .= '<option value="4">4</option>';
599
+            $html .= '<option value="5">5</option>';
600
+        }
601
+        $html .= '</select>';
602
+    }
603
+
604
+    return $html;
605 605
 }
606 606
 
607 607
 /**
@@ -616,20 +616,20 @@  discard block
 block discarded – undo
616 616
  * @return string Rating icons html content.
617 617
  */
618 618
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
619
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620
-		$rating = min($rating, $star_count);
621
-		$full_stars = floor( $rating );
622
-		$half_stars = ceil( $rating - $full_stars );
623
-		$empty_stars = $star_count - $full_stars - $half_stars;
619
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620
+        $rating = min($rating, $star_count);
621
+        $full_stars = floor( $rating );
622
+        $half_stars = ceil( $rating - $full_stars );
623
+        $empty_stars = $star_count - $full_stars - $half_stars;
624 624
 		
625
-		$html = '<div class="gd-star-rating gd-fa-star-rating">';
626
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629
-		$html .= '</div>';
630
-	}
631
-
632
-	return $html;
625
+        $html = '<div class="gd-star-rating gd-fa-star-rating">';
626
+        $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
+        $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
+        $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629
+        $html .= '</div>';
630
+    }
631
+
632
+    return $html;
633 633
 }
634 634
 
635 635
 /**
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
  * @package GeoDirectory
640 640
  */
641 641
 function geodir_font_awesome_rating_css() {
642
-	// Font awesome rating style
643
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
644
-		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
645
-		if ($full_color != '#757575') {
646
-			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
642
+    // Font awesome rating style
643
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
644
+        $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
645
+        if ($full_color != '#757575') {
646
+            echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
647 647
 			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;</style>';
648
-		}
649
-	}
648
+        }
649
+    }
650 650
 }
651 651
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                 $listing_page_id = $post->ID;
34 34
 				
35 35
 				$regex_pattern = get_shortcode_regex();
36
-				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
36
+				preg_match('/' . $regex_pattern . '/s', $post->post_content, $regex_matches);
37 37
 				
38 38
 				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39 39
 					$shortcode_atts = shortcode_parse_atts($regex_matches[3]);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 if (!empty($post_types))
56 56
                     $post_type = $post_types[0];
57 57
 					
58
-				if($sc_post_type != '' )
58
+				if ($sc_post_type != '')
59 59
 					$post_type = $sc_post_type;
60 60
 				
61 61
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      */
411 411
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
412 412
     $templates = array();
413
-    $name = (string)$name;
413
+    $name = (string) $name;
414 414
     if ('' !== $name) {
415 415
         $template_name = "{$slug}-{$name}.php";
416 416
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 function geodir_convert_listing_view_class($columns = '') {
525 525
 	$class = '';
526 526
 	
527
-	switch ((int)$columns) {
527
+	switch ((int) $columns) {
528 528
 		case 1:
529 529
 			$class = '';
530 530
 		break;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		$html .= '<option value=""></option>';
590 590
 		if (!empty($star_texts) && is_array($star_texts)) {
591 591
 			foreach ($star_texts as $i => $text) {
592
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
592
+				$html .= '<option ' . selected((int) ($i + 1), (int) $default, false) . ' value="' . (int) ($i + 1) . '">' . $text . '</option>';
593 593
 			}
594 594
 		} else {
595 595
 			$html .= '<option value="1">1</option>';
@@ -618,14 +618,14 @@  discard block
 block discarded – undo
618 618
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
619 619
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620 620
 		$rating = min($rating, $star_count);
621
-		$full_stars = floor( $rating );
622
-		$half_stars = ceil( $rating - $full_stars );
621
+		$full_stars = floor($rating);
622
+		$half_stars = ceil($rating - $full_stars);
623 623
 		$empty_stars = $star_count - $full_stars - $half_stars;
624 624
 		
625 625
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
626
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
626
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
627
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
628
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629 629
 		$html .= '</div>';
630 630
 	}
631 631
 
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/class-recursive-arrayaccess.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,6 @@
 block discarded – undo
107 107
 	 * @link http://php.net/manual/en/arrayaccess.offsetset.php
108 108
 	 *
109 109
 	 * @param mixed $offset The offset to assign the value to.
110
-	 * @param mixed $value  The value to set.
111 110
 	 *
112 111
 	 * @return void
113 112
 	 */
Please login to merge, or discard this patch.
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multidimensional ArrayAccess
4
- *
5
- * Allows ArrayAccess-like functionality with multidimensional arrays.  Fully supports
6
- * both sets and unsets.
7
- *
8
- * @package WordPress
9
- * @subpackage Session
10
- * @since 3.6.0
11
- */
3
+     * Multidimensional ArrayAccess
4
+     *
5
+     * Allows ArrayAccess-like functionality with multidimensional arrays.  Fully supports
6
+     * both sets and unsets.
7
+     *
8
+     * @package WordPress
9
+     * @subpackage Session
10
+     * @since 3.6.0
11
+     */
12 12
 
13 13
 // Exit if accessed directly
14 14
 if ( ! defined( 'ABSPATH' ) ) exit;
@@ -20,120 +20,120 @@  discard block
 block discarded – undo
20 20
  * @since 3.6.0
21 21
  */
22 22
 class Recursive_ArrayAccess implements ArrayAccess {
23
-	/**
24
-	 * Internal data collection.
25
-	 *
26
-	 * @var array
27
-	 */
28
-	protected $container = array();
23
+    /**
24
+     * Internal data collection.
25
+     *
26
+     * @var array
27
+     */
28
+    protected $container = array();
29 29
 
30
-	/**
31
-	 * Flag whether or not the internal collection has been changed.
32
-	 *
33
-	 * @var bool
34
-	 */
35
-	protected $dirty = false;
30
+    /**
31
+     * Flag whether or not the internal collection has been changed.
32
+     *
33
+     * @var bool
34
+     */
35
+    protected $dirty = false;
36 36
 
37
-	/**
38
-	 * Default object constructor.
39
-	 *
40
-	 * @param array $data
41
-	 */
42
-	protected function __construct( $data = array() ) {
43
-		foreach ( $data as $key => $value ) {
44
-			$this[ $key ] = $value;
45
-		}
46
-	}
37
+    /**
38
+     * Default object constructor.
39
+     *
40
+     * @param array $data
41
+     */
42
+    protected function __construct( $data = array() ) {
43
+        foreach ( $data as $key => $value ) {
44
+            $this[ $key ] = $value;
45
+        }
46
+    }
47 47
 
48
-	/**
49
-	 * Allow deep copies of objects
50
-	 */
51
-	public function __clone() {
52
-		foreach ( $this->container as $key => $value ) {
53
-			if ( $value instanceof self ) {
54
-				$this[ $key ] = clone $value;
55
-			}
56
-		}
57
-	}
48
+    /**
49
+     * Allow deep copies of objects
50
+     */
51
+    public function __clone() {
52
+        foreach ( $this->container as $key => $value ) {
53
+            if ( $value instanceof self ) {
54
+                $this[ $key ] = clone $value;
55
+            }
56
+        }
57
+    }
58 58
 
59
-	/**
60
-	 * Output the data container as a multidimensional array.
61
-	 *
62
-	 * @return array
63
-	 */
64
-	public function toArray() {
65
-		$data = $this->container;
66
-		foreach ( $data as $key => $value ) {
67
-			if ( $value instanceof self ) {
68
-				$data[ $key ] = $value->toArray();
69
-			}
70
-		}
71
-		return $data;
72
-	}
59
+    /**
60
+     * Output the data container as a multidimensional array.
61
+     *
62
+     * @return array
63
+     */
64
+    public function toArray() {
65
+        $data = $this->container;
66
+        foreach ( $data as $key => $value ) {
67
+            if ( $value instanceof self ) {
68
+                $data[ $key ] = $value->toArray();
69
+            }
70
+        }
71
+        return $data;
72
+    }
73 73
 
74
-	/**
75
-	* ArrayAccess Implementation
76
-	**/
74
+    /**
75
+     * ArrayAccess Implementation
76
+     **/
77 77
 
78
-	/**
79
-	 * Whether a offset exists
80
-	 *
81
-	 * @link http://php.net/manual/en/arrayaccess.offsetexists.php
82
-	 *
83
-	 * @param mixed $offset An offset to check for.
84
-	 *
85
-	 * @return boolean true on success or false on failure.
86
-	 */
87
-	public function offsetExists( $offset ) {
88
-		return isset( $this->container[ $offset ]) ;
89
-	}
78
+    /**
79
+     * Whether a offset exists
80
+     *
81
+     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
82
+     *
83
+     * @param mixed $offset An offset to check for.
84
+     *
85
+     * @return boolean true on success or false on failure.
86
+     */
87
+    public function offsetExists( $offset ) {
88
+        return isset( $this->container[ $offset ]) ;
89
+    }
90 90
 
91
-	/**
92
-	 * Offset to retrieve
93
-	 *
94
-	 * @link http://php.net/manual/en/arrayaccess.offsetget.php
95
-	 *
96
-	 * @param mixed $offset The offset to retrieve.
97
-	 *
98
-	 * @return mixed Can return all value types.
99
-	 */
100
-	public function offsetGet( $offset ) {
101
-		return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
102
-	}
91
+    /**
92
+     * Offset to retrieve
93
+     *
94
+     * @link http://php.net/manual/en/arrayaccess.offsetget.php
95
+     *
96
+     * @param mixed $offset The offset to retrieve.
97
+     *
98
+     * @return mixed Can return all value types.
99
+     */
100
+    public function offsetGet( $offset ) {
101
+        return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
102
+    }
103 103
 
104
-	/**
105
-	 * Offset to set
106
-	 *
107
-	 * @link http://php.net/manual/en/arrayaccess.offsetset.php
108
-	 *
109
-	 * @param mixed $offset The offset to assign the value to.
110
-	 * @param mixed $value  The value to set.
111
-	 *
112
-	 * @return void
113
-	 */
114
-	public function offsetSet( $offset, $data ) {
115
-		if ( is_array( $data ) ) {
116
-			$data = new self( $data );
117
-		}
118
-		if ( $offset === null ) { // don't forget this!
119
-			$this->container[] = $data;
120
-		} else {
121
-			$this->container[ $offset ] = $data;
122
-		}
104
+    /**
105
+     * Offset to set
106
+     *
107
+     * @link http://php.net/manual/en/arrayaccess.offsetset.php
108
+     *
109
+     * @param mixed $offset The offset to assign the value to.
110
+     * @param mixed $value  The value to set.
111
+     *
112
+     * @return void
113
+     */
114
+    public function offsetSet( $offset, $data ) {
115
+        if ( is_array( $data ) ) {
116
+            $data = new self( $data );
117
+        }
118
+        if ( $offset === null ) { // don't forget this!
119
+            $this->container[] = $data;
120
+        } else {
121
+            $this->container[ $offset ] = $data;
122
+        }
123 123
 
124
-		$this->dirty = true;
125
-	}
124
+        $this->dirty = true;
125
+    }
126 126
 
127
-	/**
128
-	 * Offset to unset
129
-	 *
130
-	 * @link http://php.net/manual/en/arrayaccess.offsetunset.php
131
-	 *
132
-	 * @param mixed $offset The offset to unset.
133
-	 *
134
-	 * @return void
135
-	 */
136
-	public function offsetUnset( $offset ) {
137
-		unset( $this->container[ $offset ] );
138
-	}
127
+    /**
128
+     * Offset to unset
129
+     *
130
+     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
131
+     *
132
+     * @param mixed $offset The offset to unset.
133
+     *
134
+     * @return void
135
+     */
136
+    public function offsetUnset( $offset ) {
137
+        unset( $this->container[ $offset ] );
138
+    }
139 139
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if (!defined('ABSPATH')) exit;
15 15
 
16 16
 /**
17 17
  * Recursive array class to allow multidimensional array access.
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @param array $data
41 41
 	 */
42
-	protected function __construct( $data = array() ) {
43
-		foreach ( $data as $key => $value ) {
44
-			$this[ $key ] = $value;
42
+	protected function __construct($data = array()) {
43
+		foreach ($data as $key => $value) {
44
+			$this[$key] = $value;
45 45
 		}
46 46
 	}
47 47
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * Allow deep copies of objects
50 50
 	 */
51 51
 	public function __clone() {
52
-		foreach ( $this->container as $key => $value ) {
53
-			if ( $value instanceof self ) {
54
-				$this[ $key ] = clone $value;
52
+		foreach ($this->container as $key => $value) {
53
+			if ($value instanceof self) {
54
+				$this[$key] = clone $value;
55 55
 			}
56 56
 		}
57 57
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function toArray() {
65 65
 		$data = $this->container;
66
-		foreach ( $data as $key => $value ) {
67
-			if ( $value instanceof self ) {
68
-				$data[ $key ] = $value->toArray();
66
+		foreach ($data as $key => $value) {
67
+			if ($value instanceof self) {
68
+				$data[$key] = $value->toArray();
69 69
 			}
70 70
 		}
71 71
 		return $data;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return boolean true on success or false on failure.
86 86
 	 */
87
-	public function offsetExists( $offset ) {
88
-		return isset( $this->container[ $offset ]) ;
87
+	public function offsetExists($offset) {
88
+		return isset($this->container[$offset]);
89 89
 	}
90 90
 
91 91
 	/**
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return mixed Can return all value types.
99 99
 	 */
100
-	public function offsetGet( $offset ) {
101
-		return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
100
+	public function offsetGet($offset) {
101
+		return isset($this->container[$offset]) ? $this->container[$offset] : null;
102 102
 	}
103 103
 
104 104
 	/**
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return void
113 113
 	 */
114
-	public function offsetSet( $offset, $data ) {
115
-		if ( is_array( $data ) ) {
116
-			$data = new self( $data );
114
+	public function offsetSet($offset, $data) {
115
+		if (is_array($data)) {
116
+			$data = new self($data);
117 117
 		}
118
-		if ( $offset === null ) { // don't forget this!
118
+		if ($offset === null) { // don't forget this!
119 119
 			$this->container[] = $data;
120 120
 		} else {
121
-			$this->container[ $offset ] = $data;
121
+			$this->container[$offset] = $data;
122 122
 		}
123 123
 
124 124
 		$this->dirty = true;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return void
135 135
 	 */
136
-	public function offsetUnset( $offset ) {
137
-		unset( $this->container[ $offset ] );
136
+	public function offsetUnset($offset) {
137
+		unset($this->container[$offset]);
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if ( ! defined( 'ABSPATH' ) ) {
15
+    exit;
16
+}
15 17
 
16 18
 /**
17 19
  * Return the current cache expire setting.
Please login to merge, or discard this patch.
geodirectory-functions/wp-session/class-wp-session.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,6 @@
 block discarded – undo
51 51
 	/**
52 52
 	 * Retrieve the current session instance.
53 53
 	 *
54
-	 * @param bool $session_id Session ID from which to populate data.
55 54
 	 *
56 55
 	 * @return bool|WP_Session
57 56
 	 */
Please login to merge, or discard this patch.
Indentation   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress session managment.
4
- *
5
- * Standardizes WordPress session data using database-backed options for storage.
6
- * for storing user session information.
7
- *
8
- * @package WordPress
9
- * @subpackage Session
10
- * @since   3.7.0
11
- */
3
+     * WordPress session managment.
4
+     *
5
+     * Standardizes WordPress session data using database-backed options for storage.
6
+     * for storing user session information.
7
+     *
8
+     * @package WordPress
9
+     * @subpackage Session
10
+     * @since   3.7.0
11
+     */
12 12
 
13 13
 // Exit if accessed directly
14 14
 if ( ! defined( 'ABSPATH' ) ) exit;
@@ -20,313 +20,313 @@  discard block
 block discarded – undo
20 20
  * @since   3.7.0
21 21
  */
22 22
 final class WP_Session extends Recursive_ArrayAccess implements Iterator, Countable {
23
-	/**
24
-	 * ID of the current session.
25
-	 *
26
-	 * @var string
27
-	 */
28
-	public $session_id;
29
-
30
-	/**
31
-	 * Unix timestamp when session expires.
32
-	 *
33
-	 * @var int
34
-	 */
35
-	protected $expires;
36
-
37
-	/**
38
-	 * Unix timestamp indicating when the expiration time needs to be reset.
39
-	 *
40
-	 * @var int
41
-	 */
42
-	protected $exp_variant;
43
-
44
-	/**
45
-	 * Singleton instance.
46
-	 *
47
-	 * @var bool|WP_Session
48
-	 */
49
-	private static $instance = false;
50
-
51
-	/**
52
-	 * Retrieve the current session instance.
53
-	 *
54
-	 * @param bool $session_id Session ID from which to populate data.
55
-	 *
56
-	 * @return bool|WP_Session
57
-	 */
58
-	public static function get_instance() {
59
-		if ( ! self::$instance ) {
60
-			self::$instance = new self();
61
-		}
62
-
63
-		return self::$instance;
64
-	}
65
-
66
-	/**
67
-	 * Default constructor.
68
-	 * Will rebuild the session collection from the given session ID if it exists. Otherwise, will
69
-	 * create a new session with that ID.
70
-	 *
71
-	 * @param $session_id
72
-	 * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
73
-	 */
74
-	protected function __construct() {
75
-		if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
76
-			$cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
77
-			$cookie_crumbs = explode( '||', $cookie );
78
-
79
-			if( $this->is_valid_md5( $cookie_crumbs[0] ) ) {
80
-
81
-				$this->session_id = $cookie_crumbs[0];
82
-
83
-			} else {
84
-
85
-				$this->regenerate_id( true );
86
-
87
-			}
88
-
89
-			$this->expires     = $cookie_crumbs[1];
90
-			$this->exp_variant = $cookie_crumbs[2];
91
-
92
-			// Update the session expiration if we're past the variant time
93
-			if ( time() > $this->exp_variant ) {
94
-				$this->set_expiration();
95
-				delete_option( "_wp_session_expires_{$this->session_id}" );
96
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
97
-			}
98
-		} else {
99
-			$this->session_id = $this->generate_id();
100
-			$this->set_expiration();
101
-		}
102
-
103
-		$this->read_data();
104
-
105
-		$this->set_cookie();
106
-
107
-	}
108
-
109
-	/**
110
-	 * Set both the expiration time and the expiration variant.
111
-	 *
112
-	 * If the current time is below the variant, we don't update the session's expiration time. If it's
113
-	 * greater than the variant, then we update the expiration time in the database.  This prevents
114
-	 * writing to the database on every page load for active sessions and only updates the expiration
115
-	 * time if we're nearing when the session actually expires.
116
-	 *
117
-	 * By default, the expiration time is set to 30 minutes.
118
-	 * By default, the expiration variant is set to 24 minutes.
119
-	 *
120
-	 * As a result, the session expiration time - at a maximum - will only be written to the database once
121
-	 * every 24 minutes.  After 30 minutes, the session will have been expired. No cookie will be sent by
122
-	 * the browser, and the old session will be queued for deletion by the garbage collector.
123
-	 *
124
-	 * @uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data.
125
-	 * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
126
-	 */
127
-	protected function set_expiration() {
128
-		$this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
129
-		$this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
130
-	}
131
-
132
-	/**
133
-	 * Set the session cookie
134
-	 */
135
-	protected function set_cookie() {
136
-		@setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
137
-	}
138
-
139
-	/**
140
-	 * Generate a cryptographically strong unique ID for the session token.
141
-	 *
142
-	 * @return string
143
-	 */
144
-	protected function generate_id() {
145
-		require_once( ABSPATH . 'wp-includes/class-phpass.php');
146
-		$hasher = new PasswordHash( 8, false );
147
-
148
-		return md5( $hasher->get_random_bytes( 32 ) );
149
-	}
150
-
151
-	/**
152
-	 * Checks if is valid md5 string
153
-	 *
154
-	 * @param string $md5
155
-	 * @return int
156
-	 */
157
-	protected function is_valid_md5( $md5 = '' ){
158
-		return preg_match( '/^[a-f0-9]{32}$/', $md5 );
159
-	}
160
-
161
-	/**
162
-	 * Read data from a transient for the current session.
163
-	 *
164
-	 * Automatically resets the expiration time for the session transient to some time in the future.
165
-	 *
166
-	 * @return array
167
-	 */
168
-	protected function read_data() {
169
-		$this->container = get_option( "_wp_session_{$this->session_id}", array() );
170
-
171
-		return $this->container;
172
-	}
173
-
174
-	/**
175
-	 * Write the data from the current session to the data storage system.
176
-	 */
177
-	public function write_data() {
178
-		$option_key = "_wp_session_{$this->session_id}";
179
-
180
-		// Only write the collection to the DB if it's changed.
181
-		if ( $this->dirty ) {
182
-			if ( false === get_option( $option_key ) ) {
183
-				add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
184
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
185
-			} else {
186
-				delete_option( "_wp_session_{$this->session_id}" );
187
-				add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
188
-			}
189
-		}
190
-	}
191
-
192
-	/**
193
-	 * Output the current container contents as a JSON-encoded string.
194
-	 *
195
-	 * @return string
196
-	 */
197
-	public function json_out() {
198
-		return json_encode( $this->container );
199
-	}
200
-
201
-	/**
202
-	 * Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
203
-	 *
204
-	 * @param string $data
205
-	 *
206
-	 * @return bool
207
-	 */
208
-	public function json_in( $data ) {
209
-		$array = json_decode( $data );
210
-
211
-		if ( is_array( $array ) ) {
212
-			$this->container = $array;
213
-			return true;
214
-		}
215
-
216
-		return false;
217
-	}
218
-
219
-	/**
220
-	 * Regenerate the current session's ID.
221
-	 *
222
-	 * @param bool $delete_old Flag whether or not to delete the old session data from the server.
223
-	 */
224
-	public function regenerate_id( $delete_old = false ) {
225
-		if ( $delete_old ) {
226
-			delete_option( "_wp_session_{$this->session_id}" );
227
-		}
228
-
229
-		$this->session_id = $this->generate_id();
230
-
231
-		$this->set_cookie();
232
-	}
233
-
234
-	/**
235
-	 * Check if a session has been initialized.
236
-	 *
237
-	 * @return bool
238
-	 */
239
-	public function session_started() {
240
-		return !!self::$instance;
241
-	}
242
-
243
-	/**
244
-	 * Return the read-only cache expiration value.
245
-	 *
246
-	 * @return int
247
-	 */
248
-	public function cache_expiration() {
249
-		return $this->expires;
250
-	}
251
-
252
-	/**
253
-	 * Flushes all session variables.
254
-	 */
255
-	public function reset() {
256
-		$this->container = array();
257
-	}
258
-
259
-	/*****************************************************************/
260
-	/*                     Iterator Implementation                   */
261
-	/*****************************************************************/
262
-
263
-	/**
264
-	 * Current position of the array.
265
-	 *
266
-	 * @link http://php.net/manual/en/iterator.current.php
267
-	 *
268
-	 * @return mixed
269
-	 */
270
-	public function current() {
271
-		return current( $this->container );
272
-	}
273
-
274
-	/**
275
-	 * Key of the current element.
276
-	 *
277
-	 * @link http://php.net/manual/en/iterator.key.php
278
-	 *
279
-	 * @return mixed
280
-	 */
281
-	public function key() {
282
-		return key( $this->container );
283
-	}
284
-
285
-	/**
286
-	 * Move the internal point of the container array to the next item
287
-	 *
288
-	 * @link http://php.net/manual/en/iterator.next.php
289
-	 *
290
-	 * @return void
291
-	 */
292
-	public function next() {
293
-		next( $this->container );
294
-	}
295
-
296
-	/**
297
-	 * Rewind the internal point of the container array.
298
-	 *
299
-	 * @link http://php.net/manual/en/iterator.rewind.php
300
-	 *
301
-	 * @return void
302
-	 */
303
-	public function rewind() {
304
-		reset( $this->container );
305
-	}
306
-
307
-	/**
308
-	 * Is the current key valid?
309
-	 *
310
-	 * @link http://php.net/manual/en/iterator.rewind.php
311
-	 *
312
-	 * @return bool
313
-	 */
314
-	public function valid() {
315
-		return $this->offsetExists( $this->key() );
316
-	}
317
-
318
-	/*****************************************************************/
319
-	/*                    Countable Implementation                   */
320
-	/*****************************************************************/
321
-
322
-	/**
323
-	 * Get the count of elements in the container array.
324
-	 *
325
-	 * @link http://php.net/manual/en/countable.count.php
326
-	 *
327
-	 * @return int
328
-	 */
329
-	public function count() {
330
-		return count( $this->container );
331
-	}
23
+    /**
24
+     * ID of the current session.
25
+     *
26
+     * @var string
27
+     */
28
+    public $session_id;
29
+
30
+    /**
31
+     * Unix timestamp when session expires.
32
+     *
33
+     * @var int
34
+     */
35
+    protected $expires;
36
+
37
+    /**
38
+     * Unix timestamp indicating when the expiration time needs to be reset.
39
+     *
40
+     * @var int
41
+     */
42
+    protected $exp_variant;
43
+
44
+    /**
45
+     * Singleton instance.
46
+     *
47
+     * @var bool|WP_Session
48
+     */
49
+    private static $instance = false;
50
+
51
+    /**
52
+     * Retrieve the current session instance.
53
+     *
54
+     * @param bool $session_id Session ID from which to populate data.
55
+     *
56
+     * @return bool|WP_Session
57
+     */
58
+    public static function get_instance() {
59
+        if ( ! self::$instance ) {
60
+            self::$instance = new self();
61
+        }
62
+
63
+        return self::$instance;
64
+    }
65
+
66
+    /**
67
+     * Default constructor.
68
+     * Will rebuild the session collection from the given session ID if it exists. Otherwise, will
69
+     * create a new session with that ID.
70
+     *
71
+     * @param $session_id
72
+     * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
73
+     */
74
+    protected function __construct() {
75
+        if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
76
+            $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
77
+            $cookie_crumbs = explode( '||', $cookie );
78
+
79
+            if( $this->is_valid_md5( $cookie_crumbs[0] ) ) {
80
+
81
+                $this->session_id = $cookie_crumbs[0];
82
+
83
+            } else {
84
+
85
+                $this->regenerate_id( true );
86
+
87
+            }
88
+
89
+            $this->expires     = $cookie_crumbs[1];
90
+            $this->exp_variant = $cookie_crumbs[2];
91
+
92
+            // Update the session expiration if we're past the variant time
93
+            if ( time() > $this->exp_variant ) {
94
+                $this->set_expiration();
95
+                delete_option( "_wp_session_expires_{$this->session_id}" );
96
+                add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
97
+            }
98
+        } else {
99
+            $this->session_id = $this->generate_id();
100
+            $this->set_expiration();
101
+        }
102
+
103
+        $this->read_data();
104
+
105
+        $this->set_cookie();
106
+
107
+    }
108
+
109
+    /**
110
+     * Set both the expiration time and the expiration variant.
111
+     *
112
+     * If the current time is below the variant, we don't update the session's expiration time. If it's
113
+     * greater than the variant, then we update the expiration time in the database.  This prevents
114
+     * writing to the database on every page load for active sessions and only updates the expiration
115
+     * time if we're nearing when the session actually expires.
116
+     *
117
+     * By default, the expiration time is set to 30 minutes.
118
+     * By default, the expiration variant is set to 24 minutes.
119
+     *
120
+     * As a result, the session expiration time - at a maximum - will only be written to the database once
121
+     * every 24 minutes.  After 30 minutes, the session will have been expired. No cookie will be sent by
122
+     * the browser, and the old session will be queued for deletion by the garbage collector.
123
+     *
124
+     * @uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data.
125
+     * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
126
+     */
127
+    protected function set_expiration() {
128
+        $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
129
+        $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
130
+    }
131
+
132
+    /**
133
+     * Set the session cookie
134
+     */
135
+    protected function set_cookie() {
136
+        @setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
137
+    }
138
+
139
+    /**
140
+     * Generate a cryptographically strong unique ID for the session token.
141
+     *
142
+     * @return string
143
+     */
144
+    protected function generate_id() {
145
+        require_once( ABSPATH . 'wp-includes/class-phpass.php');
146
+        $hasher = new PasswordHash( 8, false );
147
+
148
+        return md5( $hasher->get_random_bytes( 32 ) );
149
+    }
150
+
151
+    /**
152
+     * Checks if is valid md5 string
153
+     *
154
+     * @param string $md5
155
+     * @return int
156
+     */
157
+    protected function is_valid_md5( $md5 = '' ){
158
+        return preg_match( '/^[a-f0-9]{32}$/', $md5 );
159
+    }
160
+
161
+    /**
162
+     * Read data from a transient for the current session.
163
+     *
164
+     * Automatically resets the expiration time for the session transient to some time in the future.
165
+     *
166
+     * @return array
167
+     */
168
+    protected function read_data() {
169
+        $this->container = get_option( "_wp_session_{$this->session_id}", array() );
170
+
171
+        return $this->container;
172
+    }
173
+
174
+    /**
175
+     * Write the data from the current session to the data storage system.
176
+     */
177
+    public function write_data() {
178
+        $option_key = "_wp_session_{$this->session_id}";
179
+
180
+        // Only write the collection to the DB if it's changed.
181
+        if ( $this->dirty ) {
182
+            if ( false === get_option( $option_key ) ) {
183
+                add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
184
+                add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
185
+            } else {
186
+                delete_option( "_wp_session_{$this->session_id}" );
187
+                add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
188
+            }
189
+        }
190
+    }
191
+
192
+    /**
193
+     * Output the current container contents as a JSON-encoded string.
194
+     *
195
+     * @return string
196
+     */
197
+    public function json_out() {
198
+        return json_encode( $this->container );
199
+    }
200
+
201
+    /**
202
+     * Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
203
+     *
204
+     * @param string $data
205
+     *
206
+     * @return bool
207
+     */
208
+    public function json_in( $data ) {
209
+        $array = json_decode( $data );
210
+
211
+        if ( is_array( $array ) ) {
212
+            $this->container = $array;
213
+            return true;
214
+        }
215
+
216
+        return false;
217
+    }
218
+
219
+    /**
220
+     * Regenerate the current session's ID.
221
+     *
222
+     * @param bool $delete_old Flag whether or not to delete the old session data from the server.
223
+     */
224
+    public function regenerate_id( $delete_old = false ) {
225
+        if ( $delete_old ) {
226
+            delete_option( "_wp_session_{$this->session_id}" );
227
+        }
228
+
229
+        $this->session_id = $this->generate_id();
230
+
231
+        $this->set_cookie();
232
+    }
233
+
234
+    /**
235
+     * Check if a session has been initialized.
236
+     *
237
+     * @return bool
238
+     */
239
+    public function session_started() {
240
+        return !!self::$instance;
241
+    }
242
+
243
+    /**
244
+     * Return the read-only cache expiration value.
245
+     *
246
+     * @return int
247
+     */
248
+    public function cache_expiration() {
249
+        return $this->expires;
250
+    }
251
+
252
+    /**
253
+     * Flushes all session variables.
254
+     */
255
+    public function reset() {
256
+        $this->container = array();
257
+    }
258
+
259
+    /*****************************************************************/
260
+    /*                     Iterator Implementation                   */
261
+    /*****************************************************************/
262
+
263
+    /**
264
+     * Current position of the array.
265
+     *
266
+     * @link http://php.net/manual/en/iterator.current.php
267
+     *
268
+     * @return mixed
269
+     */
270
+    public function current() {
271
+        return current( $this->container );
272
+    }
273
+
274
+    /**
275
+     * Key of the current element.
276
+     *
277
+     * @link http://php.net/manual/en/iterator.key.php
278
+     *
279
+     * @return mixed
280
+     */
281
+    public function key() {
282
+        return key( $this->container );
283
+    }
284
+
285
+    /**
286
+     * Move the internal point of the container array to the next item
287
+     *
288
+     * @link http://php.net/manual/en/iterator.next.php
289
+     *
290
+     * @return void
291
+     */
292
+    public function next() {
293
+        next( $this->container );
294
+    }
295
+
296
+    /**
297
+     * Rewind the internal point of the container array.
298
+     *
299
+     * @link http://php.net/manual/en/iterator.rewind.php
300
+     *
301
+     * @return void
302
+     */
303
+    public function rewind() {
304
+        reset( $this->container );
305
+    }
306
+
307
+    /**
308
+     * Is the current key valid?
309
+     *
310
+     * @link http://php.net/manual/en/iterator.rewind.php
311
+     *
312
+     * @return bool
313
+     */
314
+    public function valid() {
315
+        return $this->offsetExists( $this->key() );
316
+    }
317
+
318
+    /*****************************************************************/
319
+    /*                    Countable Implementation                   */
320
+    /*****************************************************************/
321
+
322
+    /**
323
+     * Get the count of elements in the container array.
324
+     *
325
+     * @link http://php.net/manual/en/countable.count.php
326
+     *
327
+     * @return int
328
+     */
329
+    public function count() {
330
+        return count( $this->container );
331
+    }
332 332
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if (!defined('ABSPATH')) exit;
15 15
 
16 16
 /**
17 17
  * WordPress Session class for managing user session data.
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return bool|WP_Session
57 57
 	 */
58 58
 	public static function get_instance() {
59
-		if ( ! self::$instance ) {
59
+		if (!self::$instance) {
60 60
 			self::$instance = new self();
61 61
 		}
62 62
 
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	 * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire.
73 73
 	 */
74 74
 	protected function __construct() {
75
-		if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) {
76
-			$cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] );
77
-			$cookie_crumbs = explode( '||', $cookie );
75
+		if (isset($_COOKIE[WP_SESSION_COOKIE])) {
76
+			$cookie = stripslashes($_COOKIE[WP_SESSION_COOKIE]);
77
+			$cookie_crumbs = explode('||', $cookie);
78 78
 
79
-			if( $this->is_valid_md5( $cookie_crumbs[0] ) ) {
79
+			if ($this->is_valid_md5($cookie_crumbs[0])) {
80 80
 
81 81
 				$this->session_id = $cookie_crumbs[0];
82 82
 
83 83
 			} else {
84 84
 
85
-				$this->regenerate_id( true );
85
+				$this->regenerate_id(true);
86 86
 
87 87
 			}
88 88
 
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 			$this->exp_variant = $cookie_crumbs[2];
91 91
 
92 92
 			// Update the session expiration if we're past the variant time
93
-			if ( time() > $this->exp_variant ) {
93
+			if (time() > $this->exp_variant) {
94 94
 				$this->set_expiration();
95
-				delete_option( "_wp_session_expires_{$this->session_id}" );
96
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
95
+				delete_option("_wp_session_expires_{$this->session_id}");
96
+				add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
97 97
 			}
98 98
 		} else {
99 99
 			$this->session_id = $this->generate_id();
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 	 * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
126 126
 	 */
127 127
 	protected function set_expiration() {
128
-		$this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
129
-		$this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
128
+		$this->exp_variant = time() + (int) apply_filters('wp_session_expiration_variant', 24 * 60);
129
+		$this->expires = time() + (int) apply_filters('wp_session_expiration', 30 * 60);
130 130
 	}
131 131
 
132 132
 	/**
133 133
 	 * Set the session cookie
134 134
 	 */
135 135
 	protected function set_cookie() {
136
-		@setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
136
+		@setcookie(WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant, $this->expires, COOKIEPATH, COOKIE_DOMAIN);
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 	 * @return string
143 143
 	 */
144 144
 	protected function generate_id() {
145
-		require_once( ABSPATH . 'wp-includes/class-phpass.php');
146
-		$hasher = new PasswordHash( 8, false );
145
+		require_once(ABSPATH . 'wp-includes/class-phpass.php');
146
+		$hasher = new PasswordHash(8, false);
147 147
 
148
-		return md5( $hasher->get_random_bytes( 32 ) );
148
+		return md5($hasher->get_random_bytes(32));
149 149
 	}
150 150
 
151 151
 	/**
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 * @param string $md5
155 155
 	 * @return int
156 156
 	 */
157
-	protected function is_valid_md5( $md5 = '' ){
158
-		return preg_match( '/^[a-f0-9]{32}$/', $md5 );
157
+	protected function is_valid_md5($md5 = '') {
158
+		return preg_match('/^[a-f0-9]{32}$/', $md5);
159 159
 	}
160 160
 
161 161
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return array
167 167
 	 */
168 168
 	protected function read_data() {
169
-		$this->container = get_option( "_wp_session_{$this->session_id}", array() );
169
+		$this->container = get_option("_wp_session_{$this->session_id}", array());
170 170
 
171 171
 		return $this->container;
172 172
 	}
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
 		$option_key = "_wp_session_{$this->session_id}";
179 179
 
180 180
 		// Only write the collection to the DB if it's changed.
181
-		if ( $this->dirty ) {
182
-			if ( false === get_option( $option_key ) ) {
183
-				add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
184
-				add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' );
181
+		if ($this->dirty) {
182
+			if (false === get_option($option_key)) {
183
+				add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
184
+				add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no');
185 185
 			} else {
186
-				delete_option( "_wp_session_{$this->session_id}" );
187
-				add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' );
186
+				delete_option("_wp_session_{$this->session_id}");
187
+				add_option("_wp_session_{$this->session_id}", $this->container, '', 'no');
188 188
 			}
189 189
 		}
190 190
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @return string
196 196
 	 */
197 197
 	public function json_out() {
198
-		return json_encode( $this->container );
198
+		return json_encode($this->container);
199 199
 	}
200 200
 
201 201
 	/**
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return bool
207 207
 	 */
208
-	public function json_in( $data ) {
209
-		$array = json_decode( $data );
208
+	public function json_in($data) {
209
+		$array = json_decode($data);
210 210
 
211
-		if ( is_array( $array ) ) {
211
+		if (is_array($array)) {
212 212
 			$this->container = $array;
213 213
 			return true;
214 214
 		}
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @param bool $delete_old Flag whether or not to delete the old session data from the server.
223 223
 	 */
224
-	public function regenerate_id( $delete_old = false ) {
225
-		if ( $delete_old ) {
226
-			delete_option( "_wp_session_{$this->session_id}" );
224
+	public function regenerate_id($delete_old = false) {
225
+		if ($delete_old) {
226
+			delete_option("_wp_session_{$this->session_id}");
227 227
 		}
228 228
 
229 229
 		$this->session_id = $this->generate_id();
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return mixed
269 269
 	 */
270 270
 	public function current() {
271
-		return current( $this->container );
271
+		return current($this->container);
272 272
 	}
273 273
 
274 274
 	/**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return mixed
280 280
 	 */
281 281
 	public function key() {
282
-		return key( $this->container );
282
+		return key($this->container);
283 283
 	}
284 284
 
285 285
 	/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @return void
291 291
 	 */
292 292
 	public function next() {
293
-		next( $this->container );
293
+		next($this->container);
294 294
 	}
295 295
 
296 296
 	/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 * @return void
302 302
 	 */
303 303
 	public function rewind() {
304
-		reset( $this->container );
304
+		reset($this->container);
305 305
 	}
306 306
 
307 307
 	/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 * @return bool
313 313
 	 */
314 314
 	public function valid() {
315
-		return $this->offsetExists( $this->key() );
315
+		return $this->offsetExists($this->key());
316 316
 	}
317 317
 
318 318
 	/*****************************************************************/
@@ -327,6 +327,6 @@  discard block
 block discarded – undo
327 327
 	 * @return int
328 328
 	 */
329 329
 	public function count() {
330
-		return count( $this->container );
330
+		return count($this->container);
331 331
 	}
332 332
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) exit;
14
+if ( ! defined( 'ABSPATH' ) ) {
15
+    exit;
16
+}
15 17
 
16 18
 /**
17 19
  * Return the current cache expire setting.
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2203,7 +2203,7 @@
 block discarded – undo
2203 2203
  * @global object $wpdb WordPress Database object.
2204 2204
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2205 2205
  * @param int $attachment_id Attachment ID.
2206
- * @return bool|void Returns false on failure.
2206
+ * @return false|null Returns false on failure.
2207 2207
  */
2208 2208
 function geodirectory_before_featured_image_delete($attachment_id)
2209 2209
 {
Please login to merge, or discard this patch.
Braces   +93 added lines, -75 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 add_filter('query_vars', 'geodir_add_location_var');
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89
-if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
89
+if (get_option('permalink_structure') != '') {
90
+    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91
+}
91 92
 
92 93
 add_filter('parse_query', 'geodir_modified_query');
93 94
 
@@ -420,8 +421,9 @@  discard block
 block discarded – undo
420 421
      */
421 422
     do_action('geodir_after_social_sharing_buttons');
422 423
     $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
424
+    if (trim($content_html) != '') {
425
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
426
+    }
425 427
     if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426 428
         /**
427 429
          * Filter the geodir_social_sharing_buttons() function content.
@@ -467,8 +469,9 @@  discard block
 block discarded – undo
467 469
      */
468 470
     do_action('geodir_after_share_this_button');
469 471
     $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+    if (trim($content_html) != '') {
473
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
474
+    }
472 475
     if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473 476
         /**
474 477
          * Filter the geodir_share_this_button() function content.
@@ -526,8 +529,9 @@  discard block
 block discarded – undo
526 529
      */
527 530
     do_action('geodir_after_edit_post_link');
528 531
     $content_html = ob_get_clean();
529
-    if (trim($content_html) != '')
530
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
532
+    if (trim($content_html) != '') {
533
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
534
+    }
531 535
     if ((int)get_option('geodir_disable_user_links_section') != 1) {
532 536
         /**
533 537
          * Filter the geodir_edit_post_link() function content.
@@ -1080,8 +1084,9 @@  discard block
 block discarded – undo
1080 1084
      */
1081 1085
     do_action('geodir_after_google_analytics');
1082 1086
     $content_html = ob_get_clean();
1083
-    if (trim($content_html) != '')
1084
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1087
+    if (trim($content_html) != '') {
1088
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1089
+    }
1085 1090
     if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1086 1091
         /**
1087 1092
          * Filter the geodir_edit_post_link() function content.
@@ -1216,8 +1221,9 @@  discard block
 block discarded – undo
1216 1221
     do_action('geodir_after_detail_page_more_info');
1217 1222
 
1218 1223
     $content_html = ob_get_clean();
1219
-    if (trim($content_html) != '')
1220
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1224
+    if (trim($content_html) != '') {
1225
+            $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1226
+    }
1221 1227
     if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1222 1228
         /**
1223 1229
          * Filter the output html for function geodir_detail_page_more_info().
@@ -1322,8 +1328,9 @@  discard block
 block discarded – undo
1322 1328
     $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1323 1329
 
1324 1330
     foreach ($arr_alert_msg as $key => $value) {
1325
-        if (!is_scalar($value))
1326
-            continue;
1331
+        if (!is_scalar($value)) {
1332
+                    continue;
1333
+        }
1327 1334
         $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1328 1335
     }
1329 1336
 
@@ -1377,17 +1384,19 @@  discard block
 block discarded – undo
1377 1384
     global $geodir_sidebars;
1378 1385
     global $sidebars_widgets;
1379 1386
 
1380
-    if (!is_array($sidebars_widgets))
1381
-        $sidebars_widgets = wp_get_sidebars_widgets();
1387
+    if (!is_array($sidebars_widgets)) {
1388
+            $sidebars_widgets = wp_get_sidebars_widgets();
1389
+    }
1382 1390
     $geodir_old_sidebars = array();
1383 1391
 
1384 1392
     if (is_array($geodir_sidebars)) {
1385 1393
         foreach ($geodir_sidebars as $val) {
1386 1394
             if (is_array($sidebars_widgets)) {
1387
-                if (array_key_exists($val, $sidebars_widgets))
1388
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1389
-                else
1390
-                    $geodir_old_sidebars[$val] = array();
1395
+                if (array_key_exists($val, $sidebars_widgets)) {
1396
+                                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1397
+                } else {
1398
+                                    $geodir_old_sidebars[$val] = array();
1399
+                }
1391 1400
             }
1392 1401
         }
1393 1402
     }
@@ -1408,8 +1417,9 @@  discard block
 block discarded – undo
1408 1417
 {
1409 1418
     global $sidebars_widgets;
1410 1419
 
1411
-    if (!is_array($sidebars_widgets))
1412
-        $sidebars_widgets = wp_get_sidebars_widgets();
1420
+    if (!is_array($sidebars_widgets)) {
1421
+            $sidebars_widgets = wp_get_sidebars_widgets();
1422
+    }
1413 1423
 
1414 1424
     if (is_array($sidebars_widgets)) {
1415 1425
         $geodir_old_sidebars = get_option('geodir_sidebars');
@@ -1551,20 +1561,25 @@  discard block
 block discarded – undo
1551 1561
 
1552 1562
     global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1553 1563
 
1554
-    if ($tab == 'post_info')
1555
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1564
+    if ($tab == 'post_info') {
1565
+            $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1566
+    }
1556 1567
 
1557
-    if ($tab == 'post_images')
1558
-        $is_display = (!empty($post_images)) ? true : false;
1568
+    if ($tab == 'post_images') {
1569
+            $is_display = (!empty($post_images)) ? true : false;
1570
+    }
1559 1571
 
1560
-    if ($tab == 'post_video')
1561
-        $is_display = (!empty($video)) ? true : false;
1572
+    if ($tab == 'post_video') {
1573
+            $is_display = (!empty($video)) ? true : false;
1574
+    }
1562 1575
 
1563
-    if ($tab == 'special_offers')
1564
-        $is_display = (!empty($special_offers)) ? true : false;
1576
+    if ($tab == 'special_offers') {
1577
+            $is_display = (!empty($special_offers)) ? true : false;
1578
+    }
1565 1579
 
1566
-    if ($tab == 'reviews')
1567
-        $is_display = (geodir_is_page('detail')) ? true : false;
1580
+    if ($tab == 'reviews') {
1581
+            $is_display = (geodir_is_page('detail')) ? true : false;
1582
+    }
1568 1583
 
1569 1584
     if ($tab == 'related_listing') {
1570 1585
        $message = __('No listings found which match your selection.', 'geodirectory');
@@ -1840,11 +1855,13 @@  discard block
 block discarded – undo
1840 1855
     $region_slug = $default_location->region_slug;
1841 1856
     $city_slug = $default_location->city_slug;
1842 1857
 
1843
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1844
-        return $slug_exists = true;
1858
+    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) {
1859
+            return $slug_exists = true;
1860
+    }
1845 1861
 
1846
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1847
-        return $slug_exists = true;
1862
+    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) {
1863
+            return $slug_exists = true;
1864
+    }
1848 1865
 
1849 1866
     return $slug_exists;
1850 1867
 }
@@ -1886,40 +1903,31 @@  discard block
 block discarded – undo
1886 1903
     if(geodir_is_page('home')){
1887 1904
         $gd_page = 'home';
1888 1905
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1889
-    }
1890
-    elseif(geodir_is_page('detail')){
1906
+    } elseif(geodir_is_page('detail')){
1891 1907
         $gd_page = 'detail';
1892 1908
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1893
-    }
1894
-    elseif(geodir_is_page('pt')){
1909
+    } elseif(geodir_is_page('pt')){
1895 1910
         $gd_page = 'pt';
1896 1911
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1897
-    }
1898
-    elseif(geodir_is_page('listing')){
1912
+    } elseif(geodir_is_page('listing')){
1899 1913
         $gd_page = 'listing';
1900 1914
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1901
-    }
1902
-    elseif(geodir_is_page('location')){
1915
+    } elseif(geodir_is_page('location')){
1903 1916
         $gd_page = 'location';
1904 1917
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1905
-    }
1906
-    elseif(geodir_is_page('search')){
1918
+    } elseif(geodir_is_page('search')){
1907 1919
         $gd_page = 'search';
1908 1920
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1909
-    }
1910
-    elseif(geodir_is_page('add-listing')){
1921
+    } elseif(geodir_is_page('add-listing')){
1911 1922
         $gd_page = 'add-listing';
1912 1923
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1913
-    }
1914
-    elseif(geodir_is_page('author')){
1924
+    } elseif(geodir_is_page('author')){
1915 1925
         $gd_page = 'author';
1916 1926
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1917
-    }
1918
-    elseif(geodir_is_page('login')){
1927
+    } elseif(geodir_is_page('login')){
1919 1928
         $gd_page = 'login';
1920 1929
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1921
-    }
1922
-    elseif(geodir_is_page('listing-success')){
1930
+    } elseif(geodir_is_page('listing-success')){
1923 1931
         $gd_page = 'listing-success';
1924 1932
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1925 1933
     }
@@ -1994,11 +2002,13 @@  discard block
 block discarded – undo
1994 2002
 
1995 2003
     if (!get_option('geodir_remove_url_seperator')) {
1996 2004
 
1997
-        if (get_option('geodir_listingurl_separator'))
1998
-            delete_option('geodir_listingurl_separator');
2005
+        if (get_option('geodir_listingurl_separator')) {
2006
+                    delete_option('geodir_listingurl_separator');
2007
+        }
1999 2008
 
2000
-        if (get_option('geodir_detailurl_separator'))
2001
-            delete_option('geodir_detailurl_separator');
2009
+        if (get_option('geodir_detailurl_separator')) {
2010
+                    delete_option('geodir_detailurl_separator');
2011
+        }
2002 2012
 
2003 2013
         flush_rewrite_rules(false);
2004 2014
 
@@ -2022,8 +2032,9 @@  discard block
 block discarded – undo
2022 2032
 {
2023 2033
     foreach ($permalink_arr as $key => $value) {
2024 2034
 
2025
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
2026
-            unset($permalink_arr[$key]);
2035
+        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') {
2036
+                    unset($permalink_arr[$key]);
2037
+        }
2027 2038
 
2028 2039
     }
2029 2040
 
@@ -2156,16 +2167,18 @@  discard block
 block discarded – undo
2156 2167
 
2157 2168
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2158 2169
 
2159
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2160
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2170
+            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') {
2171
+                            $tabs_arr['post_video']['heading_text'] = $field_title;
2172
+            }
2161 2173
         }
2162 2174
 
2163 2175
         if (array_key_exists('special_offers', $tabs_arr)) {
2164 2176
 
2165 2177
             $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2166 2178
 
2167
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2168
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2179
+            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') {
2180
+                            $tabs_arr['special_offers']['heading_text'] = $field_title;
2181
+            }
2169 2182
         }
2170 2183
 
2171 2184
     }
@@ -2220,8 +2233,9 @@  discard block
 block discarded – undo
2220 2233
 
2221 2234
         $all_postypes = geodir_get_posttypes();
2222 2235
 
2223
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2224
-            return false;
2236
+        if (!in_array($post_type, $all_postypes) || !is_admin()) {
2237
+                    return false;
2238
+        }
2225 2239
 
2226 2240
         $uploads = wp_upload_dir();
2227 2241
 
@@ -2295,8 +2309,9 @@  discard block
 block discarded – undo
2295 2309
                         $file_info = pathinfo($attach->file);
2296 2310
 
2297 2311
                         $sub_dir = '';
2298
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2299
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2312
+                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
2313
+                                                    $sub_dir = stripslashes_deep($file_info['dirname']);
2314
+                        }
2300 2315
 
2301 2316
                         $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2302 2317
                         $uploads_baseurl = $uploads['baseurl'];
@@ -2318,8 +2333,9 @@  discard block
 block discarded – undo
2318 2333
 
2319 2334
                     if (!empty($attachment_data)) {
2320 2335
 
2321
-                        if ($attachment_data->ID)
2322
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2336
+                        if ($attachment_data->ID) {
2337
+                                                    $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2338
+                        }
2323 2339
 
2324 2340
                     } else {
2325 2341
 
@@ -2605,9 +2621,10 @@  discard block
 block discarded – undo
2605 2621
                             break;
2606 2622
                         case 'time': {
2607 2623
                             $value = '';
2608
-                            if ($post->$type['htmlvar_name'] != '')
2609
-                                //$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2610
-                                $value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2624
+                            if ($post->$type['htmlvar_name'] != '') {
2625
+                                                            //$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2626
+                                $value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2627
+                            }
2611 2628
 
2612 2629
                             if (strpos($field_icon, 'http') !== false) {
2613 2630
                                 $field_icon_af = '';
@@ -2642,8 +2659,9 @@  discard block
 block discarded – undo
2642 2659
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2643 2660
 
2644 2661
                             $value = '';
2645
-                            if ($post->$type['htmlvar_name'] != '')
2646
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2662
+                            if ($post->$type['htmlvar_name'] != '') {
2663
+                                                            $value = date($date_format, strtotime($post_htmlvar_value));
2664
+                            }
2647 2665
 
2648 2666
                             if (strpos($field_icon, 'http') !== false) {
2649 2667
                                 $field_icon_af = '';
Please login to merge, or discard this patch.
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -1134,9 +1134,9 @@  discard block
 block discarded – undo
1134 1134
         $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1135 1135
         $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1136 1136
        
1137
-	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1137
+        $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1138 1138
 	   
1139
-	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1139
+        $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1140 1140
 
1141 1141
         $html .= '<span class="item">';
1142 1142
         $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
@@ -1250,13 +1250,13 @@  discard block
 block discarded – undo
1250 1250
         $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1251 1251
     }
1252 1252
 	
1253
-	/**
1254
-	 * Filter the allowed image type extensions for post images.
1255
-	 *
1256
-	 * @since 1.4.7.1
1257
-	 * @param string $allowed_img_types The image type extensions array.
1258
-	 */
1259
-	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1253
+    /**
1254
+     * Filter the allowed image type extensions for post images.
1255
+     *
1256
+     * @since 1.4.7.1
1257
+     * @param string $allowed_img_types The image type extensions array.
1258
+     */
1259
+    $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1260 1260
 	
1261 1261
     $arr_alert_msg = array(
1262 1262
         'geodir_plugin_url' => geodir_plugin_url(),
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
         'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1305 1305
         'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1306 1306
         'geodir_action_remove' => __('Remove', 'geodirectory'),
1307
-		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1308
-		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1309
-		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1310
-		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1311
-		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1312
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1313
-		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1307
+        'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1308
+        'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1309
+        'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1310
+        'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1311
+        'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1312
+        'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1313
+        'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1314 1314
     );
1315 1315
 
1316 1316
     /**
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
  * @global object $gd_session GeoDirectory Session object.
1497 1497
  */
1498 1498
 function geodir_after_main_form_fields() {
1499
-	global $gd_session;
1499
+    global $gd_session;
1500 1500
 	
1501 1501
     if (get_option('geodir_accept_term_condition')) {
1502 1502
         global $post;
@@ -1569,13 +1569,13 @@  discard block
 block discarded – undo
1569 1569
         $is_display = (geodir_is_page('detail')) ? true : false;
1570 1570
 
1571 1571
     if ($tab == 'related_listing') {
1572
-       $message = __('No listings found which match your selection.', 'geodirectory');
1572
+        $message = __('No listings found which match your selection.', 'geodirectory');
1573 1573
 	   
1574
-	   /** This action is documented in geodirectory-functions/template_functions.php */
1575
-	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1574
+        /** This action is documented in geodirectory-functions/template_functions.php */
1575
+        $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
1576 1576
 	   
1577
-	   $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1578
-	}
1577
+        $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true;
1578
+    }
1579 1579
 
1580 1580
 
1581 1581
     return $is_display;
@@ -1622,12 +1622,12 @@  discard block
 block discarded – undo
1622 1622
 function geodir_changes_in_custom_fields_table() {
1623 1623
     global $wpdb, $plugin_prefix;
1624 1624
 	
1625
-	// Remove unused virtual page
1626
-	$listings_page_id = (int)get_option('geodir_listing_page');
1627
-	if ($listings_page_id) {
1628
-		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1625
+    // Remove unused virtual page
1626
+    $listings_page_id = (int)get_option('geodir_listing_page');
1627
+    if ($listings_page_id) {
1628
+        $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1629 1629
         delete_option('geodir_listing_page');
1630
-	}
1630
+    }
1631 1631
 
1632 1632
     // updated custom field table(add field to show custom field as a tab)
1633 1633
     /*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) {
@@ -1795,26 +1795,26 @@  discard block
 block discarded – undo
1795 1795
 
1796 1796
     }
1797 1797
 	
1798
-	// Update tag in detail table.
1799
-	$taxonomy_obj = get_taxonomy($taxonomy);
1800
-	$post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1798
+    // Update tag in detail table.
1799
+    $taxonomy_obj = get_taxonomy($taxonomy);
1800
+    $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL;
1801 1801
 	
1802
-	$post_types = geodir_get_posttypes();
1803
-	if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1804
-		$posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1802
+    $post_types = geodir_get_posttypes();
1803
+    if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) {		
1804
+        $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id)));
1805 1805
 		
1806
-		if (!empty($posts_obj)) {
1807
-			foreach ($posts_obj as $post_obj) {
1808
-				$post_id = $post_obj->object_id;
1806
+        if (!empty($posts_obj)) {
1807
+            foreach ($posts_obj as $post_obj) {
1808
+                $post_id = $post_obj->object_id;
1809 1809
 				
1810
-				$raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1811
-				$post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1810
+                $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names'));
1811
+                $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : '';
1812 1812
 				
1813
-				$listing_table = $plugin_prefix . $post_type . '_detail';
1814
-				$wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1815
-			}
1816
-		}
1817
-	}
1813
+                $listing_table = $plugin_prefix . $post_type . '_detail';
1814
+                $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id)));
1815
+            }
1816
+        }
1817
+    }
1818 1818
 }
1819 1819
 
1820 1820
 
@@ -2037,14 +2037,14 @@  discard block
 block discarded – undo
2037 2037
     add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
2038 2038
 }
2039 2039
 /**
2040
- * Set status from draft to publish.
2041
- *
2042
- * @since 1.0.0
2043
- * @package GeoDirectory
2044
- * @global object $wp WordPress object.
2045
- * @param object $post Post object.
2046
- * @return object Modified post object.
2047
- */
2040
+     * Set status from draft to publish.
2041
+     *
2042
+     * @since 1.0.0
2043
+     * @package GeoDirectory
2044
+     * @global object $wp WordPress object.
2045
+     * @param object $post Post object.
2046
+     * @return object Modified post object.
2047
+     */
2048 2048
 function geodir_set_status_draft_to_publish_for_own_post($post)
2049 2049
 {
2050 2050
     global $wp;
@@ -2475,7 +2475,7 @@  discard block
 block discarded – undo
2475 2475
             foreach ($custom_fields as $field) {
2476 2476
                 $field = stripslashes_deep($field); // strip slashes
2477 2477
 				
2478
-				$type = $field;
2478
+                $type = $field;
2479 2479
                 $field_name = $field['htmlvar_name'];
2480 2480
                 if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2481 2481
                     $post->$field_name = $_REQUEST[$field_name];
@@ -2563,11 +2563,11 @@  discard block
 block discarded – undo
2563 2563
                                 $field_icon = '';
2564 2564
                             }
2565 2565
 							
2566
-							$a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2566
+                            $a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2567 2567
 
2568
-							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2569
-							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2570
-							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2568
+                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2569
+                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2570
+                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2571 2571
 
2572 2572
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2573 2573
 
@@ -2686,26 +2686,26 @@  discard block
 block discarded – undo
2686 2686
                             break;
2687 2687
                         case 'radio': {
2688 2688
 
2689
-							if ($post->$type['htmlvar_name'] != '') {
2690
-								if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2689
+                            if ($post->$type['htmlvar_name'] != '') {
2690
+                                if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2691 2691
                                     $html_val = __('No', 'geodirectory');
2692 2692
                                 } else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2693 2693
                                     $html_val = __('Yes', 'geodirectory');
2694 2694
                                 } else {
2695
-									$html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2695
+                                    $html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2696 2696
 									
2697
-									if (!empty($type['option_values'])) {
2698
-										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2697
+                                    if (!empty($type['option_values'])) {
2698
+                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2699 2699
 										
2700
-										if (!empty($cf_option_values)) {
2701
-											foreach ($cf_option_values as $cf_option_value) {
2702
-												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2703
-													$html_val = $cf_option_value['label'];
2704
-												}
2705
-											}
2706
-										}
2707
-									}
2708
-								}
2700
+                                        if (!empty($cf_option_values)) {
2701
+                                            foreach ($cf_option_values as $cf_option_value) {
2702
+                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2703
+                                                    $html_val = $cf_option_value['label'];
2704
+                                                }
2705
+                                            }
2706
+                                        }
2707
+                                    }
2708
+                                }
2709 2709
 
2710 2710
                                 if (strpos($field_icon, 'http') !== false) {
2711 2711
                                     $field_icon_af = '';
@@ -2771,19 +2771,19 @@  discard block
 block discarded – undo
2771 2771
                                 $field_icon = '';
2772 2772
                             }
2773 2773
 							
2774
-							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2774
+                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2775 2775
 							
2776
-							if (!empty($type['option_values'])) {
2777
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2776
+                            if (!empty($type['option_values'])) {
2777
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2778 2778
 								
2779
-								if (!empty($cf_option_values)) {
2780
-									foreach ($cf_option_values as $cf_option_value) {
2781
-										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2782
-											$field_value = $cf_option_value['label'];
2783
-										}
2784
-									}
2785
-								}
2786
-							}
2779
+                                if (!empty($cf_option_values)) {
2780
+                                    foreach ($cf_option_values as $cf_option_value) {
2781
+                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2782
+                                            $field_value = $cf_option_value['label'];
2783
+                                        }
2784
+                                    }
2785
+                                }
2786
+                            }
2787 2787
 
2788 2788
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2789 2789
 
@@ -2811,16 +2811,16 @@  discard block
 block discarded – undo
2811 2811
                             $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2812 2812
 
2813 2813
                             $option_values = array();
2814
-							if (!empty($type['option_values'])) {
2815
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2814
+                            if (!empty($type['option_values'])) {
2815
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2816 2816
 								
2817
-								if (!empty($cf_option_values)) {
2818
-									foreach ($cf_option_values as $cf_option_value) {
2819
-										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2820
-											$option_values[] = $cf_option_value['label'];
2821
-										}
2822
-									}
2823
-								}
2817
+                                if (!empty($cf_option_values)) {
2818
+                                    foreach ($cf_option_values as $cf_option_value) {
2819
+                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2820
+                                            $option_values[] = $cf_option_value['label'];
2821
+                                        }
2822
+                                    }
2823
+                                }
2824 2824
                             }
2825 2825
 
2826 2826
                             $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
@@ -2908,9 +2908,9 @@  discard block
 block discarded – undo
2908 2908
 
2909 2909
                                 if (!empty($files)) {
2910 2910
                                     $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2911
-							   		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2911
+                                        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2912 2912
 							   
2913
-									$file_paths = '';
2913
+                                    $file_paths = '';
2914 2914
                                     foreach ($files as $file) {
2915 2915
                                         if (!empty($file)) {
2916 2916
                                             $filetype = wp_check_filetype($file);
@@ -2921,29 +2921,29 @@  discard block
 block discarded – undo
2921 2921
 
2922 2922
                                             $arr_file_type = wp_check_filetype($filename);
2923 2923
                                             if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2924
-												continue;
2925
-											}
2926
-											$uploaded_file_type = $arr_file_type['type'];
2927
-											$uploaded_file_ext = $arr_file_type['ext'];
2924
+                                                continue;
2925
+                                            }
2926
+                                            $uploaded_file_type = $arr_file_type['type'];
2927
+                                            $uploaded_file_ext = $arr_file_type['ext'];
2928 2928
 											
2929
-											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2930
-												continue; // Invalid file type.
2931
-											}
2929
+                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2930
+                                                continue; // Invalid file type.
2931
+                                            }
2932 2932
 
2933 2933
                                             //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2934
-											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2934
+                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2935 2935
 
2936 2936
                                             // If the uploaded file is image
2937 2937
                                             if (in_array($uploaded_file_type, $image_file_types)) {
2938 2938
                                                 $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2939
-												$file_paths .= '<a href="'.$file.'">';
2940
-												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2941
-												$file_paths .= '</a>';
2942
-												$file_paths .= '</div>';
2939
+                                                $file_paths .= '<a href="'.$file.'">';
2940
+                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2941
+                                                $file_paths .= '</a>';
2942
+                                                $file_paths .= '</div>';
2943 2943
                                             } else {
2944
-                                               $ext_path = '_' . $html_var . '_';
2945
-                                               $filename = explode($ext_path, $filename);
2946
-                                               $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2944
+                                                $ext_path = '_' . $html_var . '_';
2945
+                                                $filename = explode($ext_path, $filename);
2946
+                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2947 2947
                                             }
2948 2948
                                         }
2949 2949
                                     }
@@ -3286,34 +3286,34 @@  discard block
 block discarded – undo
3286 3286
  * @return array Translation texts.
3287 3287
  */
3288 3288
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3289
-	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3289
+    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3290 3290
 	
3291
-	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content');
3291
+    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content');
3292 3292
 	
3293
-	/**
3294
-	 * Filters the geodirectory option names that requires to add for translation.
3295
-	 *
3296
-	 * @since 1.5.7
3297
-	 * @package GeoDirectory
3298
-	 *
3299
-	 * @param  array $gd_options Array of option names.
3300
-	 */
3301
-	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3302
-	$gd_options = array_unique($gd_options);
3293
+    /**
3294
+     * Filters the geodirectory option names that requires to add for translation.
3295
+     *
3296
+     * @since 1.5.7
3297
+     * @package GeoDirectory
3298
+     *
3299
+     * @param  array $gd_options Array of option names.
3300
+     */
3301
+    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3302
+    $gd_options = array_unique($gd_options);
3303 3303
 	
3304
-	if (!empty($gd_options)) {
3305
-		foreach ($gd_options as $gd_option) {
3306
-			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3307
-				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3304
+    if (!empty($gd_options)) {
3305
+        foreach ($gd_options as $gd_option) {
3306
+            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3307
+                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3308 3308
 				
3309
-				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3310
-					$translation_texts[] = stripslashes_deep($option_value);
3311
-				}
3312
-			}
3313
-		}
3314
-	}
3309
+                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3310
+                    $translation_texts[] = stripslashes_deep($option_value);
3311
+                }
3312
+            }
3313
+        }
3314
+    }
3315 3315
 	
3316
-	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3316
+    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3317 3317
 
3318 3318
     return $translation_texts;
3319 3319
 }
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 /* ON TEMPLATE INCLUDE */
137 137
 /////////////////////////
138 138
 
139
-add_filter('template_include', 'geodir_template_loader',9);
139
+add_filter('template_include', 'geodir_template_loader', 9);
140 140
 
141 141
 /////////////////////////
142 142
 /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 ////////////////////////
178 178
 
179 179
 add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100);
180
-add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3);
180
+add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3);
181 181
 add_action('created_term', 'geodir_term_review_count_force_update', 100);
182 182
 add_action('edited_term', 'geodir_term_review_count_force_update', 100);
183 183
 add_action('delete_term', 'geodir_term_review_count_force_update', 100);
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
 /////// GEO DIRECOTORY CUSTOM HOOKS ///
321 321
 
322
-add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content 
323
-add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content
322
+add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content 
323
+add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content
324 324
 
325 325
 // Detail page sidebar content 
326 326
 add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1);
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     $content_html = ob_get_clean();
423 423
     if (trim($content_html) != '')
424 424
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
425
+    if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) {
426 426
         /**
427 427
          * Filter the geodir_social_sharing_buttons() function content.
428 428
          *
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     $content_html = ob_get_clean();
470 470
     if (trim($content_html) != '')
471 471
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
472
+    if ((int) get_option('geodir_disable_sharethis_button_section') != 1) {
473 473
         /**
474 474
          * Filter the geodir_share_this_button() function content.
475 475
          *
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
     $content_html = ob_get_clean();
529 529
     if (trim($content_html) != '')
530 530
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
531
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
531
+    if ((int) get_option('geodir_disable_user_links_section') != 1) {
532 532
         /**
533 533
          * Filter the geodir_edit_post_link() function content.
534 534
          *
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
     $id = trim(get_option('geodir_ga_id'));
559 559
 
560
-    if(!$id){return;}//if no Google Analytics ID then bail.
560
+    if (!$id) {return; }//if no Google Analytics ID then bail.
561 561
 
562 562
     ob_start(); // Start buffering;
563 563
     /**
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
      * @since 1.0.0
567 567
      */
568 568
     do_action('geodir_before_google_analytics');
569
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
569
+    if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) {
570 570
         $page_url = $_SERVER['REQUEST_URI'];
571 571
         //$page_url = "/";
572 572
         ?>
@@ -594,13 +594,13 @@  discard block
 block discarded – undo
594 594
 
595 595
             function gdga_weekVSweek(){
596 596
 
597
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisweek", success: function(result){
597
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisweek", success: function(result){
598 598
                     ga_data1 = jQuery.parseJSON(result);
599 599
                     if(ga_data1.error){jQuery('#ga_stats').html(result);return;}
600 600
                     gd_renderWeekOverWeekChart();
601 601
                 }});
602 602
 
603
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastweek", success: function(result){
603
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastweek", success: function(result){
604 604
                     ga_data2 = jQuery.parseJSON(result);
605 605
                     gd_renderWeekOverWeekChart();
606 606
                 }});
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 
611 611
             function gdga_yearVSyear(){
612 612
 
613
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisyear", success: function(result){
613
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisyear", success: function(result){
614 614
                     ga_data3 = jQuery.parseJSON(result);
615 615
                     if(ga_data3.error){jQuery('#ga_stats').html(result);return;}
616 616
 
617 617
                     gd_renderYearOverYearChart()
618 618
                 }});
619 619
 
620
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastyear", success: function(result){
620
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastyear", success: function(result){
621 621
                     ga_data4 = jQuery.parseJSON(result);
622 622
                     gd_renderYearOverYearChart()
623 623
                 }});
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 
628 628
             function gdga_country(){
629 629
 
630
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=country", success: function(result){
630
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=country", success: function(result){
631 631
                     ga_data5 = jQuery.parseJSON(result);
632 632
                     if(ga_data5.error){jQuery('#ga_stats').html(result);return;}
633 633
                     gd_renderTopCountriesChart();
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
             function gdga_realtime(){
639 639
 
640
-                jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=realtime", success: function(result){
640
+                jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=realtime", success: function(result){
641 641
                     ga_data6 = jQuery.parseJSON(result);
642 642
                     if(ga_data6.error){jQuery('#ga_stats').html(result);return;}
643 643
                     gd_renderRealTime();
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
             }
709 709
 
710 710
             function gdga_noResults(){
711
-                jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>');
711
+                jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>');
712 712
                 jQuery('#gdga-legend-container').html('');
713 713
             }
714 714
 
@@ -746,18 +746,18 @@  discard block
 block discarded – undo
746 746
 
747 747
 
748 748
 
749
-                    var labels = ['<?php _e('Jan', 'geodirectory');?>',
750
-                        '<?php _e('Feb', 'geodirectory');?>',
751
-                        '<?php _e('Mar', 'geodirectory');?>',
752
-                        '<?php _e('Apr', 'geodirectory');?>',
753
-                        '<?php _e('May', 'geodirectory');?>',
754
-                        '<?php _e('Jun', 'geodirectory');?>',
755
-                        '<?php _e('Jul', 'geodirectory');?>',
756
-                        '<?php _e('Aug', 'geodirectory');?>',
757
-                        '<?php _e('Sep', 'geodirectory');?>',
758
-                        '<?php _e('Oct', 'geodirectory');?>',
759
-                        '<?php _e('Nov', 'geodirectory');?>',
760
-                        '<?php _e('Dec', 'geodirectory');?>'];
749
+                    var labels = ['<?php _e('Jan', 'geodirectory'); ?>',
750
+                        '<?php _e('Feb', 'geodirectory'); ?>',
751
+                        '<?php _e('Mar', 'geodirectory'); ?>',
752
+                        '<?php _e('Apr', 'geodirectory'); ?>',
753
+                        '<?php _e('May', 'geodirectory'); ?>',
754
+                        '<?php _e('Jun', 'geodirectory'); ?>',
755
+                        '<?php _e('Jul', 'geodirectory'); ?>',
756
+                        '<?php _e('Aug', 'geodirectory'); ?>',
757
+                        '<?php _e('Sep', 'geodirectory'); ?>',
758
+                        '<?php _e('Oct', 'geodirectory'); ?>',
759
+                        '<?php _e('Nov', 'geodirectory'); ?>',
760
+                        '<?php _e('Dec', 'geodirectory'); ?>'];
761 761
 
762 762
 
763 763
                     // Ensure the data arrays are at least as long as the labels array.
@@ -772,13 +772,13 @@  discard block
 block discarded – undo
772 772
                         labels : labels,
773 773
                         datasets : [
774 774
                             {
775
-                                label: '<?php _e('Last Year', 'geodirectory');?>',
775
+                                label: '<?php _e('Last Year', 'geodirectory'); ?>',
776 776
                                 fillColor : "rgba(220,220,220,0.5)",
777 777
                                 strokeColor : "rgba(220,220,220,1)",
778 778
                                 data : data2
779 779
                             },
780 780
                             {
781
-                                label: '<?php _e('This Year', 'geodirectory');?>',
781
+                                label: '<?php _e('This Year', 'geodirectory'); ?>',
782 782
                                 fillColor : "rgba(151,187,205,0.5)",
783 783
                                 strokeColor : "rgba(151,187,205,1)",
784 784
                                 data : data1
@@ -828,23 +828,23 @@  discard block
 block discarded – undo
828 828
 
829 829
                     <?php
830 830
                     // Here we list the shorthand days of the week so it can be used in translation.
831
-                    __("Mon",'geodirectory');
832
-                    __("Tue",'geodirectory');
833
-                    __("Wed",'geodirectory');
834
-                    __("Thu",'geodirectory');
835
-                    __("Fri",'geodirectory');
836
-                    __("Sat",'geodirectory');
837
-                    __("Sun",'geodirectory');
831
+                    __("Mon", 'geodirectory');
832
+                    __("Tue", 'geodirectory');
833
+                    __("Wed", 'geodirectory');
834
+                    __("Thu", 'geodirectory');
835
+                    __("Fri", 'geodirectory');
836
+                    __("Sat", 'geodirectory');
837
+                    __("Sun", 'geodirectory');
838 838
                     ?>
839 839
 
840 840
                     labels = [
841
-                        "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
842
-                        "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>",
843
-                        "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>",
844
-                        "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>",
845
-                        "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>",
846
-                        "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>",
847
-                        "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>"
841
+                        "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>",
842
+                        "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>",
843
+                        "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>",
844
+                        "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>",
845
+                        "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>",
846
+                        "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>",
847
+                        "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>"
848 848
                     ];
849 849
 
850 850
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
                         labels : labels,
854 854
                         datasets : [
855 855
                             {
856
-                                label: '<?php _e('Last Week', 'geodirectory');?>',
856
+                                label: '<?php _e('Last Week', 'geodirectory'); ?>',
857 857
                                 fillColor : "rgba(220,220,220,0.5)",
858 858
                                 strokeColor : "rgba(220,220,220,1)",
859 859
                                 pointColor : "rgba(220,220,220,1)",
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
                                 data : data2
862 862
                             },
863 863
                             {
864
-                                label: '<?php _e('This Week', 'geodirectory');?>',
864
+                                label: '<?php _e('This Week', 'geodirectory'); ?>',
865 865
                                 fillColor : "rgba(151,187,205,0.5)",
866 866
                                 strokeColor : "rgba(151,187,205,1)",
867 867
                                 pointColor : "rgba(151,187,205,1)",
@@ -1053,18 +1053,18 @@  discard block
 block discarded – undo
1053 1053
 
1054 1054
 
1055 1055
         <span id="ga_stats">
1056
-            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div>
1056
+            <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div>
1057 1057
 
1058 1058
             <div id="gd-active-users-container">
1059
-                <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory');?>
1059
+                <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory'); ?>
1060 1060
                     <b class="gd-ActiveUsers-value">0</b>
1061 1061
                 </div>
1062 1062
             </div>
1063 1063
 
1064 1064
             <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;">
1065
-                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option>
1066
-                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option>
1067
-                <option value="country"><?php _e("Top Countries", 'geodirectory');?></option>
1065
+                <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option>
1066
+                <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option>
1067
+                <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option>
1068 1068
             </select>
1069 1069
             <img alt="loader icon" id="gdga-loader-icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/ajax-loader.gif'; ?>" />
1070 1070
             <div class="Chartjs-figure" id="gdga-chart-container"></div>
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
     $content_html = ob_get_clean();
1083 1083
     if (trim($content_html) != '')
1084 1084
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1085
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1085
+    if ((int) get_option('geodir_disable_google_analytics_section') != 1) {
1086 1086
         /**
1087 1087
          * Filter the geodir_edit_post_link() function content.
1088 1088
          *
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
     if (trim($content_html) != '') {
1179 1179
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1180 1180
     }
1181
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1181
+    if ((int) get_option('geodir_disable_rating_info_section') != 1) {
1182 1182
         /**
1183 1183
          * Filter the geodir_detail_page_review_rating() function content.
1184 1184
          *
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
     $content_html = ob_get_clean();
1219 1219
     if (trim($content_html) != '')
1220 1220
         $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1221
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1221
+    if ((int) get_option('geodir_disable_listing_info_section') != 1) {
1222 1222
         /**
1223 1223
          * Filter the output html for function geodir_detail_page_more_info().
1224 1224
          *
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
1310 1310
 		'geodir_txt_form_wait' => __('Wait...', 'geodirectory'),
1311 1311
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1312
-		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1312
+		'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1313 1313
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1314 1314
     );
1315 1315
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
     foreach ($arr_alert_msg as $key => $value) {
1327 1327
         if (!is_scalar($value))
1328 1328
             continue;
1329
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1329
+        $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
1330 1330
     }
1331 1331
 
1332 1332
     $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
         global $post;
1503 1503
         $term_condition = '';
1504 1504
         if (isset($_REQUEST['backandedit'])) {
1505
-            $post = (object)$gd_session->get('listing');
1505
+            $post = (object) $gd_session->get('listing');
1506 1506
             $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1507 1507
         }
1508 1508
 
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
                     echo 'checked="checked"';
1517 1517
                 } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1518 1518
                        class="geodir_textfield" value="1"
1519
-                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1519
+                       style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1520 1520
 				</span>
1521 1521
             </div>
1522 1522
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
     global $wpdb, $plugin_prefix;
1624 1624
 	
1625 1625
 	// Remove unused virtual page
1626
-	$listings_page_id = (int)get_option('geodir_listing_page');
1626
+	$listings_page_id = (int) get_option('geodir_listing_page');
1627 1627
 	if ($listings_page_id) {
1628 1628
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1629 1629
         delete_option('geodir_listing_page');
@@ -1885,43 +1885,43 @@  discard block
 block discarded – undo
1885 1885
 
1886 1886
 
1887 1887
     $gd_page = '';
1888
-    if(geodir_is_page('home')){
1888
+    if (geodir_is_page('home')) {
1889 1889
         $gd_page = 'home';
1890 1890
         $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1891 1891
     }
1892
-    elseif(geodir_is_page('detail')){
1892
+    elseif (geodir_is_page('detail')) {
1893 1893
         $gd_page = 'detail';
1894 1894
         $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1895 1895
     }
1896
-    elseif(geodir_is_page('pt')){
1896
+    elseif (geodir_is_page('pt')) {
1897 1897
         $gd_page = 'pt';
1898 1898
         $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1899 1899
     }
1900
-    elseif(geodir_is_page('listing')){
1900
+    elseif (geodir_is_page('listing')) {
1901 1901
         $gd_page = 'listing';
1902 1902
         $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1903 1903
     }
1904
-    elseif(geodir_is_page('location')){
1904
+    elseif (geodir_is_page('location')) {
1905 1905
         $gd_page = 'location';
1906 1906
         $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1907 1907
     }
1908
-    elseif(geodir_is_page('search')){
1908
+    elseif (geodir_is_page('search')) {
1909 1909
         $gd_page = 'search';
1910 1910
         $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1911 1911
     }
1912
-    elseif(geodir_is_page('add-listing')){
1912
+    elseif (geodir_is_page('add-listing')) {
1913 1913
         $gd_page = 'add-listing';
1914 1914
         $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1915 1915
     }
1916
-    elseif(geodir_is_page('author')){
1916
+    elseif (geodir_is_page('author')) {
1917 1917
         $gd_page = 'author';
1918 1918
         $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1919 1919
     }
1920
-    elseif(geodir_is_page('login')){
1920
+    elseif (geodir_is_page('login')) {
1921 1921
         $gd_page = 'login';
1922 1922
         $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1923 1923
     }
1924
-    elseif(geodir_is_page('listing-success')){
1924
+    elseif (geodir_is_page('listing-success')) {
1925 1925
         $gd_page = 'listing-success';
1926 1926
         $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1927 1927
     }
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
  */
2186 2186
 function geodir_remove_template_redirect_actions()
2187 2187
 {
2188
-    if (geodir_is_page('login')){
2188
+    if (geodir_is_page('login')) {
2189 2189
         remove_all_actions('template_redirect');
2190 2190
         remove_action('init', 'avia_modify_front', 10);
2191 2191
     }
@@ -2636,8 +2636,8 @@  discard block
 block discarded – undo
2636 2636
                                 $date_format = $date_format['date_format'];
2637 2637
                             }
2638 2638
 
2639
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2640
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2639
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
2640
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
2641 2641
 
2642 2642
                             $date_format = str_replace($search, $replace, $date_format);
2643 2643
 
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
                             $html_var = $type['htmlvar_name'];
2733 2733
                             $html_val = $type['htmlvar_name'];
2734 2734
 
2735
-                            if ((int)$post->$html_var == 1) {
2735
+                            if ((int) $post->$html_var == 1) {
2736 2736
 
2737 2737
                                 if ($post->$type['htmlvar_name'] == '1') {
2738 2738
                                     $html_val = __('Yes', 'geodirectory');
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
 
2909 2909
                                 if (!empty($files)) {
2910 2910
                                     $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2911
-							   		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2911
+							   		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
2912 2912
 							   
2913 2913
 									$file_paths = '';
2914 2914
                                     foreach ($files as $file) {
@@ -2936,7 +2936,7 @@  discard block
 block discarded – undo
2936 2936
                                             // If the uploaded file is image
2937 2937
                                             if (in_array($uploaded_file_type, $image_file_types)) {
2938 2938
                                                 $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2939
-												$file_paths .= '<a href="'.$file.'">';
2939
+												$file_paths .= '<a href="' . $file . '">';
2940 2940
 												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2941 2941
 												$file_paths .= '</a>';
2942 2942
 												$file_paths .= '</div>';
@@ -3286,7 +3286,7 @@  discard block
 block discarded – undo
3286 3286
  * @return array Translation texts.
3287 3287
  */
3288 3288
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3289
-	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3289
+	$translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array();
3290 3290
 	
3291 3291
 	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content');
3292 3292
 	
Please login to merge, or discard this patch.
geodirectory-admin/admin_db_install.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
             if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
28 28
         }
29 29
 
30
-		/**
31
-		 * Include any functions needed for upgrades.
32
-		 *
33
-		 * @since 1.0.0
34
-		 */
35
-		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
30
+        /**
31
+         * Include any functions needed for upgrades.
32
+         *
33
+         * @since 1.0.0
34
+         */
35
+        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
36 36
 
37 37
 
38 38
 // rename tables if we need to
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,12 @@
 block discarded – undo
23 23
 
24 24
         $collate = '';
25 25
         if ($wpdb->has_cap('collation')) {
26
-            if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
27
-            if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
26
+            if (!empty($wpdb->charset)) {
27
+                $collate = "DEFAULT CHARACTER SET $wpdb->charset";
28
+            }
29
+            if (!empty($wpdb->collate)) {
30
+                $collate .= " COLLATE $wpdb->collate";
31
+            }
28 32
         }
29 33
 
30 34
 		/**
Please login to merge, or discard this patch.
geodirectory-admin/admin_install.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Installation related functions.
4
- *
5
- * Plugin install script which adds default pages, taxonomies, and database tables.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+     * GeoDirectory Installation related functions.
4
+     *
5
+     * Plugin install script which adds default pages, taxonomies, and database tables.
6
+     *
7
+     * @since 1.0.0
8
+     * @package GeoDirectory
9
+     */
10 10
 
11 11
 /**
12 12
  * Include custom database table related functions.
Please login to merge, or discard this patch.