@@ -40,8 +40,9 @@ |
||
| 40 | 40 | $geodir_active_nav_locations = get_nav_menu_locations(); |
| 41 | 41 | if (!empty($geodir_active_nav_locations) && is_array($geodir_active_nav_locations)) {
|
| 42 | 42 | foreach ($geodir_active_nav_locations as $key => $theme_location) {
|
| 43 | - if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) |
|
| 44 | - $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
| 43 | + if (!empty($geodir_all_nav_locations) && is_array($geodir_all_nav_locations) && array_key_exists($key, $geodir_all_nav_locations)) { |
|
| 44 | + $post_type_arr[$key] = $geodir_all_nav_locations[$key]; |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | } |
| 47 | 48 | |
@@ -11,10 +11,11 @@ discard block |
||
| 11 | 11 | $image_array = array(); |
| 12 | 12 | $post_meta = array(); |
| 13 | 13 | |
| 14 | -if (geodir_dummy_folder_exists()) |
|
| 15 | - $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
|
| 16 | -else |
|
| 17 | - $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
|
| 14 | +if (geodir_dummy_folder_exists()) { |
|
| 15 | + $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy"; |
|
| 16 | +} else { |
|
| 17 | + $dummy_image_url = 'http://www.wpgeodirectory.com/dummy'; |
|
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | switch ($dummy_post_index) {
|
| 20 | 21 | |
@@ -1807,16 +1808,18 @@ discard block |
||
| 1807 | 1808 | |
| 1808 | 1809 | foreach ($post_info as $post_info) {
|
| 1809 | 1810 | $default_location = geodir_get_default_location(); |
| 1810 | - if ($city_bound_lat1 > $city_bound_lat2) |
|
| 1811 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 1812 | - else |
|
| 1813 | - $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 1814 | - |
|
| 1815 | - |
|
| 1816 | - if ($city_bound_lng1 > $city_bound_lng2) |
|
| 1817 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 1818 | - else |
|
| 1819 | - $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 1811 | + if ($city_bound_lat1 > $city_bound_lat2) { |
|
| 1812 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat1, $city_bound_lat2), geodir_random_float($city_bound_lat2, $city_bound_lat1)); |
|
| 1813 | + } else { |
|
| 1814 | + $dummy_post_latitude = geodir_random_float(geodir_random_float($city_bound_lat2, $city_bound_lat1), geodir_random_float($city_bound_lat1, $city_bound_lat2)); |
|
| 1815 | + } |
|
| 1816 | + |
|
| 1817 | + |
|
| 1818 | + if ($city_bound_lng1 > $city_bound_lng2) { |
|
| 1819 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng1, $city_bound_lng2), geodir_random_float($city_bound_lng2, $city_bound_lng1)); |
|
| 1820 | + } else { |
|
| 1821 | + $dummy_post_longitude = geodir_random_float(geodir_random_float($city_bound_lng2, $city_bound_lng1), geodir_random_float($city_bound_lng1, $city_bound_lng2)); |
|
| 1822 | + } |
|
| 1820 | 1823 | $post_address = array(); |
| 1821 | 1824 | $postal_code = ''; |
| 1822 | 1825 | $address = ''; |
@@ -1831,28 +1834,32 @@ discard block |
||
| 1831 | 1834 | } |
| 1832 | 1835 | |
| 1833 | 1836 | if ($add_value->types[0] == 'street_number') {
|
| 1834 | - if ($address != '') |
|
| 1835 | - $address .= ',' . $add_value->long_name; |
|
| 1836 | - else |
|
| 1837 | - $address .= $add_value->long_name; |
|
| 1837 | + if ($address != '') { |
|
| 1838 | + $address .= ',' . $add_value->long_name; |
|
| 1839 | + } else { |
|
| 1840 | + $address .= $add_value->long_name; |
|
| 1841 | + } |
|
| 1838 | 1842 | } |
| 1839 | 1843 | if ($add_value->types[0] == 'route') {
|
| 1840 | - if ($address != '') |
|
| 1841 | - $address .= ',' . $add_value->long_name; |
|
| 1842 | - else |
|
| 1843 | - $address .= $add_value->long_name; |
|
| 1844 | + if ($address != '') { |
|
| 1845 | + $address .= ',' . $add_value->long_name; |
|
| 1846 | + } else { |
|
| 1847 | + $address .= $add_value->long_name; |
|
| 1848 | + } |
|
| 1844 | 1849 | } |
| 1845 | 1850 | if ($add_value->types[0] == 'neighborhood') {
|
| 1846 | - if ($address != '') |
|
| 1847 | - $address .= ',' . $add_value->long_name; |
|
| 1848 | - else |
|
| 1849 | - $address .= $add_value->long_name; |
|
| 1851 | + if ($address != '') { |
|
| 1852 | + $address .= ',' . $add_value->long_name; |
|
| 1853 | + } else { |
|
| 1854 | + $address .= $add_value->long_name; |
|
| 1855 | + } |
|
| 1850 | 1856 | } |
| 1851 | 1857 | if ($add_value->types[0] == 'sublocality') {
|
| 1852 | - if ($address != '') |
|
| 1853 | - $address .= ',' . $add_value->long_name; |
|
| 1854 | - else |
|
| 1855 | - $address .= $add_value->long_name; |
|
| 1858 | + if ($address != '') { |
|
| 1859 | + $address .= ',' . $add_value->long_name; |
|
| 1860 | + } else { |
|
| 1861 | + $address .= $add_value->long_name; |
|
| 1862 | + } |
|
| 1856 | 1863 | } |
| 1857 | 1864 | |
| 1858 | 1865 | } |
@@ -126,10 +126,11 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') {
|
| 129 | - if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) |
|
| 130 | - geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
| 131 | - else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) |
|
| 132 | - geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
| 129 | + if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) { |
|
| 130 | + geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); |
|
| 131 | + } else if (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) { |
|
| 132 | + geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); |
|
| 133 | + } |
|
| 133 | 134 | } |
| 134 | 135 | |
| 135 | 136 | if ((isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax') || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) {
|
@@ -151,22 +152,25 @@ discard block |
||
| 151 | 152 | if (current_user_can('manage_options')) {
|
| 152 | 153 | switch ($_REQUEST['geodir_autofill']): |
| 153 | 154 | case "geodir_dummy_delete" : |
| 154 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) |
|
| 155 | - return; |
|
| 155 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) { |
|
| 156 | + return; |
|
| 157 | + } |
|
| 156 | 158 | |
| 157 | - if (isset($_REQUEST['posttype'])) |
|
| 158 | - /** |
|
| 159 | + if (isset($_REQUEST['posttype'])) { |
|
| 160 | + /** |
|
| 159 | 161 | * Used to delete the dummy post data per post type. |
| 160 | 162 | * |
| 161 | 163 | * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype']. |
| 162 | 164 | * |
| 163 | 165 | * @since 1.0.0 |
| 164 | 166 | */ |
| 165 | - do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']);
|
|
| 167 | + do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); |
|
| 168 | + } |
|
| 166 | 169 | break; |
| 167 | 170 | case "geodir_dummy_insert" : |
| 168 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) |
|
| 169 | - return; |
|
| 171 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) { |
|
| 172 | + return; |
|
| 173 | + } |
|
| 170 | 174 | |
| 171 | 175 | global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
| 172 | 176 | $dummy_post_index = $_REQUEST['insert_dummy_post_index']; |
@@ -175,15 +179,16 @@ discard block |
||
| 175 | 179 | $city_bound_lat2 = $_REQUEST['city_bound_lat2']; |
| 176 | 180 | $city_bound_lng2 = $_REQUEST['city_bound_lng2']; |
| 177 | 181 | |
| 178 | - if (isset($_REQUEST['posttype'])) |
|
| 179 | - /** |
|
| 182 | + if (isset($_REQUEST['posttype'])) { |
|
| 183 | + /** |
|
| 180 | 184 | * Used to insert the dummy post data per post type. |
| 181 | 185 | * |
| 182 | 186 | * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype']. |
| 183 | 187 | * |
| 184 | 188 | * @since 1.0.0 |
| 185 | 189 | */ |
| 186 | - do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']);
|
|
| 190 | + do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); |
|
| 191 | + } |
|
| 187 | 192 | |
| 188 | 193 | break; |
| 189 | 194 | endswitch; |
@@ -204,8 +209,9 @@ discard block |
||
| 204 | 209 | |
| 205 | 210 | if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') {
|
| 206 | 211 | |
| 207 | - if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') |
|
| 208 | - require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'); |
|
| 212 | + if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') { |
|
| 213 | + require_once(geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'); |
|
| 214 | + } |
|
| 209 | 215 | |
| 210 | 216 | exit; |
| 211 | 217 | } |
@@ -266,8 +272,9 @@ discard block |
||
| 266 | 272 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 267 | 273 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
| 268 | 274 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
|
| 269 | - } else |
|
| 270 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 275 | + } else { |
|
| 276 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 277 | + } |
|
| 271 | 278 | |
| 272 | 279 | wp_redirect($redirect_to); |
| 273 | 280 | } else {
|
@@ -280,9 +287,9 @@ discard block |
||
| 280 | 287 | |
| 281 | 288 | $gd_session->un_set('listing');
|
| 282 | 289 | |
| 283 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) |
|
| 284 | - wp_redirect(get_permalink($_REQUEST['pid'])); |
|
| 285 | - else {
|
|
| 290 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) { |
|
| 291 | + wp_redirect(get_permalink($_REQUEST['pid'])); |
|
| 292 | + } else {
|
|
| 286 | 293 | geodir_remove_temp_images(); |
| 287 | 294 | wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type'])));
|
| 288 | 295 | } |
@@ -310,8 +317,9 @@ discard block |
||
| 310 | 317 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 311 | 318 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
| 312 | 319 | $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false);
|
| 313 | - } else |
|
| 314 | - $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 320 | + } else { |
|
| 321 | + $redirect_to = get_permalink(geodir_add_listing_page_id()); |
|
| 322 | + } |
|
| 315 | 323 | |
| 316 | 324 | $gd_session->un_set('listing');
|
| 317 | 325 | wp_redirect($redirect_to); |
@@ -333,8 +341,9 @@ discard block |
||
| 333 | 341 | $lastid = wp_delete_post($_REQUEST['pid']); |
| 334 | 342 | } |
| 335 | 343 | |
| 336 | - if ($lastid && !is_wp_error($lastid)) |
|
| 337 | - wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 344 | + if ($lastid && !is_wp_error($lastid)) { |
|
| 345 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
| 346 | + } |
|
| 338 | 347 | |
| 339 | 348 | //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) );
|
| 340 | 349 | } |
@@ -204,8 +204,9 @@ discard block |
||
| 204 | 204 | ############################################################# |
| 205 | 205 | function manage_category_custom_fields($deprecated, $column_name, $term_id) |
| 206 | 206 | { |
| 207 | - if ($column_name == 'cat_ID_num') |
|
| 208 | - echo $term_id; |
|
| 207 | + if ($column_name == 'cat_ID_num') { |
|
| 208 | + echo $term_id; |
|
| 209 | + } |
|
| 209 | 210 | |
| 210 | 211 | if ($column_name == 'cat_icon') { |
| 211 | 212 | $term_icon_url = get_tax_meta($term_id, 'ct_cat_icon'); |
@@ -214,9 +215,9 @@ discard block |
||
| 214 | 215 | |
| 215 | 216 | $file_info = pathinfo($term_icon_url['src']); |
| 216 | 217 | |
| 217 | - if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
| 218 | - $sub_dir = $file_info['dirname']; |
|
| 219 | - else{$sub_dir = '';} |
|
| 218 | + if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
| 219 | + $sub_dir = $file_info['dirname']; |
|
| 220 | + } else{$sub_dir = '';} |
|
| 220 | 221 | |
| 221 | 222 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
| 222 | 223 | $uploads_baseurl = $uploads['baseurl']; |
@@ -236,8 +237,9 @@ discard block |
||
| 236 | 237 | |
| 237 | 238 | if ($column_name == 'cat_default_img') { |
| 238 | 239 | $cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img'); |
| 239 | - if ($cat_default_img != '') |
|
| 240 | - echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; |
|
| 240 | + if ($cat_default_img != '') { |
|
| 241 | + echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>'; |
|
| 242 | + } |
|
| 241 | 243 | |
| 242 | 244 | } |
| 243 | 245 | } |
@@ -245,11 +247,12 @@ discard block |
||
| 245 | 247 | function geodir_get_default_catimage($term_id, $post_type = 'gd_place') |
| 246 | 248 | { |
| 247 | 249 | |
| 248 | - if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) |
|
| 249 | - return $cat_default_img; |
|
| 250 | - else |
|
| 251 | - return false; |
|
| 252 | -} |
|
| 250 | + if ($cat_default_img = get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) { |
|
| 251 | + return $cat_default_img; |
|
| 252 | + } else { |
|
| 253 | + return false; |
|
| 254 | + } |
|
| 255 | + } |
|
| 253 | 256 | |
| 254 | 257 | //Clear custom fields |
| 255 | 258 | add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field'); |
@@ -248,8 +248,9 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : ''; |
| 250 | 250 | |
| 251 | - if (!empty($comment_info)) |
|
| 252 | - $status = $comment_info->comment_approved; |
|
| 251 | + if (!empty($comment_info)) { |
|
| 252 | + $status = $comment_info->comment_approved; |
|
| 253 | + } |
|
| 253 | 254 | |
| 254 | 255 | if ($status == 'approve' || $status == 1) {
|
| 255 | 256 | $status = 1; |
@@ -381,12 +382,14 @@ discard block |
||
| 381 | 382 | function geodir_wrap_comment_text($content, $comment = '') |
| 382 | 383 | {
|
| 383 | 384 | $rating = 0; |
| 384 | - if (!empty($comment)) |
|
| 385 | - $rating = geodir_get_commentoverall($comment->comment_ID); |
|
| 385 | + if (!empty($comment)) { |
|
| 386 | + $rating = geodir_get_commentoverall($comment->comment_ID); |
|
| 387 | + } |
|
| 386 | 388 | if ($rating != 0 && !is_admin()) {
|
| 387 | 389 | return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
|
| 388 | - } else |
|
| 389 | - return $content; |
|
| 390 | + } else { |
|
| 391 | + return $content; |
|
| 392 | + } |
|
| 390 | 393 | |
| 391 | 394 | } |
| 392 | 395 | |
@@ -475,11 +478,12 @@ discard block |
||
| 475 | 478 | $post_ratings = get_post_meta($post_id, 'overall_rating'); |
| 476 | 479 | } |
| 477 | 480 | |
| 478 | - if ($post_ratings) |
|
| 479 | - return $post_ratings; |
|
| 480 | - else |
|
| 481 | - return false; |
|
| 482 | -} |
|
| 481 | + if ($post_ratings) { |
|
| 482 | + return $post_ratings; |
|
| 483 | + } else { |
|
| 484 | + return false; |
|
| 485 | + } |
|
| 486 | + } |
|
| 483 | 487 | |
| 484 | 488 | |
| 485 | 489 | /** |
@@ -504,11 +508,12 @@ discard block |
||
| 504 | 508 | ) |
| 505 | 509 | ); |
| 506 | 510 | |
| 507 | - if (!empty($reatings)) |
|
| 508 | - return $reatings; |
|
| 509 | - else |
|
| 510 | - return false; |
|
| 511 | -} |
|
| 511 | + if (!empty($reatings)) { |
|
| 512 | + return $reatings; |
|
| 513 | + } else { |
|
| 514 | + return false; |
|
| 515 | + } |
|
| 516 | + } |
|
| 512 | 517 | |
| 513 | 518 | /** |
| 514 | 519 | * Get review total of a Post. |
@@ -532,11 +537,12 @@ discard block |
||
| 532 | 537 | ) |
| 533 | 538 | ); |
| 534 | 539 | |
| 535 | - if (!empty($results)) |
|
| 536 | - return $results; |
|
| 537 | - else |
|
| 538 | - return false; |
|
| 539 | -} |
|
| 540 | + if (!empty($results)) { |
|
| 541 | + return $results; |
|
| 542 | + } else { |
|
| 543 | + return false; |
|
| 544 | + } |
|
| 545 | + } |
|
| 540 | 546 | |
| 541 | 547 | /** |
| 542 | 548 | * Get review count by user ID. |
@@ -559,11 +565,12 @@ discard block |
||
| 559 | 565 | ) |
| 560 | 566 | ); |
| 561 | 567 | |
| 562 | - if (!empty($results)) |
|
| 563 | - return $results; |
|
| 564 | - else |
|
| 565 | - return false; |
|
| 566 | -} |
|
| 568 | + if (!empty($results)) { |
|
| 569 | + return $results; |
|
| 570 | + } else { |
|
| 571 | + return false; |
|
| 572 | + } |
|
| 573 | + } |
|
| 567 | 574 | |
| 568 | 575 | /** |
| 569 | 576 | * Get average overall rating of a Post. |
@@ -597,11 +604,12 @@ discard block |
||
| 597 | 604 | ) |
| 598 | 605 | ); |
| 599 | 606 | |
| 600 | - if (!empty($results)) |
|
| 601 | - return $results; |
|
| 602 | - else |
|
| 603 | - return false; |
|
| 604 | -} |
|
| 607 | + if (!empty($results)) { |
|
| 608 | + return $results; |
|
| 609 | + } else { |
|
| 610 | + return false; |
|
| 611 | + } |
|
| 612 | + } |
|
| 605 | 613 | |
| 606 | 614 | /** |
| 607 | 615 | * Get review count of a Post. |
@@ -625,11 +633,12 @@ discard block |
||
| 625 | 633 | ) |
| 626 | 634 | ); |
| 627 | 635 | |
| 628 | - if (!empty($results)) |
|
| 629 | - return $results; |
|
| 630 | - else |
|
| 631 | - return false; |
|
| 632 | -} |
|
| 636 | + if (!empty($results)) { |
|
| 637 | + return $results; |
|
| 638 | + } else { |
|
| 639 | + return false; |
|
| 640 | + } |
|
| 641 | + } |
|
| 633 | 642 | |
| 634 | 643 | /** |
| 635 | 644 | * Get comments count of a Post. |
@@ -655,11 +664,12 @@ discard block |
||
| 655 | 664 | ); |
| 656 | 665 | |
| 657 | 666 | |
| 658 | - if (!empty($results)) |
|
| 659 | - return $results; |
|
| 660 | - else |
|
| 661 | - return false; |
|
| 662 | -} |
|
| 667 | + if (!empty($results)) { |
|
| 668 | + return $results; |
|
| 669 | + } else { |
|
| 670 | + return false; |
|
| 671 | + } |
|
| 672 | + } |
|
| 663 | 673 | |
| 664 | 674 | /** |
| 665 | 675 | * Get overall rating of a comment. |
@@ -683,11 +693,12 @@ discard block |
||
| 683 | 693 | ) |
| 684 | 694 | ); |
| 685 | 695 | |
| 686 | - if ($reatings) |
|
| 687 | - return $reatings; |
|
| 688 | - else |
|
| 689 | - return false; |
|
| 690 | -} |
|
| 696 | + if ($reatings) { |
|
| 697 | + return $reatings; |
|
| 698 | + } else { |
|
| 699 | + return false; |
|
| 700 | + } |
|
| 701 | + } |
|
| 691 | 702 | |
| 692 | 703 | /** |
| 693 | 704 | * Returns average overall rating of a Post. Depreciated since ver 1.3.6. |
@@ -930,8 +941,9 @@ discard block |
||
| 930 | 941 | $active_tabs = get_option('geodir_detail_page_tabs_excluded');
|
| 931 | 942 | |
| 932 | 943 | $is_display = true; |
| 933 | - if (!empty($active_tabs) && in_array('reviews', $active_tabs))
|
|
| 934 | - $is_display = false; |
|
| 944 | + if (!empty($active_tabs) && in_array('reviews', $active_tabs)) { |
|
| 945 | + $is_display = false; |
|
| 946 | + } |
|
| 935 | 947 | |
| 936 | 948 | /** |
| 937 | 949 | * Filter to change display value. |
@@ -106,24 +106,30 @@ discard block |
||
| 106 | 106 | $listing_slug = htmlentities(trim($_REQUEST['geodir_listing_prefix'])); |
| 107 | 107 | |
| 108 | 108 | if ($post_type == 'gd_place') {
|
| 109 | - if (array_key_exists('has_archive', $args))
|
|
| 110 | - $args['has_archive'] = $listing_slug; |
|
| 109 | + if (array_key_exists('has_archive', $args)) { |
|
| 110 | + $args['has_archive'] = $listing_slug; |
|
| 111 | + } |
|
| 111 | 112 | |
| 112 | 113 | if (array_key_exists('rewrite', $args)) {
|
| 113 | - if (array_key_exists('slug', $args['rewrite']))
|
|
| 114 | - $args['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 114 | + if (array_key_exists('slug', $args['rewrite'])) { |
|
| 115 | + $args['rewrite']['slug'] = $listing_slug; |
|
| 116 | + } |
|
| 117 | + // . '/%gd_taxonomy%'; |
|
| 115 | 118 | } |
| 116 | 119 | |
| 117 | 120 | $geodir_post_types = get_option('geodir_post_types');
|
| 118 | 121 | |
| 119 | 122 | if (array_key_exists($post_type, $geodir_post_types)) {
|
| 120 | 123 | |
| 121 | - if (array_key_exists('has_archive', $geodir_post_types[$post_type]))
|
|
| 122 | - $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
| 124 | + if (array_key_exists('has_archive', $geodir_post_types[$post_type])) { |
|
| 125 | + $geodir_post_types[$post_type]['has_archive'] = $listing_slug; |
|
| 126 | + } |
|
| 123 | 127 | |
| 124 | - if (array_key_exists('rewrite', $geodir_post_types[$post_type]))
|
|
| 125 | - if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
|
|
| 126 | - $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug;// . '/%gd_taxonomy%'; |
|
| 128 | + if (array_key_exists('rewrite', $geodir_post_types[$post_type])) { |
|
| 129 | + if (array_key_exists('slug', $geodir_post_types[$post_type]['rewrite']))
|
|
| 130 | + $geodir_post_types[$post_type]['rewrite']['slug'] = $listing_slug; |
|
| 131 | + } |
|
| 132 | + // . '/%gd_taxonomy%'; |
|
| 127 | 133 | |
| 128 | 134 | update_option('geodir_post_types', $geodir_post_types);
|
| 129 | 135 | |
@@ -138,10 +144,11 @@ discard block |
||
| 138 | 144 | if (array_key_exists('listing_slug', $geodir_taxonomies[$post_type . 'category'])) {
|
| 139 | 145 | $geodir_taxonomies[$post_type . 'category']['listing_slug'] = $listing_slug; |
| 140 | 146 | |
| 141 | - if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category']))
|
|
| 142 | - if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
|
|
| 147 | + if (array_key_exists('args', $geodir_taxonomies[$post_type . 'category'])) { |
|
| 148 | + if (array_key_exists('rewrite', $geodir_taxonomies[$post_type . 'category']['args']))
|
|
| 143 | 149 | if (array_key_exists('slug', $geodir_taxonomies[$post_type . 'category']['args']['rewrite']))
|
| 144 | - $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
| 150 | + $geodir_taxonomies[$post_type . 'category']['args']['rewrite']['slug'] = $listing_slug; |
|
| 151 | + } |
|
| 145 | 152 | |
| 146 | 153 | update_option('geodir_taxonomies', $geodir_taxonomies);
|
| 147 | 154 | |
@@ -152,10 +159,11 @@ discard block |
||
| 152 | 159 | if (array_key_exists('listing_slug', $geodir_taxonomies_tag[$post_type . '_tags'])) {
|
| 153 | 160 | $geodir_taxonomies_tag[$post_type . '_tags']['listing_slug'] = $listing_slug . '/tags'; |
| 154 | 161 | |
| 155 | - if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags']))
|
|
| 156 | - if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
|
|
| 162 | + if (array_key_exists('args', $geodir_taxonomies_tag[$post_type . '_tags'])) { |
|
| 163 | + if (array_key_exists('rewrite', $geodir_taxonomies_tag[$post_type . '_tags']['args']))
|
|
| 157 | 164 | if (array_key_exists('slug', $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']))
|
| 158 | - $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
| 165 | + $geodir_taxonomies_tag[$post_type . '_tags']['args']['rewrite']['slug'] = $listing_slug . '/tags'; |
|
| 166 | + } |
|
| 159 | 167 | |
| 160 | 168 | update_option('geodir_taxonomies', $geodir_taxonomies_tag);
|
| 161 | 169 | |
@@ -221,8 +229,9 @@ discard block |
||
| 221 | 229 | global $wpdb; |
| 222 | 230 | $location_prefix = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_type='page' AND ID=%d", $location_page));
|
| 223 | 231 | } |
| 224 | - if (!isset($location_prefix)) |
|
| 225 | - $location_prefix = 'location'; |
|
| 232 | + if (!isset($location_prefix)) { |
|
| 233 | + $location_prefix = 'location'; |
|
| 234 | + } |
|
| 226 | 235 | |
| 227 | 236 | $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
|
| 228 | 237 | if ($location_manager) {
|
@@ -441,14 +450,17 @@ discard block |
||
| 441 | 450 | $gd_country = ''; |
| 442 | 451 | $gd_region = ''; |
| 443 | 452 | $gd_city = ''; |
| 444 | - if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') |
|
| 445 | - $gd_country = urldecode($wp->query_vars['gd_country']); |
|
| 453 | + if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') { |
|
| 454 | + $gd_country = urldecode($wp->query_vars['gd_country']); |
|
| 455 | + } |
|
| 446 | 456 | |
| 447 | - if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') |
|
| 448 | - $gd_region = urldecode($wp->query_vars['gd_region']); |
|
| 457 | + if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') { |
|
| 458 | + $gd_region = urldecode($wp->query_vars['gd_region']); |
|
| 459 | + } |
|
| 449 | 460 | |
| 450 | - if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') |
|
| 451 | - $gd_city = urldecode($wp->query_vars['gd_city']); |
|
| 461 | + if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') { |
|
| 462 | + $gd_city = urldecode($wp->query_vars['gd_city']); |
|
| 463 | + } |
|
| 452 | 464 | |
| 453 | 465 | if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
|
| 454 | 466 | $default_location = geodir_get_default_location(); |
@@ -456,17 +468,19 @@ discard block |
||
| 456 | 468 | if (get_option('geodir_add_location_url')) {
|
| 457 | 469 | if ($geodir_show_location_url != 'all') {
|
| 458 | 470 | if ($gd_region == '') {
|
| 459 | - if ($gd_ses_region = $gd_session->get('gd_region'))
|
|
| 460 | - $gd_region = $gd_ses_region; |
|
| 461 | - else |
|
| 462 | - $gd_region = $default_location->region_slug; |
|
| 471 | + if ($gd_ses_region = $gd_session->get('gd_region')) { |
|
| 472 | + $gd_region = $gd_ses_region; |
|
| 473 | + } else { |
|
| 474 | + $gd_region = $default_location->region_slug; |
|
| 475 | + } |
|
| 463 | 476 | } |
| 464 | 477 | |
| 465 | 478 | if ($gd_city == '') {
|
| 466 | - if ($gd_ses_city = $gd_session->get('gd_city'))
|
|
| 467 | - $gd_city = $gd_ses_city; |
|
| 468 | - else |
|
| 469 | - $gd_city = $default_location->city_slug; |
|
| 479 | + if ($gd_ses_city = $gd_session->get('gd_city')) { |
|
| 480 | + $gd_city = $gd_ses_city; |
|
| 481 | + } else { |
|
| 482 | + $gd_city = $default_location->city_slug; |
|
| 483 | + } |
|
| 470 | 484 | |
| 471 | 485 | $base_location_link = geodir_get_location_link('base');
|
| 472 | 486 | wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city); |
@@ -585,8 +599,9 @@ discard block |
||
| 585 | 599 | |
| 586 | 600 | |
| 587 | 601 | $geodir_term = str_replace('/' . $geodir_last_term, '', $geodir_term, $post_title_replace_count);
|
| 588 | - if (!$post_title_replace_count) |
|
| 589 | - $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); |
|
| 602 | + if (!$post_title_replace_count) { |
|
| 603 | + $geodir_term = str_replace($geodir_last_term, '', $geodir_term, $post_title_replace_count); |
|
| 604 | + } |
|
| 590 | 605 | $geodir_terms = explode('/', $geodir_term);
|
| 591 | 606 | $geodir_last_term = end($geodir_terms); |
| 592 | 607 | |
@@ -622,8 +637,9 @@ discard block |
||
| 622 | 637 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
| 623 | 638 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && |
| 624 | 639 | geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city) |
| 625 | - ) |
|
| 626 | - $is_geodir_location_found = true; |
|
| 640 | + ) { |
|
| 641 | + $is_geodir_location_found = true; |
|
| 642 | + } |
|
| 627 | 643 | |
| 628 | 644 | // if location has not been found for country , region and city then search for country and region only |
| 629 | 645 | |
@@ -631,8 +647,9 @@ discard block |
||
| 631 | 647 | $gd_city = ''; |
| 632 | 648 | if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && |
| 633 | 649 | geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) |
| 634 | - ) |
|
| 635 | - $is_geodir_location_found = true; |
|
| 650 | + ) { |
|
| 651 | + $is_geodir_location_found = true; |
|
| 652 | + } |
|
| 636 | 653 | |
| 637 | 654 | } |
| 638 | 655 | |
@@ -640,8 +657,9 @@ discard block |
||
| 640 | 657 | if (!$is_geodir_location_found) {
|
| 641 | 658 | $gd_city = ''; |
| 642 | 659 | $gd_region = ''; |
| 643 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
| 644 | - $is_geodir_location_found = true; |
|
| 660 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { |
|
| 661 | + $is_geodir_location_found = true; |
|
| 662 | + } |
|
| 645 | 663 | } |
| 646 | 664 | } else if ($geodir_show_location_url == 'country_city') {
|
| 647 | 665 | if (count($geodir_terms) >= 2) {
|
@@ -651,17 +669,19 @@ discard block |
||
| 651 | 669 | $gd_country = urldecode($geodir_terms[0]); |
| 652 | 670 | } |
| 653 | 671 | |
| 654 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 655 | - $is_geodir_location_found = true; |
|
| 672 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { |
|
| 673 | + $is_geodir_location_found = true; |
|
| 674 | + } |
|
| 656 | 675 | |
| 657 | 676 | // if location has not been found for country and city then search for country only |
| 658 | 677 | if (!$is_geodir_location_found) {
|
| 659 | 678 | $gd_city = ''; |
| 660 | 679 | |
| 661 | - if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) |
|
| 662 | - $is_geodir_location_found = true; |
|
| 680 | + if (geodir_strtolower($default_location->country_slug) == geodir_strtolower($gd_country)) { |
|
| 681 | + $is_geodir_location_found = true; |
|
| 682 | + } |
|
| 663 | 683 | } |
| 664 | - } else if ($geodir_show_location_url == 'region_city') {
|
|
| 684 | + } else if ($geodir_show_location_url == 'region_city') {
|
|
| 665 | 685 | if (count($geodir_terms) >= 2) {
|
| 666 | 686 | $gd_region = urldecode($geodir_terms[0]); |
| 667 | 687 | $gd_city = urldecode($geodir_terms[1]); |
@@ -669,15 +689,17 @@ discard block |
||
| 669 | 689 | $gd_region = urldecode($geodir_terms[0]); |
| 670 | 690 | } |
| 671 | 691 | |
| 672 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) |
|
| 673 | - $is_geodir_location_found = true; |
|
| 692 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region) && geodir_strtolower($default_location->city_slug) == geodir_strtolower($gd_city)) { |
|
| 693 | + $is_geodir_location_found = true; |
|
| 694 | + } |
|
| 674 | 695 | |
| 675 | 696 | // if location has not been found for region and city then search for region only |
| 676 | 697 | if (!$is_geodir_location_found) {
|
| 677 | 698 | $gd_city = ''; |
| 678 | 699 | |
| 679 | - if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) |
|
| 680 | - $is_geodir_location_found = true; |
|
| 700 | + if (geodir_strtolower($default_location->region_slug) == geodir_strtolower($gd_region)) { |
|
| 701 | + $is_geodir_location_found = true; |
|
| 702 | + } |
|
| 681 | 703 | } |
| 682 | 704 | } else {
|
| 683 | 705 | $gd_city = $geodir_terms[0]; |
@@ -719,14 +741,17 @@ discard block |
||
| 719 | 741 | |
| 720 | 742 | $wp->query_vars[$geodir_taxonomy] = $geodir_term; |
| 721 | 743 | // eliminate location related terms from taxonomy term |
| 722 | - if ($gd_country != '') |
|
| 723 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 744 | + if ($gd_country != '') { |
|
| 745 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_country) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
| 746 | + } |
|
| 724 | 747 | |
| 725 | - if ($gd_region != '') |
|
| 726 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 748 | + if ($gd_region != '') { |
|
| 749 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_region) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
| 750 | + } |
|
| 727 | 751 | |
| 728 | - if ($gd_city != '') |
|
| 729 | - $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1);
|
|
| 752 | + if ($gd_city != '') { |
|
| 753 | + $wp->query_vars[$geodir_taxonomy] = preg_replace('/' . urlencode($gd_city) . '/', '', $wp->query_vars[$geodir_taxonomy], 1); |
|
| 754 | + } |
|
| 730 | 755 | |
| 731 | 756 | |
| 732 | 757 | $wp->query_vars[$geodir_taxonomy] = str_replace('///', '', $wp->query_vars[$geodir_taxonomy]);
|
@@ -762,27 +787,34 @@ discard block |
||
| 762 | 787 | if (get_option('geodir_add_location_url')) {
|
| 763 | 788 | if ($geodir_show_location_url == 'all') {
|
| 764 | 789 | } else if ($geodir_show_location_url == 'country_city') {
|
| 765 | - if (isset($wp->query_vars['gd_region'])) |
|
| 766 | - $wp->query_vars['gd_region'] = ''; |
|
| 790 | + if (isset($wp->query_vars['gd_region'])) { |
|
| 791 | + $wp->query_vars['gd_region'] = ''; |
|
| 792 | + } |
|
| 767 | 793 | } else if ($geodir_show_location_url == 'region_city') {
|
| 768 | - if (isset($wp->query_vars['gd_country'])) |
|
| 769 | - $wp->query_vars['gd_country'] = ''; |
|
| 794 | + if (isset($wp->query_vars['gd_country'])) { |
|
| 795 | + $wp->query_vars['gd_country'] = ''; |
|
| 796 | + } |
|
| 770 | 797 | } else {
|
| 771 | - if (isset($wp->query_vars['gd_country'])) |
|
| 772 | - $wp->query_vars['gd_country'] = ''; |
|
| 798 | + if (isset($wp->query_vars['gd_country'])) { |
|
| 799 | + $wp->query_vars['gd_country'] = ''; |
|
| 800 | + } |
|
| 773 | 801 | |
| 774 | - if (isset($wp->query_vars['gd_region'])) |
|
| 775 | - $wp->query_vars['gd_region'] = ''; |
|
| 802 | + if (isset($wp->query_vars['gd_region'])) { |
|
| 803 | + $wp->query_vars['gd_region'] = ''; |
|
| 804 | + } |
|
| 776 | 805 | } |
| 777 | 806 | } else {
|
| 778 | - if (isset($wp->query_vars['gd_country'])) |
|
| 779 | - $wp->query_vars['gd_country'] = ''; |
|
| 807 | + if (isset($wp->query_vars['gd_country'])) { |
|
| 808 | + $wp->query_vars['gd_country'] = ''; |
|
| 809 | + } |
|
| 780 | 810 | |
| 781 | - if (isset($wp->query_vars['gd_region'])) |
|
| 782 | - $wp->query_vars['gd_region'] = ''; |
|
| 811 | + if (isset($wp->query_vars['gd_region'])) { |
|
| 812 | + $wp->query_vars['gd_region'] = ''; |
|
| 813 | + } |
|
| 783 | 814 | |
| 784 | - if (isset($wp->query_vars['gd_city'])) |
|
| 785 | - $wp->query_vars['gd_city'] = ''; |
|
| 815 | + if (isset($wp->query_vars['gd_city'])) { |
|
| 816 | + $wp->query_vars['gd_city'] = ''; |
|
| 817 | + } |
|
| 786 | 818 | } |
| 787 | 819 | } |
| 788 | 820 | |
@@ -894,8 +926,9 @@ discard block |
||
| 894 | 926 | function geodir_exclude_page_where($where) |
| 895 | 927 | {
|
| 896 | 928 | global $wpdb; |
| 897 | - if (is_admin()) |
|
| 898 | - $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
| 929 | + if (is_admin()) { |
|
| 930 | + $where .= " AND $wpdb->posts.post_status != 'virtual'"; |
|
| 931 | + } |
|
| 899 | 932 | |
| 900 | 933 | return $where; |
| 901 | 934 | } |
@@ -76,22 +76,19 @@ discard block |
||
| 76 | 76 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-6 day"));}
|
| 77 | 77 | if(!$ga_end){$ga_end = date('Y-m-d');}
|
| 78 | 78 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 79 | - }elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 79 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastweek'){
|
|
| 80 | 80 | if(!$ga_start){$ga_start = date('Y-m-d', strtotime("-13 day"));}
|
| 81 | 81 | if(!$ga_end){$ga_end = date('Y-m-d', strtotime("-7 day"));}
|
| 82 | 82 | $dimensions = "&dimensions=ga:date,ga:nthDay"; |
| 83 | - } |
|
| 84 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 83 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='thisyear'){
|
|
| 85 | 84 | if(!$ga_start){$ga_start = date('Y')."-01-01";}
|
| 86 | 85 | if(!$ga_end){$ga_end = date('Y-m-d');}
|
| 87 | 86 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 88 | - } |
|
| 89 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 87 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='lastyear'){
|
|
| 90 | 88 | if(!$ga_start){$ga_start = date('Y', strtotime("-1 year"))."-01-01";}
|
| 91 | 89 | if(!$ga_end){$ga_end = date('Y', strtotime("-1 year"))."-12-31";}
|
| 92 | 90 | $dimensions = "&dimensions=ga:month,ga:nthMonth"; |
| 93 | - } |
|
| 94 | - elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 91 | + } elseif(isset($_REQUEST['ga_type']) && $_REQUEST['ga_type']=='country'){
|
|
| 95 | 92 | if(!$ga_start){$ga_start = "14daysAgo";}
|
| 96 | 93 | if(!$ga_end){$ga_end = "yesterday";}
|
| 97 | 94 | $dimensions = "&dimensions=ga:country&sort=-ga:pageviews&max-results=5"; |
@@ -144,7 +141,7 @@ discard block |
||
| 144 | 141 | if(!empty($response['response']['code']) && $response['response']['code']==200) {//access token is valid
|
| 145 | 142 | |
| 146 | 143 | return $at; |
| 147 | - }else{//else get new access token
|
|
| 144 | + } else{//else get new access token
|
|
| 148 | 145 | |
| 149 | 146 | $refresh_at = get_option('gd_ga_refresh_token');
|
| 150 | 147 | if(!$refresh_at){
|
@@ -167,7 +164,7 @@ discard block |
||
| 167 | 164 | update_option('gd_ga_access_token', $parts->access_token);
|
| 168 | 165 | return $parts->access_token; |
| 169 | 166 | |
| 170 | - }else{
|
|
| 167 | + } else{
|
|
| 171 | 168 | echo json_encode(array('error'=>__('Login failed', 'geodirectory')));exit;
|
| 172 | 169 | } |
| 173 | 170 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $slug = $post->post_name; |
| 154 | 154 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 155 | 155 | $login_url = trailingslashit($home_url)."$slug/"; |
| 156 | - }else{ |
|
| 156 | + } else{ |
|
| 157 | 157 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $slug = $post->post_name; |
| 203 | 203 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 204 | 204 | $info_url = trailingslashit($home_url)."$slug/"; |
| 205 | - }else{ |
|
| 205 | + } else{ |
|
| 206 | 206 | $info_url = trailingslashit($home_url); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -107,11 +107,13 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (!empty($field_default_cat)) |
|
| 111 | - $field_default_cat = ''; |
|
| 110 | + if (!empty($field_default_cat)) { |
|
| 111 | + $field_default_cat = ''; |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | - if (!empty($cat_find_array)) |
|
| 114 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 114 | + if (!empty($cat_find_array)) { |
|
| 115 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")"; |
|
| 116 | + } |
|
| 115 | 117 | |
| 116 | 118 | $main_query_array = $map_cat_ids_array; |
| 117 | 119 | |
@@ -143,8 +145,9 @@ discard block |
||
| 143 | 145 | $gd_posttype = " AND p.post_type = %s"; |
| 144 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 145 | 147 | |
| 146 | - } else |
|
| 147 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 148 | + } else { |
|
| 149 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 150 | + } |
|
| 148 | 151 | |
| 149 | 152 | $join = ", " . $table . " AS pd "; |
| 150 | 153 | |
@@ -309,8 +312,7 @@ discard block |
||
| 309 | 312 | |
| 310 | 313 | if (!empty($cat_content_info)) {
|
| 311 | 314 | return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
| 312 | - } |
|
| 313 | - else {
|
|
| 315 | + } else {
|
|
| 314 | 316 | return '[{"totalcount":"0"}]';
|
| 315 | 317 | } |
| 316 | 318 | } |
| 317 | 319 | \ No newline at end of file |