@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | -if(get_option('geodir_enable_map_cache')){
|
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 10 | +if (get_option('geodir_enable_map_cache')) {
|
|
| 11 | + add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @since 1.6.22 |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function geodir_get_map_cache($cache){
|
|
| 24 | +function geodir_get_map_cache($cache) {
|
|
| 25 | 25 | |
| 26 | 26 | // if a search is going on then dont even try to check for cache. |
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 27 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 28 | 28 | return $cache; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 44 | 44 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 47 | 47 | |
| 48 | 48 | $blog_id = get_current_blog_id(); |
| 49 | - if($blog_id>1){
|
|
| 49 | + if ($blog_id > 1) {
|
|
| 50 | 50 | $file_name = $blog_id."_".$file_name; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
| 54 | - $file = $file_path . $file_name . ".json"; |
|
| 54 | + $file = $file_path.$file_name.".json"; |
|
| 55 | 55 | |
| 56 | - if(file_exists($file)){
|
|
| 56 | + if (file_exists($file)) {
|
|
| 57 | 57 | // do the cache delete stuff |
| 58 | 58 | $cache_time = get_option('geodir_map_cache');
|
| 59 | - if(!$cache_time){
|
|
| 59 | + if (!$cache_time) {
|
|
| 60 | 60 | $cache_time = time(); |
| 61 | 61 | update_option('geodir_map_cache', $cache_time);
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 64 | + if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
|
|
| 65 | 65 | geodir_delete_map_cache(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if(file_exists($file) && is_readable($file)){
|
|
| 68 | + if (file_exists($file) && is_readable($file)) {
|
|
| 69 | 69 | ob_start(); |
| 70 | 70 | readfile($file); // readfile is quicker then file get contents |
| 71 | 71 | return ob_get_clean(); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @since 1.6.22 |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
| 86 | -function geodir_save_map_cache($map_json){
|
|
| 86 | +function geodir_save_map_cache($map_json) {
|
|
| 87 | 87 | |
| 88 | 88 | // if a search is going on then dont even try to check for cache. |
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 89 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 90 | 90 | return $map_json; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 106 | 106 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 109 | 109 | |
| 110 | 110 | $blog_id = get_current_blog_id(); |
| 111 | - if($blog_id>1){
|
|
| 111 | + if ($blog_id > 1) {
|
|
| 112 | 112 | $file_name = $blog_id."_".$file_name; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | global $wp_filesystem; |
| 119 | 119 | if (empty($wp_filesystem)) {
|
| 120 | - require_once (ABSPATH . '/wp-admin/includes/file.php'); |
|
| 120 | + require_once (ABSPATH.'/wp-admin/includes/file.php'); |
|
| 121 | 121 | WP_Filesystem(); |
| 122 | 122 | } |
| 123 | 123 | $wp_filesystem->put_contents( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
| 139 | 139 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 140 | 140 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 141 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 141 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 142 | 142 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 143 | 143 | die; |
| 144 | 144 | } |
@@ -158,21 +158,21 @@ discard block |
||
| 158 | 158 | global $wpdb, $plugin_prefix, $gd_session; |
| 159 | 159 | |
| 160 | 160 | if ($_REQUEST['m_id'] != '') {
|
| 161 | - $pid = (int)$_REQUEST['m_id']; |
|
| 161 | + $pid = (int) $_REQUEST['m_id']; |
|
| 162 | 162 | } else {
|
| 163 | 163 | echo __('No marker data found', 'geodirectory');
|
| 164 | 164 | exit; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 168 | - $post = (object)$gd_ses_listing; |
|
| 168 | + $post = (object) $gd_ses_listing; |
|
| 169 | 169 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 170 | 170 | } else {
|
| 171 | 171 | $geodir_post_type = get_post_type($pid); |
| 172 | 172 | |
| 173 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 173 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 174 | 174 | |
| 175 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 175 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 176 | 176 | |
| 177 | 177 | $postinfo = $wpdb->get_results($sql); |
| 178 | 178 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function get_markers() {
|
| 208 | 208 | |
| 209 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 209 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @since 1.6.22 |
| 216 | 216 | */ |
| 217 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 218 | - if($map_cache){
|
|
| 217 | + $map_cache = apply_filters('geodir_get_markers_cache', '');
|
|
| 218 | + if ($map_cache) {
|
|
| 219 | 219 | return $map_cache; |
| 220 | 220 | wp_die(); |
| 221 | 221 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 231 | 231 | |
| 232 | 232 | $map_cat_ids_array = array('0');
|
| 233 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 233 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | $field_default_cat = ''; |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 239 | 239 | |
| 240 | 240 | if (!empty($map_cat_arr)) {
|
| 241 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 241 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 242 | 242 | |
| 243 | 243 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 244 | 244 | $cat_find_array = array(); |
| 245 | 245 | foreach ($map_cat_ids_array as $cat_id) {
|
| 246 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 247 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 246 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 247 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 248 | 248 | $main_query_array[] = $cat_id; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $field_default_cat = ''; |
| 256 | 256 | |
| 257 | 257 | if (!empty($cat_find_array)) |
| 258 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 258 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 259 | 259 | |
| 260 | 260 | $main_query_array = $map_cat_ids_array; |
| 261 | 261 | |
| 262 | 262 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 263 | 263 | $search .= " AND p.post_title LIKE %s"; |
| 264 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 264 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $gd_posttype = ''; |
| 285 | 285 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 286 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 286 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 287 | 287 | $gd_posttype = " AND p.post_type = %s"; |
| 288 | 288 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 289 | 289 | |
| 290 | 290 | } else |
| 291 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 291 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 292 | 292 | |
| 293 | - $join = ", " . $table . " AS pd "; |
|
| 293 | + $join = ", ".$table." AS pd "; |
|
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | 296 | * Filter the SQL JOIN clause for the markers data |
@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 312 | 312 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 313 | - $cat_type = $post_type . 'category'; |
|
| 313 | + $cat_type = $post_type.'category'; |
|
| 314 | 314 | if ($post_type == 'gd_event') {
|
| 315 | 315 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 316 | 316 | } else {
|
| 317 | 317 | $event_select = ""; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 320 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 321 | 321 | /** |
| 322 | 322 | * Filter the SQL SELECT clause to retrive fields data |
| 323 | 323 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 339 | 339 | |
| 340 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 340 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
|
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Filter the SQL query to retrive markers data |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
| 388 | 388 | |
| 389 | 389 | $today = strtotime(date_i18n('Y-m-d'));
|
| 390 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 390 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 391 | 391 | |
| 392 | 392 | foreach ($catinfo as $catinfo_obj) {
|
| 393 | 393 | $post_title = $catinfo_obj->post_title; |
@@ -403,29 +403,29 @@ discard block |
||
| 403 | 403 | $endtimes = ''; |
| 404 | 404 | $astarttimes = array(); |
| 405 | 405 | $aendtimes = array(); |
| 406 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 406 | + if (!isset($recurring_data['repeat_type'])) {
|
|
| 407 | 407 | $recurring_data['repeat_type'] = 'custom'; |
| 408 | 408 | } |
| 409 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 410 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 409 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
|
|
| 410 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
| 411 | 411 | |
| 412 | 412 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
| 413 | 413 | |
| 414 | - if ( !empty( $recurring_dates ) ) {
|
|
| 415 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 416 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 417 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 418 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 414 | + if (!empty($recurring_dates)) {
|
|
| 415 | + if (empty($recurring_data['all_day'])) {
|
|
| 416 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 417 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 418 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 419 | 419 | } else {
|
| 420 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 421 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 420 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 421 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $e = 0; |
| 426 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 427 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 428 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 426 | + foreach ($recurring_dates as $key => $date) {
|
|
| 427 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 428 | + if (!empty($astarttimes) && isset($astarttimes[$key])) {
|
|
| 429 | 429 | $starttimes = $astarttimes[$key]; |
| 430 | 430 | $endtimes = $aendtimes[$key]; |
| 431 | 431 | } else {
|
@@ -434,50 +434,50 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 437 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
| 438 | 438 | $duration--; |
| 439 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 439 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
|
|
| 440 | 440 | |
| 441 | 441 | // Hide past dates |
| 442 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 442 | + if (strtotime($enddate) < $today) {
|
|
| 443 | 443 | continue; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 447 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 446 | + $sdate = strtotime($date.' '.$starttimes); |
|
| 447 | + $edate = strtotime($enddate.' '.$endtimes); |
|
| 448 | 448 | |
| 449 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 450 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 449 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
| 450 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
| 451 | 451 | |
| 452 | 452 | $same_day = false; |
| 453 | 453 | $full_day = false; |
| 454 | 454 | $same_datetime = false; |
| 455 | 455 | |
| 456 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 456 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
|
|
| 457 | 457 | $full_day = true; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 460 | + if ($start_date == $end_date && $full_day) {
|
|
| 461 | 461 | $same_datetime = true; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 465 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 466 | - if ( $full_day ) {
|
|
| 464 | + $link_date = date_i18n('Y-m-d', $sdate);
|
|
| 465 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
| 466 | + if ($full_day) {
|
|
| 467 | 467 | $start_date = $title_date; |
| 468 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 468 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 471 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
|
|
| 472 | 472 | $same_day = true; |
| 473 | 473 | |
| 474 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 474 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $event_dates .= ' :: ' . $start_date; |
|
| 477 | + $event_dates .= ' :: '.$start_date; |
|
| 478 | 478 | |
| 479 | - if ( !$same_day && !$same_datetime ) {
|
|
| 480 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 479 | + if (!$same_day && !$same_datetime) {
|
|
| 480 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | $e++; |
@@ -488,67 +488,67 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } else {
|
| 491 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 492 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 494 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 495 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 491 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
| 492 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
| 494 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 495 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 496 | 496 | |
| 497 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 498 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 499 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 497 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 498 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 499 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 500 | 500 | |
| 501 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 501 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
|
|
| 502 | 502 | $start_date = $event_recurring_dates[0]; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 505 | + if (strtotime($end_date) < strtotime($start_date)) {
|
|
| 506 | 506 | $end_date = $start_date; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 510 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 510 | + if ($starttime == '' && !empty($starttimes)) {
|
|
| 511 | 511 | $starttime = $starttimes[0]; |
| 512 | 512 | $endtime = $endtimes[0]; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | $same_day = false; |
| 516 | 516 | $one_day = false; |
| 517 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 517 | + if ($start_date == $end_date && $all_day) {
|
|
| 518 | 518 | $one_day = true; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - if ( $all_day ) {
|
|
| 522 | - $start_datetime = strtotime( $start_date ); |
|
| 523 | - $end_datetime = strtotime( $end_date ); |
|
| 521 | + if ($all_day) {
|
|
| 522 | + $start_datetime = strtotime($start_date); |
|
| 523 | + $end_datetime = strtotime($end_date); |
|
| 524 | 524 | |
| 525 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 526 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 527 | - if ( $start_date == $end_date ) {
|
|
| 525 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
| 526 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
| 527 | + if ($start_date == $end_date) {
|
|
| 528 | 528 | $one_day = true; |
| 529 | 529 | } |
| 530 | 530 | } else {
|
| 531 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 532 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 531 | + if ($start_date == $end_date && $starttime == $endtime) {
|
|
| 532 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
|
|
| 533 | 533 | $one_day = false; |
| 534 | 534 | } |
| 535 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 536 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 535 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
| 536 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
| 537 | 537 | |
| 538 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 539 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 538 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
| 539 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 542 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
|
|
| 543 | 543 | $same_day = true; |
| 544 | 544 | |
| 545 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 545 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $event_dates .= ' :: ' . $start_date; |
|
| 548 | + $event_dates .= ' :: '.$start_date; |
|
| 549 | 549 | |
| 550 | - if ( !$same_day && !$one_day ) {
|
|
| 551 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 550 | + if (!$same_day && !$one_day) {
|
|
| 551 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
| 565 | 565 | |
| 566 | 566 | // if single cat lets just show that icon |
| 567 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 568 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 567 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
|
|
| 568 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | $icon_size = array('w' => 36, 'h' => 45);
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 588 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 589 | 589 | $post_ids[] = $catinfo_obj->post_id; |
| 590 | 590 | } |
| 591 | 591 | } |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | $totalcount = count(array_unique($post_ids)); |
| 610 | 610 | |
| 611 | 611 | if (!empty($cat_content_info)) {
|
| 612 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 612 | + $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 613 | 613 | } |
| 614 | 614 | else {
|
| 615 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 615 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * @since 1.6.22 |
| 623 | 623 | * @param string $map_json The JSON string of the map markers results. |
| 624 | 624 | */ |
| 625 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 625 | + return apply_filters('geodir_markers_json', $map_json);
|
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |