@@ -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 |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $gd_post_type = sanitize_text_field($_REQUEST['post_type']); |
| 11 | 11 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 12 | 12 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 13 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 13 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 14 | 14 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 15 | 15 | die; |
| 16 | 16 | } |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | global $wpdb, $plugin_prefix, $gd_session; |
| 31 | 31 | |
| 32 | 32 | if ($_REQUEST['m_id'] != '') {
|
| 33 | - $pid = (int)$_REQUEST['m_id']; |
|
| 33 | + $pid = (int) $_REQUEST['m_id']; |
|
| 34 | 34 | } else {
|
| 35 | 35 | echo __('No marker data found', 'geodirectory');
|
| 36 | 36 | exit; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 40 | - $post = (object)$gd_ses_listing; |
|
| 40 | + $post = (object) $gd_ses_listing; |
|
| 41 | 41 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 42 | 42 | } else {
|
| 43 | 43 | $geodir_post_type = get_post_type($pid); |
| 44 | 44 | |
| 45 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 45 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 46 | 46 | |
| 47 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 47 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 48 | 48 | |
| 49 | 49 | $postinfo = $wpdb->get_results($sql); |
| 50 | 50 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 89 | 89 | |
| 90 | 90 | $map_cat_ids_array = array('0');
|
| 91 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 91 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | $field_default_cat = ''; |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 97 | 97 | |
| 98 | 98 | if (!empty($map_cat_arr)) {
|
| 99 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 99 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 100 | 100 | |
| 101 | 101 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 102 | 102 | $cat_find_array = array(); |
| 103 | 103 | foreach ($map_cat_ids_array as $cat_id) {
|
| 104 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 105 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 104 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 105 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 106 | 106 | $main_query_array[] = $cat_id; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | $field_default_cat = ''; |
| 114 | 114 | |
| 115 | 115 | if (!empty($cat_find_array)) |
| 116 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 116 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 117 | 117 | |
| 118 | 118 | $main_query_array = $map_cat_ids_array; |
| 119 | 119 | |
| 120 | 120 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 121 | 121 | $search .= " AND p.post_title LIKE %s"; |
| 122 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 122 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $gd_posttype = ''; |
| 143 | 143 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 144 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 144 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 145 | 145 | $gd_posttype = " AND p.post_type = %s"; |
| 146 | 146 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 147 | 147 | |
| 148 | 148 | } else |
| 149 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 149 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 150 | 150 | |
| 151 | - $join = ", " . $table . " AS pd "; |
|
| 151 | + $join = ", ".$table." AS pd "; |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Filter the SQL JOIN clause for the markers data |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 170 | 170 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 171 | - $cat_type = $post_type . 'category'; |
|
| 171 | + $cat_type = $post_type.'category'; |
|
| 172 | 172 | if ($post_type == 'gd_event') {
|
| 173 | 173 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 174 | 174 | } else {
|
| 175 | 175 | $event_select = ""; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 178 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 179 | 179 | /** |
| 180 | 180 | * Filter the SQL SELECT clause to retrive fields data |
| 181 | 181 | * |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 197 | 197 | |
| 198 | - $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);
|
|
| 198 | + $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);
|
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * Filter the SQL query to retrive markers data |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $e = 0; |
| 258 | 258 | foreach ($recurring_dates as $date) {
|
| 259 | 259 | if (strtotime($date) >= $today) {
|
| 260 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date)); |
|
| 260 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date)); |
|
| 261 | 261 | |
| 262 | 262 | $e++; |
| 263 | 263 | if ($e == 3) { // only show 3 event dates
|
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date; |
| 272 | 272 | |
| 273 | 273 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 274 | - $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 274 | + $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date)); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $icon_size = array('w' => 36, 'h' => 45);
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - $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.'}';
|
|
| 302 | + $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.'}';
|
|
| 303 | 303 | $post_ids[] = $catinfo_obj->post_id; |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $totalcount = count(array_unique($post_ids)); |
| 324 | 324 | |
| 325 | 325 | if (!empty($cat_content_info)) {
|
| 326 | - return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 326 | + return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 327 | 327 | } |
| 328 | 328 | else {
|
| 329 | 329 | return '[{"totalcount":"0"}]';
|
@@ -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 | - |
|
| 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 | + |
|
| 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 |
@@ -45,9 +45,10 @@ discard block |
||
| 45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 47 | 47 | $mapzoom = 4; |
| 48 | - if (isset($_REQUEST['add_hood'])) |
|
| 49 | - $mapzoom = 10; |
|
| 50 | -} |
|
| 48 | + if (isset($_REQUEST['add_hood'])) { |
|
| 49 | + $mapzoom = 10; |
|
| 50 | + } |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | /** |
| 53 | 54 | * Filter the auto change address fields values |
@@ -641,8 +642,9 @@ discard block |
||
| 641 | 642 | </script> |
| 642 | 643 | <?php |
| 643 | 644 | $set_button_class = 'geodir_button'; |
| 644 | -if (is_admin()) |
|
| 645 | - $set_button_class = 'button-primary'; |
|
| 645 | +if (is_admin()) { |
|
| 646 | + $set_button_class = 'button-primary'; |
|
| 647 | +} |
|
| 646 | 648 | ?> |
| 647 | 649 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" |
| 648 | 650 | value="<?php _e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | $defaultcity = isset($default_location->city) ? $default_location->city : ''; |
| 35 | 35 | $lat_lng_blank = false; |
| 36 | 36 | if ($lat == '' && $lng == '') {
|
| 37 | - $lat_lng_blank = true; |
|
| 38 | - $city = $defaultcity; |
|
| 39 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 40 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 41 | - $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 42 | - $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 37 | + $lat_lng_blank = true; |
|
| 38 | + $city = $defaultcity; |
|
| 39 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 40 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 41 | + $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 42 | + $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 43 | 43 | } |
| 44 | 44 | $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
| 45 | 45 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 46 | 46 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 47 | - $mapzoom = 4; |
|
| 48 | - if (isset($_REQUEST['add_hood'])) |
|
| 49 | - $mapzoom = 10; |
|
| 47 | + $mapzoom = 4; |
|
| 48 | + if (isset($_REQUEST['add_hood'])) |
|
| 49 | + $mapzoom = 10; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * Fires at the start of the add javascript on the add lsitings map. |
| 68 | 68 | * |
| 69 | 69 | * @since 1.0.0 |
| 70 | - * @param string $prefix The prefix for all elements. |
|
| 70 | + * @param string $prefix The prefix for all elements. |
|
| 71 | 71 | */ |
| 72 | 72 | do_action('geodir_add_listing_js_start', $prefix);
|
| 73 | 73 | ?> |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | getZip = postal_code.long_name; |
| 315 | 315 | } |
| 316 | 316 | <?php |
| 317 | - /** |
|
| 318 | - * Fires to add javascript variable to use in google map. |
|
| 319 | - * |
|
| 320 | - * @since 1.0.0 |
|
| 321 | - */ |
|
| 322 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 323 | - ?> |
|
| 317 | + /** |
|
| 318 | + * Fires to add javascript variable to use in google map. |
|
| 319 | + * |
|
| 320 | + * @since 1.0.0 |
|
| 321 | + */ |
|
| 322 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 323 | + ?> |
|
| 324 | 324 | <?php if ($is_map_restrict) { ?>
|
| 325 | 325 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 326 | 326 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | <?php |
| 403 | - /** |
|
| 404 | - * Fires when marker address updated on map. |
|
| 405 | - * |
|
| 406 | - * @since 1.0.0 |
|
| 407 | - * @param string $prefix Identifier used as a prefix for field name |
|
| 408 | - */ |
|
| 409 | - do_action('geodir_update_marker_address', $prefix);
|
|
| 410 | - echo $updateMarkerAddress = ob_get_clean(); |
|
| 411 | - ?> |
|
| 403 | + /** |
|
| 404 | + * Fires when marker address updated on map. |
|
| 405 | + * |
|
| 406 | + * @since 1.0.0 |
|
| 407 | + * @param string $prefix Identifier used as a prefix for field name |
|
| 408 | + */ |
|
| 409 | + do_action('geodir_update_marker_address', $prefix);
|
|
| 410 | + echo $updateMarkerAddress = ob_get_clean(); |
|
| 411 | + ?> |
|
| 412 | 412 | } |
| 413 | 413 | function geodir_codeAddress(set_on_map) {
|
| 414 | 414 | var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 437 | 437 | <?php ob_start(); |
| 438 | - $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 439 | - $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 440 | - ?> |
|
| 438 | + $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 439 | + $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 440 | + ?> |
|
| 441 | 441 | if (set_on_map && is_restrict) {
|
| 442 | 442 | if (zip != '' && address != '') {
|
| 443 | 443 | address = address + ',' + zip; |
@@ -446,12 +446,12 @@ discard block |
||
| 446 | 446 | if (typeof address === 'undefined') |
| 447 | 447 | address = ''; |
| 448 | 448 | <?php |
| 449 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 449 | + if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 450 | 450 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 451 | 451 | address = ''; |
| 452 | 452 | } |
| 453 | 453 | <?php |
| 454 | - }?> |
|
| 454 | + }?> |
|
| 455 | 455 | |
| 456 | 456 | if (ISO2 == 'GB') {
|
| 457 | 457 | address = address + ',' + city + ',' + country + ',' + zip; // UK is funny with regions |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | <?php $codeAddress = ob_get_clean(); |
| 463 | - /** |
|
| 464 | - * Filter the address variable |
|
| 465 | - * |
|
| 466 | - * @since 1.0.0 |
|
| 467 | - * |
|
| 468 | - * @param string $codeAddress Row of address to use in google map. |
|
| 469 | - */ |
|
| 470 | - echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 471 | - ?> |
|
| 463 | + /** |
|
| 464 | + * Filter the address variable |
|
| 465 | + * |
|
| 466 | + * @since 1.0.0 |
|
| 467 | + * |
|
| 468 | + * @param string $codeAddress Row of address to use in google map. |
|
| 469 | + */ |
|
| 470 | + echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 471 | + ?> |
|
| 472 | 472 | if (!window.gdMaps) { // No Google Map Loaded
|
| 473 | 473 | return; |
| 474 | 474 | } |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | updateMarkerPosition(baseMarker.getPosition()); |
| 494 | 494 | //if(set_on_map && is_restrict) {
|
| 495 | 495 | <?php |
| 496 | - /** |
|
| 497 | - * Fires before set geocode position. |
|
| 498 | - * |
|
| 499 | - * @since 1.0.0 |
|
| 500 | - */ |
|
| 501 | - do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 502 | - ?> |
|
| 496 | + /** |
|
| 497 | + * Fires before set geocode position. |
|
| 498 | + * |
|
| 499 | + * @since 1.0.0 |
|
| 500 | + */ |
|
| 501 | + do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 502 | + ?> |
|
| 503 | 503 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 504 | 504 | //} |
| 505 | 505 | } else {
|
@@ -545,13 +545,13 @@ discard block |
||
| 545 | 545 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
| 546 | 546 | } |
| 547 | 547 | <?php |
| 548 | - /** |
|
| 549 | - * Fires to add javascript variable to use in google map. |
|
| 550 | - * |
|
| 551 | - * @since 1.0.0 |
|
| 552 | - */ |
|
| 553 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 554 | - ?> |
|
| 548 | + /** |
|
| 549 | + * Fires to add javascript variable to use in google map. |
|
| 550 | + * |
|
| 551 | + * @since 1.0.0 |
|
| 552 | + */ |
|
| 553 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 554 | + ?> |
|
| 555 | 555 | <?php if ($is_map_restrict) { ?>
|
| 556 | 556 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 557 | 557 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | <?php |
| 700 | 700 | $set_button_class = 'geodir_button'; |
| 701 | 701 | if (is_admin()) |
| 702 | - $set_button_class = 'button-primary'; |
|
| 702 | + $set_button_class = 'button-primary'; |
|
| 703 | 703 | ?> |
| 704 | 704 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
| 705 | 705 | <div id="<?php echo $prefix; ?>d_mouseClick"></div> |
@@ -81,16 +81,16 @@ discard block |
||
| 81 | 81 | window.gdMaps = window.gdMaps || gdMaps; |
| 82 | 82 | |
| 83 | 83 | user_address = false; |
| 84 | - jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
|
|
| 84 | + jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
|
|
| 85 | 85 | user_address = true; |
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | 88 | baseMarker = ''; |
| 89 | 89 | geocoder = ''; |
| 90 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 91 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 92 | - <?php if($lat_lng_blank){$lat='';$lng='';}?>
|
|
| 93 | - var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>; |
|
| 90 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 91 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 92 | + <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
|
|
| 93 | + var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>; |
|
| 94 | 94 | var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>; |
| 95 | 95 | var oldstr_address; |
| 96 | 96 | var oldstr_zip; |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | do_action('geodir_add_listing_geocode_js_vars');
|
| 323 | 323 | ?> |
| 324 | 324 | <?php if ($is_map_restrict) { ?>
|
| 325 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 326 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 327 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 325 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 326 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 327 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 328 | 328 | jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 329 | 329 | baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 330 | 330 | updateMarkerPosition(baseMarker.getPosition()); |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | <?php } ?> |
| 334 | 334 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 335 | 335 | } else {
|
| 336 | - updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 336 | + updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | function centerMap(latlng) {
|
| 340 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 340 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 341 | 341 | if (window.gdMaps == 'google') {
|
| 342 | 342 | jQuery.goMap.map.panTo(baseMarker.getPosition()); |
| 343 | 343 | } else if (window.gdMaps == 'osm') {
|
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | function centerMarker() {
|
| 349 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 349 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 350 | 350 | var center = jQuery.goMap.map.getCenter(); |
| 351 | 351 | if (window.gdMaps == 'google') {
|
| 352 | 352 | baseMarker.setPosition(center); |
@@ -355,47 +355,47 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | function updateMapZoom(zoom) {
|
| 358 | - jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
|
|
| 358 | + jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
|
|
| 359 | 359 | } |
| 360 | 360 | function updateMarkerPosition(markerlatLng) {
|
| 361 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 362 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
|
|
| 363 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
|
|
| 361 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 362 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
|
|
| 363 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
|
|
| 364 | 364 | } |
| 365 | 365 | function updateMarkerPositionOSM(markerlatLng) {
|
| 366 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
|
|
| 367 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
|
|
| 366 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
|
|
| 367 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
|
|
| 368 | 368 | } |
| 369 | 369 | function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
|
| 370 | - var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>'; |
|
| 371 | - <?php ob_start();?> |
|
| 372 | - var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
|
|
| 373 | - var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
|
|
| 370 | + var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>'; |
|
| 371 | + <?php ob_start(); ?> |
|
| 372 | + var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
|
|
| 373 | + var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
|
|
| 374 | 374 | |
| 375 | - if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
|
|
| 376 | - jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
|
|
| 375 | + if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
|
|
| 376 | + jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
|
|
| 377 | 377 | } |
| 378 | 378 | if (getAddress) {
|
| 379 | 379 | oldstr_address = getAddress; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
|
|
| 382 | + jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
|
|
| 383 | 383 | if (getZip) {
|
| 384 | 384 | oldstr_zip = getZip; |
| 385 | 385 | } |
| 386 | 386 | if (set_map_val_in_fields) {
|
| 387 | 387 | if (getCountry) {
|
| 388 | - jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 389 | - jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
|
|
| 388 | + jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 389 | + jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
|
|
| 390 | 390 | } |
| 391 | 391 | if (getState) {
|
| 392 | - if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
|
|
| 393 | - jQuery("#<?php echo $prefix.'region';?>").val(getState);
|
|
| 392 | + if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
|
|
| 393 | + jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
|
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | if (getCity) {
|
| 397 | - if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
|
|
| 398 | - jQuery("#<?php echo $prefix.'city';?>").val(getCity);
|
|
| 397 | + if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
|
|
| 398 | + jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
|
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | } |
@@ -411,12 +411,12 @@ discard block |
||
| 411 | 411 | ?> |
| 412 | 412 | } |
| 413 | 413 | function geodir_codeAddress(set_on_map) {
|
| 414 | - var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
|
| 415 | - var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
|
|
| 416 | - var city = jQuery('#<?php echo $prefix.'city';?>').val();
|
|
| 417 | - var region = jQuery('#<?php echo $prefix.'region';?>').val();
|
|
| 418 | - var country = jQuery('#<?php echo $prefix.'country';?>').val();
|
|
| 419 | - var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
|
|
| 414 | + var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
|
|
| 415 | + var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
|
|
| 416 | + var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
|
|
| 417 | + var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
|
|
| 418 | + var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
|
|
| 419 | + var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
|
|
| 420 | 420 | var ISO2 = country_selected.data('country_code');
|
| 421 | 421 | if (ISO2 == '--') {
|
| 422 | 422 | ISO2 = ''; |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | zip = ''; |
| 426 | 426 | } |
| 427 | 427 | if (typeof city == "undefined") {
|
| 428 | - city = '<?php echo addslashes_gpc($city);?>'; |
|
| 428 | + city = '<?php echo addslashes_gpc($city); ?>'; |
|
| 429 | 429 | } |
| 430 | 430 | if (typeof region == "undefined") {
|
| 431 | - region = '<?php echo addslashes_gpc($region);?>'; |
|
| 431 | + region = '<?php echo addslashes_gpc($region); ?>'; |
|
| 432 | 432 | } |
| 433 | 433 | if (typeof country == "undefined") {
|
| 434 | - country = '<?php echo addslashes_gpc($country);?>'; |
|
| 434 | + country = '<?php echo addslashes_gpc($country); ?>'; |
|
| 435 | 435 | } |
| 436 | 436 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 437 | 437 | <?php ob_start(); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | if (typeof address === 'undefined') |
| 447 | 447 | address = ''; |
| 448 | 448 | <?php |
| 449 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 449 | + if (is_admin() && isset($_REQUEST['tab'])) {?>
|
|
| 450 | 450 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 451 | 451 | address = ''; |
| 452 | 452 | } |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | geocoder.geocode({'address': address, 'country': ISO2},
|
| 487 | 487 | function (results, status) {
|
| 488 | 488 | console.log(status); |
| 489 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 489 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 490 | 490 | if (status == google.maps.GeocoderStatus.OK) {
|
| 491 | 491 | baseMarker.setPosition(results[0].geometry.location); |
| 492 | 492 | jQuery.goMap.map.setCenter(results[0].geometry.location); |
@@ -503,21 +503,21 @@ discard block |
||
| 503 | 503 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 504 | 504 | //} |
| 505 | 505 | } else {
|
| 506 | - alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
|
|
| 506 | + alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
|
|
| 507 | 507 | } |
| 508 | 508 | }); |
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | function gdMaxMap() {
|
| 512 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 512 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 513 | 513 | |
| 514 | - jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
|
|
| 514 | + jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
|
|
| 515 | 515 | jQuery('.map_category').toggleClass('map_category_fullscreen');
|
| 516 | - jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
|
|
| 516 | + jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
|
|
| 517 | 517 | jQuery('body').toggleClass('body_fullscreen');
|
| 518 | - jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 519 | - jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 520 | - jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 518 | + jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 519 | + jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 520 | + jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 521 | 521 | jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
|
| 522 | 522 | window.setTimeout(function () {
|
| 523 | 523 | if (window.gdMaps == 'google') {
|
@@ -553,9 +553,9 @@ discard block |
||
| 553 | 553 | do_action('geodir_add_listing_geocode_js_vars');
|
| 554 | 554 | ?> |
| 555 | 555 | <?php if ($is_map_restrict) { ?>
|
| 556 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 557 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 558 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 556 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 557 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 558 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 559 | 559 | centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 560 | 560 | baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 561 | 561 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
@@ -564,39 +564,39 @@ discard block |
||
| 564 | 564 | <?php } ?> |
| 565 | 565 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 566 | 566 | } else {
|
| 567 | - alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 567 | + alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | jQuery(function ($) {
|
| 572 | - $("#<?php echo $prefix.'map';?>").goMap({
|
|
| 573 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 574 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 575 | - zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT, |
|
| 572 | + $("#<?php echo $prefix.'map'; ?>").goMap({
|
|
| 573 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 574 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 575 | + zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT, |
|
| 576 | 576 | maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN |
| 577 | 577 | streetViewControl: true, |
| 578 | - <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
|
|
| 578 | + <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
|
|
| 579 | 579 | }); |
| 580 | 580 | |
| 581 | 581 | if (window.gdMaps) {
|
| 582 | 582 | geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : []; |
| 583 | 583 | |
| 584 | 584 | baseMarker = $.goMap.createMarker({
|
| 585 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 586 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 585 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 586 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 587 | 587 | id: 'baseMarker', |
| 588 | - icon: '<?php echo $marker_icon;?>', |
|
| 588 | + icon: '<?php echo $marker_icon; ?>', |
|
| 589 | 589 | draggable: true, |
| 590 | 590 | addToMap: true, // For OSM |
| 591 | - w: parseFloat('<?php echo $icon_size['w'];?>'),
|
|
| 592 | - h: parseFloat('<?php echo $icon_size['h'];?>'),
|
|
| 591 | + w: parseFloat('<?php echo $icon_size['w']; ?>'),
|
|
| 592 | + h: parseFloat('<?php echo $icon_size['h']; ?>'),
|
|
| 593 | 593 | }); |
| 594 | 594 | } else {
|
| 595 | - jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
|
|
| 596 | - jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
|
|
| 595 | + jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
|
|
| 596 | + jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
|
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - $("#<?php echo $prefix;?>set_address_button").click(function () {
|
|
| 599 | + $("#<?php echo $prefix; ?>set_address_button").click(function () {
|
|
| 600 | 600 | var set_on_map = true; |
| 601 | 601 | geodir_codeAddress(set_on_map); |
| 602 | 602 | }); |
@@ -630,14 +630,14 @@ discard block |
||
| 630 | 630 | updateMapZoom($.goMap.map.zoom); |
| 631 | 631 | }); |
| 632 | 632 | |
| 633 | - var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
|
|
| 633 | + var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
|
|
| 634 | 634 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
| 635 | 635 | |
| 636 | 636 | <?php if ($is_map_restrict) { ?>
|
| 637 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
|
| 637 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>'; |
|
| 638 | 638 | geocoder.geocode({'address': CITY_ADDRESS},
|
| 639 | 639 | function (results, status) {
|
| 640 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 640 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 641 | 641 | if (status == google.maps.GeocoderStatus.OK) {
|
| 642 | 642 | // Bounds for North America |
| 643 | 643 | var bound_lat_lng = String(results[0].geometry.bounds); |
@@ -648,13 +648,13 @@ discard block |
||
| 648 | 648 | new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3]) |
| 649 | 649 | ); |
| 650 | 650 | } else {
|
| 651 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
|
|
| 651 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
|
|
| 652 | 652 | } |
| 653 | 653 | }); |
| 654 | 654 | <?php } ?> |
| 655 | 655 | // Limit the zoom level |
| 656 | 656 | google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
|
| 657 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 657 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 658 | 658 | if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel); |
| 659 | 659 | }); |
| 660 | 660 | } else if (window.gdMaps == 'osm') {
|
@@ -680,10 +680,10 @@ discard block |
||
| 680 | 680 | updateMapZoom($.goMap.map.getZoom()); |
| 681 | 681 | }); |
| 682 | 682 | |
| 683 | - L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
|
|
| 683 | + L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
|
|
| 684 | 684 | |
| 685 | 685 | <?php if ($is_map_restrict) { ?>
|
| 686 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>'; |
|
| 686 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>'; |
|
| 687 | 687 | geocodePositionOSM('', CITY_ADDRESS);
|
| 688 | 688 | <?php } ?> |
| 689 | 689 | // Limit the zoom level |
@@ -706,14 +706,14 @@ discard block |
||
| 706 | 706 | <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;"> |
| 707 | 707 | <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div> |
| 708 | 708 | <div class="TopRight"></div> |
| 709 | - <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 709 | + <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 710 | 710 | <!-- new map start --> |
| 711 | 711 | <div class="iprelative"> |
| 712 | - <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 712 | + <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 713 | 713 | <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div> |
| 714 | 714 | <div id="<?php echo $prefix; ?>advmap_counter"></div> |
| 715 | 715 | <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 716 | - <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 716 | + <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 717 | 717 | </div> |
| 718 | 718 | <!-- new map end --> |
| 719 | 719 | </div> |
@@ -223,10 +223,11 @@ discard block |
||
| 223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 224 | 224 | <?php } |
| 225 | 225 | |
| 226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 227 | - $show_entire_cat_panel = "none"; |
|
| 228 | - else |
|
| 229 | - $show_entire_cat_panel = "''"; |
|
| 226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { |
|
| 227 | + $show_entire_cat_panel = "none"; |
|
| 228 | + } else { |
|
| 229 | + $show_entire_cat_panel = "''"; |
|
| 230 | + } |
|
| 230 | 231 | ?> |
| 231 | 232 | |
| 232 | 233 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
@@ -288,8 +289,9 @@ discard block |
||
| 288 | 289 | } |
| 289 | 290 | |
| 290 | 291 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
| 291 | - if (empty($geodir_default_map_search_pt)) |
|
| 292 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 292 | + if (empty($geodir_default_map_search_pt)) { |
|
| 293 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 294 | + } |
|
| 293 | 295 | |
| 294 | 296 | /** |
| 295 | 297 | * Filter the post type to retrive data for map |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
| 131 | 131 | } else {
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
| 136 | 136 | } else {
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | 170 | // Set default map options |
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
|
|
| 173 | 173 | |
| 174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
| 175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | 190 | ?> |
| 191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
| 191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
| 194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
| 195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
| 196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
| 195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
| 196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 197 | 197 | |
| 198 | 198 | <div class="map_background"> |
| 199 | 199 | <div class="top_banner_section_in clearfix"> |
| 200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
| 202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
| 203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
| 202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
| 203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 204 | 204 | <!-- new map start --> |
| 205 | 205 | <div class="iprelative"> |
| 206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
| 207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
| 209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
| 207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
| 209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 210 | 210 | <!--<div id="home_map_counter"></div> --> |
| 211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
| 211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
| 212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
| 213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
| 214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
|
| 215 | 215 | </div> |
| 216 | 216 | <!-- new map end --> |
| 217 | 217 | </div> |
| 218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
| 218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
| 219 | 219 | </div> |
| 220 | 220 | </div> |
| 221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
| 222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
| 223 | 223 | <?php } else {
|
| 224 | 224 | ?> |
| 225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
| 225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/>
|
| 243 | 243 | |
| 244 | 244 | <script> |
| 245 | - <?php if(geodir_is_page('detail')){?>
|
|
| 245 | + <?php if (geodir_is_page('detail')) {?>
|
|
| 246 | 246 | jQuery(function () {
|
| 247 | 247 | gd_initialize_ac(); |
| 248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // Create the autocomplete object, restricting the search |
| 254 | 254 | // to geographical location types. |
| 255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
| 256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
|
|
| 256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
|
|
| 257 | 257 | {types: ['geocode']});
|
| 258 | 258 | // When the user selects an address from the dropdown, |
| 259 | 259 | // populate the address fields in the form. |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
|
| 309 | 309 | ?> |
| 310 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
| 310 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
| 311 | 311 | <?php |
| 312 | 312 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 313 | 313 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | ?> |
| 319 | 319 | <div |
| 320 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
| 320 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
| 321 | 321 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
| 322 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
| 323 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
| 324 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?>
|
|
| 325 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
| 322 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
| 323 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
| 324 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?>
|
|
| 325 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
| 326 | 326 | <input |
| 327 | 327 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
|
| 328 | 328 | type="text" |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 335 | 335 | <?php } else {$child_collapse = "0";
|
| 336 | 336 | ?> |
| 337 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
| 337 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
| 338 | 338 | <?php } ?> |
| 339 | 339 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
| 340 | 340 | <div class="toggle"> |
| 341 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
| 341 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
| 342 | 342 | <script>jQuery( document ).ready(function() {
|
| 343 | 343 | geodir_show_sub_cat_collapse_button(); |
| 344 | 344 | });</script> |
@@ -367,21 +367,21 @@ discard block |
||
| 367 | 367 | $city = $country != 'me' ? $city : ''; |
| 368 | 368 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
| 369 | 369 | ?> |
| 370 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
| 371 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
| 372 | - value="<?php echo $country;?>"/> |
|
| 373 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
| 374 | - value="<?php echo $region;?>"/> |
|
| 375 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
| 376 | - value="<?php echo $city;?>"/> |
|
| 377 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
| 378 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
| 370 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
| 371 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
| 372 | + value="<?php echo $country; ?>"/> |
|
| 373 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
| 374 | + value="<?php echo $region; ?>"/> |
|
| 375 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
| 376 | + value="<?php echo $city; ?>"/> |
|
| 377 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
| 378 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
| 379 | 379 | <?php } else { //end of location filter
|
| 380 | 380 | ?> |
| 381 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
| 381 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
| 382 | 382 | <?php }?> |
| 383 | 383 | |
| 384 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
| 384 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
| 385 | 385 | |
| 386 | 386 | <input type="hidden" name="limitstart" value=""/> |
| 387 | 387 | |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 391 | 391 | $post_types = geodir_get_posttypes('object');
|
| 392 | - if (count((array)($post_types)) > 1) {
|
|
| 392 | + if (count((array) ($post_types)) > 1) {
|
|
| 393 | 393 | ?> |
| 394 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
| 395 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
| 394 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
| 395 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
| 396 | 396 | |
| 397 | 397 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 398 | 398 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | foreach ($post_types as $post_type => $args) {
|
| 404 | 404 | if (!in_array($post_type, $exclude_post_types)) {
|
| 405 | 405 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
| 406 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
| 406 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__(ucfirst($args->labels->name), 'geodirectory').'</a></li>'; |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | ?> |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | <script type="text/javascript"> |
| 429 | 429 | |
| 430 | 430 | jQuery(document).ready(function () {
|
| 431 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
|
|
| 432 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
|
|
| 433 | - map_sticky('<?php echo $map_canvas_name;?>');
|
|
| 431 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
|
|
| 432 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
|
|
| 433 | + map_sticky('<?php echo $map_canvas_name; ?>');
|
|
| 434 | 434 | }); |
| 435 | 435 | |
| 436 | 436 | </script> |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | <script> |
| 442 | 442 | (function () {
|
| 443 | 443 | var screenH = jQuery(window).height(); |
| 444 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
|
|
| 444 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
|
|
| 445 | 445 | |
| 446 | 446 | var ptypeH = ''; |
| 447 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 448 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 447 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 448 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 452 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 453 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 454 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 455 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 451 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 452 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 453 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 454 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 455 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 456 | 456 | |
| 457 | 457 | }()); |
| 458 | 458 | </script> |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | <script> |
| 465 | 465 | (function () {
|
| 466 | 466 | var screenH = jQuery(window).height(); |
| 467 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
|
|
| 467 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
|
|
| 468 | 468 | var ptypeH = ''; |
| 469 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 470 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 469 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 470 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 473 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 474 | 474 | |
| 475 | 475 | }()); |
| 476 | 476 | </script> |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | * @param array $geodir_map_options Array of map settings. |
| 486 | 486 | * @param string $map_canvas_name The canvas name and ID for the map. |
| 487 | 487 | */ |
| 488 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 488 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
|
|
| 489 | 489 | |
| 490 | 490 | |
| 491 | 491 | endif; // Exclude posttypes if end |
@@ -67,77 +67,77 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function geodir_draw_map($map_args = array()) |
| 69 | 69 | {
|
| 70 | - global $map_canvas_arr; |
|
| 71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | - |
|
| 74 | - $default_location = geodir_get_default_location(); |
|
| 75 | - |
|
| 76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | - $map_default_zoom = 12; |
|
| 79 | - // map options default values |
|
| 80 | - $width = 950; |
|
| 81 | - $height = 450; |
|
| 82 | - $child_collapse = '0'; |
|
| 83 | - $sticky = ''; |
|
| 84 | - $enable_cat_filters = false; |
|
| 85 | - $enable_text_search = false; |
|
| 86 | - $enable_post_type_filters = false; |
|
| 87 | - $enable_location_filters = false; |
|
| 88 | - $enable_jason_on_load = false; |
|
| 89 | - $enable_map_direction = false; |
|
| 90 | - $enable_marker_cluster = false; |
|
| 91 | - $enable_map_resize_button = false; |
|
| 92 | - $maptype = 'ROADMAP'; |
|
| 93 | - |
|
| 94 | - $geodir_map_options = array( |
|
| 95 | - 'width' => $width, |
|
| 96 | - 'height' => $height, |
|
| 97 | - 'child_collapse' => $child_collapse, |
|
| 98 | - 'sticky' => $sticky, |
|
| 99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | - 'enable_text_search' => $enable_text_search, |
|
| 102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | - 'enable_location_filters' => $enable_location_filters, |
|
| 104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | - 'enable_map_direction' => $enable_map_direction, |
|
| 106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | - 'map_canvas_name' => $map_canvas_name, |
|
| 109 | - 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | - 'latitude' => $map_default_lat, |
|
| 111 | - 'longitude' => $map_default_lng, |
|
| 112 | - 'zoom' => $map_default_zoom, |
|
| 113 | - 'scrollwheel' => true, |
|
| 114 | - 'streetViewControl' => true, |
|
| 115 | - 'maptype' => $maptype, |
|
| 116 | - 'showPreview' => '0', |
|
| 117 | - 'maxZoom' => 21, |
|
| 118 | - 'autozoom' => true, |
|
| 119 | - 'bubble_size' => 'small', |
|
| 120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - if (!empty($map_args)) {
|
|
| 125 | - foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | - } else {
|
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | - } else {
|
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 70 | + global $map_canvas_arr; |
|
| 71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | + |
|
| 74 | + $default_location = geodir_get_default_location(); |
|
| 75 | + |
|
| 76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | + $map_default_zoom = 12; |
|
| 79 | + // map options default values |
|
| 80 | + $width = 950; |
|
| 81 | + $height = 450; |
|
| 82 | + $child_collapse = '0'; |
|
| 83 | + $sticky = ''; |
|
| 84 | + $enable_cat_filters = false; |
|
| 85 | + $enable_text_search = false; |
|
| 86 | + $enable_post_type_filters = false; |
|
| 87 | + $enable_location_filters = false; |
|
| 88 | + $enable_jason_on_load = false; |
|
| 89 | + $enable_map_direction = false; |
|
| 90 | + $enable_marker_cluster = false; |
|
| 91 | + $enable_map_resize_button = false; |
|
| 92 | + $maptype = 'ROADMAP'; |
|
| 93 | + |
|
| 94 | + $geodir_map_options = array( |
|
| 95 | + 'width' => $width, |
|
| 96 | + 'height' => $height, |
|
| 97 | + 'child_collapse' => $child_collapse, |
|
| 98 | + 'sticky' => $sticky, |
|
| 99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | + 'enable_text_search' => $enable_text_search, |
|
| 102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | + 'enable_location_filters' => $enable_location_filters, |
|
| 104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | + 'enable_map_direction' => $enable_map_direction, |
|
| 106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | + 'map_canvas_name' => $map_canvas_name, |
|
| 109 | + 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | + 'latitude' => $map_default_lat, |
|
| 111 | + 'longitude' => $map_default_lng, |
|
| 112 | + 'zoom' => $map_default_zoom, |
|
| 113 | + 'scrollwheel' => true, |
|
| 114 | + 'streetViewControl' => true, |
|
| 115 | + 'maptype' => $maptype, |
|
| 116 | + 'showPreview' => '0', |
|
| 117 | + 'maxZoom' => 21, |
|
| 118 | + 'autozoom' => true, |
|
| 119 | + 'bubble_size' => 'small', |
|
| 120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + if (!empty($map_args)) {
|
|
| 125 | + foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | + } else {
|
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | + } else {
|
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | 141 | * Filter the options to use in google map. |
| 142 | 142 | * |
| 143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
|
| 148 | 148 | |
| 149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
| 149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
| 150 | 150 | |
| 151 | - /** |
|
| 151 | + /** |
|
| 152 | 152 | * Filter the post types to display data on map. |
| 153 | 153 | * |
| 154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | - // Set default map options |
|
| 169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | + // Set default map options |
|
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 173 | 173 | |
| 174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 175 | 175 | |
| 176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | - $map_width = '100%'; |
|
| 178 | - } else {
|
|
| 179 | - $map_width = $geodir_map_options['width']; |
|
| 180 | - } |
|
| 176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | + $map_width = '100%'; |
|
| 178 | + } else {
|
|
| 179 | + $map_width = $geodir_map_options['width']; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - /** |
|
| 182 | + /** |
|
| 183 | 183 | * Filter the width of map. |
| 184 | 184 | * |
| 185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | - ?> |
|
| 190 | + ?> |
|
| 191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 222 | 222 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
| 223 | 223 | <?php } else {
|
| 224 | - ?> |
|
| 224 | + ?> |
|
| 225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 229 | - $show_entire_cat_panel = "none"; |
|
| 230 | - else |
|
| 231 | - $show_entire_cat_panel = "''"; |
|
| 232 | - ?> |
|
| 228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 229 | + $show_entire_cat_panel = "none"; |
|
| 230 | + else |
|
| 231 | + $show_entire_cat_panel = "''"; |
|
| 232 | + ?> |
|
| 233 | 233 | |
| 234 | 234 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
| 235 | 235 | |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
|
| 286 | 286 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
|
| 287 | 287 | <option <?php if (get_option('geodir_search_dist_1') == 'km') {
|
| 288 | - echo 'selected="selected"'; |
|
| 289 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 288 | + echo 'selected="selected"'; |
|
| 289 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 290 | 290 | </select> |
| 291 | 291 | </div> |
| 292 | 292 | |
@@ -298,12 +298,12 @@ discard block |
||
| 298 | 298 | if (empty($geodir_default_map_search_pt)) |
| 299 | 299 | $geodir_default_map_search_pt = 'gd_place'; |
| 300 | 300 | |
| 301 | - global $gd_session; |
|
| 302 | - $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
|
|
| 301 | + global $gd_session; |
|
| 302 | + $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
|
|
| 303 | 303 | |
| 304 | - if ($homemap_catlist_ptype) {
|
|
| 305 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 306 | - } |
|
| 304 | + if ($homemap_catlist_ptype) {
|
|
| 305 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | 309 | * Filter the post type to retrive data for map |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | ?> |
| 317 | 317 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
| 318 | 318 | <?php |
| 319 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 320 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 319 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 320 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 321 | 321 | $map_cat_class = ''; |
| 322 | 322 | if ($geodir_map_options['enable_post_type_filters']) {
|
| 323 | 323 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
| 324 | 324 | } |
| 325 | - ?> |
|
| 325 | + ?> |
|
| 326 | 326 | <div |
| 327 | 327 | class="map-category-listing<?php echo $map_cat_class;?>"> |
| 328 | 328 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
|
| 341 | 341 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 342 | 342 | <?php } else {$child_collapse = "0";
|
| 343 | - ?> |
|
| 343 | + ?> |
|
| 344 | 344 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
| 345 | 345 | <?php } ?> |
| 346 | 346 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -362,17 +362,17 @@ discard block |
||
| 362 | 362 | <!-- map-category-listings--> |
| 363 | 363 | |
| 364 | 364 | <?php |
| 365 | - if ($geodir_map_options['enable_location_filters']) {
|
|
| 365 | + if ($geodir_map_options['enable_location_filters']) {
|
|
| 366 | 366 | $country = get_query_var('gd_country');
|
| 367 | 367 | $region = get_query_var('gd_region');
|
| 368 | 368 | $city = get_query_var('gd_city');
|
| 369 | 369 | |
| 370 | - //fix for location/me page |
|
| 371 | - $country = $country != 'me' ? $country : ''; |
|
| 370 | + //fix for location/me page |
|
| 371 | + $country = $country != 'me' ? $country : ''; |
|
| 372 | 372 | $region = $region != 'me' ? $region : ''; |
| 373 | 373 | $city = $country != 'me' ? $city : ''; |
| 374 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 375 | - ?> |
|
| 374 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 375 | + ?> |
|
| 376 | 376 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
| 377 | 377 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
| 378 | 378 | value="<?php echo $country;?>"/> |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
| 384 | 384 | value="<?php echo $gd_neighbourhood;?>"/> |
| 385 | 385 | <?php } else { //end of location filter
|
| 386 | - ?> |
|
| 386 | + ?> |
|
| 387 | 387 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
| 388 | 388 | <?php }?> |
| 389 | 389 | |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | |
| 396 | 396 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 397 | - $post_types = geodir_get_posttypes('object');
|
|
| 398 | - if (count((array)($post_types)) > 1) {
|
|
| 399 | - ?> |
|
| 397 | + $post_types = geodir_get_posttypes('object');
|
|
| 398 | + if (count((array)($post_types)) > 1) {
|
|
| 399 | + ?> |
|
| 400 | 400 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
| 401 | 401 | style="max-width:<?php echo $map_width;?>!important;"> |
| 402 | 402 | |
@@ -404,15 +404,15 @@ discard block |
||
| 404 | 404 | <div class="geodir-map-posttype-list"><?php } ?> |
| 405 | 405 | <ul class="clearfix place-list"> |
| 406 | 406 | <?php |
| 407 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 407 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 408 | 408 | |
| 409 | - foreach ($post_types as $post_type => $args) {
|
|
| 410 | - if (!in_array($post_type, $exclude_post_types)) {
|
|
| 411 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 409 | + foreach ($post_types as $post_type => $args) {
|
|
| 410 | + if (!in_array($post_type, $exclude_post_types)) {
|
|
| 411 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 412 | 412 | echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
| 413 | - } |
|
| 414 | - } |
|
| 415 | - ?> |
|
| 413 | + } |
|
| 414 | + } |
|
| 415 | + ?> |
|
| 416 | 416 | </ul> |
| 417 | 417 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 418 | 418 | </div><?php } ?> |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | </div> <!-- map-places-listings--> |
| 428 | 428 | <?php } |
| 429 | - } // end of post type filter if |
|
| 430 | - ?> |
|
| 429 | + } // end of post type filter if |
|
| 430 | + ?> |
|
| 431 | 431 | |
| 432 | 432 | </div> |
| 433 | 433 | </div> <!--end of stick trigger container--> |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | </script> |
| 443 | 443 | <?php |
| 444 | 444 | |
| 445 | - if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 446 | - ?> |
|
| 445 | + if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 446 | + ?> |
|
| 447 | 447 | <script> |
| 448 | 448 | (function () {
|
| 449 | 449 | var screenH = jQuery(window).height(); |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | <?php |
| 467 | 467 | |
| 468 | - } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 469 | - ?> |
|
| 468 | + } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 469 | + ?> |
|
| 470 | 470 | <script> |
| 471 | 471 | (function () {
|
| 472 | 472 | var screenH = jQuery(window).height(); |
@@ -481,20 +481,20 @@ discard block |
||
| 481 | 481 | }()); |
| 482 | 482 | </script> |
| 483 | 483 | <?php |
| 484 | - } |
|
| 484 | + } |
|
| 485 | 485 | |
| 486 | - /** |
|
| 487 | - * Action that runs after all the map code has been output; |
|
| 488 | - * |
|
| 489 | - * @since 1.5.3 |
|
| 490 | - * |
|
| 491 | - * @param array $geodir_map_options Array of map settings. |
|
| 492 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 493 | - */ |
|
| 494 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 486 | + /** |
|
| 487 | + * Action that runs after all the map code has been output; |
|
| 488 | + * |
|
| 489 | + * @since 1.5.3 |
|
| 490 | + * |
|
| 491 | + * @param array $geodir_map_options Array of map settings. |
|
| 492 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 493 | + */ |
|
| 494 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 495 | 495 | |
| 496 | 496 | |
| 497 | - endif; // Exclude posttypes if end |
|
| 497 | + endif; // Exclude posttypes if end |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | ?> |
| 501 | 501 | \ No newline at end of file |
@@ -16,8 +16,9 @@ |
||
| 16 | 16 | * the visitor has not yet entered the password we will |
| 17 | 17 | * return early without loading the comments. |
| 18 | 18 | */ |
| 19 | -if (post_password_required()) |
|
| 20 | - return; |
|
| 19 | +if (post_password_required()) { |
|
| 20 | + return; |
|
| 21 | +} |
|
| 21 | 22 | ?> |
| 22 | 23 | |
| 23 | 24 | <div id="comments" class="comments-area"> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * return early without loading the comments. |
| 18 | 18 | */ |
| 19 | 19 | if (post_password_required()) |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | ?> |
| 22 | 22 | |
| 23 | 23 | <div id="comments" class="comments-area"> |
@@ -25,35 +25,35 @@ discard block |
||
| 25 | 25 | <?php // You can start editing here -- including this comment! ?> |
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | - /** |
|
| 29 | - * Called before displaying reviews. |
|
| 30 | - * |
|
| 31 | - * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
| 32 | - * |
|
| 33 | - * @since 1.5.7 |
|
| 34 | - */ |
|
| 35 | - do_action('geodir_before_review_list'); ?>
|
|
| 28 | + /** |
|
| 29 | + * Called before displaying reviews. |
|
| 30 | + * |
|
| 31 | + * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
| 32 | + * |
|
| 33 | + * @since 1.5.7 |
|
| 34 | + */ |
|
| 35 | + do_action('geodir_before_review_list'); ?>
|
|
| 36 | 36 | |
| 37 | 37 | <?php if (have_comments()) : ?> |
| 38 | 38 | <h2 class="comments-title"> |
| 39 | 39 | <?php |
| 40 | - printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'),
|
|
| 41 | - number_format_i18n(get_comments_number()), get_the_title()); |
|
| 42 | - ?> |
|
| 40 | + printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'),
|
|
| 41 | + number_format_i18n(get_comments_number()), get_the_title()); |
|
| 42 | + ?> |
|
| 43 | 43 | </h2> |
| 44 | 44 | |
| 45 | 45 | <?php |
| 46 | - /** |
|
| 47 | - * Called after displaying review listing title. |
|
| 48 | - * |
|
| 49 | - * @since 1.5.7 |
|
| 50 | - */ |
|
| 51 | - do_action('geodir_after_review_list_title'); ?>
|
|
| 46 | + /** |
|
| 47 | + * Called after displaying review listing title. |
|
| 48 | + * |
|
| 49 | + * @since 1.5.7 |
|
| 50 | + */ |
|
| 51 | + do_action('geodir_after_review_list_title'); ?>
|
|
| 52 | 52 | |
| 53 | 53 | <ol class="commentlist"> |
| 54 | 54 | <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
|
| 55 | 55 | <?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
|
| 56 | - ?> |
|
| 56 | + ?> |
|
| 57 | 57 | </ol><!-- .commentlist --> |
| 58 | 58 | |
| 59 | 59 | <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
|
@@ -68,51 +68,51 @@ discard block |
||
| 68 | 68 | <?php endif; // check for comment navigation ?> |
| 69 | 69 | |
| 70 | 70 | <?php |
| 71 | - /* If there are no comments and comments are closed, let's leave a note. |
|
| 71 | + /* If there are no comments and comments are closed, let's leave a note. |
|
| 72 | 72 | * But we only want the note on posts and pages that had comments in the first place. |
| 73 | 73 | */ |
| 74 | - if (!comments_open() && get_comments_number()) : ?> |
|
| 74 | + if (!comments_open() && get_comments_number()) : ?> |
|
| 75 | 75 | <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
|
| 76 | 76 | <?php endif; ?> |
| 77 | 77 | |
| 78 | 78 | <?php endif; // have_comments() ?> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - /** |
|
| 82 | - * Called before displaying "Leave a review form". |
|
| 83 | - * |
|
| 84 | - * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
| 85 | - * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
| 86 | - * |
|
| 87 | - * @since 1.5.7 |
|
| 88 | - */ |
|
| 89 | - do_action('geodir_before_review_form'); ?>
|
|
| 81 | + /** |
|
| 82 | + * Called before displaying "Leave a review form". |
|
| 83 | + * |
|
| 84 | + * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
| 85 | + * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
| 86 | + * |
|
| 87 | + * @since 1.5.7 |
|
| 88 | + */ |
|
| 89 | + do_action('geodir_before_review_form'); ?>
|
|
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - /** |
|
| 93 | - * Filters comment form args |
|
| 94 | - * |
|
| 95 | - * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
| 96 | - * |
|
| 97 | - * @since 1.0.0 |
|
| 98 | - */ |
|
| 99 | - $args = apply_filters('geodir_review_form_args', array(
|
|
| 100 | - 'title_reply' => __('Leave a Review', 'geodirectory'),
|
|
| 101 | - 'label_submit' => __('Post Review', 'geodirectory'),
|
|
| 102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 104 | - )); |
|
| 105 | - comment_form($args); |
|
| 106 | - ?> |
|
| 92 | + /** |
|
| 93 | + * Filters comment form args |
|
| 94 | + * |
|
| 95 | + * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
| 96 | + * |
|
| 97 | + * @since 1.0.0 |
|
| 98 | + */ |
|
| 99 | + $args = apply_filters('geodir_review_form_args', array(
|
|
| 100 | + 'title_reply' => __('Leave a Review', 'geodirectory'),
|
|
| 101 | + 'label_submit' => __('Post Review', 'geodirectory'),
|
|
| 102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | + 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 104 | + )); |
|
| 105 | + comment_form($args); |
|
| 106 | + ?> |
|
| 107 | 107 | |
| 108 | 108 | <?php |
| 109 | - /** |
|
| 110 | - * Called after displaying "Leave a review form". |
|
| 111 | - * |
|
| 112 | - * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
| 113 | - * |
|
| 114 | - * @since 1.5.7 |
|
| 115 | - */ |
|
| 116 | - do_action('geodir_after_review_form'); ?>
|
|
| 109 | + /** |
|
| 110 | + * Called after displaying "Leave a review form". |
|
| 111 | + * |
|
| 112 | + * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
| 113 | + * |
|
| 114 | + * @since 1.5.7 |
|
| 115 | + */ |
|
| 116 | + do_action('geodir_after_review_form'); ?>
|
|
| 117 | 117 | |
| 118 | 118 | </div><!-- #comments .comments-area --> |
| 119 | 119 | \ No newline at end of file |
@@ -99,8 +99,8 @@ |
||
| 99 | 99 | $args = apply_filters('geodir_review_form_args', array(
|
| 100 | 100 | 'title_reply' => __('Leave a Review', 'geodirectory'),
|
| 101 | 101 | 'label_submit' => __('Post Review', 'geodirectory'),
|
| 102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
|
|
| 102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
|
|
| 103 | + 'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>'
|
|
| 104 | 104 | )); |
| 105 | 105 | comment_form($args); |
| 106 | 106 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if (!defined('ABSPATH')) exit; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Return the current cache expire setting. |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param string $data |
| 38 | 38 | */ |
| 39 | -function wp_session_decode( $data ) { |
|
| 39 | +function wp_session_decode($data) { |
|
| 40 | 40 | $wp_session = WP_Session::get_instance(); |
| 41 | 41 | |
| 42 | - return $wp_session->json_in( $data ); |
|
| 42 | + return $wp_session->json_in($data); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
| 63 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
| 64 | 64 | $wp_session = WP_Session::get_instance(); |
| 65 | 65 | |
| 66 | - $wp_session->regenerate_id( $delete_old_session ); |
|
| 66 | + $wp_session->regenerate_id($delete_old_session); |
|
| 67 | 67 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function wp_session_start() { |
| 79 | 79 | $wp_session = WP_Session::get_instance(); |
| 80 | - do_action( 'wp_session_start' ); |
|
| 80 | + do_action('wp_session_start'); |
|
| 81 | 81 | |
| 82 | 82 | return $wp_session->session_started(); |
| 83 | 83 | } |
| 84 | -add_action( 'plugins_loaded', 'wp_session_start' ); |
|
| 84 | +add_action('plugins_loaded', 'wp_session_start'); |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Return the current session status. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | function wp_session_status() { |
| 92 | 92 | $wp_session = WP_Session::get_instance(); |
| 93 | 93 | |
| 94 | - if ( $wp_session->session_started() ) { |
|
| 94 | + if ($wp_session->session_started()) { |
|
| 95 | 95 | return PHP_SESSION_ACTIVE; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $wp_session = WP_Session::get_instance(); |
| 115 | 115 | |
| 116 | 116 | $wp_session->write_data(); |
| 117 | - do_action( 'wp_session_commit' ); |
|
| 117 | + do_action('wp_session_commit'); |
|
| 118 | 118 | } |
| 119 | -add_action( 'shutdown', 'wp_session_write_close' ); |
|
| 119 | +add_action('shutdown', 'wp_session_write_close'); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Clean up expired sessions by removing data and their expiration entries from |
@@ -128,51 +128,51 @@ discard block |
||
| 128 | 128 | function wp_session_cleanup() { |
| 129 | 129 | global $wpdb; |
| 130 | 130 | |
| 131 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
| 131 | + if (defined('WP_SETUP_CONFIG')) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
| 136 | - $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" ); |
|
| 135 | + if (!defined('WP_INSTALLING')) { |
|
| 136 | + $expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'"); |
|
| 137 | 137 | |
| 138 | - $now = current_time( 'timestamp' ); |
|
| 138 | + $now = current_time('timestamp'); |
|
| 139 | 139 | $expired_sessions = array(); |
| 140 | 140 | |
| 141 | - foreach( $expiration_keys as $expiration ) { |
|
| 141 | + foreach ($expiration_keys as $expiration) { |
|
| 142 | 142 | |
| 143 | 143 | // If the session has expired |
| 144 | - if ( $now > intval( $expiration->option_value ) ) { |
|
| 144 | + if ($now > intval($expiration->option_value)) { |
|
| 145 | 145 | |
| 146 | 146 | // Get the session ID by parsing the option_name |
| 147 | - $session_id = substr( $expiration->option_name, 20 ); |
|
| 147 | + $session_id = substr($expiration->option_name, 20); |
|
| 148 | 148 | |
| 149 | - if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) { |
|
| 149 | + if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) { |
|
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $expired_sessions[] = $expiration->option_name; |
| 154 | - $expired_sessions[] = esc_sql( "_wp_session_$session_id" ); |
|
| 154 | + $expired_sessions[] = esc_sql("_wp_session_$session_id"); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Delete all expired sessions in a single query |
| 159 | - if ( ! empty( $expired_sessions ) ) { |
|
| 160 | - $option_names = implode( "','", $expired_sessions ); |
|
| 161 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" ); |
|
| 159 | + if (!empty($expired_sessions)) { |
|
| 160 | + $option_names = implode("','", $expired_sessions); |
|
| 161 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Allow other plugins to hook in to the garbage collection process. |
| 166 | - do_action( 'wp_session_cleanup' ); |
|
| 166 | + do_action('wp_session_cleanup'); |
|
| 167 | 167 | } |
| 168 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
| 168 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Register the garbage collector as a twice daily event. |
| 172 | 172 | */ |
| 173 | 173 | function wp_session_register_garbage_collection() { |
| 174 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
| 175 | - wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' ); |
|
| 174 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
| 175 | + wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection'); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
| 178 | +add_action('wp', 'wp_session_register_garbage_collection'); |
|
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | + exit; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | /** |
| 17 | 19 | * Return the current cache expire setting. |
@@ -50,16 +50,19 @@ |
||
| 50 | 50 | <?php |
| 51 | 51 | |
| 52 | 52 | $default_search_for_text = SEARCH_FOR_TEXT; |
| 53 | - if (get_option('geodir_search_field_default_text'))
|
|
| 54 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 53 | + if (get_option('geodir_search_field_default_text')) { |
|
| 54 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | $default_near_text = NEAR_TEXT; |
| 57 | - if (get_option('geodir_near_field_default_text'))
|
|
| 58 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 58 | + if (get_option('geodir_near_field_default_text')) { |
|
| 59 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | $default_search_button_label = __('Search', 'geodirectory');
|
| 61 | - if (get_option('geodir_search_button_label'))
|
|
| 62 | - $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 63 | + if (get_option('geodir_search_button_label')) { |
|
| 64 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory'); |
|
| 65 | + } |
|
| 63 | 66 | |
| 64 | 67 | $post_types = geodir_get_posttypes('object');
|
| 65 | 68 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $post_types = geodir_get_posttypes('object');
|
| 65 | 65 | |
| 66 | - if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 66 | + if (!empty($post_types) && count((array) $post_types) > 1): |
|
| 67 | 67 | ?> |
| 68 | 68 | <select name="stype" class="search_by_post"> |
| 69 | 69 | <?php foreach ($post_types as $post_type => $info): |
@@ -75,19 +75,19 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | 77 | |
| 78 | - <option data-label="<?php echo get_post_type_archive_link($post_type);?>" |
|
| 79 | - value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 78 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
| 79 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 80 | 80 | if ($post_type == $_REQUEST['stype']) {
|
| 81 | 81 | echo 'selected="selected"'; |
| 82 | 82 | } |
| 83 | 83 | } elseif ($curr_post_type == $post_type) {
|
| 84 | 84 | echo 'selected="selected"'; |
| 85 | - }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 85 | + }?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
| 86 | 86 | |
| 87 | 87 | <?php endforeach; ?> |
| 88 | 88 | </select> |
| 89 | 89 | <?php elseif (!empty($post_types)): |
| 90 | - echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 90 | + echo '<input type="hidden" name="stype" value="'.key($post_types).'" />'; |
|
| 91 | 91 | endif; ?> |
| 92 | 92 | |
| 93 | 93 | <input class="search_text" name="s" |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @since 1.5.5 |
| 158 | 158 | * @param string $default_search_button_label The current search button text. |
| 159 | 159 | */ |
| 160 | - $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 160 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label); ?>
|
|
| 161 | 161 | <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" /> |
| 162 | 162 | <?php |
| 163 | 163 | /** |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $curr_post_type = geodir_get_current_posttype(); |
| 16 | 16 | if (function_exists('geodir_location_geo_home_link')) {
|
| 17 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 17 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 18 | 18 | } |
| 19 | 19 | $search_url = trailingslashit(get_home_url()); |
| 20 | 20 | if (function_exists('geodir_location_geo_home_link')) {
|
| 21 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 21 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 22 | 22 | } |
| 23 | 23 | ?> |
| 24 | 24 | |
@@ -37,104 +37,104 @@ discard block |
||
| 37 | 37 | <div class="geodir-loc-bar"> |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - /** |
|
| 41 | - * Called inside the search form but before any of the fields. |
|
| 42 | - * |
|
| 43 | - * @since 1.0.0 |
|
| 44 | - */ |
|
| 45 | - do_action('geodir_before_search_form') ?>
|
|
| 40 | + /** |
|
| 41 | + * Called inside the search form but before any of the fields. |
|
| 42 | + * |
|
| 43 | + * @since 1.0.0 |
|
| 44 | + */ |
|
| 45 | + do_action('geodir_before_search_form') ?>
|
|
| 46 | 46 | |
| 47 | 47 | <div class="clearfix geodir-loc-bar-in"> |
| 48 | 48 | <div class="geodir-search"> |
| 49 | 49 | |
| 50 | 50 | <?php |
| 51 | 51 | |
| 52 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 53 | - if (get_option('geodir_search_field_default_text'))
|
|
| 54 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 52 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
| 53 | + if (get_option('geodir_search_field_default_text'))
|
|
| 54 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 55 | 55 | |
| 56 | - $default_near_text = NEAR_TEXT; |
|
| 57 | - if (get_option('geodir_near_field_default_text'))
|
|
| 58 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 56 | + $default_near_text = NEAR_TEXT; |
|
| 57 | + if (get_option('geodir_near_field_default_text'))
|
|
| 58 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 59 | 59 | |
| 60 | - $default_search_button_label = __('Search', 'geodirectory');
|
|
| 61 | - if (get_option('geodir_search_button_label'))
|
|
| 62 | - $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 60 | + $default_search_button_label = __('Search', 'geodirectory');
|
|
| 61 | + if (get_option('geodir_search_button_label'))
|
|
| 62 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 63 | 63 | |
| 64 | - $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
|
|
| 64 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
|
|
| 65 | 65 | |
| 66 | - if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 67 | - ?> |
|
| 66 | + if (!empty($post_types) && count((array)$post_types) > 1): |
|
| 67 | + ?> |
|
| 68 | 68 | <select name="stype" class="search_by_post"> |
| 69 | 69 | <?php foreach ($post_types as $post_type => $info): |
| 70 | - global $wpdb; |
|
| 71 | - $has_posts = ''; |
|
| 72 | - $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 73 | - if (!$has_posts) {
|
|
| 74 | - continue; |
|
| 75 | - } |
|
| 76 | - ?> |
|
| 70 | + global $wpdb; |
|
| 71 | + $has_posts = ''; |
|
| 72 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 73 | + if (!$has_posts) {
|
|
| 74 | + continue; |
|
| 75 | + } |
|
| 76 | + ?> |
|
| 77 | 77 | |
| 78 | 78 | <option data-label="<?php echo get_post_type_archive_link($post_type);?>" |
| 79 | 79 | value="<?php echo $post_type;?>" <?php if (isset($_REQUEST['stype'])) {
|
| 80 | - if ($post_type == $_REQUEST['stype']) {
|
|
| 81 | - echo 'selected="selected"'; |
|
| 82 | - } |
|
| 83 | - } elseif ($curr_post_type == $post_type) {
|
|
| 84 | - echo 'selected="selected"'; |
|
| 85 | - }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 80 | + if ($post_type == $_REQUEST['stype']) {
|
|
| 81 | + echo 'selected="selected"'; |
|
| 82 | + } |
|
| 83 | + } elseif ($curr_post_type == $post_type) {
|
|
| 84 | + echo 'selected="selected"'; |
|
| 85 | + }?>><?php _e(ucfirst($info->labels->name), 'geodirectory');?></option> |
|
| 86 | 86 | |
| 87 | 87 | <?php endforeach; ?> |
| 88 | 88 | </select> |
| 89 | 89 | <?php elseif (!empty($post_types)): |
| 90 | - echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 91 | - endif; ?> |
|
| 90 | + echo '<input type="hidden" name="stype" value="' . key($post_types) . '" />'; |
|
| 91 | + endif; ?> |
|
| 92 | 92 | |
| 93 | 93 | <input class="search_text" name="s" |
| 94 | 94 | value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
|
| 95 | - echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 96 | - } else {
|
|
| 97 | - echo $default_search_for_text; |
|
| 98 | - } ?>" type="text" |
|
| 95 | + echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 96 | + } else {
|
|
| 97 | + echo $default_search_for_text; |
|
| 98 | + } ?>" type="text" |
|
| 99 | 99 | onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
|
| 100 | 100 | onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
|
| 101 | 101 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | <?php |
| 105 | - if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 106 | - $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 107 | - } else {
|
|
| 108 | - $near = $default_near_text; |
|
| 109 | - } |
|
| 110 | - /** |
|
| 111 | - * Filter the "Near" text value for the search form. |
|
| 112 | - * |
|
| 113 | - * This is the input "value" attribute and can change depending on what the user searches and is not always the default value. |
|
| 114 | - * |
|
| 115 | - * @since 1.0.0 |
|
| 116 | - * @param string $near The current near value. |
|
| 117 | - * @param string $default_near_text The default near value. |
|
| 118 | - */ |
|
| 119 | - $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 120 | - /** |
|
| 121 | - * Filter the default "Near" text value for the search form. |
|
| 122 | - * |
|
| 123 | - * This is the default value if nothing has been searched. |
|
| 124 | - * |
|
| 125 | - * @since 1.0.0 |
|
| 126 | - * @param string $near The current near value. |
|
| 127 | - * @param string $default_near_text The default near value. |
|
| 128 | - */ |
|
| 129 | - $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 130 | - /** |
|
| 131 | - * Filter the class for the near search input. |
|
| 132 | - * |
|
| 133 | - * @since 1.0.0 |
|
| 134 | - * @param string $class The class for the HTML near input, default is blank. |
|
| 135 | - */ |
|
| 136 | - $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 137 | - ?> |
|
| 105 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 106 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 107 | + } else {
|
|
| 108 | + $near = $default_near_text; |
|
| 109 | + } |
|
| 110 | + /** |
|
| 111 | + * Filter the "Near" text value for the search form. |
|
| 112 | + * |
|
| 113 | + * This is the input "value" attribute and can change depending on what the user searches and is not always the default value. |
|
| 114 | + * |
|
| 115 | + * @since 1.0.0 |
|
| 116 | + * @param string $near The current near value. |
|
| 117 | + * @param string $default_near_text The default near value. |
|
| 118 | + */ |
|
| 119 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 120 | + /** |
|
| 121 | + * Filter the default "Near" text value for the search form. |
|
| 122 | + * |
|
| 123 | + * This is the default value if nothing has been searched. |
|
| 124 | + * |
|
| 125 | + * @since 1.0.0 |
|
| 126 | + * @param string $near The current near value. |
|
| 127 | + * @param string $default_near_text The default near value. |
|
| 128 | + */ |
|
| 129 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 130 | + /** |
|
| 131 | + * Filter the class for the near search input. |
|
| 132 | + * |
|
| 133 | + * @since 1.0.0 |
|
| 134 | + * @param string $class The class for the HTML near input, default is blank. |
|
| 135 | + */ |
|
| 136 | + $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 137 | + ?> |
|
| 138 | 138 | |
| 139 | 139 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
| 140 | 140 | onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
|
@@ -142,42 +142,42 @@ discard block |
||
| 142 | 142 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"/> |
| 143 | 143 | |
| 144 | 144 | <?php |
| 145 | - /** |
|
| 146 | - * Called on the GD search form just before the search button. |
|
| 147 | - * |
|
| 148 | - * @since 1.0.0 |
|
| 149 | - */ |
|
| 150 | - do_action('geodir_before_search_button');
|
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Filter the default search button text value for the search form. |
|
| 154 | - * |
|
| 155 | - * This text can be changed via an option in settings, this is a last resort. |
|
| 156 | - * |
|
| 157 | - * @since 1.5.5 |
|
| 158 | - * @param string $default_search_button_label The current search button text. |
|
| 159 | - */ |
|
| 160 | - $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 145 | + /** |
|
| 146 | + * Called on the GD search form just before the search button. |
|
| 147 | + * |
|
| 148 | + * @since 1.0.0 |
|
| 149 | + */ |
|
| 150 | + do_action('geodir_before_search_button');
|
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Filter the default search button text value for the search form. |
|
| 154 | + * |
|
| 155 | + * This text can be changed via an option in settings, this is a last resort. |
|
| 156 | + * |
|
| 157 | + * @since 1.5.5 |
|
| 158 | + * @param string $default_search_button_label The current search button text. |
|
| 159 | + */ |
|
| 160 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);?>
|
|
| 161 | 161 | <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" class="geodir_submit_search" /> |
| 162 | 162 | <?php |
| 163 | - /** |
|
| 164 | - * Called on the GD search form just after the search button. |
|
| 165 | - * |
|
| 166 | - * @since 1.0.0 |
|
| 167 | - */ |
|
| 168 | - do_action('geodir_after_search_button'); ?>
|
|
| 163 | + /** |
|
| 164 | + * Called on the GD search form just after the search button. |
|
| 165 | + * |
|
| 166 | + * @since 1.0.0 |
|
| 167 | + */ |
|
| 168 | + do_action('geodir_after_search_button'); ?>
|
|
| 169 | 169 | </div> |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | </div> |
| 173 | 173 | |
| 174 | 174 | <?php |
| 175 | - /** |
|
| 176 | - * Called inside the search form but after all the input fields. |
|
| 177 | - * |
|
| 178 | - * @since 1.0.0 |
|
| 179 | - */ |
|
| 180 | - do_action('geodir_after_search_form') ?>
|
|
| 175 | + /** |
|
| 176 | + * Called inside the search form but after all the input fields. |
|
| 177 | + * |
|
| 178 | + * @since 1.0.0 |
|
| 179 | + */ |
|
| 180 | + do_action('geodir_after_search_form') ?>
|
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | </div> |
@@ -54,8 +54,9 @@ |
||
| 54 | 54 | echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
| 58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
| 57 | + if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') { |
|
| 58 | + echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | ?> |
| 61 | 62 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') {
|
| 13 | - $redirect_to = $_GET['redirect_to']; |
|
| 13 | + $redirect_to = $_GET['redirect_to']; |
|
| 14 | 14 | } else {
|
| 15 | - //echo $_SERVER['HTTP_HOST'] ; |
|
| 16 | - $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
|
| 17 | - if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
|
|
| 18 | - $redirect_to = home_url(); |
|
| 19 | - } |
|
| 15 | + //echo $_SERVER['HTTP_HOST'] ; |
|
| 16 | + $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
|
| 17 | + if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) {
|
|
| 18 | + $redirect_to = home_url(); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
@@ -38,36 +38,36 @@ discard block |
||
| 38 | 38 | <h4> |
| 39 | 39 | <?php |
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template. |
|
| 43 | - * |
|
| 44 | - * @since 1.0.0 |
|
| 45 | - */ |
|
| 46 | - echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
|
|
| 41 | + /** |
|
| 42 | + * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template. |
|
| 43 | + * |
|
| 44 | + * @since 1.0.0 |
|
| 45 | + */ |
|
| 46 | + echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE);
|
|
| 47 | 47 | |
| 48 | - ?> |
|
| 48 | + ?> |
|
| 49 | 49 | </h4> |
| 50 | 50 | <?php |
| 51 | - if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
|
|
| 52 | - echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
| 53 | - } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
|
|
| 54 | - echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
| 55 | - } |
|
| 51 | + if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
|
|
| 52 | + echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
| 53 | + } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
|
|
| 54 | + echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
| 58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
| 57 | + if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
| 58 | + echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
| 59 | 59 | |
| 60 | - ?> |
|
| 60 | + ?> |
|
| 61 | 61 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
| 62 | 62 | method="post"> |
| 63 | 63 | |
| 64 | 64 | <div class="form_row clearfix"> |
| 65 | 65 | <input placeholder='<?php echo USERNAME_TEXT; ?>' type="text" name="log" id="user_login" |
| 66 | 66 | value="<?php global $user_login; |
| 67 | - if (!isset($user_login)) {
|
|
| 68 | - $user_login = ''; |
|
| 69 | - } |
|
| 70 | - echo esc_attr($user_login); ?>" size="20" class="textfield"/> |
|
| 67 | + if (!isset($user_login)) {
|
|
| 68 | + $user_login = ''; |
|
| 69 | + } |
|
| 70 | + echo esc_attr($user_login); ?>" size="20" class="textfield"/> |
|
| 71 | 71 | <span class="user_loginInfo"></span> |
| 72 | 72 | </div> |
| 73 | 73 | |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | </div> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - /** |
|
| 82 | - * This is a default WordPress action that calls any additional elements needed for any login forms. |
|
| 83 | - * |
|
| 84 | - * We use this action before the remember me checkbox on the sigin form. |
|
| 85 | - * |
|
| 86 | - * @since 1.0.0 |
|
| 87 | - */ |
|
| 88 | - do_action('login_form'); ?>
|
|
| 81 | + /** |
|
| 82 | + * This is a default WordPress action that calls any additional elements needed for any login forms. |
|
| 83 | + * |
|
| 84 | + * We use this action before the remember me checkbox on the sigin form. |
|
| 85 | + * |
|
| 86 | + * @since 1.0.0 |
|
| 87 | + */ |
|
| 88 | + do_action('login_form'); ?>
|
|
| 89 | 89 | <p class="rember"> |
| 90 | 90 | <input name="rememberme" type="checkbox" id="rememberme" value="forever" class="fl"/> |
| 91 | 91 | <?php echo REMEMBER_ON_COMPUTER_TEXT; ?> |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?>' type="text" name="user_login" |
| 110 | 110 | value="<?php echo esc_attr($user_login); ?>" size="20" class="user_login1 textfield"/> |
| 111 | 111 | <?php |
| 112 | - /** |
|
| 113 | - * Called before the get new password button in the login box template. |
|
| 114 | - * |
|
| 115 | - * @since 1.0.0 |
|
| 116 | - */ |
|
| 117 | - do_action('lostpassword_form'); ?>
|
|
| 112 | + /** |
|
| 113 | + * Called before the get new password button in the login box template. |
|
| 114 | + * |
|
| 115 | + * @since 1.0.0 |
|
| 116 | + */ |
|
| 117 | + do_action('lostpassword_form'); ?>
|
|
| 118 | 118 | </div> |
| 119 | 119 | <input type="submit" name="get_new_password" value="<?php echo GET_NEW_PW_TEXT; ?>" class="geodir_button"/> |
| 120 | 120 | </form> |
@@ -49,13 +49,13 @@ |
||
| 49 | 49 | </h4> |
| 50 | 50 | <?php |
| 51 | 51 | if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') {
|
| 52 | - echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
| 52 | + echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>"; |
|
| 53 | 53 | } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) {
|
| 54 | - echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
| 54 | + echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>"; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
| 58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
| 58 | + echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>'; |
|
| 59 | 59 | |
| 60 | 60 | ?> |
| 61 | 61 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
@@ -61,10 +61,11 @@ |
||
| 61 | 61 | ob_start(); |
| 62 | 62 | echo '<h5 class="geodir_information">'; |
| 63 | 63 | |
| 64 | - if (!isset($_REQUEST['pid'])) |
|
| 65 | - printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
| 66 | - else |
|
| 67 | - printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
| 64 | + if (!isset($_REQUEST['pid'])) { |
|
| 65 | + printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
| 66 | + } else { |
|
| 67 | + printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
| 68 | + } |
|
| 68 | 69 | |
| 69 | 70 | echo '</h5>'; |
| 70 | 71 | $publish_listing_form_message = ob_get_clean(); |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | $post_type = $post->listing_type; |
| 16 | 16 | |
| 17 | 17 | if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
| 18 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
| 18 | + $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
| 19 | 19 | } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) { |
| 20 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
| 20 | + $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -45,48 +45,48 @@ discard block |
||
| 45 | 45 | <form action="<?php echo $form_action_url; ?>" name="publish_listing" id="publish_listing" method="post"> |
| 46 | 46 | <div class="clearfix"> |
| 47 | 47 | <input type="hidden" name="pid" value="<?php if (isset($post->pid)) { |
| 48 | - echo $post->pid; |
|
| 49 | - } ?>"> |
|
| 48 | + echo $post->pid; |
|
| 49 | + } ?>"> |
|
| 50 | 50 | <?php |
| 51 | - /** |
|
| 52 | - * Called on the add listing preview page inside the publish listings form, before the publish message. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @see 'geodir_publish_listing_form_after_msg' |
|
| 56 | - */ |
|
| 57 | - do_action('geodir_publish_listing_form_before_msg'); ?> |
|
| 51 | + /** |
|
| 52 | + * Called on the add listing preview page inside the publish listings form, before the publish message. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @see 'geodir_publish_listing_form_after_msg' |
|
| 56 | + */ |
|
| 57 | + do_action('geodir_publish_listing_form_before_msg'); ?> |
|
| 58 | 58 | <?php |
| 59 | - $alive_days = UNLIMITED; |
|
| 60 | - $type_title = ''; |
|
| 61 | - ob_start(); |
|
| 62 | - echo '<h5 class="geodir_information">'; |
|
| 63 | - |
|
| 64 | - if (!isset($_REQUEST['pid'])) |
|
| 65 | - printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
| 66 | - else |
|
| 67 | - printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
| 68 | - |
|
| 69 | - echo '</h5>'; |
|
| 70 | - $publish_listing_form_message = ob_get_clean(); |
|
| 71 | - /** |
|
| 72 | - * Filter the publish listing message on the preview page. |
|
| 73 | - * |
|
| 74 | - * @since 1.0.0 |
|
| 75 | - * @param string $publish_listing_form_message The message to be filtered. |
|
| 76 | - */ |
|
| 77 | - $publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message); |
|
| 78 | - echo $publish_listing_form_message; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Called on the add listing preview page inside the publish listings form, after the publish message. |
|
| 82 | - * |
|
| 83 | - * @since 1.0.0 |
|
| 84 | - * @see 'geodir_publish_listing_form_before_msg' |
|
| 85 | - */ |
|
| 86 | - do_action('geodir_publish_listing_form_after_msg'); |
|
| 87 | - |
|
| 88 | - ob_start(); // start action button buffering |
|
| 89 | - ?> |
|
| 59 | + $alive_days = UNLIMITED; |
|
| 60 | + $type_title = ''; |
|
| 61 | + ob_start(); |
|
| 62 | + echo '<h5 class="geodir_information">'; |
|
| 63 | + |
|
| 64 | + if (!isset($_REQUEST['pid'])) |
|
| 65 | + printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
| 66 | + else |
|
| 67 | + printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
| 68 | + |
|
| 69 | + echo '</h5>'; |
|
| 70 | + $publish_listing_form_message = ob_get_clean(); |
|
| 71 | + /** |
|
| 72 | + * Filter the publish listing message on the preview page. |
|
| 73 | + * |
|
| 74 | + * @since 1.0.0 |
|
| 75 | + * @param string $publish_listing_form_message The message to be filtered. |
|
| 76 | + */ |
|
| 77 | + $publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message); |
|
| 78 | + echo $publish_listing_form_message; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Called on the add listing preview page inside the publish listings form, after the publish message. |
|
| 82 | + * |
|
| 83 | + * @since 1.0.0 |
|
| 84 | + * @see 'geodir_publish_listing_form_before_msg' |
|
| 85 | + */ |
|
| 86 | + do_action('geodir_publish_listing_form_after_msg'); |
|
| 87 | + |
|
| 88 | + ob_start(); // start action button buffering |
|
| 89 | + ?> |
|
| 90 | 90 | <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?> |
| 91 | 91 | |
| 92 | 92 | <input type="submit" name="Submit and Pay" value="<?php echo PRO_UPDATE_BUTTON; ?>" |
@@ -95,46 +95,46 @@ discard block |
||
| 95 | 95 | <input type="submit" name="Submit and Pay" value="<?php echo PRO_SUBMIT_BUTTON; ?>" |
| 96 | 96 | class=" geodir_button geodir_publish_button"/> |
| 97 | 97 | <?php |
| 98 | - } |
|
| 99 | - $publish_listing_form_button = ob_get_clean(); |
|
| 100 | - /** |
|
| 101 | - * Filter the HTML button for publishing the listing on the preview page. |
|
| 102 | - * |
|
| 103 | - * @since 1.0.0 |
|
| 104 | - * @param string $publish_listing_form_button The HTML for the submit button. |
|
| 105 | - */ |
|
| 106 | - $publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button); |
|
| 107 | - echo $publish_listing_form_button; |
|
| 108 | - |
|
| 109 | - $post_id = ''; |
|
| 110 | - if (isset($post->pid)) { |
|
| 111 | - $post_id = $post->pid; |
|
| 112 | - } else if (isset($_REQUEST['pid'])) { |
|
| 113 | - $post_id = (int)$_REQUEST['pid']; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
| 117 | - $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false); |
|
| 118 | - |
|
| 119 | - ob_start(); // start go back and edit / cancel buffering |
|
| 120 | - ?> |
|
| 98 | + } |
|
| 99 | + $publish_listing_form_button = ob_get_clean(); |
|
| 100 | + /** |
|
| 101 | + * Filter the HTML button for publishing the listing on the preview page. |
|
| 102 | + * |
|
| 103 | + * @since 1.0.0 |
|
| 104 | + * @param string $publish_listing_form_button The HTML for the submit button. |
|
| 105 | + */ |
|
| 106 | + $publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button); |
|
| 107 | + echo $publish_listing_form_button; |
|
| 108 | + |
|
| 109 | + $post_id = ''; |
|
| 110 | + if (isset($post->pid)) { |
|
| 111 | + $post_id = $post->pid; |
|
| 112 | + } else if (isset($_REQUEST['pid'])) { |
|
| 113 | + $post_id = (int)$_REQUEST['pid']; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
| 117 | + $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false); |
|
| 118 | + |
|
| 119 | + ob_start(); // start go back and edit / cancel buffering |
|
| 120 | + ?> |
|
| 121 | 121 | <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a> |
| 122 | 122 | <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>" |
| 123 | 123 | class="geodir_button geodir_cancle_button" |
| 124 | 124 | onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/> |
| 125 | 125 | <?php |
| 126 | 126 | |
| 127 | - $publish_listing_form_go_back = ob_get_clean(); |
|
| 128 | - /** |
|
| 129 | - * Filter the cancel and go back and edit HTML on the preview page. |
|
| 130 | - * |
|
| 131 | - * @since 1.0.0 |
|
| 132 | - * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link. |
|
| 133 | - */ |
|
| 134 | - $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back); |
|
| 135 | - echo $publish_listing_form_go_back; |
|
| 136 | - |
|
| 137 | - ?> |
|
| 127 | + $publish_listing_form_go_back = ob_get_clean(); |
|
| 128 | + /** |
|
| 129 | + * Filter the cancel and go back and edit HTML on the preview page. |
|
| 130 | + * |
|
| 131 | + * @since 1.0.0 |
|
| 132 | + * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link. |
|
| 133 | + */ |
|
| 134 | + $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back); |
|
| 135 | + echo $publish_listing_form_go_back; |
|
| 136 | + |
|
| 137 | + ?> |
|
| 138 | 138 | </div> |
| 139 | 139 | </form> |
| 140 | 140 | </div> |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | $post_type = $post->listing_type; |
| 16 | 16 | |
| 17 | 17 | if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
| 18 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
| 18 | + $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=update&listing_type='.$post_type; |
|
| 19 | 19 | } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) { |
| 20 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
| 20 | + $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=publish&listing_type='.$post_type; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if (isset($post->pid)) { |
| 111 | 111 | $post_id = $post->pid; |
| 112 | 112 | } else if (isset($_REQUEST['pid'])) { |
| 113 | - $post_id = (int)$_REQUEST['pid']; |
|
| 113 | + $post_id = (int) $_REQUEST['pid']; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $postlink = get_permalink(geodir_add_listing_page_id()); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a> |
| 122 | 122 | <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>" |
| 123 | 123 | class="geodir_button geodir_cancle_button" |
| 124 | - onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/> |
|
| 124 | + onclick="window.location.href='<?php echo geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=cancel&pid='.$post_id.'&listing_type='.$post_type; ?>'"/> |
|
| 125 | 125 | <?php |
| 126 | 126 | |
| 127 | 127 | $publish_listing_form_go_back = ob_get_clean(); |
@@ -353,7 +353,7 @@ |
||
| 353 | 353 | |
| 354 | 354 | if(!$cpt_left){ |
| 355 | 355 | $cpt_left = "gd-cpt-flat"; |
| 356 | - }else{ |
|
| 356 | + } else{ |
|
| 357 | 357 | $cpt_left = ''; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $output = geodir_cpt_categories_output($params); |
| 147 | 147 | |
| 148 | 148 | echo $args['before_widget']; |
| 149 | - if ( $params['title'] ) { |
|
| 149 | + if ($params['title']) { |
|
| 150 | 150 | echo '<div class="geodir_list_heading clearfix">'; |
| 151 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
| 151 | + echo $args['before_title'].$params['title'].$args['after_title']; |
|
| 152 | 152 | echo '</div>'; |
| 153 | 153 | } |
| 154 | 154 | echo '<div class="gd-cptcats-widget">'; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param array $instance Previously saved values from database. |
| 192 | 192 | */ |
| 193 | 193 | public function form($instance) { |
| 194 | - $instance = wp_parse_args( (array)$instance, |
|
| 194 | + $instance = wp_parse_args((array) $instance, |
|
| 195 | 195 | array( |
| 196 | 196 | 'title' => '', |
| 197 | 197 | 'post_type' => array(), // NULL for all |
@@ -221,42 +221,42 @@ discard block |
||
| 221 | 221 | <p> |
| 222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
| 223 | 223 | <select name="<?php echo $this->get_field_name('post_type'); ?>[]" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat" multiple="multiple"> |
| 224 | - <option value="0" <?php selected( (empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 224 | + <option value="0" <?php selected((empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 225 | 225 | <?php foreach ($post_type_options as $name => $title) { ?> |
| 226 | - <option value="<?php echo $name;?>" <?php selected( is_array($post_type) && in_array($name, $post_type), true ); ?>><?php echo $title; ?></option> |
|
| 226 | + <option value="<?php echo $name; ?>" <?php selected(is_array($post_type) && in_array($name, $post_type), true); ?>><?php echo $title; ?></option> |
|
| 227 | 227 | <?php } ?> |
| 228 | 228 | </select> |
| 229 | 229 | </p> |
| 230 | - <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked( $hide_empty ); ?> value="1" /> |
|
| 231 | - <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e( 'Hide empty categories', 'geodirectory' ); ?></label><br /> |
|
| 232 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked( $show_count ); ?> value="1" /> |
|
| 233 | - <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e( 'Show category count' ); ?></label> <small><?php _e( '( Enabling will slow down page loading for big directories. )', 'geodirectory' ); ?></small><br /> |
|
| 234 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked( $hide_icon ); ?> value="1" /> |
|
| 235 | - <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e( 'Hide category icon', 'geodirectory' ); ?></label><br /> |
|
| 236 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked( $cpt_left ); ?> value="1" /> |
|
| 237 | - <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e( 'Show CPT on same line', 'geodirectory' ); ?></label> |
|
| 230 | + <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked($hide_empty); ?> value="1" /> |
|
| 231 | + <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e('Hide empty categories', 'geodirectory'); ?></label><br /> |
|
| 232 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked($show_count); ?> value="1" /> |
|
| 233 | + <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('Show category count'); ?></label> <small><?php _e('( Enabling will slow down page loading for big directories. )', 'geodirectory'); ?></small><br /> |
|
| 234 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked($hide_icon); ?> value="1" /> |
|
| 235 | + <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e('Hide category icon', 'geodirectory'); ?></label><br /> |
|
| 236 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked($cpt_left); ?> value="1" /> |
|
| 237 | + <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e('Show CPT on same line', 'geodirectory'); ?></label> |
|
| 238 | 238 | <p> |
| 239 | 239 | <label for="<?php echo $this->get_field_id('sort_by'); ?>"><?php _e('Sort by:', 'geodirectory'); ?></label> |
| 240 | 240 | <select name="<?php echo $this->get_field_name('sort_by'); ?>" id="<?php echo $this->get_field_id('sort_by'); ?>" class="widefat"> |
| 241 | - <option value="az" <?php selected( $sort_by, 'az' ); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
| 242 | - <option value="count" <?php selected( $sort_by, 'count' ); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
| 241 | + <option value="az" <?php selected($sort_by, 'az'); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
| 242 | + <option value="count" <?php selected($sort_by, 'count'); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
| 243 | 243 | </select> |
| 244 | 244 | </p> |
| 245 | 245 | <p> |
| 246 | 246 | <label for="<?php echo $this->get_field_id('max_count'); ?>"><?php _e('Max no of sub-categories:', 'geodirectory'); ?></label> |
| 247 | 247 | <select name="<?php echo $this->get_field_name('max_count'); ?>" id="<?php echo $this->get_field_id('max_count'); ?>" class="widefat"> |
| 248 | - <option value="all" <?php selected( $max_count, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 248 | + <option value="all" <?php selected($max_count, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 249 | 249 | <?php for ($n = 10; $n >= 0; $n--) { ?> |
| 250 | - <option value="<?php echo $n;?>" <?php selected( $max_count, $n ); ?>><?php echo $n; ?></option> |
|
| 250 | + <option value="<?php echo $n; ?>" <?php selected($max_count, $n); ?>><?php echo $n; ?></option> |
|
| 251 | 251 | <?php } ?> |
| 252 | 252 | </select> |
| 253 | 253 | </p> |
| 254 | 254 | <p> |
| 255 | 255 | <label for="<?php echo $this->get_field_id('max_level'); ?>"><?php _e('Show max sub-categories depth:', 'geodirectory'); ?></label> |
| 256 | 256 | <select name="<?php echo $this->get_field_name('max_level'); ?>" id="<?php echo $this->get_field_id('max_level'); ?>" class="widefat"> |
| 257 | - <option value="all" <?php selected( $max_level, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 257 | + <option value="all" <?php selected($max_level, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 258 | 258 | <?php for ($n = 0; $n <= 10; $n++) { ?> |
| 259 | - <option value="<?php echo $n;?>" <?php selected( $max_level, $n ); ?>><?php echo $n; ?></option> |
|
| 259 | + <option value="<?php echo $n; ?>" <?php selected($max_level, $n); ?>><?php echo $n; ?></option> |
|
| 260 | 260 | <?php } ?> |
| 261 | 261 | </select> |
| 262 | 262 | </p> |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @return string CPT categories content. |
| 276 | 276 | */ |
| 277 | 277 | function geodir_cpt_categories_output($params) { |
| 278 | - $args = wp_parse_args((array)$params, |
|
| 278 | + $args = wp_parse_args((array) $params, |
|
| 279 | 279 | array( |
| 280 | 280 | 'title' => '', |
| 281 | 281 | 'post_type' => array(), // NULL for all |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $current_taxonomy = get_query_var('taxonomy'); |
| 310 | 310 | $current_posttype = geodir_get_current_posttype(); |
| 311 | 311 | |
| 312 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
| 312 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype.'category') { |
|
| 313 | 313 | $is_category = true; |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -345,15 +345,15 @@ discard block |
||
| 345 | 345 | $hide_empty = !empty($args['hide_empty']) ? true : false; |
| 346 | 346 | $max_count = strip_tags($args['max_count']); |
| 347 | 347 | $all_childs = $max_count == 'all' ? true : false; |
| 348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 348 | + $max_count = $max_count > 0 ? (int) $max_count : 0; |
|
| 349 | 349 | $max_level = strip_tags($args['max_level']); |
| 350 | 350 | $show_count = !empty($args['show_count']) ? true : false; |
| 351 | 351 | $hide_icon = !empty($args['hide_icon']) ? true : false; |
| 352 | 352 | $cpt_left = !empty($args['cpt_left']) ? true : false; |
| 353 | 353 | |
| 354 | - if(!$cpt_left){ |
|
| 354 | + if (!$cpt_left) { |
|
| 355 | 355 | $cpt_left = "gd-cpt-flat"; |
| 356 | - }else{ |
|
| 356 | + } else { |
|
| 357 | 357 | $cpt_left = ''; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $output = ''; |
| 368 | 368 | if (!empty($post_types)) { |
| 369 | 369 | foreach ($post_types as $cpt => $cpt_info) { |
| 370 | - $cat_taxonomy = $cpt . 'category'; |
|
| 370 | + $cat_taxonomy = $cpt.'category'; |
|
| 371 | 371 | $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
| 372 | 372 | if ($hide_empty) { |
| 373 | 373 | $categories = geodir_filter_empty_terms($categories); |
@@ -383,32 +383,32 @@ discard block |
||
| 383 | 383 | if ($is_listing) { |
| 384 | 384 | $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
| 385 | 385 | } |
| 386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-'.$cpt.$row_class.' '.$cpt_left.'">'; |
|
| 387 | 387 | |
| 388 | 388 | if ($is_category) { |
| 389 | 389 | $term_info = get_term($current_term_id, $cat_taxonomy); |
| 390 | 390 | |
| 391 | 391 | $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
| 392 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 392 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($term_info->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
| 393 | 393 | |
| 394 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
| 395 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
| 394 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$term_info->count.')</span>' : ''; |
|
| 395 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.$term_icon_url.$term_info->name.$count.'</h2>'; |
|
| 396 | 396 | } else { |
| 397 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
| 397 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.__($cpt_info['labels']['name'], 'geodirectory').'</h2>'; |
|
| 398 | 398 | } |
| 399 | 399 | foreach ($categories as $category) { |
| 400 | 400 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
| 401 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 401 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
| 402 | 402 | |
| 403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 403 | + $term_link = get_term_link($category, $category->taxonomy); |
|
| 404 | 404 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 405 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
| 406 | 406 | |
| 407 | 407 | $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
| 408 | 408 | $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
| 409 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 409 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
| 410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></h3>'; |
|
| 411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) { |
|
| 412 | 412 | $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
| 413 | 413 | } |
| 414 | 414 | $cpt_row .= '</li>'; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | * @return string Html content. |
| 441 | 441 | */ |
| 442 | 442 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
| 443 | - $cat_taxonomy = $cpt . 'category'; |
|
| 443 | + $cat_taxonomy = $cpt.'category'; |
|
| 444 | 444 | |
| 445 | 445 | $orderby = 'count'; |
| 446 | 446 | $order = 'DESC'; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $order = 'ASC'; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 452 | + if ($max_level != 'all' && $depth > (int) $max_level) { |
|
| 453 | 453 | return ''; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -466,18 +466,18 @@ discard block |
||
| 466 | 466 | $child_cats = geodir_sort_terms($child_cats, 'count'); |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
| 469 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-'.$depth.'">'; |
|
| 470 | 470 | $depth++; |
| 471 | 471 | foreach ($child_cats as $category) { |
| 472 | 472 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
| 473 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 473 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
| 474 | + $term_link = get_term_link($category, $category->taxonomy); |
|
| 475 | 475 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 477 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 476 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
| 477 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
| 478 | 478 | |
| 479 | 479 | $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
| 480 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
| 480 | + $content .= '<a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></li>'; |
|
| 481 | 481 | $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
| 482 | 482 | } |
| 483 | 483 | $content .= '</li></ul>'; |
@@ -13,210 +13,210 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | class geodir_cpt_categories_widget extends WP_Widget { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Register the cpt categories with WordPress. |
|
| 18 | - * |
|
| 19 | - * @since 1.5.4 |
|
| 20 | - */ |
|
| 21 | - public function __construct() { |
|
| 22 | - $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
| 23 | - parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Front-end display content for cpt categories widget. |
|
| 28 | - * |
|
| 29 | - * @since 1.5.4 |
|
| 30 | - * |
|
| 31 | - * @param array $args Widget arguments. |
|
| 32 | - * @param array $instance Saved values from database. |
|
| 33 | - */ |
|
| 34 | - public function widget($args, $instance) { |
|
| 35 | - $params = array(); |
|
| 36 | - /** |
|
| 37 | - * Filter the widget title. |
|
| 38 | - * |
|
| 39 | - * @since 1.5.4 |
|
| 40 | - * |
|
| 41 | - * @param string $title The widget title. Default empty. |
|
| 42 | - * @param array $instance An array of the widget's settings. |
|
| 43 | - * @param mixed $id_base The widget ID. |
|
| 44 | - */ |
|
| 45 | - $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Filter the widget setting post type. |
|
| 49 | - * |
|
| 50 | - * @since 1.5.4 |
|
| 51 | - * |
|
| 52 | - * @param array $post_type The post types to display categories. |
|
| 53 | - * @param array $instance An array of the widget's settings. |
|
| 54 | - * @param mixed $id_base The widget ID. |
|
| 55 | - */ |
|
| 56 | - $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Filter the widget setting to hide empty categories. |
|
| 60 | - * |
|
| 61 | - * @since 1.5.4 |
|
| 62 | - * |
|
| 63 | - * @param bool $hide_empty If true then empty category will be not displayed. |
|
| 64 | - * @param array $instance An array of the widget's settings. |
|
| 65 | - * @param mixed $id_base The widget ID. |
|
| 66 | - */ |
|
| 67 | - $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Filter the widget setting to show/hide category count. |
|
| 71 | - * |
|
| 72 | - * @since 1.5.4 |
|
| 73 | - * |
|
| 74 | - * @param bool $show_count If true then category count will be displayed. |
|
| 75 | - * @param array $instance An array of the widget's settings. |
|
| 76 | - * @param mixed $id_base The widget ID. |
|
| 77 | - */ |
|
| 78 | - $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Filter the widget setting to show/hide category icon. |
|
| 82 | - * |
|
| 83 | - * @since 1.5.4 |
|
| 84 | - * |
|
| 85 | - * @param bool $hide_icon If true then category icon will be not displayed. |
|
| 86 | - * @param array $instance An array of the widget's settings. |
|
| 87 | - * @param mixed $id_base The widget ID. |
|
| 88 | - */ |
|
| 89 | - $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Filter the widget setting to show CPT inline or not. |
|
| 93 | - * |
|
| 94 | - * @since 1.5.4 |
|
| 95 | - * |
|
| 96 | - * @param bool $cpt_left If true then CPT will be displayed inline. |
|
| 97 | - * @param array $instance An array of the widget's settings. |
|
| 98 | - * @param mixed $id_base The widget ID. |
|
| 99 | - */ |
|
| 100 | - $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Filter the widget categories sorting order settings. |
|
| 104 | - * |
|
| 105 | - * @since 1.5.4 |
|
| 106 | - * |
|
| 107 | - * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
| 108 | - * @param array $instance An array of the widget's settings. |
|
| 109 | - * @param mixed $id_base The widget ID. |
|
| 110 | - */ |
|
| 111 | - $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Filter the widget max no of sub-categories count. |
|
| 115 | - * |
|
| 116 | - * @since 1.5.4 |
|
| 117 | - * |
|
| 118 | - * @param bool|string $max_count Widget max no of sub-categories count. |
|
| 119 | - * @param array $instance An array of the widget's settings. |
|
| 120 | - * @param mixed $id_base The widget ID. |
|
| 121 | - */ |
|
| 122 | - $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Filter the widget max sub-categories depth. |
|
| 126 | - * |
|
| 127 | - * @since 1.5.4 |
|
| 128 | - * |
|
| 129 | - * @param bool|string $max_level Widget max sub-categories depth. |
|
| 130 | - * @param array $instance An array of the widget's settings. |
|
| 131 | - * @param mixed $id_base The widget ID. |
|
| 132 | - */ |
|
| 133 | - $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Filter the widget parameters. |
|
| 137 | - * |
|
| 138 | - * @since 1.5.4 |
|
| 139 | - * |
|
| 140 | - * @param array $params The widget parameters. |
|
| 141 | - * @param array $instance An array of the widget's settings. |
|
| 142 | - * @param mixed $id_base The widget ID. |
|
| 143 | - */ |
|
| 144 | - $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
| 145 | - |
|
| 146 | - $output = geodir_cpt_categories_output($params); |
|
| 147 | - |
|
| 148 | - echo $args['before_widget']; |
|
| 149 | - if ( $params['title'] ) { |
|
| 150 | - echo '<div class="geodir_list_heading clearfix">'; |
|
| 151 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
| 152 | - echo '</div>'; |
|
| 153 | - } |
|
| 154 | - echo '<div class="gd-cptcats-widget">'; |
|
| 155 | - echo $output; |
|
| 156 | - echo '</div>'; |
|
| 157 | - echo $args['after_widget']; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Sanitize cpt categories widget values as they are saved. |
|
| 162 | - * |
|
| 163 | - * @since 1.5.4 |
|
| 164 | - * |
|
| 165 | - * @param array $new_instance Values just sent to be saved. |
|
| 166 | - * @param array $old_instance Previously saved values from database. |
|
| 167 | - * |
|
| 168 | - * @return array Updated safe values to be saved. |
|
| 169 | - */ |
|
| 170 | - public function update($new_instance, $old_instance) { |
|
| 171 | - $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
| 172 | - $instance = $old_instance; |
|
| 173 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 174 | - $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
| 175 | - $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
| 176 | - $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
| 177 | - $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
| 178 | - $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
| 179 | - $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
| 180 | - $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
| 181 | - $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
| 182 | - |
|
| 183 | - return $instance; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Back-end cpt categories settings form. |
|
| 188 | - * |
|
| 189 | - * @since 1.5.4 |
|
| 190 | - * |
|
| 191 | - * @param array $instance Previously saved values from database. |
|
| 192 | - */ |
|
| 193 | - public function form($instance) { |
|
| 194 | - $instance = wp_parse_args( (array)$instance, |
|
| 195 | - array( |
|
| 196 | - 'title' => '', |
|
| 197 | - 'post_type' => array(), // NULL for all |
|
| 198 | - 'hide_empty' => '', |
|
| 199 | - 'show_count' => '', |
|
| 200 | - 'hide_icon' => '', |
|
| 201 | - 'cpt_left' => '', |
|
| 202 | - 'sort_by' => 'count', |
|
| 203 | - 'max_count' => 'all', |
|
| 204 | - 'max_level' => '1' |
|
| 205 | - ) |
|
| 206 | - ); |
|
| 207 | - |
|
| 208 | - $title = strip_tags($instance['title']); |
|
| 209 | - $post_type = $instance['post_type']; |
|
| 210 | - $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
| 211 | - $show_count = !empty($instance['show_count']) ? true : false; |
|
| 212 | - $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
| 213 | - $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
| 214 | - $max_count = strip_tags($instance['max_count']); |
|
| 215 | - $max_level = strip_tags($instance['max_level']); |
|
| 216 | - $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
| 217 | - |
|
| 218 | - $post_type_options = geodir_get_posttypes('options'); |
|
| 219 | - ?> |
|
| 16 | + /** |
|
| 17 | + * Register the cpt categories with WordPress. |
|
| 18 | + * |
|
| 19 | + * @since 1.5.4 |
|
| 20 | + */ |
|
| 21 | + public function __construct() { |
|
| 22 | + $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
| 23 | + parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Front-end display content for cpt categories widget. |
|
| 28 | + * |
|
| 29 | + * @since 1.5.4 |
|
| 30 | + * |
|
| 31 | + * @param array $args Widget arguments. |
|
| 32 | + * @param array $instance Saved values from database. |
|
| 33 | + */ |
|
| 34 | + public function widget($args, $instance) { |
|
| 35 | + $params = array(); |
|
| 36 | + /** |
|
| 37 | + * Filter the widget title. |
|
| 38 | + * |
|
| 39 | + * @since 1.5.4 |
|
| 40 | + * |
|
| 41 | + * @param string $title The widget title. Default empty. |
|
| 42 | + * @param array $instance An array of the widget's settings. |
|
| 43 | + * @param mixed $id_base The widget ID. |
|
| 44 | + */ |
|
| 45 | + $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Filter the widget setting post type. |
|
| 49 | + * |
|
| 50 | + * @since 1.5.4 |
|
| 51 | + * |
|
| 52 | + * @param array $post_type The post types to display categories. |
|
| 53 | + * @param array $instance An array of the widget's settings. |
|
| 54 | + * @param mixed $id_base The widget ID. |
|
| 55 | + */ |
|
| 56 | + $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Filter the widget setting to hide empty categories. |
|
| 60 | + * |
|
| 61 | + * @since 1.5.4 |
|
| 62 | + * |
|
| 63 | + * @param bool $hide_empty If true then empty category will be not displayed. |
|
| 64 | + * @param array $instance An array of the widget's settings. |
|
| 65 | + * @param mixed $id_base The widget ID. |
|
| 66 | + */ |
|
| 67 | + $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Filter the widget setting to show/hide category count. |
|
| 71 | + * |
|
| 72 | + * @since 1.5.4 |
|
| 73 | + * |
|
| 74 | + * @param bool $show_count If true then category count will be displayed. |
|
| 75 | + * @param array $instance An array of the widget's settings. |
|
| 76 | + * @param mixed $id_base The widget ID. |
|
| 77 | + */ |
|
| 78 | + $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Filter the widget setting to show/hide category icon. |
|
| 82 | + * |
|
| 83 | + * @since 1.5.4 |
|
| 84 | + * |
|
| 85 | + * @param bool $hide_icon If true then category icon will be not displayed. |
|
| 86 | + * @param array $instance An array of the widget's settings. |
|
| 87 | + * @param mixed $id_base The widget ID. |
|
| 88 | + */ |
|
| 89 | + $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Filter the widget setting to show CPT inline or not. |
|
| 93 | + * |
|
| 94 | + * @since 1.5.4 |
|
| 95 | + * |
|
| 96 | + * @param bool $cpt_left If true then CPT will be displayed inline. |
|
| 97 | + * @param array $instance An array of the widget's settings. |
|
| 98 | + * @param mixed $id_base The widget ID. |
|
| 99 | + */ |
|
| 100 | + $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Filter the widget categories sorting order settings. |
|
| 104 | + * |
|
| 105 | + * @since 1.5.4 |
|
| 106 | + * |
|
| 107 | + * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
| 108 | + * @param array $instance An array of the widget's settings. |
|
| 109 | + * @param mixed $id_base The widget ID. |
|
| 110 | + */ |
|
| 111 | + $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Filter the widget max no of sub-categories count. |
|
| 115 | + * |
|
| 116 | + * @since 1.5.4 |
|
| 117 | + * |
|
| 118 | + * @param bool|string $max_count Widget max no of sub-categories count. |
|
| 119 | + * @param array $instance An array of the widget's settings. |
|
| 120 | + * @param mixed $id_base The widget ID. |
|
| 121 | + */ |
|
| 122 | + $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Filter the widget max sub-categories depth. |
|
| 126 | + * |
|
| 127 | + * @since 1.5.4 |
|
| 128 | + * |
|
| 129 | + * @param bool|string $max_level Widget max sub-categories depth. |
|
| 130 | + * @param array $instance An array of the widget's settings. |
|
| 131 | + * @param mixed $id_base The widget ID. |
|
| 132 | + */ |
|
| 133 | + $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Filter the widget parameters. |
|
| 137 | + * |
|
| 138 | + * @since 1.5.4 |
|
| 139 | + * |
|
| 140 | + * @param array $params The widget parameters. |
|
| 141 | + * @param array $instance An array of the widget's settings. |
|
| 142 | + * @param mixed $id_base The widget ID. |
|
| 143 | + */ |
|
| 144 | + $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
| 145 | + |
|
| 146 | + $output = geodir_cpt_categories_output($params); |
|
| 147 | + |
|
| 148 | + echo $args['before_widget']; |
|
| 149 | + if ( $params['title'] ) { |
|
| 150 | + echo '<div class="geodir_list_heading clearfix">'; |
|
| 151 | + echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
| 152 | + echo '</div>'; |
|
| 153 | + } |
|
| 154 | + echo '<div class="gd-cptcats-widget">'; |
|
| 155 | + echo $output; |
|
| 156 | + echo '</div>'; |
|
| 157 | + echo $args['after_widget']; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Sanitize cpt categories widget values as they are saved. |
|
| 162 | + * |
|
| 163 | + * @since 1.5.4 |
|
| 164 | + * |
|
| 165 | + * @param array $new_instance Values just sent to be saved. |
|
| 166 | + * @param array $old_instance Previously saved values from database. |
|
| 167 | + * |
|
| 168 | + * @return array Updated safe values to be saved. |
|
| 169 | + */ |
|
| 170 | + public function update($new_instance, $old_instance) { |
|
| 171 | + $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
| 172 | + $instance = $old_instance; |
|
| 173 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 174 | + $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
| 175 | + $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
| 176 | + $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
| 177 | + $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
| 178 | + $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
| 179 | + $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
| 180 | + $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
| 181 | + $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
| 182 | + |
|
| 183 | + return $instance; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Back-end cpt categories settings form. |
|
| 188 | + * |
|
| 189 | + * @since 1.5.4 |
|
| 190 | + * |
|
| 191 | + * @param array $instance Previously saved values from database. |
|
| 192 | + */ |
|
| 193 | + public function form($instance) { |
|
| 194 | + $instance = wp_parse_args( (array)$instance, |
|
| 195 | + array( |
|
| 196 | + 'title' => '', |
|
| 197 | + 'post_type' => array(), // NULL for all |
|
| 198 | + 'hide_empty' => '', |
|
| 199 | + 'show_count' => '', |
|
| 200 | + 'hide_icon' => '', |
|
| 201 | + 'cpt_left' => '', |
|
| 202 | + 'sort_by' => 'count', |
|
| 203 | + 'max_count' => 'all', |
|
| 204 | + 'max_level' => '1' |
|
| 205 | + ) |
|
| 206 | + ); |
|
| 207 | + |
|
| 208 | + $title = strip_tags($instance['title']); |
|
| 209 | + $post_type = $instance['post_type']; |
|
| 210 | + $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
| 211 | + $show_count = !empty($instance['show_count']) ? true : false; |
|
| 212 | + $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
| 213 | + $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
| 214 | + $max_count = strip_tags($instance['max_count']); |
|
| 215 | + $max_level = strip_tags($instance['max_level']); |
|
| 216 | + $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
| 217 | + |
|
| 218 | + $post_type_options = geodir_get_posttypes('options'); |
|
| 219 | + ?> |
|
| 220 | 220 | <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p> |
| 221 | 221 | <p> |
| 222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | </select> |
| 262 | 262 | </p> |
| 263 | 263 | <?php |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | } // class geodir_cpt_categories_widget |
| 266 | 266 | |
| 267 | 267 | register_widget('geodir_cpt_categories_widget'); |
@@ -275,152 +275,152 @@ discard block |
||
| 275 | 275 | * @return string CPT categories content. |
| 276 | 276 | */ |
| 277 | 277 | function geodir_cpt_categories_output($params) { |
| 278 | - $args = wp_parse_args((array)$params, |
|
| 279 | - array( |
|
| 280 | - 'title' => '', |
|
| 281 | - 'post_type' => array(), // NULL for all |
|
| 282 | - 'hide_empty' => '', |
|
| 283 | - 'show_count' => '', |
|
| 284 | - 'hide_icon' => '', |
|
| 285 | - 'cpt_left' => '', |
|
| 286 | - 'sort_by' => 'count', |
|
| 287 | - 'max_count' => 'all', |
|
| 288 | - 'max_level' => '1', |
|
| 289 | - ) |
|
| 290 | - ); |
|
| 291 | - |
|
| 292 | - $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
| 293 | - |
|
| 294 | - $gd_post_types = geodir_get_posttypes('array'); |
|
| 295 | - |
|
| 296 | - $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
| 297 | - $current_posttype = geodir_get_current_posttype(); |
|
| 298 | - |
|
| 299 | - $is_listing = false; |
|
| 300 | - $is_category = false; |
|
| 301 | - if (geodir_is_page('listing')) { |
|
| 302 | - $current_posttype = geodir_get_current_posttype(); |
|
| 303 | - |
|
| 304 | - if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
| 305 | - $is_listing = true; |
|
| 306 | - |
|
| 307 | - if (is_tax()) { // category page |
|
| 308 | - $current_term_id = get_queried_object_id(); |
|
| 309 | - $current_taxonomy = get_query_var('taxonomy'); |
|
| 310 | - $current_posttype = geodir_get_current_posttype(); |
|
| 311 | - |
|
| 312 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
| 313 | - $is_category = true; |
|
| 314 | - } |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - $parent_category = 0; |
|
| 320 | - if ($is_listing) { |
|
| 321 | - $post_type_arr = array($current_posttype); |
|
| 322 | - |
|
| 323 | - if ($is_category) { |
|
| 324 | - $parent_category = $current_term_id; |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - $post_types = array(); |
|
| 329 | - if (!empty($post_type_arr)) { |
|
| 330 | - if (in_array('0', $post_type_arr)) { |
|
| 331 | - $post_types = $gd_post_types; |
|
| 332 | - } else { |
|
| 333 | - foreach ($post_type_arr as $cpt) { |
|
| 334 | - if (isset($gd_post_types[$cpt])) { |
|
| 335 | - $post_types[$cpt] = $gd_post_types[$cpt]; |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - if (empty($post_type_arr)) { |
|
| 342 | - $post_types = $gd_post_types; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
| 346 | - $max_count = strip_tags($args['max_count']); |
|
| 347 | - $all_childs = $max_count == 'all' ? true : false; |
|
| 348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 349 | - $max_level = strip_tags($args['max_level']); |
|
| 350 | - $show_count = !empty($args['show_count']) ? true : false; |
|
| 351 | - $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
| 352 | - $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
| 353 | - |
|
| 354 | - if(!$cpt_left){ |
|
| 355 | - $cpt_left = "gd-cpt-flat"; |
|
| 356 | - }else{ |
|
| 357 | - $cpt_left = ''; |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - $orderby = 'count'; |
|
| 361 | - $order = 'DESC'; |
|
| 362 | - if ($sort_by == 'az') { |
|
| 363 | - $orderby = 'name'; |
|
| 364 | - $order = 'ASC'; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - $output = ''; |
|
| 368 | - if (!empty($post_types)) { |
|
| 369 | - foreach ($post_types as $cpt => $cpt_info) { |
|
| 370 | - $cat_taxonomy = $cpt . 'category'; |
|
| 371 | - $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
| 372 | - if ($hide_empty) { |
|
| 373 | - $categories = geodir_filter_empty_terms($categories); |
|
| 374 | - } |
|
| 375 | - if ($sort_by == 'count') { |
|
| 376 | - $categories = geodir_sort_terms($categories, 'count'); |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - if (!empty($categories)) { |
|
| 380 | - $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
| 381 | - $row_class = ''; |
|
| 382 | - |
|
| 383 | - if ($is_listing) { |
|
| 384 | - $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
| 385 | - } |
|
| 386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 387 | - |
|
| 388 | - if ($is_category) { |
|
| 389 | - $term_info = get_term($current_term_id, $cat_taxonomy); |
|
| 390 | - |
|
| 391 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
| 392 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 393 | - |
|
| 394 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
| 395 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
| 396 | - } else { |
|
| 397 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
| 398 | - } |
|
| 399 | - foreach ($categories as $category) { |
|
| 400 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 401 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 402 | - |
|
| 403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 404 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 406 | - |
|
| 407 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
| 408 | - $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
| 409 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 412 | - $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
| 413 | - } |
|
| 414 | - $cpt_row .= '</li>'; |
|
| 415 | - $cpt_row .= '</ul>'; |
|
| 416 | - } |
|
| 417 | - $cpt_row .= '</ul></div>'; |
|
| 418 | - |
|
| 419 | - $output .= $cpt_row; |
|
| 420 | - } |
|
| 421 | - } |
|
| 422 | - } |
|
| 423 | - return $output; |
|
| 278 | + $args = wp_parse_args((array)$params, |
|
| 279 | + array( |
|
| 280 | + 'title' => '', |
|
| 281 | + 'post_type' => array(), // NULL for all |
|
| 282 | + 'hide_empty' => '', |
|
| 283 | + 'show_count' => '', |
|
| 284 | + 'hide_icon' => '', |
|
| 285 | + 'cpt_left' => '', |
|
| 286 | + 'sort_by' => 'count', |
|
| 287 | + 'max_count' => 'all', |
|
| 288 | + 'max_level' => '1', |
|
| 289 | + ) |
|
| 290 | + ); |
|
| 291 | + |
|
| 292 | + $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
| 293 | + |
|
| 294 | + $gd_post_types = geodir_get_posttypes('array'); |
|
| 295 | + |
|
| 296 | + $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
| 297 | + $current_posttype = geodir_get_current_posttype(); |
|
| 298 | + |
|
| 299 | + $is_listing = false; |
|
| 300 | + $is_category = false; |
|
| 301 | + if (geodir_is_page('listing')) { |
|
| 302 | + $current_posttype = geodir_get_current_posttype(); |
|
| 303 | + |
|
| 304 | + if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
| 305 | + $is_listing = true; |
|
| 306 | + |
|
| 307 | + if (is_tax()) { // category page |
|
| 308 | + $current_term_id = get_queried_object_id(); |
|
| 309 | + $current_taxonomy = get_query_var('taxonomy'); |
|
| 310 | + $current_posttype = geodir_get_current_posttype(); |
|
| 311 | + |
|
| 312 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
| 313 | + $is_category = true; |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + $parent_category = 0; |
|
| 320 | + if ($is_listing) { |
|
| 321 | + $post_type_arr = array($current_posttype); |
|
| 322 | + |
|
| 323 | + if ($is_category) { |
|
| 324 | + $parent_category = $current_term_id; |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + $post_types = array(); |
|
| 329 | + if (!empty($post_type_arr)) { |
|
| 330 | + if (in_array('0', $post_type_arr)) { |
|
| 331 | + $post_types = $gd_post_types; |
|
| 332 | + } else { |
|
| 333 | + foreach ($post_type_arr as $cpt) { |
|
| 334 | + if (isset($gd_post_types[$cpt])) { |
|
| 335 | + $post_types[$cpt] = $gd_post_types[$cpt]; |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + if (empty($post_type_arr)) { |
|
| 342 | + $post_types = $gd_post_types; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
| 346 | + $max_count = strip_tags($args['max_count']); |
|
| 347 | + $all_childs = $max_count == 'all' ? true : false; |
|
| 348 | + $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 349 | + $max_level = strip_tags($args['max_level']); |
|
| 350 | + $show_count = !empty($args['show_count']) ? true : false; |
|
| 351 | + $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
| 352 | + $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
| 353 | + |
|
| 354 | + if(!$cpt_left){ |
|
| 355 | + $cpt_left = "gd-cpt-flat"; |
|
| 356 | + }else{ |
|
| 357 | + $cpt_left = ''; |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + $orderby = 'count'; |
|
| 361 | + $order = 'DESC'; |
|
| 362 | + if ($sort_by == 'az') { |
|
| 363 | + $orderby = 'name'; |
|
| 364 | + $order = 'ASC'; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + $output = ''; |
|
| 368 | + if (!empty($post_types)) { |
|
| 369 | + foreach ($post_types as $cpt => $cpt_info) { |
|
| 370 | + $cat_taxonomy = $cpt . 'category'; |
|
| 371 | + $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
| 372 | + if ($hide_empty) { |
|
| 373 | + $categories = geodir_filter_empty_terms($categories); |
|
| 374 | + } |
|
| 375 | + if ($sort_by == 'count') { |
|
| 376 | + $categories = geodir_sort_terms($categories, 'count'); |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + if (!empty($categories)) { |
|
| 380 | + $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
| 381 | + $row_class = ''; |
|
| 382 | + |
|
| 383 | + if ($is_listing) { |
|
| 384 | + $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
| 385 | + } |
|
| 386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 387 | + |
|
| 388 | + if ($is_category) { |
|
| 389 | + $term_info = get_term($current_term_id, $cat_taxonomy); |
|
| 390 | + |
|
| 391 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
| 392 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 393 | + |
|
| 394 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
| 395 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
| 396 | + } else { |
|
| 397 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
| 398 | + } |
|
| 399 | + foreach ($categories as $category) { |
|
| 400 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 401 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 402 | + |
|
| 403 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 404 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 405 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 406 | + |
|
| 407 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
| 408 | + $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
| 409 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 412 | + $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
| 413 | + } |
|
| 414 | + $cpt_row .= '</li>'; |
|
| 415 | + $cpt_row .= '</ul>'; |
|
| 416 | + } |
|
| 417 | + $cpt_row .= '</ul></div>'; |
|
| 418 | + |
|
| 419 | + $output .= $cpt_row; |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + } |
|
| 423 | + return $output; |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | /** |
@@ -440,48 +440,48 @@ discard block |
||
| 440 | 440 | * @return string Html content. |
| 441 | 441 | */ |
| 442 | 442 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
| 443 | - $cat_taxonomy = $cpt . 'category'; |
|
| 444 | - |
|
| 445 | - $orderby = 'count'; |
|
| 446 | - $order = 'DESC'; |
|
| 447 | - if ($sort_by == 'az') { |
|
| 448 | - $orderby = 'name'; |
|
| 449 | - $order = 'ASC'; |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 453 | - return ''; |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
| 457 | - if ($hide_empty) { |
|
| 458 | - $child_cats = geodir_filter_empty_terms($child_cats); |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - if (empty($child_cats)) { |
|
| 462 | - return ''; |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - if ($sort_by == 'count') { |
|
| 466 | - $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
| 467 | - } |
|
| 468 | - |
|
| 469 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
| 470 | - $depth++; |
|
| 471 | - foreach ($child_cats as $category) { |
|
| 472 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 473 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 475 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 477 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 478 | - |
|
| 479 | - $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
| 480 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
| 481 | - $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
| 482 | - } |
|
| 483 | - $content .= '</li></ul>'; |
|
| 484 | - |
|
| 485 | - return $content; |
|
| 443 | + $cat_taxonomy = $cpt . 'category'; |
|
| 444 | + |
|
| 445 | + $orderby = 'count'; |
|
| 446 | + $order = 'DESC'; |
|
| 447 | + if ($sort_by == 'az') { |
|
| 448 | + $orderby = 'name'; |
|
| 449 | + $order = 'ASC'; |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 453 | + return ''; |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
| 457 | + if ($hide_empty) { |
|
| 458 | + $child_cats = geodir_filter_empty_terms($child_cats); |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + if (empty($child_cats)) { |
|
| 462 | + return ''; |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + if ($sort_by == 'count') { |
|
| 466 | + $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
| 470 | + $depth++; |
|
| 471 | + foreach ($child_cats as $category) { |
|
| 472 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 473 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 474 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 475 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 476 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 477 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 478 | + |
|
| 479 | + $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
| 480 | + $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
| 481 | + $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
| 482 | + } |
|
| 483 | + $content .= '</li></ul>'; |
|
| 484 | + |
|
| 485 | + return $content; |
|
| 486 | 486 | } |
| 487 | 487 | ?> |
| 488 | 488 | \ No newline at end of file |