@@ -10,13 +10,13 @@ |
||
| 10 | 10 | |
| 11 | 11 | // Page titles translatable CPT names |
| 12 | 12 | function geodir_kelo_title_translation( $args) { |
| 13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 17 | - } |
|
| 13 | + if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | + }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | + $args['title'] = __($args['title'],'geodirectory'); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - return $args; |
|
| 19 | + return $args; |
|
| 20 | 20 | } |
| 21 | 21 | add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
| 22 | 22 | |
@@ -9,15 +9,15 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Page titles translatable CPT names |
| 12 | -function geodir_kelo_title_translation( $args) { |
|
| 13 | - if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){ |
|
| 14 | - $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory'); |
|
| 15 | - }elseif(function_exists('geodir_is_geodir_page')){ |
|
| 16 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 12 | +function geodir_kelo_title_translation($args) { |
|
| 13 | + if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) { |
|
| 14 | + $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory'); |
|
| 15 | + }elseif (function_exists('geodir_is_geodir_page')) { |
|
| 16 | + $args['title'] = __($args['title'], 'geodirectory'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | return $args; |
| 20 | 20 | } |
| 21 | -add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
|
| 21 | +add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1); |
|
| 22 | 22 | |
| 23 | 23 | |
@@ -7,61 +7,61 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
|
| 10 | - global $gd_session; |
|
| 11 | - $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 12 | - $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 13 | - $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 14 | - $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 15 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 16 | - echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 17 | - die; |
|
| 10 | + global $gd_session; |
|
| 11 | + $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
|
| 12 | + $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
|
| 13 | + $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 14 | + $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
|
| 15 | + $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 16 | + echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
|
| 17 | + die; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Send the content-type header with correct encoding |
| 21 | 21 | header("Content-type: text/javascript; charset=utf-8");
|
| 22 | 22 | |
| 23 | 23 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
|
| 24 | - echo get_markers(); |
|
| 25 | - exit; |
|
| 24 | + echo get_markers(); |
|
| 25 | + exit; |
|
| 26 | 26 | } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
|
| 27 | - /** |
|
| 28 | - * @global object $wpdb WordPress Database object. |
|
| 29 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 30 | - * @global object $gd_session GeoDirectory Session object. |
|
| 31 | - */ |
|
| 32 | - global $wpdb, $plugin_prefix, $gd_session; |
|
| 33 | - |
|
| 34 | - if ($_REQUEST['m_id'] != '') {
|
|
| 35 | - $pid = (int)$_REQUEST['m_id']; |
|
| 36 | - } else {
|
|
| 37 | - echo __('No marker data found', 'geodirectory');
|
|
| 38 | - exit; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 42 | - $post = (object)$gd_ses_listing; |
|
| 43 | - echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 44 | - } else {
|
|
| 45 | - $geodir_post_type = get_post_type($pid); |
|
| 46 | - |
|
| 47 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 48 | - |
|
| 49 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 50 | - |
|
| 51 | - $postinfo = $wpdb->get_results($sql); |
|
| 52 | - |
|
| 53 | - $data_arr = array(); |
|
| 54 | - |
|
| 55 | - if ($postinfo) {
|
|
| 56 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 57 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 58 | - |
|
| 59 | - foreach ($postinfo as $postinfo_obj) {
|
|
| 60 | - echo geodir_get_infowindow_html($postinfo_obj); |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - exit; |
|
| 27 | + /** |
|
| 28 | + * @global object $wpdb WordPress Database object. |
|
| 29 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 30 | + * @global object $gd_session GeoDirectory Session object. |
|
| 31 | + */ |
|
| 32 | + global $wpdb, $plugin_prefix, $gd_session; |
|
| 33 | + |
|
| 34 | + if ($_REQUEST['m_id'] != '') {
|
|
| 35 | + $pid = (int)$_REQUEST['m_id']; |
|
| 36 | + } else {
|
|
| 37 | + echo __('No marker data found', 'geodirectory');
|
|
| 38 | + exit; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 42 | + $post = (object)$gd_ses_listing; |
|
| 43 | + echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
|
| 44 | + } else {
|
|
| 45 | + $geodir_post_type = get_post_type($pid); |
|
| 46 | + |
|
| 47 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 48 | + |
|
| 49 | + $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 50 | + |
|
| 51 | + $postinfo = $wpdb->get_results($sql); |
|
| 52 | + |
|
| 53 | + $data_arr = array(); |
|
| 54 | + |
|
| 55 | + if ($postinfo) {
|
|
| 56 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 57 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 58 | + |
|
| 59 | + foreach ($postinfo as $postinfo_obj) {
|
|
| 60 | + echo geodir_get_infowindow_html($postinfo_obj); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + exit; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -79,80 +79,80 @@ discard block |
||
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | 81 | function get_markers() {
|
| 82 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
| 82 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes; |
|
| 83 | 83 | |
| 84 | - $search = ''; |
|
| 85 | - $main_query_array; |
|
| 84 | + $search = ''; |
|
| 85 | + $main_query_array; |
|
| 86 | 86 | |
| 87 | - $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 88 | - $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 87 | + $srcharr = array("'", "/", "-", '"', '\\', ''');
|
|
| 88 | + $replarr = array("′", "⁄", "–", "“", '', "′");
|
|
| 89 | 89 | |
| 90 | - $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 90 | + $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
|
| 91 | 91 | |
| 92 | - $map_cat_ids_array = array('0');
|
|
| 93 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 92 | + $map_cat_ids_array = array('0');
|
|
| 93 | + $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | - $field_default_cat = ''; |
|
| 97 | - if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 98 | - $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 96 | + $field_default_cat = ''; |
|
| 97 | + if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
|
|
| 98 | + $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
|
| 99 | 99 | |
| 100 | - if (!empty($map_cat_arr)) {
|
|
| 101 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 100 | + if (!empty($map_cat_arr)) {
|
|
| 101 | + $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 102 | 102 | |
| 103 | - $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 104 | - $cat_find_array = array(); |
|
| 105 | - foreach ($map_cat_ids_array as $cat_id) {
|
|
| 106 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 107 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 108 | - $main_query_array[] = $cat_id; |
|
| 109 | - } |
|
| 103 | + $map_cat_ids_array = explode(',', $map_cat_arr);
|
|
| 104 | + $cat_find_array = array(); |
|
| 105 | + foreach ($map_cat_ids_array as $cat_id) {
|
|
| 106 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 107 | + $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 108 | + $main_query_array[] = $cat_id; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - } |
|
| 112 | - } |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - if (!empty($field_default_cat)) |
|
| 115 | - $field_default_cat = ''; |
|
| 114 | + if (!empty($field_default_cat)) |
|
| 115 | + $field_default_cat = ''; |
|
| 116 | 116 | |
| 117 | - if (!empty($cat_find_array)) |
|
| 118 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 117 | + if (!empty($cat_find_array)) |
|
| 118 | + $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 119 | 119 | |
| 120 | - $main_query_array = $map_cat_ids_array; |
|
| 120 | + $main_query_array = $map_cat_ids_array; |
|
| 121 | 121 | |
| 122 | - if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 123 | - $search .= " AND p.post_title LIKE %s"; |
|
| 124 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 129 | - * |
|
| 130 | - * @since 1.5.3 |
|
| 131 | - * |
|
| 132 | - * @param string $search The SQL query for search/where. |
|
| 133 | - */ |
|
| 134 | - $search = apply_filters('geodir_marker_search', $search);
|
|
| 135 | - /** |
|
| 136 | - * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 137 | - * |
|
| 138 | - * @since 1.5.3 |
|
| 139 | - * |
|
| 140 | - * @param array $main_query_array The SQL query values for search/where. |
|
| 141 | - */ |
|
| 142 | - $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 143 | - |
|
| 144 | - $gd_posttype = ''; |
|
| 145 | - if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 146 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 147 | - $gd_posttype = " AND p.post_type = %s"; |
|
| 148 | - $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 149 | - |
|
| 150 | - } else |
|
| 151 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 152 | - |
|
| 153 | - $join = ", " . $table . " AS pd "; |
|
| 154 | - |
|
| 155 | - /** |
|
| 122 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
|
| 123 | + $search .= " AND p.post_title LIKE %s"; |
|
| 124 | + $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Filter the marker query search SQL, values are replaces with %s or %d. |
|
| 129 | + * |
|
| 130 | + * @since 1.5.3 |
|
| 131 | + * |
|
| 132 | + * @param string $search The SQL query for search/where. |
|
| 133 | + */ |
|
| 134 | + $search = apply_filters('geodir_marker_search', $search);
|
|
| 135 | + /** |
|
| 136 | + * Filter the marker query search SQL values %s and %d, this is an array of values. |
|
| 137 | + * |
|
| 138 | + * @since 1.5.3 |
|
| 139 | + * |
|
| 140 | + * @param array $main_query_array The SQL query values for search/where. |
|
| 141 | + */ |
|
| 142 | + $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
|
|
| 143 | + |
|
| 144 | + $gd_posttype = ''; |
|
| 145 | + if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
|
| 146 | + $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 147 | + $gd_posttype = " AND p.post_type = %s"; |
|
| 148 | + $main_query_array[] = $_REQUEST['gd_posttype']; |
|
| 149 | + |
|
| 150 | + } else |
|
| 151 | + $table = $plugin_prefix . 'gd_place_detail'; |
|
| 152 | + |
|
| 153 | + $join = ", " . $table . " AS pd "; |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | 156 | * Filter the SQL JOIN clause for the markers data |
| 157 | 157 | * |
| 158 | 158 | * @since 1.0.0 |
@@ -169,16 +169,16 @@ discard block |
||
| 169 | 169 | * @param string $search Row of searched fields to use in WHERE clause. |
| 170 | 170 | */ |
| 171 | 171 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 172 | - $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 173 | - $cat_type = $post_type . 'category'; |
|
| 174 | - if ($post_type == 'gd_event') {
|
|
| 175 | - $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 176 | - } else {
|
|
| 177 | - $event_select = ""; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 181 | - /** |
|
| 172 | + $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
|
| 173 | + $cat_type = $post_type . 'category'; |
|
| 174 | + if ($post_type == 'gd_event') {
|
|
| 175 | + $event_select = ", pd.recurring_dates, pd.is_recurring"; |
|
| 176 | + } else {
|
|
| 177 | + $event_select = ""; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 181 | + /** |
|
| 182 | 182 | * Filter the SQL SELECT clause to retrive fields data |
| 183 | 183 | * |
| 184 | 184 | * @since 1.0.0 |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 199 | 199 | |
| 200 | - $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);
|
|
| 200 | + $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);
|
|
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Filter the SQL query to retrive markers data |
@@ -209,125 +209,125 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | $catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
|
| 211 | 211 | |
| 212 | - $catinfo = $wpdb->get_results($catsql); |
|
| 212 | + $catinfo = $wpdb->get_results($catsql); |
|
| 213 | 213 | |
| 214 | - $cat_content_info = array(); |
|
| 215 | - $content_data = array(); |
|
| 216 | - $post_ids = array(); |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * Called before marker data is processed into JSON. |
|
| 220 | - * |
|
| 221 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 222 | - * |
|
| 223 | - * @since 1.5.3 |
|
| 224 | - * @param object $catinfo The posts object containing all marker data. |
|
| 225 | - * @see 'geodir_after_marker_post_process' |
|
| 226 | - */ |
|
| 227 | - $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * Called before marker data is processed into JSON. |
|
| 231 | - * |
|
| 232 | - * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 233 | - * |
|
| 234 | - * @since 1.4.9 |
|
| 235 | - * @param object $catinfo The posts object containing all marker data. |
|
| 236 | - * @see 'geodir_after_marker_post_process' |
|
| 237 | - */ |
|
| 238 | - do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 239 | - |
|
| 240 | - // Sort any posts into a ajax array |
|
| 241 | - if (!empty($catinfo)) {
|
|
| 242 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 243 | - global $geodir_date_format; |
|
| 244 | - |
|
| 245 | - $today = strtotime(date_i18n('Y-m-d'));
|
|
| 214 | + $cat_content_info = array(); |
|
| 215 | + $content_data = array(); |
|
| 216 | + $post_ids = array(); |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * Called before marker data is processed into JSON. |
|
| 220 | + * |
|
| 221 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 222 | + * |
|
| 223 | + * @since 1.5.3 |
|
| 224 | + * @param object $catinfo The posts object containing all marker data. |
|
| 225 | + * @see 'geodir_after_marker_post_process' |
|
| 226 | + */ |
|
| 227 | + $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
|
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * Called before marker data is processed into JSON. |
|
| 231 | + * |
|
| 232 | + * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 233 | + * |
|
| 234 | + * @since 1.4.9 |
|
| 235 | + * @param object $catinfo The posts object containing all marker data. |
|
| 236 | + * @see 'geodir_after_marker_post_process' |
|
| 237 | + */ |
|
| 238 | + do_action('geodir_before_marker_post_process_action', $catinfo);
|
|
| 239 | + |
|
| 240 | + // Sort any posts into a ajax array |
|
| 241 | + if (!empty($catinfo)) {
|
|
| 242 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 243 | + global $geodir_date_format; |
|
| 244 | + |
|
| 245 | + $today = strtotime(date_i18n('Y-m-d'));
|
|
| 246 | 246 | |
| 247 | - foreach ($catinfo as $catinfo_obj) {
|
|
| 248 | - $post_title = $catinfo_obj->post_title; |
|
| 247 | + foreach ($catinfo as $catinfo_obj) {
|
|
| 248 | + $post_title = $catinfo_obj->post_title; |
|
| 249 | 249 | |
| 250 | - if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
|
|
| 251 | - $event_dates = ''; |
|
| 252 | - $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 250 | + if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
|
|
| 251 | + $event_dates = ''; |
|
| 252 | + $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array(); |
|
| 253 | 253 | |
| 254 | - $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 255 | - if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 256 | - $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 254 | + $post_info = geodir_get_post_info($catinfo_obj->post_id); |
|
| 255 | + if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
|
|
| 256 | + $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 257 | 257 | |
| 258 | - if (!empty($recurring_dates)) {
|
|
| 259 | - $e = 0; |
|
| 260 | - foreach ($recurring_dates as $date) {
|
|
| 261 | - if (strtotime($date) >= $today) {
|
|
| 262 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 258 | + if (!empty($recurring_dates)) {
|
|
| 259 | + $e = 0; |
|
| 260 | + foreach ($recurring_dates as $date) {
|
|
| 261 | + if (strtotime($date) >= $today) {
|
|
| 262 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 263 | 263 | |
| 264 | - $e++; |
|
| 265 | - if ($e == 3) { // only show 3 event dates
|
|
| 266 | - break; |
|
| 267 | - } |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - } else {
|
|
| 272 | - $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
| 273 | - $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
| 264 | + $e++; |
|
| 265 | + if ($e == 3) { // only show 3 event dates
|
|
| 266 | + break; |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + } else {
|
|
| 272 | + $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : ''; |
|
| 273 | + $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
|
| 274 | 274 | |
| 275 | - if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 276 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 277 | - } |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - if (empty($event_dates)) {
|
|
| 281 | - continue; |
|
| 282 | - } |
|
| 275 | + if ($end_date != '' && strtotime($end_date) >= $today) {
|
|
| 276 | + $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + if (empty($event_dates)) {
|
|
| 281 | + continue; |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - $post_title .= $event_dates; |
|
| 285 | - } |
|
| 284 | + $post_title .= $event_dates; |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
| 288 | - $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 289 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 287 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : ''; |
|
| 288 | + $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : ''; |
|
| 289 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 290 | 290 | |
| 291 | - if ($icon != '') {
|
|
| 292 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 291 | + if ($icon != '') {
|
|
| 292 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 293 | 293 | |
| 294 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 295 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 296 | - } else {
|
|
| 297 | - $icon_size = geodir_get_marker_size($icon); |
|
| 298 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 299 | - } |
|
| 300 | - } else {
|
|
| 301 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 302 | - } |
|
| 303 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 304 | - $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 . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 305 | - $post_ids[] = $catinfo_obj->post_id; |
|
| 306 | - } |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - /** |
|
| 310 | - * Called after marker data is processed into JSON. |
|
| 311 | - * |
|
| 312 | - * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 313 | - * |
|
| 314 | - * @since 1.4.9 |
|
| 315 | - * @param array $content_data The array containing all markers in JSON format. |
|
| 316 | - * @param object $catinfo The posts object containing all marker data. |
|
| 317 | - * @see 'geodir_before_marker_post_process' |
|
| 318 | - */ |
|
| 319 | - do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 320 | - |
|
| 321 | - if (!empty($content_data)) {
|
|
| 322 | - $cat_content_info[] = implode(',', $content_data);
|
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - $totalcount = count(array_unique($post_ids)); |
|
| 326 | - |
|
| 327 | - if (!empty($cat_content_info)) {
|
|
| 328 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 329 | - } |
|
| 330 | - else {
|
|
| 331 | - return '[{"totalcount":"0"}]';
|
|
| 332 | - } |
|
| 294 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 295 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 296 | + } else {
|
|
| 297 | + $icon_size = geodir_get_marker_size($icon); |
|
| 298 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 299 | + } |
|
| 300 | + } else {
|
|
| 301 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 302 | + } |
|
| 303 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 304 | + $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 . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 305 | + $post_ids[] = $catinfo_obj->post_id; |
|
| 306 | + } |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + /** |
|
| 310 | + * Called after marker data is processed into JSON. |
|
| 311 | + * |
|
| 312 | + * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers. |
|
| 313 | + * |
|
| 314 | + * @since 1.4.9 |
|
| 315 | + * @param array $content_data The array containing all markers in JSON format. |
|
| 316 | + * @param object $catinfo The posts object containing all marker data. |
|
| 317 | + * @see 'geodir_before_marker_post_process' |
|
| 318 | + */ |
|
| 319 | + do_action('geodir_after_marker_post_process', $content_data, $catinfo);
|
|
| 320 | + |
|
| 321 | + if (!empty($content_data)) {
|
|
| 322 | + $cat_content_info[] = implode(',', $content_data);
|
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + $totalcount = count(array_unique($post_ids)); |
|
| 326 | + |
|
| 327 | + if (!empty($cat_content_info)) {
|
|
| 328 | + return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 329 | + } |
|
| 330 | + else {
|
|
| 331 | + return '[{"totalcount":"0"}]';
|
|
| 332 | + } |
|
| 333 | 333 | } |
| 334 | 334 | \ No newline at end of file |