@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_session_start() |
| 18 | 18 | {
|
| 19 | - if (!session_id()) session_start(); |
|
| 20 | - global $geodir_add_location_url; |
|
| 19 | + if (!session_id()) session_start(); |
|
| 20 | + global $geodir_add_location_url; |
|
| 21 | 21 | |
| 22 | - $geodir_add_location_url = NULL; |
|
| 22 | + $geodir_add_location_url = NULL; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function geodir_modified_query($query) |
| 35 | 35 | {
|
| 36 | - if ($query->is_main_query() && ( |
|
| 37 | - (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | - || geodir_is_page('listing')
|
|
| 39 | - || geodir_is_page('author')
|
|
| 40 | - || geodir_is_page('search')
|
|
| 41 | - || geodir_is_page('detail'))
|
|
| 42 | - ) {
|
|
| 43 | - |
|
| 44 | - $query->set('is_geodir_loop', true);
|
|
| 45 | - } |
|
| 36 | + if ($query->is_main_query() && ( |
|
| 37 | + (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | + || geodir_is_page('listing')
|
|
| 39 | + || geodir_is_page('author')
|
|
| 40 | + || geodir_is_page('search')
|
|
| 41 | + || geodir_is_page('detail'))
|
|
| 42 | + ) {
|
|
| 43 | + |
|
| 44 | + $query->set('is_geodir_loop', true);
|
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $query; |
|
| 47 | + return $query; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -67,81 +67,81 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function set_listing_request() |
| 69 | 69 | {
|
| 70 | - global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 70 | + global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | - // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | - if (!geodir_is_geodir_page()) {
|
|
| 75 | - return; |
|
| 76 | - } |
|
| 73 | + // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | + if (!geodir_is_geodir_page()) {
|
|
| 75 | + return; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /* remove all pre filters */ |
|
| 79 | - remove_all_filters('query');
|
|
| 80 | - remove_all_filters('posts_search');
|
|
| 81 | - remove_all_filters('posts_fields');
|
|
| 82 | - remove_all_filters('posts_join');
|
|
| 83 | - remove_all_filters('posts_orderby');
|
|
| 84 | - remove_all_filters('posts_where');
|
|
| 78 | + /* remove all pre filters */ |
|
| 79 | + remove_all_filters('query');
|
|
| 80 | + remove_all_filters('posts_search');
|
|
| 81 | + remove_all_filters('posts_fields');
|
|
| 82 | + remove_all_filters('posts_join');
|
|
| 83 | + remove_all_filters('posts_orderby');
|
|
| 84 | + remove_all_filters('posts_where');
|
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | - if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 87 | + if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 88 | 88 | |
| 89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | - //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 89 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | + //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 91 | 91 | |
| 92 | - if (isset($_REQUEST['sdist'])) {
|
|
| 93 | - ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | - } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | - $dist = get_option('geodir_search_dist');
|
|
| 92 | + if (isset($_REQUEST['sdist'])) {
|
|
| 93 | + ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | + } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | + $dist = get_option('geodir_search_dist');
|
|
| 96 | 96 | |
| 97 | - } else {
|
|
| 98 | - $dist = 25000; |
|
| 99 | - } // Distance |
|
| 97 | + } else {
|
|
| 98 | + $dist = 25000; |
|
| 99 | + } // Distance |
|
| 100 | 100 | |
| 101 | - if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | - } else {
|
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | - } // Latatude |
|
| 101 | + if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | + $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | + } else {
|
|
| 104 | + $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | + } // Latatude |
|
| 106 | 106 | |
| 107 | - if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | - } else {
|
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | - } // Distance |
|
| 107 | + if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | + $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | + } else {
|
|
| 110 | + $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | + } // Distance |
|
| 112 | 112 | |
| 113 | - if (isset($_REQUEST['snear'])) {
|
|
| 114 | - $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | - } |
|
| 113 | + if (isset($_REQUEST['snear'])) {
|
|
| 114 | + $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - if (isset($_REQUEST['s'])) {
|
|
| 118 | - $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | - } |
|
| 117 | + if (isset($_REQUEST['s'])) {
|
|
| 118 | + $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - if ($snear == 'NEAR ME') {
|
|
| 122 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | - $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | - $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | - } |
|
| 121 | + if ($snear == 'NEAR ME') {
|
|
| 122 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | + $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | + $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | |
| 129 | - if (strstr($s, ',')) {
|
|
| 130 | - $s_AA = str_replace(" ", "", $s);
|
|
| 131 | - $s_A = explode(",", $s_AA);
|
|
| 132 | - $s_A = implode('","', $s_A);
|
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 134 | - } else {
|
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 136 | - } |
|
| 129 | + if (strstr($s, ',')) {
|
|
| 130 | + $s_AA = str_replace(" ", "", $s);
|
|
| 131 | + $s_A = explode(",", $s_AA);
|
|
| 132 | + $s_A = implode('","', $s_A);
|
|
| 133 | + $s_A = '"' . $s_A . '"'; |
|
| 134 | + } else {
|
|
| 135 | + $s_A = '"' . $s . '"'; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - if (strstr($s, ' ')) {
|
|
| 139 | - $s_SA = explode(" ", $s);
|
|
| 140 | - } else {
|
|
| 141 | - $s_SA = ''; |
|
| 142 | - } |
|
| 138 | + if (strstr($s, ' ')) {
|
|
| 139 | + $s_SA = explode(" ", $s);
|
|
| 140 | + } else {
|
|
| 141 | + $s_SA = ''; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - endif; |
|
| 144 | + endif; |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
@@ -162,56 +162,56 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function geodir_listing_loop_filter($query) |
| 164 | 164 | {
|
| 165 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 165 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 166 | 166 | |
| 167 | - // fix wp_reset_query for popular post view widget |
|
| 168 | - if (!geodir_is_geodir_page()) {
|
|
| 169 | - return; |
|
| 170 | - } |
|
| 167 | + // fix wp_reset_query for popular post view widget |
|
| 168 | + if (!geodir_is_geodir_page()) {
|
|
| 169 | + return; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | - |
|
| 174 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | - |
|
| 177 | - if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | - $request_term = end($request_term); |
|
| 180 | - if (!term_exists($request_term)) {
|
|
| 181 | - $args = array('number' => '1',);
|
|
| 182 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | - foreach ($terms_arr as $location_term) {
|
|
| 184 | - $term_arr = $location_term; |
|
| 185 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | - } |
|
| 187 | - $wp_query->queried_object_id = 1; |
|
| 188 | - $wp_query->queried_object = $term_arr; |
|
| 189 | - //print_r($wp_query) ; |
|
| 190 | - } |
|
| 191 | - } |
|
| 172 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | + |
|
| 174 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | + |
|
| 177 | + if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | + $request_term = end($request_term); |
|
| 180 | + if (!term_exists($request_term)) {
|
|
| 181 | + $args = array('number' => '1',);
|
|
| 182 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | + foreach ($terms_arr as $location_term) {
|
|
| 184 | + $term_arr = $location_term; |
|
| 185 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | + } |
|
| 187 | + $wp_query->queried_object_id = 1; |
|
| 188 | + $wp_query->queried_object = $term_arr; |
|
| 189 | + //print_r($wp_query) ; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - } |
|
| 194 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 195 | - |
|
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | - |
|
| 198 | - add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | - add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | - geodir_post_where(); |
|
| 201 | - if (!is_admin()) |
|
| 202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | - |
|
| 204 | - // advanced filter for popular post view widget |
|
| 205 | - global $wp_query; |
|
| 206 | - if (!is_admin()) {
|
|
| 207 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | - } |
|
| 210 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | - } |
|
| 193 | + } |
|
| 194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 212 | 195 | |
| 213 | - } |
|
| 214 | - return $query; |
|
| 196 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | + |
|
| 198 | + add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | + add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | + geodir_post_where(); |
|
| 201 | + if (!is_admin()) |
|
| 202 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | + |
|
| 204 | + // advanced filter for popular post view widget |
|
| 205 | + global $wp_query; |
|
| 206 | + if (!is_admin()) {
|
|
| 207 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | + } |
|
| 210 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + } |
|
| 214 | + return $query; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -230,67 +230,67 @@ discard block |
||
| 230 | 230 | * @return string Modified fields query string. |
| 231 | 231 | */ |
| 232 | 232 | function geodir_posts_fields($fields) {
|
| 233 | - global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 233 | + global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 234 | 234 | |
| 235 | - // Filter-Location-Manager to add location table. |
|
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 235 | + // Filter-Location-Manager to add location table. |
|
| 236 | + $fields .= ", " . $table . ".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 239 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 240 | 240 | |
| 241 | 241 | if ($gd_session->get('all_near_me')) {
|
| 242 | - $mylat = $gd_session->get('user_lat');
|
|
| 243 | - $mylon = $gd_session->get('user_lon');
|
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - global $s; |
|
| 250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | - $keywords = explode(" ", $s);
|
|
| 252 | - |
|
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 256 | - unset($keywords[$kkey]); |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - } |
|
| 242 | + $mylat = $gd_session->get('user_lat');
|
|
| 243 | + $mylon = $gd_session->get('user_lon');
|
|
| 244 | + } |
|
| 260 | 245 | |
| 246 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | + } |
|
| 261 | 248 | |
| 262 | - if (count($keywords) > 1) {
|
|
| 263 | - $parts = array( |
|
| 264 | - 'AND' => 'gd_alltitlematch_part', |
|
| 265 | - 'OR' => 'gd_titlematch_part' |
|
| 266 | - ); |
|
| 267 | - $gd_titlematch_part = ""; |
|
| 268 | - foreach ($parts as $key => $part) {
|
|
| 269 | - $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | - $count = 0; |
|
| 271 | - foreach ($keywords as $keyword) {
|
|
| 272 | - $keyword = trim($keyword); |
|
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 249 | + global $s; |
|
| 250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | + $keywords = explode(" ", $s);
|
|
| 252 | + |
|
| 253 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | + foreach($keywords as $kkey=>$kword){
|
|
| 255 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 256 | + unset($keywords[$kkey]); |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + |
|
| 262 | + if (count($keywords) > 1) {
|
|
| 263 | + $parts = array( |
|
| 264 | + 'AND' => 'gd_alltitlematch_part', |
|
| 265 | + 'OR' => 'gd_titlematch_part' |
|
| 266 | + ); |
|
| 267 | + $gd_titlematch_part = ""; |
|
| 268 | + foreach ($parts as $key => $part) {
|
|
| 269 | + $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | + $count = 0; |
|
| 271 | + foreach ($keywords as $keyword) {
|
|
| 272 | + $keyword = trim($keyword); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | - if ($count < count($keywords)) {
|
|
| 276 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 275 | + if ($count < count($keywords)) {
|
|
| 276 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 277 | 277 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
| 278 | - } else {
|
|
| 279 | - //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 278 | + } else {
|
|
| 279 | + //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 280 | 280 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
| 281 | - } |
|
| 282 | - } |
|
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | - } |
|
| 285 | - } else {
|
|
| 286 | - $gd_titlematch_part = ""; |
|
| 287 | - } |
|
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | + } |
|
| 285 | + } else {
|
|
| 286 | + $gd_titlematch_part = ""; |
|
| 287 | + } |
|
| 288 | + $s = stripslashes_deep( $s ); |
|
| 289 | + $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | 290 | $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
| 291 | - } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - return $fields; |
|
| 293 | + return $fields; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -307,26 +307,26 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | function geodir_posts_join($join) |
| 309 | 309 | {
|
| 310 | - global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 310 | + global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 311 | 311 | |
| 312 | - ########### WPML ########### |
|
| 312 | + ########### WPML ########### |
|
| 313 | 313 | |
| 314 | - if (function_exists('icl_object_id')) {
|
|
| 315 | - global $sitepress; |
|
| 316 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | - if ($lang_code) {
|
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | - } |
|
| 314 | + if (function_exists('icl_object_id')) {
|
|
| 315 | + global $sitepress; |
|
| 316 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | + if ($lang_code) {
|
|
| 319 | + $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | - } |
|
| 323 | - ########### WPML ########### |
|
| 322 | + } |
|
| 323 | + ########### WPML ########### |
|
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | - //===old code start |
|
| 327 | - //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 325 | + $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | + //===old code start |
|
| 327 | + //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 328 | 328 | |
| 329 | - return $join; |
|
| 329 | + return $join; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | function geodir_posts_orderby($orderby) |
| 346 | 346 | {
|
| 347 | - global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 347 | + global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 348 | 348 | |
| 349 | - $sort_by = ''; |
|
| 350 | - $orderby = ' '; |
|
| 349 | + $sort_by = ''; |
|
| 350 | + $orderby = ' '; |
|
| 351 | 351 | |
| 352 | - if (get_query_var('order_by'))
|
|
| 353 | - $sort_by = get_query_var('order_by');
|
|
| 352 | + if (get_query_var('order_by'))
|
|
| 353 | + $sort_by = get_query_var('order_by');
|
|
| 354 | 354 | |
| 355 | - /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 355 | + /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 356 | 356 | $current_term = $wp_query->get_queried_object(); |
| 357 | 357 | } |
| 358 | 358 | |
@@ -366,116 +366,116 @@ discard block |
||
| 366 | 366 | }*/ |
| 367 | 367 | |
| 368 | 368 | |
| 369 | - if ($snear != '') {
|
|
| 370 | - $orderby .= " distance,"; |
|
| 371 | - } |
|
| 369 | + if ($snear != '') {
|
|
| 370 | + $orderby .= " distance,"; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 373 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | - if ($sort_by == '') {
|
|
| 378 | - $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | - if (!empty($default_sort)) |
|
| 380 | - $sort_by = $default_sort; |
|
| 381 | - } |
|
| 377 | + if ($sort_by == '') {
|
|
| 378 | + $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | + if (!empty($default_sort)) |
|
| 380 | + $sort_by = $default_sort; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - /* |
|
| 383 | + /* |
|
| 384 | 384 | if search by term & no location then order always "relevance" |
| 385 | 385 | if search by location then order always "nearest" |
| 386 | 386 | */ |
| 387 | - if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | - $search_term = get_query_var('s');
|
|
| 387 | + if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | + $search_term = get_query_var('s');
|
|
| 389 | 389 | |
| 390 | - if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | - $sort_by = 'az'; |
|
| 392 | - } |
|
| 390 | + if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | + $sort_by = 'az'; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - if ($snear != '') {
|
|
| 395 | - $sort_by = 'nearest'; |
|
| 396 | - } |
|
| 397 | - } |
|
| 394 | + if ($snear != '') {
|
|
| 395 | + $sort_by = 'nearest'; |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | - switch ($sort_by): |
|
| 400 | - case 'newest': |
|
| 401 | - $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | - break; |
|
| 403 | - case 'oldest': |
|
| 404 | - $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | - break; |
|
| 406 | - case 'low_review': |
|
| 407 | - case 'rating_count_asc': |
|
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | - break; |
|
| 410 | - case 'high_review': |
|
| 411 | - case 'rating_count_desc': |
|
| 399 | + switch ($sort_by): |
|
| 400 | + case 'newest': |
|
| 401 | + $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | + break; |
|
| 403 | + case 'oldest': |
|
| 404 | + $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | + break; |
|
| 406 | + case 'low_review': |
|
| 407 | + case 'rating_count_asc': |
|
| 408 | + $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | + break; |
|
| 410 | + case 'high_review': |
|
| 411 | + case 'rating_count_desc': |
|
| 412 | 412 | $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
| 413 | - break; |
|
| 414 | - case 'low_rating': |
|
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | - break; |
|
| 417 | - case 'high_rating': |
|
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | - break; |
|
| 420 | - case 'featured': |
|
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 422 | - break; |
|
| 423 | - case 'nearest': |
|
| 424 | - $orderby = " distance asc, "; |
|
| 425 | - break; |
|
| 426 | - case 'farthest': |
|
| 427 | - $orderby = " distance desc, "; |
|
| 428 | - break; |
|
| 429 | - case 'random': |
|
| 430 | - $orderby = " rand(), "; |
|
| 431 | - break; |
|
| 432 | - case 'az': |
|
| 433 | - $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | - break; |
|
| 435 | - default: |
|
| 436 | - |
|
| 437 | - break; |
|
| 438 | - endswitch; |
|
| 439 | - |
|
| 440 | - global $s; |
|
| 441 | - |
|
| 442 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 443 | - $keywords = explode(" ", $s);
|
|
| 444 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 445 | - foreach($keywords as $kkey=>$kword){
|
|
| 446 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 447 | - unset($keywords[$kkey]); |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 452 | - if (count($keywords) > 1) {
|
|
| 453 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 454 | - } else {
|
|
| 455 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 456 | - } |
|
| 457 | - } else {
|
|
| 458 | - if (count($keywords) > 1) {
|
|
| 459 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 460 | - } else {
|
|
| 461 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 462 | - } |
|
| 463 | - } |
|
| 464 | - } |
|
| 413 | + break; |
|
| 414 | + case 'low_rating': |
|
| 415 | + $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | + break; |
|
| 417 | + case 'high_rating': |
|
| 418 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | + break; |
|
| 420 | + case 'featured': |
|
| 421 | + $orderby = $table . ".is_featured asc, "; |
|
| 422 | + break; |
|
| 423 | + case 'nearest': |
|
| 424 | + $orderby = " distance asc, "; |
|
| 425 | + break; |
|
| 426 | + case 'farthest': |
|
| 427 | + $orderby = " distance desc, "; |
|
| 428 | + break; |
|
| 429 | + case 'random': |
|
| 430 | + $orderby = " rand(), "; |
|
| 431 | + break; |
|
| 432 | + case 'az': |
|
| 433 | + $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | + break; |
|
| 435 | + default: |
|
| 436 | + |
|
| 437 | + break; |
|
| 438 | + endswitch; |
|
| 439 | + |
|
| 440 | + global $s; |
|
| 441 | + |
|
| 442 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 443 | + $keywords = explode(" ", $s);
|
|
| 444 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 445 | + foreach($keywords as $kkey=>$kword){
|
|
| 446 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 447 | + unset($keywords[$kkey]); |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 452 | + if (count($keywords) > 1) {
|
|
| 453 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 454 | + } else {
|
|
| 455 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 456 | + } |
|
| 457 | + } else {
|
|
| 458 | + if (count($keywords) > 1) {
|
|
| 459 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 460 | + } else {
|
|
| 461 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 462 | + } |
|
| 463 | + } |
|
| 464 | + } |
|
| 465 | 465 | |
| 466 | - /** |
|
| 467 | - * Filter order by SQL. |
|
| 468 | - * |
|
| 469 | - * @since 1.0.0 |
|
| 470 | - * @param string $orderby The orderby query string. |
|
| 471 | - * @param string $sort_by Sortby query string. |
|
| 472 | - * @param string $table Listing table name. |
|
| 473 | - */ |
|
| 474 | - $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 466 | + /** |
|
| 467 | + * Filter order by SQL. |
|
| 468 | + * |
|
| 469 | + * @since 1.0.0 |
|
| 470 | + * @param string $orderby The orderby query string. |
|
| 471 | + * @param string $sort_by Sortby query string. |
|
| 472 | + * @param string $table Listing table name. |
|
| 473 | + */ |
|
| 474 | + $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 475 | 475 | |
| 476 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 476 | + $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 477 | 477 | |
| 478 | - return $orderby; |
|
| 478 | + return $orderby; |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
@@ -493,53 +493,53 @@ discard block |
||
| 493 | 493 | function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table) |
| 494 | 494 | {
|
| 495 | 495 | |
| 496 | - global $wpdb; |
|
| 496 | + global $wpdb; |
|
| 497 | 497 | |
| 498 | - if ($sort_by != '' && !is_search()) {
|
|
| 498 | + if ($sort_by != '' && !is_search()) {
|
|
| 499 | 499 | |
| 500 | - $sort_array = explode('_', $sort_by);
|
|
| 500 | + $sort_array = explode('_', $sort_by);
|
|
| 501 | 501 | |
| 502 | - $sort_by_count = count($sort_array); |
|
| 502 | + $sort_by_count = count($sort_array); |
|
| 503 | 503 | |
| 504 | - $order = $sort_array[$sort_by_count - 1]; |
|
| 504 | + $order = $sort_array[$sort_by_count - 1]; |
|
| 505 | 505 | |
| 506 | - if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 506 | + if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 507 | 507 | |
| 508 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 508 | + $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 509 | 509 | |
| 510 | - switch ($sort_by): |
|
| 510 | + switch ($sort_by): |
|
| 511 | 511 | |
| 512 | - case 'post_date': |
|
| 513 | - case 'comment_count': |
|
| 512 | + case 'post_date': |
|
| 513 | + case 'comment_count': |
|
| 514 | 514 | |
| 515 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 516 | - break; |
|
| 515 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 516 | + break; |
|
| 517 | 517 | |
| 518 | - case 'distance': |
|
| 519 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 520 | - break; |
|
| 518 | + case 'distance': |
|
| 519 | + $orderby = $sort_by . " " . $order . ", "; |
|
| 520 | + break; |
|
| 521 | 521 | |
| 522 | 522 | |
| 523 | - // sort by rating |
|
| 524 | - case 'overall_rating': |
|
| 525 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 523 | + // sort by rating |
|
| 524 | + case 'overall_rating': |
|
| 525 | + $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 526 | 526 | |
| 527 | - break; |
|
| 527 | + break; |
|
| 528 | 528 | |
| 529 | 529 | |
| 530 | - default: |
|
| 531 | - if (geodir_column_exist($table, $sort_by)) {
|
|
| 530 | + default: |
|
| 531 | + if (geodir_column_exist($table, $sort_by)) {
|
|
| 532 | 532 | $orderby = $table . "." . $sort_by . " " . $order . ", "; |
| 533 | 533 | } |
| 534 | - break; |
|
| 534 | + break; |
|
| 535 | 535 | |
| 536 | - endswitch; |
|
| 536 | + endswitch; |
|
| 537 | 537 | |
| 538 | - } |
|
| 538 | + } |
|
| 539 | 539 | |
| 540 | - } |
|
| 540 | + } |
|
| 541 | 541 | |
| 542 | - return $orderby; |
|
| 542 | + return $orderby; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -554,34 +554,34 @@ discard block |
||
| 554 | 554 | {
|
| 555 | 555 | |
| 556 | 556 | |
| 557 | - global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 557 | + global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 558 | 558 | |
| 559 | - if (!is_admin()) {
|
|
| 559 | + if (!is_admin()) {
|
|
| 560 | 560 | |
| 561 | - if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 562 | - add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 561 | + if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 562 | + add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 563 | 563 | |
| 564 | - } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 564 | + } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 565 | 565 | |
| 566 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 566 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 567 | 567 | |
| 568 | - if ($snear != '') |
|
| 569 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 568 | + if ($snear != '') |
|
| 569 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 570 | 570 | |
| 571 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 571 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 572 | 572 | |
| 573 | - } elseif (geodir_is_page('author')) {
|
|
| 573 | + } elseif (geodir_is_page('author')) {
|
|
| 574 | 574 | |
| 575 | - add_filter('posts_where', 'author_filter_where', 1);
|
|
| 575 | + add_filter('posts_where', 'author_filter_where', 1);
|
|
| 576 | 576 | |
| 577 | - } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - //if (!geodir_is_page('detail'))
|
|
| 580 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 579 | + //if (!geodir_is_page('detail'))
|
|
| 580 | + add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 581 | 581 | |
| 582 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 582 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 583 | 583 | |
| 584 | - } |
|
| 584 | + } |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -596,13 +596,13 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | function geodir_preview_post_cap($allcaps, $caps, $args) |
| 598 | 598 | {
|
| 599 | - $user_id = get_current_user_id(); |
|
| 600 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 599 | + $user_id = get_current_user_id(); |
|
| 600 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 601 | 601 | |
| 602 | - $allcaps['edit_posts'] = true; |
|
| 603 | - } |
|
| 604 | - //print_r($allcaps); |
|
| 605 | - return $allcaps; |
|
| 602 | + $allcaps['edit_posts'] = true; |
|
| 603 | + } |
|
| 604 | + //print_r($allcaps); |
|
| 605 | + return $allcaps; |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | function geodir_edit_listing_where($where) |
| 619 | 619 | {
|
| 620 | - global $wpdb; |
|
| 621 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 622 | - return $where; |
|
| 620 | + global $wpdb; |
|
| 621 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 622 | + return $where; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | |
@@ -636,29 +636,29 @@ discard block |
||
| 636 | 636 | */ |
| 637 | 637 | function geodir_default_where($where) |
| 638 | 638 | {
|
| 639 | - global $wp_query, $wpdb; |
|
| 640 | - |
|
| 641 | - //print_r($wp_query); |
|
| 642 | - ########### WPML ########### |
|
| 643 | - |
|
| 644 | - if (function_exists('icl_object_id')) {
|
|
| 645 | - global $sitepress, $table_prefix; |
|
| 646 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 647 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 648 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 649 | - //echo '##########'.$q_post_type; |
|
| 650 | - if ($lang_code && $q_post_type) {
|
|
| 651 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 652 | - //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 653 | - } |
|
| 639 | + global $wp_query, $wpdb; |
|
| 654 | 640 | |
| 655 | - } |
|
| 656 | - ########### WPML ########### |
|
| 641 | + //print_r($wp_query); |
|
| 642 | + ########### WPML ########### |
|
| 657 | 643 | |
| 644 | + if (function_exists('icl_object_id')) {
|
|
| 645 | + global $sitepress, $table_prefix; |
|
| 646 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 647 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 648 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 649 | + //echo '##########'.$q_post_type; |
|
| 650 | + if ($lang_code && $q_post_type) {
|
|
| 651 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 652 | + //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 653 | + } |
|
| 654 | + |
|
| 655 | + } |
|
| 656 | + ########### WPML ########### |
|
| 658 | 657 | |
| 659 | - return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 660 | 658 | |
| 661 | - /* ====== old code start === |
|
| 659 | + return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 660 | + |
|
| 661 | + /* ====== old code start === |
|
| 662 | 662 | $where = str_replace("0 = 1", "1=1", $where);
|
| 663 | 663 | $country = get_query_var('gd_country');
|
| 664 | 664 | $region = get_query_var('gd_region');
|
@@ -699,108 +699,108 @@ discard block |
||
| 699 | 699 | * @return string Modified where query string. |
| 700 | 700 | */ |
| 701 | 701 | function searching_filter_where($where) {
|
| 702 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 702 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 703 | 703 | |
| 704 | - $search_term = 'OR'; |
|
| 705 | - $search_term = 'AND'; |
|
| 706 | - $geodir_custom_search = ''; |
|
| 707 | - $category_search_range = ''; |
|
| 704 | + $search_term = 'OR'; |
|
| 705 | + $search_term = 'AND'; |
|
| 706 | + $geodir_custom_search = ''; |
|
| 707 | + $category_search_range = ''; |
|
| 708 | 708 | |
| 709 | - if (is_single() && get_query_var('post_type')) {
|
|
| 709 | + if (is_single() && get_query_var('post_type')) {
|
|
| 710 | 710 | return $where; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - if (is_tax()) {
|
|
| 713 | + if (is_tax()) {
|
|
| 714 | 714 | return $where; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | $s = trim($s); |
| 718 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 719 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 720 | - |
|
| 721 | - $where = ''; |
|
| 722 | - $better_search_terms = ''; |
|
| 723 | - if (isset($_REQUEST['stype'])) |
|
| 724 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 725 | - else |
|
| 726 | - $post_types = 'gd_place'; |
|
| 727 | - |
|
| 728 | - if ($s != '') {
|
|
| 729 | - $keywords = explode(" ", $s);
|
|
| 730 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 731 | - foreach($keywords as $kkey=>$kword){
|
|
| 732 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 733 | - unset($keywords[$kkey]); |
|
| 734 | - } |
|
| 735 | - } |
|
| 736 | - } |
|
| 718 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 719 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 720 | + |
|
| 721 | + $where = ''; |
|
| 722 | + $better_search_terms = ''; |
|
| 723 | + if (isset($_REQUEST['stype'])) |
|
| 724 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 725 | + else |
|
| 726 | + $post_types = 'gd_place'; |
|
| 737 | 727 | |
| 738 | - if (!empty($keywords)) {
|
|
| 739 | - foreach ($keywords as $keyword) {
|
|
| 740 | - $keyword = trim($keyword); |
|
| 741 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 742 | - if ($keyword != '') {
|
|
| 743 | - /** |
|
| 744 | - * Filter the search query keywords SQL. |
|
| 745 | - * |
|
| 746 | - * @since 1.5.9 |
|
| 747 | - * @package GeoDirectory |
|
| 748 | - * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 749 | - * @param array $keywords The array of keywords for the query. |
|
| 750 | - * @param string $keyword The single keyword being searched. |
|
| 751 | - */ |
|
| 728 | + if ($s != '') {
|
|
| 729 | + $keywords = explode(" ", $s);
|
|
| 730 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 731 | + foreach($keywords as $kkey=>$kword){
|
|
| 732 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 733 | + unset($keywords[$kkey]); |
|
| 734 | + } |
|
| 735 | + } |
|
| 736 | + } |
|
| 737 | + |
|
| 738 | + if (!empty($keywords)) {
|
|
| 739 | + foreach ($keywords as $keyword) {
|
|
| 740 | + $keyword = trim($keyword); |
|
| 741 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 742 | + if ($keyword != '') {
|
|
| 743 | + /** |
|
| 744 | + * Filter the search query keywords SQL. |
|
| 745 | + * |
|
| 746 | + * @since 1.5.9 |
|
| 747 | + * @package GeoDirectory |
|
| 748 | + * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 749 | + * @param array $keywords The array of keywords for the query. |
|
| 750 | + * @param string $keyword The single keyword being searched. |
|
| 751 | + */ |
|
| 752 | 752 | $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
| 753 | - } |
|
| 754 | - } |
|
| 755 | - } |
|
| 756 | - } |
|
| 753 | + } |
|
| 754 | + } |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | 757 | |
| 758 | - /* get taxonomy */ |
|
| 759 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 760 | - if($taxonomies) {
|
|
| 761 | - $taxonomies = implode("','", $taxonomies);
|
|
| 762 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 763 | - }else{$taxonomies='';}
|
|
| 758 | + /* get taxonomy */ |
|
| 759 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 760 | + if($taxonomies) {
|
|
| 761 | + $taxonomies = implode("','", $taxonomies);
|
|
| 762 | + $taxonomies = "'" . $taxonomies . "'"; |
|
| 763 | + }else{$taxonomies='';}
|
|
| 764 | 764 | |
| 765 | - $content_where = $terms_where = ''; |
|
| 765 | + $content_where = $terms_where = ''; |
|
| 766 | 766 | if ($s != '') {
|
| 767 | - /** |
|
| 768 | - * Filter the search query content where values. |
|
| 769 | - * |
|
| 770 | - * @since 1.5.0 |
|
| 771 | - * @package GeoDirectory |
|
| 772 | - * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 773 | - */ |
|
| 767 | + /** |
|
| 768 | + * Filter the search query content where values. |
|
| 769 | + * |
|
| 770 | + * @since 1.5.0 |
|
| 771 | + * @package GeoDirectory |
|
| 772 | + * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 773 | + */ |
|
| 774 | 774 | $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
| 775 | - /** |
|
| 776 | - * Filter the search query term values. |
|
| 777 | - * |
|
| 778 | - * @since 1.5.0 |
|
| 779 | - * @package GeoDirectory |
|
| 780 | - * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 781 | - */ |
|
| 782 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 775 | + /** |
|
| 776 | + * Filter the search query term values. |
|
| 777 | + * |
|
| 778 | + * @since 1.5.0 |
|
| 779 | + * @package GeoDirectory |
|
| 780 | + * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 781 | + */ |
|
| 782 | + $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - if ($snear != '') {
|
|
| 785 | + if ($snear != '') {
|
|
| 786 | 786 | |
| 787 | 787 | |
| 788 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 789 | - $dist = $gd_session->get('near_me_range');
|
|
| 790 | - } |
|
| 791 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 792 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 793 | - $lat1 = $mylat - ($dist / 69); |
|
| 794 | - $lat2 = $mylat + ($dist / 69); |
|
| 788 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 789 | + $dist = $gd_session->get('near_me_range');
|
|
| 790 | + } |
|
| 791 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 792 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 793 | + $lat1 = $mylat - ($dist / 69); |
|
| 794 | + $lat2 = $mylat + ($dist / 69); |
|
| 795 | 795 | |
| 796 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 797 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 798 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 799 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 796 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 797 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 798 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 799 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 800 | 800 | |
| 801 | 801 | |
| 802 | 802 | |
| 803 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 803 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 804 | 804 | $content_where |
| 805 | 805 | OR ($wpdb->posts.ID IN( |
| 806 | 806 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -817,13 +817,13 @@ discard block |
||
| 817 | 817 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
| 818 | 818 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
| 819 | 819 | |
| 820 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 821 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 822 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 823 | - } |
|
| 820 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 821 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 822 | + $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 823 | + } |
|
| 824 | 824 | |
| 825 | - } else {
|
|
| 826 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 825 | + } else {
|
|
| 826 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 827 | 827 | $content_where |
| 828 | 828 | OR ( $wpdb->posts.ID IN( |
| 829 | 829 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -837,19 +837,19 @@ discard block |
||
| 837 | 837 | ) |
| 838 | 838 | AND $wpdb->posts.post_type in ('$post_types')
|
| 839 | 839 | AND ($wpdb->posts.post_status = 'publish') "; |
| 840 | - } |
|
| 840 | + } |
|
| 841 | 841 | |
| 842 | 842 | ########### WPML ########### |
| 843 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 843 | + if ( function_exists( 'icl_object_id' ) ) {
|
|
| 844 | 844 | $lang_code = ICL_LANGUAGE_CODE; |
| 845 | 845 | |
| 846 | 846 | if ($lang_code && $post_types) {
|
| 847 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 848 | - } |
|
| 849 | - } |
|
| 850 | - ########### WPML ########### |
|
| 847 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 848 | + } |
|
| 849 | + } |
|
| 850 | + ########### WPML ########### |
|
| 851 | 851 | |
| 852 | - return $where; |
|
| 852 | + return $where; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | |
@@ -864,45 +864,45 @@ discard block |
||
| 864 | 864 | * @return string Modified where query string. |
| 865 | 865 | */ |
| 866 | 866 | function author_filter_where($where) {
|
| 867 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
| 867 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
| 868 | 868 | |
| 869 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 870 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 869 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 870 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 871 | 871 | |
| 872 | - if (isset($_REQUEST['stype'])) {
|
|
| 873 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 874 | - } else {
|
|
| 875 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 876 | - } |
|
| 872 | + if (isset($_REQUEST['stype'])) {
|
|
| 873 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 874 | + } else {
|
|
| 875 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 876 | + } |
|
| 877 | 877 | |
| 878 | - if ($user_id > 0) {
|
|
| 879 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 880 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 881 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 882 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 883 | - } else |
|
| 884 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 885 | - |
|
| 886 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 887 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 888 | - } else {
|
|
| 889 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 890 | - } |
|
| 891 | - } else {
|
|
| 892 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 893 | - } |
|
| 878 | + if ($user_id > 0) {
|
|
| 879 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 880 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 881 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 882 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 883 | + } else |
|
| 884 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 885 | + |
|
| 886 | + if ($user_id == (int)get_current_user_id()) {
|
|
| 887 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 888 | + } else {
|
|
| 889 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 890 | + } |
|
| 891 | + } else {
|
|
| 892 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 893 | + } |
|
| 894 | 894 | |
| 895 | - ########### WPML ########### |
|
| 896 | - if (function_exists('icl_object_id')) {
|
|
| 897 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 898 | - if ($lang_code) {
|
|
| 899 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 900 | - } |
|
| 895 | + ########### WPML ########### |
|
| 896 | + if (function_exists('icl_object_id')) {
|
|
| 897 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 898 | + if ($lang_code) {
|
|
| 899 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 900 | + } |
|
| 901 | 901 | |
| 902 | - } |
|
| 903 | - ########### WPML ########### |
|
| 902 | + } |
|
| 903 | + ########### WPML ########### |
|
| 904 | 904 | |
| 905 | - return $where; |
|
| 905 | + return $where; |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | /** |
@@ -917,11 +917,11 @@ discard block |
||
| 917 | 917 | */ |
| 918 | 918 | function geodir_filter_widget_join($join) |
| 919 | 919 | {
|
| 920 | - global $wp_query, $table; |
|
| 921 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 922 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 923 | - } |
|
| 924 | - return $join; |
|
| 920 | + global $wp_query, $table; |
|
| 921 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 922 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 923 | + } |
|
| 924 | + return $join; |
|
| 925 | 925 | } |
| 926 | 926 | |
| 927 | 927 | /** |
@@ -936,44 +936,44 @@ discard block |
||
| 936 | 936 | */ |
| 937 | 937 | function geodir_filter_widget_where($where) |
| 938 | 938 | {
|
| 939 | - global $wp_query, $table; |
|
| 940 | - if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 941 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 942 | - } |
|
| 943 | - if (!empty($wp_query->query['show_special_only'])) {
|
|
| 944 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 945 | - } |
|
| 946 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 947 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 948 | - } |
|
| 949 | - if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 950 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 951 | - } |
|
| 952 | - return $where; |
|
| 939 | + global $wp_query, $table; |
|
| 940 | + if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 941 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 942 | + } |
|
| 943 | + if (!empty($wp_query->query['show_special_only'])) {
|
|
| 944 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 945 | + } |
|
| 946 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 947 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 948 | + } |
|
| 949 | + if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 950 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 951 | + } |
|
| 952 | + return $where; |
|
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | |
| 956 | 956 | function geodir_related_posts_fields($fields) {
|
| 957 | - global $wp_query, $wpdb, $table, $post; |
|
| 957 | + global $wp_query, $wpdb, $table, $post; |
|
| 958 | 958 | |
| 959 | - $fields .= ", " . $table . ".* "; |
|
| 959 | + $fields .= ", " . $table . ".* "; |
|
| 960 | 960 | |
| 961 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 961 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 962 | 962 | |
| 963 | - $mylat = $post->post_latitude; |
|
| 964 | - $mylon = $post->post_longitude; |
|
| 963 | + $mylat = $post->post_latitude; |
|
| 964 | + $mylon = $post->post_longitude; |
|
| 965 | 965 | |
| 966 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 967 | - return $fields; |
|
| 966 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 967 | + return $fields; |
|
| 968 | 968 | } |
| 969 | 969 | function geodir_related_posts_fields_filter($query) {
|
| 970 | - if (geodir_is_page('detail')) {
|
|
| 971 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 972 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 973 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 974 | - ) {
|
|
| 975 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 976 | - } |
|
| 977 | - } |
|
| 970 | + if (geodir_is_page('detail')) {
|
|
| 971 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 972 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 973 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 974 | + ) {
|
|
| 975 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 976 | + } |
|
| 977 | + } |
|
| 978 | 978 | } |
| 979 | 979 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1); |
| 980 | 980 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @global object $gd_session GeoDirectory Session object. |
| 18 | 18 | */ |
| 19 | 19 | function geodir_list_view_select() {
|
| 20 | - global $gd_session; |
|
| 20 | + global $gd_session; |
|
| 21 | 21 | ?> |
| 22 | 22 | <script type="text/javascript"> |
| 23 | 23 | function geodir_list_view_select(list) {
|
@@ -86,63 +86,63 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function geodir_max_excerpt($charlength) |
| 88 | 88 | {
|
| 89 | - global $post; |
|
| 90 | - if ($charlength == '0') {
|
|
| 91 | - return; |
|
| 92 | - } |
|
| 93 | - $out = ''; |
|
| 89 | + global $post; |
|
| 90 | + if ($charlength == '0') {
|
|
| 91 | + return; |
|
| 92 | + } |
|
| 93 | + $out = ''; |
|
| 94 | 94 | |
| 95 | 95 | $temp_post = $post; |
| 96 | 96 | $excerpt = get_the_excerpt(); |
| 97 | 97 | |
| 98 | - $charlength++; |
|
| 99 | - $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
|
|
| 100 | - if (mb_strlen($excerpt) > $charlength) {
|
|
| 101 | - if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 102 | - $excut = -(mb_strlen($excerpt_more)); |
|
| 103 | - $subex = mb_substr($excerpt, 0, $excut); |
|
| 104 | - if ($charlength > 0 && mb_strlen($subex) > $charlength) {
|
|
| 105 | - $subex = mb_substr($subex, 0, $charlength); |
|
| 106 | - } |
|
| 107 | - $out .= $subex; |
|
| 108 | - } else {
|
|
| 109 | - $subex = mb_substr($excerpt, 0, $charlength - 5); |
|
| 110 | - $exwords = explode(' ', $subex);
|
|
| 111 | - $excut = -(mb_strlen($exwords[count($exwords) - 1])); |
|
| 112 | - if ($excut < 0) {
|
|
| 113 | - $out .= mb_substr($subex, 0, $excut); |
|
| 114 | - } else {
|
|
| 115 | - $out .= $subex; |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 119 | - /** |
|
| 120 | - * Filter excerpt read more text. |
|
| 121 | - * |
|
| 122 | - * @since 1.0.0 |
|
| 123 | - */ |
|
| 124 | - $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 125 | - $out .= '</a>'; |
|
| 126 | - |
|
| 127 | - } else {
|
|
| 128 | - if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 129 | - $excut = -(mb_strlen($excerpt_more)); |
|
| 130 | - $out .= mb_substr($excerpt, 0, $excut); |
|
| 131 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 132 | - /** |
|
| 133 | - * Filter excerpt read more text. |
|
| 134 | - * |
|
| 135 | - * @since 1.0.0 |
|
| 136 | - */ |
|
| 137 | - $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 138 | - $out .= '</a>'; |
|
| 139 | - } else {
|
|
| 140 | - $out .= $excerpt; |
|
| 141 | - } |
|
| 142 | - } |
|
| 98 | + $charlength++; |
|
| 99 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
|
|
| 100 | + if (mb_strlen($excerpt) > $charlength) {
|
|
| 101 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 102 | + $excut = -(mb_strlen($excerpt_more)); |
|
| 103 | + $subex = mb_substr($excerpt, 0, $excut); |
|
| 104 | + if ($charlength > 0 && mb_strlen($subex) > $charlength) {
|
|
| 105 | + $subex = mb_substr($subex, 0, $charlength); |
|
| 106 | + } |
|
| 107 | + $out .= $subex; |
|
| 108 | + } else {
|
|
| 109 | + $subex = mb_substr($excerpt, 0, $charlength - 5); |
|
| 110 | + $exwords = explode(' ', $subex);
|
|
| 111 | + $excut = -(mb_strlen($exwords[count($exwords) - 1])); |
|
| 112 | + if ($excut < 0) {
|
|
| 113 | + $out .= mb_substr($subex, 0, $excut); |
|
| 114 | + } else {
|
|
| 115 | + $out .= $subex; |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 119 | + /** |
|
| 120 | + * Filter excerpt read more text. |
|
| 121 | + * |
|
| 122 | + * @since 1.0.0 |
|
| 123 | + */ |
|
| 124 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 125 | + $out .= '</a>'; |
|
| 126 | + |
|
| 127 | + } else {
|
|
| 128 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 129 | + $excut = -(mb_strlen($excerpt_more)); |
|
| 130 | + $out .= mb_substr($excerpt, 0, $excut); |
|
| 131 | + $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 132 | + /** |
|
| 133 | + * Filter excerpt read more text. |
|
| 134 | + * |
|
| 135 | + * @since 1.0.0 |
|
| 136 | + */ |
|
| 137 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 138 | + $out .= '</a>'; |
|
| 139 | + } else {
|
|
| 140 | + $out .= $excerpt; |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | 143 | $post = $temp_post; |
| 144 | 144 | |
| 145 | - return $out; |
|
| 145 | + return $out; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -157,34 +157,34 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | function geodir_post_package_info($package_info, $post = '', $post_type = '') |
| 159 | 159 | {
|
| 160 | - $package_info['pid'] = 0; |
|
| 161 | - $package_info['days'] = 0; |
|
| 162 | - $package_info['amount'] = 0; |
|
| 163 | - $package_info['is_featured'] = 0; |
|
| 164 | - $package_info['image_limit'] = ''; |
|
| 165 | - $package_info['google_analytics'] = 1; |
|
| 166 | - $package_info['sendtofriend'] = 1; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Filter listing package info. |
|
| 170 | - * |
|
| 171 | - * @since 1.0.0 |
|
| 172 | - * @param array $package_info {
|
|
| 173 | - * Attributes of the package_info. |
|
| 174 | - * |
|
| 175 | - * @type int $pid Package ID. Default 0. |
|
| 176 | - * @type int $days Package validity in Days. Default 0. |
|
| 177 | - * @type int $amount Package amount. Default 0. |
|
| 178 | - * @type int $is_featured Is this featured package? Default 0. |
|
| 179 | - * @type string $image_limit Image limit for this package. Default "". |
|
| 180 | - * @type int $google_analytics Add analytics to this package. Default 1. |
|
| 181 | - * @type int $sendtofriend Send to friend. Default 1. |
|
| 182 | - * |
|
| 183 | - * } |
|
| 184 | - * @param object|string $post The post object. |
|
| 185 | - * @param string $post_type The post type. |
|
| 186 | - */ |
|
| 187 | - return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
|
|
| 160 | + $package_info['pid'] = 0; |
|
| 161 | + $package_info['days'] = 0; |
|
| 162 | + $package_info['amount'] = 0; |
|
| 163 | + $package_info['is_featured'] = 0; |
|
| 164 | + $package_info['image_limit'] = ''; |
|
| 165 | + $package_info['google_analytics'] = 1; |
|
| 166 | + $package_info['sendtofriend'] = 1; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Filter listing package info. |
|
| 170 | + * |
|
| 171 | + * @since 1.0.0 |
|
| 172 | + * @param array $package_info {
|
|
| 173 | + * Attributes of the package_info. |
|
| 174 | + * |
|
| 175 | + * @type int $pid Package ID. Default 0. |
|
| 176 | + * @type int $days Package validity in Days. Default 0. |
|
| 177 | + * @type int $amount Package amount. Default 0. |
|
| 178 | + * @type int $is_featured Is this featured package? Default 0. |
|
| 179 | + * @type string $image_limit Image limit for this package. Default "". |
|
| 180 | + * @type int $google_analytics Add analytics to this package. Default 1. |
|
| 181 | + * @type int $sendtofriend Send to friend. Default 1. |
|
| 182 | + * |
|
| 183 | + * } |
|
| 184 | + * @param object|string $post The post object. |
|
| 185 | + * @param string $post_type The post type. |
|
| 186 | + */ |
|
| 187 | + return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
|
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -212,127 +212,127 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function geodir_send_inquiry($request) |
| 214 | 214 | {
|
| 215 | - global $wpdb; |
|
| 215 | + global $wpdb; |
|
| 216 | 216 | |
| 217 | - // strip slashes from text |
|
| 218 | - $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 217 | + // strip slashes from text |
|
| 218 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 219 | 219 | |
| 220 | - $yourname = $request['inq_name']; |
|
| 221 | - $youremail = $request['inq_email']; |
|
| 222 | - $inq_phone = $request['inq_phone']; |
|
| 223 | - $frnd_comments = $request['inq_msg']; |
|
| 224 | - $pid = $request['pid']; |
|
| 220 | + $yourname = $request['inq_name']; |
|
| 221 | + $youremail = $request['inq_email']; |
|
| 222 | + $inq_phone = $request['inq_phone']; |
|
| 223 | + $frnd_comments = $request['inq_msg']; |
|
| 224 | + $pid = $request['pid']; |
|
| 225 | 225 | |
| 226 | - $author_id = ''; |
|
| 227 | - $post_title = ''; |
|
| 226 | + $author_id = ''; |
|
| 227 | + $post_title = ''; |
|
| 228 | 228 | |
| 229 | - if ($request['pid']) {
|
|
| 229 | + if ($request['pid']) {
|
|
| 230 | 230 | |
| 231 | - $productinfosql = $wpdb->prepare( |
|
| 232 | - "select ID,post_author,post_title from $wpdb->posts where ID =%d", |
|
| 233 | - array($request['pid']) |
|
| 234 | - ); |
|
| 235 | - $productinfo = $wpdb->get_row($productinfosql); |
|
| 231 | + $productinfosql = $wpdb->prepare( |
|
| 232 | + "select ID,post_author,post_title from $wpdb->posts where ID =%d", |
|
| 233 | + array($request['pid']) |
|
| 234 | + ); |
|
| 235 | + $productinfo = $wpdb->get_row($productinfosql); |
|
| 236 | 236 | |
| 237 | - $author_id = $productinfo->post_author; |
|
| 238 | - $post_title = $productinfo->post_title; |
|
| 239 | - } |
|
| 237 | + $author_id = $productinfo->post_author; |
|
| 238 | + $post_title = $productinfo->post_title; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>'; |
|
| 241 | + $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>'; |
|
| 242 | 242 | |
| 243 | - $user_info = get_userdata($author_id); |
|
| 244 | - $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
| 245 | - $to_name = geodir_get_client_name($author_id); |
|
| 243 | + $user_info = get_userdata($author_id); |
|
| 244 | + $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
| 245 | + $to_name = geodir_get_client_name($author_id); |
|
| 246 | 246 | |
| 247 | - if ($to_email == '') {
|
|
| 248 | - $to_email = get_option('admin_email');
|
|
| 249 | - } |
|
| 247 | + if ($to_email == '') {
|
|
| 248 | + $to_email = get_option('admin_email');
|
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * Called after the send enquiry var have been set but before the email has been sent. |
|
| 253 | - * |
|
| 254 | - * @since 1.0.0 |
|
| 255 | - * @param array $request {
|
|
| 256 | - * The submitted form fields as an array. |
|
| 257 | - * |
|
| 258 | - * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 259 | - * @type string $pid Post ID. |
|
| 260 | - * @type string $inq_name Sender name. |
|
| 261 | - * @type string $inq_email Sender mail. |
|
| 262 | - * @type string $inq_phone Sender phone. |
|
| 263 | - * @type string $inq_msg Email message. |
|
| 264 | - * |
|
| 265 | - * } |
|
| 266 | - * @param string $type The form type, default: `Enquiry`. |
|
| 267 | - */ |
|
| 268 | - do_action('geodir_after_send_enquiry', $request, 'Enquiry');
|
|
| 269 | - |
|
| 270 | - $client_message = $frnd_comments; |
|
| 271 | - $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
|
|
| 272 | - /** |
|
| 273 | - * Filter client message text. |
|
| 274 | - * |
|
| 275 | - * @since 1.0.0 |
|
| 276 | - * @param string $client_message Client message text. |
|
| 277 | - */ |
|
| 278 | - $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
|
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Called before the send enquiry email is sent. |
|
| 282 | - * |
|
| 283 | - * @since 1.0.0 |
|
| 284 | - * @param array $request {
|
|
| 285 | - * The submitted form fields as an array. |
|
| 286 | - * |
|
| 287 | - * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 288 | - * @type string $pid Post ID. |
|
| 289 | - * @type string $inq_name Sender name. |
|
| 290 | - * @type string $inq_email Sender mail. |
|
| 291 | - * @type string $inq_phone Sender phone. |
|
| 292 | - * @type string $inq_msg Email message. |
|
| 293 | - * |
|
| 294 | - * } |
|
| 295 | - */ |
|
| 296 | - do_action('geodir_before_send_enquiry_email', $request);
|
|
| 297 | - if ($to_email) {
|
|
| 298 | - // strip slashes message |
|
| 299 | - $client_message = stripslashes_deep($client_message); |
|
| 300 | - |
|
| 301 | - geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email |
|
| 302 | - } |
|
| 251 | + /** |
|
| 252 | + * Called after the send enquiry var have been set but before the email has been sent. |
|
| 253 | + * |
|
| 254 | + * @since 1.0.0 |
|
| 255 | + * @param array $request {
|
|
| 256 | + * The submitted form fields as an array. |
|
| 257 | + * |
|
| 258 | + * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 259 | + * @type string $pid Post ID. |
|
| 260 | + * @type string $inq_name Sender name. |
|
| 261 | + * @type string $inq_email Sender mail. |
|
| 262 | + * @type string $inq_phone Sender phone. |
|
| 263 | + * @type string $inq_msg Email message. |
|
| 264 | + * |
|
| 265 | + * } |
|
| 266 | + * @param string $type The form type, default: `Enquiry`. |
|
| 267 | + */ |
|
| 268 | + do_action('geodir_after_send_enquiry', $request, 'Enquiry');
|
|
| 303 | 269 | |
| 304 | - /** |
|
| 305 | - * Called after the send enquiry email is sent. |
|
| 306 | - * |
|
| 307 | - * @since 1.0.0 |
|
| 308 | - * @param array $request {
|
|
| 309 | - * The submitted form fields as an array. |
|
| 310 | - * |
|
| 311 | - * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 312 | - * @type string $pid Post ID. |
|
| 313 | - * @type string $inq_name Sender name. |
|
| 314 | - * @type string $inq_email Sender mail. |
|
| 315 | - * @type string $inq_phone Sender phone. |
|
| 316 | - * @type string $inq_msg Email message. |
|
| 317 | - * |
|
| 318 | - * } |
|
| 319 | - */ |
|
| 320 | - do_action('geodir_after_send_enquiry_email', $request);
|
|
| 321 | - $url = get_permalink($pid); |
|
| 322 | - if (strstr($url, '?')) {
|
|
| 323 | - $url = $url . "&send_inquiry=success"; |
|
| 324 | - } else {
|
|
| 325 | - $url = $url . "?send_inquiry=success"; |
|
| 326 | - } |
|
| 327 | - /** |
|
| 328 | - * Filter redirect url after the send enquiry email is sent. |
|
| 329 | - * |
|
| 330 | - * @since 1.0.0 |
|
| 331 | - * @param string $url Redirect url. |
|
| 332 | - */ |
|
| 333 | - $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
|
|
| 334 | - wp_redirect($url); |
|
| 335 | - gd_die(); |
|
| 270 | + $client_message = $frnd_comments; |
|
| 271 | + $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
|
|
| 272 | + /** |
|
| 273 | + * Filter client message text. |
|
| 274 | + * |
|
| 275 | + * @since 1.0.0 |
|
| 276 | + * @param string $client_message Client message text. |
|
| 277 | + */ |
|
| 278 | + $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
|
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Called before the send enquiry email is sent. |
|
| 282 | + * |
|
| 283 | + * @since 1.0.0 |
|
| 284 | + * @param array $request {
|
|
| 285 | + * The submitted form fields as an array. |
|
| 286 | + * |
|
| 287 | + * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 288 | + * @type string $pid Post ID. |
|
| 289 | + * @type string $inq_name Sender name. |
|
| 290 | + * @type string $inq_email Sender mail. |
|
| 291 | + * @type string $inq_phone Sender phone. |
|
| 292 | + * @type string $inq_msg Email message. |
|
| 293 | + * |
|
| 294 | + * } |
|
| 295 | + */ |
|
| 296 | + do_action('geodir_before_send_enquiry_email', $request);
|
|
| 297 | + if ($to_email) {
|
|
| 298 | + // strip slashes message |
|
| 299 | + $client_message = stripslashes_deep($client_message); |
|
| 300 | + |
|
| 301 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * Called after the send enquiry email is sent. |
|
| 306 | + * |
|
| 307 | + * @since 1.0.0 |
|
| 308 | + * @param array $request {
|
|
| 309 | + * The submitted form fields as an array. |
|
| 310 | + * |
|
| 311 | + * @type string $sendact Enquiry type. Default "send_inqury". |
|
| 312 | + * @type string $pid Post ID. |
|
| 313 | + * @type string $inq_name Sender name. |
|
| 314 | + * @type string $inq_email Sender mail. |
|
| 315 | + * @type string $inq_phone Sender phone. |
|
| 316 | + * @type string $inq_msg Email message. |
|
| 317 | + * |
|
| 318 | + * } |
|
| 319 | + */ |
|
| 320 | + do_action('geodir_after_send_enquiry_email', $request);
|
|
| 321 | + $url = get_permalink($pid); |
|
| 322 | + if (strstr($url, '?')) {
|
|
| 323 | + $url = $url . "&send_inquiry=success"; |
|
| 324 | + } else {
|
|
| 325 | + $url = $url . "?send_inquiry=success"; |
|
| 326 | + } |
|
| 327 | + /** |
|
| 328 | + * Filter redirect url after the send enquiry email is sent. |
|
| 329 | + * |
|
| 330 | + * @since 1.0.0 |
|
| 331 | + * @param string $url Redirect url. |
|
| 332 | + */ |
|
| 333 | + $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
|
|
| 334 | + wp_redirect($url); |
|
| 335 | + gd_die(); |
|
| 336 | 336 | |
| 337 | 337 | } |
| 338 | 338 | |
@@ -361,85 +361,85 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | function geodir_send_friend($request) |
| 363 | 363 | {
|
| 364 | - global $wpdb; |
|
| 365 | - |
|
| 366 | - // strip slashes from text |
|
| 367 | - $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 368 | - |
|
| 369 | - $yourname = $request['yourname']; |
|
| 370 | - $youremail = $request['youremail']; |
|
| 371 | - $frnd_subject = $request['frnd_subject']; |
|
| 372 | - $frnd_comments = $request['frnd_comments']; |
|
| 373 | - $pid = $request['pid']; |
|
| 374 | - $to_email = $request['to_email']; |
|
| 375 | - $to_name = $request['to_name']; |
|
| 376 | - if ($request['pid']) {
|
|
| 377 | - $productinfosql = $wpdb->prepare( |
|
| 378 | - "select ID,post_title from $wpdb->posts where ID =%d", |
|
| 379 | - array($request['pid']) |
|
| 380 | - ); |
|
| 381 | - $productinfo = $wpdb->get_results($productinfosql); |
|
| 382 | - foreach ($productinfo as $productinfoObj) {
|
|
| 383 | - $post_title = $productinfoObj->post_title; |
|
| 384 | - } |
|
| 385 | - } |
|
| 364 | + global $wpdb; |
|
| 365 | + |
|
| 366 | + // strip slashes from text |
|
| 367 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 368 | + |
|
| 369 | + $yourname = $request['yourname']; |
|
| 370 | + $youremail = $request['youremail']; |
|
| 371 | + $frnd_subject = $request['frnd_subject']; |
|
| 372 | + $frnd_comments = $request['frnd_comments']; |
|
| 373 | + $pid = $request['pid']; |
|
| 374 | + $to_email = $request['to_email']; |
|
| 375 | + $to_name = $request['to_name']; |
|
| 376 | + if ($request['pid']) {
|
|
| 377 | + $productinfosql = $wpdb->prepare( |
|
| 378 | + "select ID,post_title from $wpdb->posts where ID =%d", |
|
| 379 | + array($request['pid']) |
|
| 380 | + ); |
|
| 381 | + $productinfo = $wpdb->get_results($productinfosql); |
|
| 382 | + foreach ($productinfo as $productinfoObj) {
|
|
| 383 | + $post_title = $productinfoObj->post_title; |
|
| 384 | + } |
|
| 385 | + } |
|
| 386 | 386 | |
| 387 | - /** |
|
| 388 | - * Called before the send to friend email is sent. |
|
| 389 | - * |
|
| 390 | - * @since 1.0.0 |
|
| 391 | - * @param array $request {
|
|
| 392 | - * The submitted form fields as an array. |
|
| 393 | - * |
|
| 394 | - * @type string $sendact Enquiry type. Default "email_frnd". |
|
| 395 | - * @type string $pid Post ID. |
|
| 396 | - * @type string $to_name Friend name. |
|
| 397 | - * @type string $to_email Friend email. |
|
| 398 | - * @type string $yourname Sender name. |
|
| 399 | - * @type string $youremail Sender email. |
|
| 400 | - * @type string $frnd_subject Email subject. |
|
| 401 | - * @type string $frnd_comments Email Message. |
|
| 402 | - * |
|
| 403 | - * } |
|
| 404 | - */ |
|
| 405 | - do_action('geodir_before_send_to_friend_email', $request);
|
|
| 406 | - geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email |
|
| 407 | - |
|
| 408 | - /** |
|
| 409 | - * Called after the send to friend email is sent. |
|
| 410 | - * |
|
| 411 | - * @since 1.0.0 |
|
| 412 | - * @param array $request {
|
|
| 413 | - * The submitted form fields as an array. |
|
| 414 | - * |
|
| 415 | - * @type string $sendact Enquiry type. Default "email_frnd". |
|
| 416 | - * @type string $pid Post ID. |
|
| 417 | - * @type string $to_name Friend name. |
|
| 418 | - * @type string $to_email Friend email. |
|
| 419 | - * @type string $yourname Sender name. |
|
| 420 | - * @type string $youremail Sender email. |
|
| 421 | - * @type string $frnd_subject Email subject. |
|
| 422 | - * @type string $frnd_comments Email Message. |
|
| 423 | - * |
|
| 424 | - * } |
|
| 425 | - */ |
|
| 426 | - do_action('geodir_after_send_to_friend_email', $request);
|
|
| 427 | - |
|
| 428 | - $url = get_permalink($pid); |
|
| 429 | - if (strstr($url, '?')) {
|
|
| 430 | - $url = $url . "&sendtofrnd=success"; |
|
| 431 | - } else {
|
|
| 432 | - $url = $url . "?sendtofrnd=success"; |
|
| 433 | - } |
|
| 434 | - /** |
|
| 435 | - * Filter redirect url after the send to friend email is sent. |
|
| 436 | - * |
|
| 437 | - * @since 1.0.0 |
|
| 438 | - * @param string $url Redirect url. |
|
| 439 | - */ |
|
| 440 | - $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
|
|
| 441 | - wp_redirect($url); |
|
| 442 | - gd_die(); |
|
| 387 | + /** |
|
| 388 | + * Called before the send to friend email is sent. |
|
| 389 | + * |
|
| 390 | + * @since 1.0.0 |
|
| 391 | + * @param array $request {
|
|
| 392 | + * The submitted form fields as an array. |
|
| 393 | + * |
|
| 394 | + * @type string $sendact Enquiry type. Default "email_frnd". |
|
| 395 | + * @type string $pid Post ID. |
|
| 396 | + * @type string $to_name Friend name. |
|
| 397 | + * @type string $to_email Friend email. |
|
| 398 | + * @type string $yourname Sender name. |
|
| 399 | + * @type string $youremail Sender email. |
|
| 400 | + * @type string $frnd_subject Email subject. |
|
| 401 | + * @type string $frnd_comments Email Message. |
|
| 402 | + * |
|
| 403 | + * } |
|
| 404 | + */ |
|
| 405 | + do_action('geodir_before_send_to_friend_email', $request);
|
|
| 406 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email |
|
| 407 | + |
|
| 408 | + /** |
|
| 409 | + * Called after the send to friend email is sent. |
|
| 410 | + * |
|
| 411 | + * @since 1.0.0 |
|
| 412 | + * @param array $request {
|
|
| 413 | + * The submitted form fields as an array. |
|
| 414 | + * |
|
| 415 | + * @type string $sendact Enquiry type. Default "email_frnd". |
|
| 416 | + * @type string $pid Post ID. |
|
| 417 | + * @type string $to_name Friend name. |
|
| 418 | + * @type string $to_email Friend email. |
|
| 419 | + * @type string $yourname Sender name. |
|
| 420 | + * @type string $youremail Sender email. |
|
| 421 | + * @type string $frnd_subject Email subject. |
|
| 422 | + * @type string $frnd_comments Email Message. |
|
| 423 | + * |
|
| 424 | + * } |
|
| 425 | + */ |
|
| 426 | + do_action('geodir_after_send_to_friend_email', $request);
|
|
| 427 | + |
|
| 428 | + $url = get_permalink($pid); |
|
| 429 | + if (strstr($url, '?')) {
|
|
| 430 | + $url = $url . "&sendtofrnd=success"; |
|
| 431 | + } else {
|
|
| 432 | + $url = $url . "?sendtofrnd=success"; |
|
| 433 | + } |
|
| 434 | + /** |
|
| 435 | + * Filter redirect url after the send to friend email is sent. |
|
| 436 | + * |
|
| 437 | + * @since 1.0.0 |
|
| 438 | + * @param string $url Redirect url. |
|
| 439 | + */ |
|
| 440 | + $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
|
|
| 441 | + wp_redirect($url); |
|
| 442 | + gd_die(); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -453,28 +453,28 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | function geodir_before_tab_content($hash_key) |
| 455 | 455 | {
|
| 456 | - switch ($hash_key) {
|
|
| 457 | - case 'post_info' : |
|
| 458 | - echo '<div class="geodir-company_info field-group">'; |
|
| 459 | - break; |
|
| 460 | - case 'post_images' : |
|
| 461 | - /** |
|
| 462 | - * Filter post gallery HTML id. |
|
| 463 | - * |
|
| 464 | - * @since 1.0.0 |
|
| 465 | - */ |
|
| 466 | - echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
|
|
| 467 | - break; |
|
| 468 | - case 'reviews' : |
|
| 469 | - echo '<div id="reviews-wrap" class="clearfix"> '; |
|
| 470 | - break; |
|
| 471 | - case 'post_video': |
|
| 472 | - echo ' <div id="post_video-wrap" class="clearfix">'; |
|
| 473 | - break; |
|
| 474 | - case 'special_offers': |
|
| 475 | - echo '<div id="special_offers-wrap" class="clearfix">'; |
|
| 476 | - break; |
|
| 477 | - } |
|
| 456 | + switch ($hash_key) {
|
|
| 457 | + case 'post_info' : |
|
| 458 | + echo '<div class="geodir-company_info field-group">'; |
|
| 459 | + break; |
|
| 460 | + case 'post_images' : |
|
| 461 | + /** |
|
| 462 | + * Filter post gallery HTML id. |
|
| 463 | + * |
|
| 464 | + * @since 1.0.0 |
|
| 465 | + */ |
|
| 466 | + echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
|
|
| 467 | + break; |
|
| 468 | + case 'reviews' : |
|
| 469 | + echo '<div id="reviews-wrap" class="clearfix"> '; |
|
| 470 | + break; |
|
| 471 | + case 'post_video': |
|
| 472 | + echo ' <div id="post_video-wrap" class="clearfix">'; |
|
| 473 | + break; |
|
| 474 | + case 'special_offers': |
|
| 475 | + echo '<div id="special_offers-wrap" class="clearfix">'; |
|
| 476 | + break; |
|
| 477 | + } |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
@@ -488,23 +488,23 @@ discard block |
||
| 488 | 488 | */ |
| 489 | 489 | function geodir_after_tab_content($hash_key) |
| 490 | 490 | {
|
| 491 | - switch ($hash_key) {
|
|
| 492 | - case 'post_info' : |
|
| 493 | - echo '</div>'; |
|
| 494 | - break; |
|
| 495 | - case 'post_images' : |
|
| 496 | - echo '</div>'; |
|
| 497 | - break; |
|
| 498 | - case 'reviews' : |
|
| 499 | - echo '</div>'; |
|
| 500 | - break; |
|
| 501 | - case 'post_video': |
|
| 502 | - echo '</div>'; |
|
| 503 | - break; |
|
| 504 | - case 'special_offers': |
|
| 505 | - echo '</div>'; |
|
| 506 | - break; |
|
| 507 | - } |
|
| 491 | + switch ($hash_key) {
|
|
| 492 | + case 'post_info' : |
|
| 493 | + echo '</div>'; |
|
| 494 | + break; |
|
| 495 | + case 'post_images' : |
|
| 496 | + echo '</div>'; |
|
| 497 | + break; |
|
| 498 | + case 'reviews' : |
|
| 499 | + echo '</div>'; |
|
| 500 | + break; |
|
| 501 | + case 'post_video': |
|
| 502 | + echo '</div>'; |
|
| 503 | + break; |
|
| 504 | + case 'special_offers': |
|
| 505 | + echo '</div>'; |
|
| 506 | + break; |
|
| 507 | + } |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | |
@@ -520,21 +520,21 @@ discard block |
||
| 520 | 520 | function geodir_get_posts_default_sort($post_type) |
| 521 | 521 | {
|
| 522 | 522 | |
| 523 | - global $wpdb; |
|
| 523 | + global $wpdb; |
|
| 524 | 524 | |
| 525 | - if ($post_type != '') {
|
|
| 525 | + if ($post_type != '') {
|
|
| 526 | 526 | |
| 527 | - $all_postypes = geodir_get_posttypes(); |
|
| 527 | + $all_postypes = geodir_get_posttypes(); |
|
| 528 | 528 | |
| 529 | - if (!in_array($post_type, $all_postypes)) |
|
| 530 | - return false; |
|
| 529 | + if (!in_array($post_type, $all_postypes)) |
|
| 530 | + return false; |
|
| 531 | 531 | |
| 532 | - $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
|
|
| 532 | + $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
|
|
| 533 | 533 | |
| 534 | - if (!empty($sort_field_info)) |
|
| 535 | - return $sort_field_info; |
|
| 534 | + if (!empty($sort_field_info)) |
|
| 535 | + return $sort_field_info; |
|
| 536 | 536 | |
| 537 | - } |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | 539 | } |
| 540 | 540 | |
@@ -549,24 +549,24 @@ discard block |
||
| 549 | 549 | * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false. |
| 550 | 550 | */ |
| 551 | 551 | function geodir_get_sort_options($post_type) {
|
| 552 | - global $wpdb; |
|
| 553 | - |
|
| 554 | - if ($post_type != '') {
|
|
| 555 | - $all_postypes = geodir_get_posttypes(); |
|
| 556 | - |
|
| 557 | - if (!in_array($post_type, $all_postypes)) |
|
| 558 | - return false; |
|
| 559 | - |
|
| 560 | - $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
|
|
| 561 | - /** |
|
| 562 | - * Filter post sort options. |
|
| 563 | - * |
|
| 564 | - * @since 1.0.0 |
|
| 565 | - * @param array $sort_field_info Unfiltered sort field array. |
|
| 566 | - * @param string $post_type Post type. |
|
| 567 | - */ |
|
| 568 | - return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
|
|
| 569 | - } |
|
| 552 | + global $wpdb; |
|
| 553 | + |
|
| 554 | + if ($post_type != '') {
|
|
| 555 | + $all_postypes = geodir_get_posttypes(); |
|
| 556 | + |
|
| 557 | + if (!in_array($post_type, $all_postypes)) |
|
| 558 | + return false; |
|
| 559 | + |
|
| 560 | + $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
|
|
| 561 | + /** |
|
| 562 | + * Filter post sort options. |
|
| 563 | + * |
|
| 564 | + * @since 1.0.0 |
|
| 565 | + * @param array $sort_field_info Unfiltered sort field array. |
|
| 566 | + * @param string $post_type Post type. |
|
| 567 | + */ |
|
| 568 | + return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
|
|
| 569 | + } |
|
| 570 | 570 | |
| 571 | 571 | } |
| 572 | 572 | |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | function geodir_display_sort_options() |
| 582 | 582 | {
|
| 583 | - global $wp_query; |
|
| 583 | + global $wp_query; |
|
| 584 | 584 | |
| 585 | 585 | /** |
| 586 | 586 | * On search pages there should be no sort options, sorting is done by search criteria. |
@@ -591,57 +591,57 @@ discard block |
||
| 591 | 591 | return; |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - $sort_by = ''; |
|
| 594 | + $sort_by = ''; |
|
| 595 | 595 | |
| 596 | - if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by']; |
|
| 596 | + if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by']; |
|
| 597 | 597 | |
| 598 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 598 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 599 | 599 | |
| 600 | - $sort_options = geodir_get_sort_options($gd_post_type); |
|
| 600 | + $sort_options = geodir_get_sort_options($gd_post_type); |
|
| 601 | 601 | |
| 602 | 602 | |
| 603 | - $sort_field_options = ''; |
|
| 603 | + $sort_field_options = ''; |
|
| 604 | 604 | |
| 605 | - if (!empty($sort_options)) {
|
|
| 606 | - foreach ($sort_options as $sort) {
|
|
| 605 | + if (!empty($sort_options)) {
|
|
| 606 | + foreach ($sort_options as $sort) {
|
|
| 607 | 607 | $sort = stripslashes_deep($sort); // strip slashes |
| 608 | 608 | |
| 609 | - $label = __($sort->site_title, 'geodirectory'); |
|
| 609 | + $label = __($sort->site_title, 'geodirectory'); |
|
| 610 | 610 | |
| 611 | - if ($sort->field_type == 'random') {
|
|
| 612 | - $key = $sort->field_type; |
|
| 613 | - ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 614 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 615 | - } |
|
| 611 | + if ($sort->field_type == 'random') {
|
|
| 612 | + $key = $sort->field_type; |
|
| 613 | + ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 614 | + $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 615 | + } |
|
| 616 | 616 | |
| 617 | - if ($sort->htmlvar_name == 'comment_count') {
|
|
| 618 | - $sort->htmlvar_name = 'rating_count'; |
|
| 619 | - } |
|
| 617 | + if ($sort->htmlvar_name == 'comment_count') {
|
|
| 618 | + $sort->htmlvar_name = 'rating_count'; |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - if ($sort->sort_asc) {
|
|
| 622 | - $key = $sort->htmlvar_name . '_asc'; |
|
| 623 | - $label = $sort->site_title; |
|
| 624 | - if ($sort->asc_title) |
|
| 625 | - $label = $sort->asc_title; |
|
| 626 | - ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 627 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 628 | - } |
|
| 621 | + if ($sort->sort_asc) {
|
|
| 622 | + $key = $sort->htmlvar_name . '_asc'; |
|
| 623 | + $label = $sort->site_title; |
|
| 624 | + if ($sort->asc_title) |
|
| 625 | + $label = $sort->asc_title; |
|
| 626 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 627 | + $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - if ($sort->sort_desc) {
|
|
| 631 | - $key = $sort->htmlvar_name . '_desc'; |
|
| 632 | - $label = $sort->site_title; |
|
| 633 | - if ($sort->desc_title) |
|
| 634 | - $label = $sort->desc_title; |
|
| 635 | - ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 636 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 637 | - } |
|
| 630 | + if ($sort->sort_desc) {
|
|
| 631 | + $key = $sort->htmlvar_name . '_desc'; |
|
| 632 | + $label = $sort->site_title; |
|
| 633 | + if ($sort->desc_title) |
|
| 634 | + $label = $sort->desc_title; |
|
| 635 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 636 | + $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
|
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | - } |
|
| 640 | - } |
|
| 639 | + } |
|
| 640 | + } |
|
| 641 | 641 | |
| 642 | - if ($sort_field_options != '') {
|
|
| 642 | + if ($sort_field_options != '') {
|
|
| 643 | 643 | |
| 644 | - ?> |
|
| 644 | + ?> |
|
| 645 | 645 | |
| 646 | 646 | <div class="geodir-tax-sort"> |
| 647 | 647 | |
@@ -650,14 +650,14 @@ discard block |
||
| 650 | 650 | <option |
| 651 | 651 | value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
|
| 652 | 652 | |
| 653 | - echo $sort_field_options;?> |
|
| 653 | + echo $sort_field_options;?> |
|
| 654 | 654 | |
| 655 | 655 | </select> |
| 656 | 656 | |
| 657 | 657 | </div> |
| 658 | 658 | <?php |
| 659 | 659 | |
| 660 | - } |
|
| 660 | + } |
|
| 661 | 661 | |
| 662 | 662 | } |
| 663 | 663 | |
@@ -677,10 +677,10 @@ discard block |
||
| 677 | 677 | function geodir_advance_customfields_heading($title, $field_type) |
| 678 | 678 | {
|
| 679 | 679 | |
| 680 | - if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
|
|
| 681 | - $title = ''; |
|
| 682 | - } |
|
| 683 | - return $title; |
|
| 680 | + if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
|
|
| 681 | + $title = ''; |
|
| 682 | + } |
|
| 683 | + return $title; |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | |
@@ -697,73 +697,73 @@ discard block |
||
| 697 | 697 | * @return string Returns related posts html. |
| 698 | 698 | */ |
| 699 | 699 | function geodir_related_posts_display($request) {
|
| 700 | - if (!empty($request)) {
|
|
| 701 | - $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
| 702 | - $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
| 703 | - |
|
| 704 | - $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
|
|
| 705 | - $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
| 706 | - $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
| 707 | - $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
| 708 | - $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
| 709 | - $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
| 710 | - $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
| 711 | - $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
| 712 | - |
|
| 713 | - global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
|
| 714 | - $related_parent_lat = $post->post_latitude; |
|
| 715 | - $related_parent_lon = $post->post_longitude; |
|
| 716 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
|
| 717 | - $is_display = $arr_detail_page_tabs['related_listing']['is_display']; |
|
| 718 | - $origi_post = $post; |
|
| 719 | - $post_type = ''; |
|
| 720 | - $post_id = ''; |
|
| 721 | - $category_taxonomy = ''; |
|
| 722 | - $tax_field = 'id'; |
|
| 723 | - $category = array(); |
|
| 724 | - |
|
| 725 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 726 | - $post = (object)$gd_session->get('listing');
|
|
| 727 | - $post_type = $post->listing_type; |
|
| 728 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 729 | - $post_id = $_REQUEST['pid']; |
|
| 730 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 731 | - $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 732 | - $post_type = $post->post_type; |
|
| 733 | - $post_id = $_REQUEST['pid']; |
|
| 734 | - } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 735 | - $post_type = $post->post_type; |
|
| 736 | - $post_id = $post->ID; |
|
| 737 | - } |
|
| 700 | + if (!empty($request)) {
|
|
| 701 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
| 702 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
| 703 | + |
|
| 704 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
|
|
| 705 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
| 706 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
| 707 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
| 708 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
| 709 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
| 710 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
| 711 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
| 712 | + |
|
| 713 | + global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
|
| 714 | + $related_parent_lat = $post->post_latitude; |
|
| 715 | + $related_parent_lon = $post->post_longitude; |
|
| 716 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
|
| 717 | + $is_display = $arr_detail_page_tabs['related_listing']['is_display']; |
|
| 718 | + $origi_post = $post; |
|
| 719 | + $post_type = ''; |
|
| 720 | + $post_id = ''; |
|
| 721 | + $category_taxonomy = ''; |
|
| 722 | + $tax_field = 'id'; |
|
| 723 | + $category = array(); |
|
| 724 | + |
|
| 725 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 726 | + $post = (object)$gd_session->get('listing');
|
|
| 727 | + $post_type = $post->listing_type; |
|
| 728 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 729 | + $post_id = $_REQUEST['pid']; |
|
| 730 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 731 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 732 | + $post_type = $post->post_type; |
|
| 733 | + $post_id = $_REQUEST['pid']; |
|
| 734 | + } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 735 | + $post_type = $post->post_type; |
|
| 736 | + $post_id = $post->ID; |
|
| 737 | + } |
|
| 738 | 738 | |
| 739 | - if ($relate_to == 'category') {
|
|
| 739 | + if ($relate_to == 'category') {
|
|
| 740 | 740 | |
| 741 | - $category_taxonomy = $post_type . $relate_to; |
|
| 742 | - if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 743 | - $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 741 | + $category_taxonomy = $post_type . $relate_to; |
|
| 742 | + if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 743 | + $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 744 | 744 | |
| 745 | - } elseif ($relate_to == 'tags') {
|
|
| 745 | + } elseif ($relate_to == 'tags') {
|
|
| 746 | 746 | |
| 747 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 748 | - if ($post->post_tags != '') |
|
| 749 | - $category = explode(',', trim($post->post_tags, ','));
|
|
| 750 | - $tax_field = 'name'; |
|
| 751 | - } |
|
| 747 | + $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 748 | + if ($post->post_tags != '') |
|
| 749 | + $category = explode(',', trim($post->post_tags, ','));
|
|
| 750 | + $tax_field = 'name'; |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | - /* --- return false in invalid request --- */ |
|
| 754 | - if (empty($category)) |
|
| 755 | - return false; |
|
| 753 | + /* --- return false in invalid request --- */ |
|
| 754 | + if (empty($category)) |
|
| 755 | + return false; |
|
| 756 | 756 | |
| 757 | - $all_postypes = geodir_get_posttypes(); |
|
| 757 | + $all_postypes = geodir_get_posttypes(); |
|
| 758 | 758 | |
| 759 | - if (!in_array($post_type, $all_postypes)) |
|
| 760 | - return false; |
|
| 759 | + if (!in_array($post_type, $all_postypes)) |
|
| 760 | + return false; |
|
| 761 | 761 | |
| 762 | - /* --- return false in invalid request --- */ |
|
| 762 | + /* --- return false in invalid request --- */ |
|
| 763 | 763 | |
| 764 | - $location_url = ''; |
|
| 765 | - if ($add_location_filter != '0') {
|
|
| 766 | - $location_url = array(); |
|
| 764 | + $location_url = ''; |
|
| 765 | + if ($add_location_filter != '0') {
|
|
| 766 | + $location_url = array(); |
|
| 767 | 767 | $geodir_show_location_url = get_option('geodir_show_location_url');
|
| 768 | 768 | |
| 769 | 769 | $gd_city = get_query_var('gd_city');
|
@@ -771,13 +771,13 @@ discard block |
||
| 771 | 771 | if ($gd_city) {
|
| 772 | 772 | $gd_country = get_query_var('gd_country');
|
| 773 | 773 | $gd_region = get_query_var('gd_region');
|
| 774 | - } else {
|
|
| 775 | - $location = geodir_get_default_location(); |
|
| 774 | + } else {
|
|
| 775 | + $location = geodir_get_default_location(); |
|
| 776 | 776 | |
| 777 | 777 | $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
| 778 | 778 | $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
| 779 | 779 | $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
| 780 | - } |
|
| 780 | + } |
|
| 781 | 781 | |
| 782 | 782 | if ($geodir_show_location_url == 'all') {
|
| 783 | 783 | $location_url[] = $gd_country; |
@@ -790,100 +790,100 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | $location_url[] = $gd_city; |
| 792 | 792 | |
| 793 | - $location_url = implode('/', $location_url);
|
|
| 794 | - } |
|
| 793 | + $location_url = implode('/', $location_url);
|
|
| 794 | + } |
|
| 795 | 795 | |
| 796 | 796 | |
| 797 | - if (!empty($category)) {
|
|
| 798 | - global $geodir_add_location_url; |
|
| 799 | - $geodir_add_location_url = '0'; |
|
| 800 | - if ($add_location_filter != '0') {
|
|
| 801 | - $geodir_add_location_url = '1'; |
|
| 802 | - } |
|
| 803 | - $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 804 | - $geodir_add_location_url = NULL; |
|
| 805 | - } |
|
| 806 | - ob_start(); |
|
| 807 | - ?> |
|
| 797 | + if (!empty($category)) {
|
|
| 798 | + global $geodir_add_location_url; |
|
| 799 | + $geodir_add_location_url = '0'; |
|
| 800 | + if ($add_location_filter != '0') {
|
|
| 801 | + $geodir_add_location_url = '1'; |
|
| 802 | + } |
|
| 803 | + $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 804 | + $geodir_add_location_url = NULL; |
|
| 805 | + } |
|
| 806 | + ob_start(); |
|
| 807 | + ?> |
|
| 808 | 808 | |
| 809 | 809 | |
| 810 | 810 | <div class="geodir_locations geodir_location_listing"> |
| 811 | 811 | |
| 812 | 812 | <?php |
| 813 | - if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 814 | - /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 815 | - $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 816 | - /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 817 | - $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 818 | - ?> |
|
| 813 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 814 | + /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 815 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 816 | + /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 817 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 818 | + ?> |
|
| 819 | 819 | <div class="location_list_heading clearfix"> |
| 820 | 820 | <?php echo $before_title . $title . $after_title; ?> |
| 821 | 821 | </div> |
| 822 | 822 | <?php |
| 823 | - } |
|
| 824 | - $query_args = array( |
|
| 825 | - 'posts_per_page' => $post_number, |
|
| 826 | - 'is_geodir_loop' => true, |
|
| 827 | - 'gd_location' => ($add_location_filter) ? true : false, |
|
| 828 | - 'post_type' => $post_type, |
|
| 829 | - 'order_by' => $list_sort, |
|
| 830 | - 'post__not_in' => array($post_id), |
|
| 831 | - 'excerpt_length' => $character_count, |
|
| 832 | - 'related_listings' => $is_display |
|
| 833 | - ); |
|
| 823 | + } |
|
| 824 | + $query_args = array( |
|
| 825 | + 'posts_per_page' => $post_number, |
|
| 826 | + 'is_geodir_loop' => true, |
|
| 827 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
| 828 | + 'post_type' => $post_type, |
|
| 829 | + 'order_by' => $list_sort, |
|
| 830 | + 'post__not_in' => array($post_id), |
|
| 831 | + 'excerpt_length' => $character_count, |
|
| 832 | + 'related_listings' => $is_display |
|
| 833 | + ); |
|
| 834 | 834 | |
| 835 | - $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 836 | - 'field' => $tax_field, |
|
| 837 | - 'terms' => $category |
|
| 838 | - ); |
|
| 835 | + $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 836 | + 'field' => $tax_field, |
|
| 837 | + 'terms' => $category |
|
| 838 | + ); |
|
| 839 | 839 | |
| 840 | - $query_args['tax_query'] = array($tax_query); |
|
| 840 | + $query_args['tax_query'] = array($tax_query); |
|
| 841 | 841 | |
| 842 | 842 | |
| 843 | - global $gridview_columns, $post; |
|
| 843 | + global $gridview_columns, $post; |
|
| 844 | 844 | |
| 845 | 845 | |
| 846 | - query_posts($query_args); |
|
| 846 | + query_posts($query_args); |
|
| 847 | 847 | |
| 848 | - if (strstr($layout, 'gridview')) {
|
|
| 849 | - $listing_view_exp = explode('_', $layout);
|
|
| 850 | - $gridview_columns = $layout; |
|
| 851 | - $layout = $listing_view_exp[0]; |
|
| 852 | - } else if ($layout == 'list') {
|
|
| 853 | - $gridview_columns = ''; |
|
| 854 | - } |
|
| 855 | - $related_posts = true; |
|
| 848 | + if (strstr($layout, 'gridview')) {
|
|
| 849 | + $listing_view_exp = explode('_', $layout);
|
|
| 850 | + $gridview_columns = $layout; |
|
| 851 | + $layout = $listing_view_exp[0]; |
|
| 852 | + } else if ($layout == 'list') {
|
|
| 853 | + $gridview_columns = ''; |
|
| 854 | + } |
|
| 855 | + $related_posts = true; |
|
| 856 | 856 | |
| 857 | - $related_nearest = false; |
|
| 858 | - if ($list_sort == 'nearest') {
|
|
| 859 | - $related_nearest = true; |
|
| 860 | - } |
|
| 857 | + $related_nearest = false; |
|
| 858 | + if ($list_sort == 'nearest') {
|
|
| 859 | + $related_nearest = true; |
|
| 860 | + } |
|
| 861 | 861 | |
| 862 | 862 | |
| 863 | - /** |
|
| 864 | - * Filters related listing listview template. |
|
| 865 | - * |
|
| 866 | - * @since 1.0.0 |
|
| 867 | - */ |
|
| 868 | - $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 863 | + /** |
|
| 864 | + * Filters related listing listview template. |
|
| 865 | + * |
|
| 866 | + * @since 1.0.0 |
|
| 867 | + */ |
|
| 868 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 869 | 869 | |
| 870 | - /** |
|
| 871 | - * Includes related listing listview template. |
|
| 872 | - * |
|
| 873 | - * @since 1.0.0 |
|
| 874 | - */ |
|
| 875 | - include($template); |
|
| 870 | + /** |
|
| 871 | + * Includes related listing listview template. |
|
| 872 | + * |
|
| 873 | + * @since 1.0.0 |
|
| 874 | + */ |
|
| 875 | + include($template); |
|
| 876 | 876 | |
| 877 | - wp_reset_query(); |
|
| 878 | - $post = $origi_post; |
|
| 879 | - $related_nearest = false; |
|
| 880 | - ?> |
|
| 877 | + wp_reset_query(); |
|
| 878 | + $post = $origi_post; |
|
| 879 | + $related_nearest = false; |
|
| 880 | + ?> |
|
| 881 | 881 | |
| 882 | 882 | </div> |
| 883 | 883 | <?php |
| 884 | - return $html = ob_get_clean(); |
|
| 884 | + return $html = ob_get_clean(); |
|
| 885 | 885 | |
| 886 | - } |
|
| 886 | + } |
|
| 887 | 887 | |
| 888 | 888 | } |
| 889 | 889 | |
@@ -899,17 +899,17 @@ discard block |
||
| 899 | 899 | */ |
| 900 | 900 | function geodir_category_count_script() |
| 901 | 901 | {
|
| 902 | - global $geodir_post_category_str; |
|
| 902 | + global $geodir_post_category_str; |
|
| 903 | 903 | |
| 904 | - if (!empty($geodir_post_category_str)) {
|
|
| 905 | - $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 906 | - } |
|
| 904 | + if (!empty($geodir_post_category_str)) {
|
|
| 905 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 906 | + } |
|
| 907 | 907 | |
| 908 | - $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 909 | - $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 910 | - echo '<script>'; |
|
| 911 | - echo $script; |
|
| 912 | - echo '</script>'; |
|
| 908 | + $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 909 | + $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 910 | + echo '<script>'; |
|
| 911 | + echo $script; |
|
| 912 | + echo '</script>'; |
|
| 913 | 913 | |
| 914 | 914 | } |
| 915 | 915 | |
@@ -922,16 +922,16 @@ discard block |
||
| 922 | 922 | */ |
| 923 | 923 | function geodir_get_map_default_language() |
| 924 | 924 | {
|
| 925 | - $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 926 | - if (empty($geodir_default_map_language)) |
|
| 927 | - $geodir_default_map_language = 'en'; |
|
| 928 | - /** |
|
| 929 | - * Filter default map language. |
|
| 930 | - * |
|
| 931 | - * @since 1.0.0 |
|
| 932 | - * @param string $geodir_default_map_language Default map language. |
|
| 933 | - */ |
|
| 934 | - return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 925 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 926 | + if (empty($geodir_default_map_language)) |
|
| 927 | + $geodir_default_map_language = 'en'; |
|
| 928 | + /** |
|
| 929 | + * Filter default map language. |
|
| 930 | + * |
|
| 931 | + * @since 1.0.0 |
|
| 932 | + * @param string $geodir_default_map_language Default map language. |
|
| 933 | + */ |
|
| 934 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** |
@@ -943,14 +943,14 @@ discard block |
||
| 943 | 943 | */ |
| 944 | 944 | function geodir_get_map_api_key() |
| 945 | 945 | {
|
| 946 | - $key = get_option('geodir_google_api_key');
|
|
| 947 | - /** |
|
| 948 | - * Filter Google maps api key. |
|
| 949 | - * |
|
| 950 | - * @since 1.6.4 |
|
| 951 | - * @param string $key Google maps api key. |
|
| 952 | - */ |
|
| 953 | - return apply_filters('geodir_google_api_key', $key);
|
|
| 946 | + $key = get_option('geodir_google_api_key');
|
|
| 947 | + /** |
|
| 948 | + * Filter Google maps api key. |
|
| 949 | + * |
|
| 950 | + * @since 1.6.4 |
|
| 951 | + * @param string $key Google maps api key. |
|
| 952 | + */ |
|
| 953 | + return apply_filters('geodir_google_api_key', $key);
|
|
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | |
@@ -967,12 +967,12 @@ discard block |
||
| 967 | 967 | */ |
| 968 | 968 | function geodir_add_meta_keywords() |
| 969 | 969 | {
|
| 970 | - global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 970 | + global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 971 | 971 | |
| 972 | - $is_geodir_page = geodir_is_geodir_page(); |
|
| 973 | - if (!$is_geodir_page) {
|
|
| 974 | - return; |
|
| 975 | - }// if non GD page, bail |
|
| 972 | + $is_geodir_page = geodir_is_geodir_page(); |
|
| 973 | + if (!$is_geodir_page) {
|
|
| 974 | + return; |
|
| 975 | + }// if non GD page, bail |
|
| 976 | 976 | |
| 977 | 977 | $use_gd_meta = true; |
| 978 | 978 | if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
|
@@ -987,182 +987,182 @@ discard block |
||
| 987 | 987 | return; |
| 988 | 988 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
| 989 | 989 | |
| 990 | - $current_term = $wp_query->get_queried_object(); |
|
| 990 | + $current_term = $wp_query->get_queried_object(); |
|
| 991 | 991 | |
| 992 | - $all_postypes = geodir_get_posttypes(); |
|
| 992 | + $all_postypes = geodir_get_posttypes(); |
|
| 993 | 993 | |
| 994 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 994 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 995 | 995 | |
| 996 | - $meta_desc = ''; |
|
| 997 | - $meta_key = ''; |
|
| 998 | - if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 999 | - /** |
|
| 1000 | - * Filter SEO meta location description. |
|
| 1001 | - * |
|
| 1002 | - * @since 1.0.0 |
|
| 1003 | - */ |
|
| 1004 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1005 | - $meta_desc .= ''; |
|
| 1006 | - } |
|
| 1007 | - if (have_posts() && is_single() OR is_page()) {
|
|
| 1008 | - while (have_posts()) {
|
|
| 1009 | - the_post(); |
|
| 1010 | - |
|
| 1011 | - if (has_excerpt()) {
|
|
| 1012 | - $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1013 | - if (empty($out_excerpt)) {
|
|
| 1014 | - $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1015 | - } |
|
| 1016 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1017 | - } else {
|
|
| 1018 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1019 | - $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1020 | - if (empty($out_excerpt)) {
|
|
| 1021 | - $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1022 | - } |
|
| 1023 | - $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1024 | - } |
|
| 996 | + $meta_desc = ''; |
|
| 997 | + $meta_key = ''; |
|
| 998 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 999 | + /** |
|
| 1000 | + * Filter SEO meta location description. |
|
| 1001 | + * |
|
| 1002 | + * @since 1.0.0 |
|
| 1003 | + */ |
|
| 1004 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1005 | + $meta_desc .= ''; |
|
| 1006 | + } |
|
| 1007 | + if (have_posts() && is_single() OR is_page()) {
|
|
| 1008 | + while (have_posts()) {
|
|
| 1009 | + the_post(); |
|
| 1010 | + |
|
| 1011 | + if (has_excerpt()) {
|
|
| 1012 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1013 | + if (empty($out_excerpt)) {
|
|
| 1014 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1015 | + } |
|
| 1016 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1017 | + } else {
|
|
| 1018 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1019 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1020 | + if (empty($out_excerpt)) {
|
|
| 1021 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1022 | + } |
|
| 1023 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1024 | + } |
|
| 1025 | 1025 | |
| 1026 | - $meta_desc .= $out_excerpt; |
|
| 1027 | - } |
|
| 1028 | - } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1029 | - if (is_category()) {
|
|
| 1030 | - $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1031 | - } elseif (is_tag()) {
|
|
| 1032 | - $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1033 | - } |
|
| 1034 | - } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1035 | - $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1036 | - } |
|
| 1026 | + $meta_desc .= $out_excerpt; |
|
| 1027 | + } |
|
| 1028 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1029 | + if (is_category()) {
|
|
| 1030 | + $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1031 | + } elseif (is_tag()) {
|
|
| 1032 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1033 | + } |
|
| 1034 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1035 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1036 | + } |
|
| 1037 | 1037 | |
| 1038 | 1038 | |
| 1039 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 1040 | - $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1041 | - $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1042 | - |
|
| 1043 | - $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1044 | - $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1045 | - |
|
| 1046 | - $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1047 | - $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1048 | - |
|
| 1049 | - $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1050 | - $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1051 | - $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1052 | - $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1053 | - $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1054 | - $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1055 | - $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1056 | - $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1057 | - $location_id = NULL; |
|
| 1058 | - if ($geodir_location_manager) {
|
|
| 1059 | - $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1060 | - $location_id = (int)$wpdb->get_var($sql); |
|
| 1061 | - $location_type = geodir_what_is_current_location(); |
|
| 1062 | - if ($location_type == 'city') {
|
|
| 1063 | - $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1064 | - } elseif ($location_type == 'region') {
|
|
| 1065 | - $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1066 | - } elseif ($location_type == 'country') {
|
|
| 1067 | - $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1068 | - $replace_location = __($replace_location, 'geodirectory'); |
|
| 1069 | - } |
|
| 1070 | - $country = get_query_var('gd_country');
|
|
| 1071 | - $region = get_query_var('gd_region');
|
|
| 1072 | - $city = get_query_var('gd_city');
|
|
| 1073 | - $current_location = ''; |
|
| 1074 | - if ($country != '') {
|
|
| 1075 | - $current_location = get_actual_location_name('country', $country, true);
|
|
| 1076 | - } |
|
| 1077 | - if ($region != '') {
|
|
| 1078 | - $current_location = get_actual_location_name('region', $region);
|
|
| 1079 | - } |
|
| 1080 | - if ($city != '') {
|
|
| 1081 | - $current_location = get_actual_location_name('city', $city);
|
|
| 1082 | - } |
|
| 1083 | - $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1084 | - } |
|
| 1039 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 1040 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1041 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1042 | + |
|
| 1043 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1044 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1045 | + |
|
| 1046 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1047 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1048 | + |
|
| 1049 | + $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1050 | + $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1051 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1052 | + $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1053 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1054 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1055 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1056 | + $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1057 | + $location_id = NULL; |
|
| 1058 | + if ($geodir_location_manager) {
|
|
| 1059 | + $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1060 | + $location_id = (int)$wpdb->get_var($sql); |
|
| 1061 | + $location_type = geodir_what_is_current_location(); |
|
| 1062 | + if ($location_type == 'city') {
|
|
| 1063 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1064 | + } elseif ($location_type == 'region') {
|
|
| 1065 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1066 | + } elseif ($location_type == 'country') {
|
|
| 1067 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1068 | + $replace_location = __($replace_location, 'geodirectory'); |
|
| 1069 | + } |
|
| 1070 | + $country = get_query_var('gd_country');
|
|
| 1071 | + $region = get_query_var('gd_region');
|
|
| 1072 | + $city = get_query_var('gd_city');
|
|
| 1073 | + $current_location = ''; |
|
| 1074 | + if ($country != '') {
|
|
| 1075 | + $current_location = get_actual_location_name('country', $country, true);
|
|
| 1076 | + } |
|
| 1077 | + if ($region != '') {
|
|
| 1078 | + $current_location = get_actual_location_name('region', $region);
|
|
| 1079 | + } |
|
| 1080 | + if ($city != '') {
|
|
| 1081 | + $current_location = get_actual_location_name('city', $city);
|
|
| 1082 | + } |
|
| 1083 | + $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1084 | + } |
|
| 1085 | 1085 | |
| 1086 | - $geodir_meta_keys = ''; |
|
| 1087 | - $geodir_meta_desc = ''; |
|
| 1088 | - if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1089 | - if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1090 | - $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
| 1091 | - |
|
| 1092 | - $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1093 | - $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
| 1094 | - |
|
| 1095 | - if ($geodir_is_category) {
|
|
| 1096 | - $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1097 | - if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1098 | - $category_id = $category->term_id; |
|
| 1099 | - $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1100 | - if ($location_id) {
|
|
| 1101 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1102 | - $cat_loc_option = get_option($option_name); |
|
| 1103 | - |
|
| 1104 | - $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
| 1105 | - if (!$gd_cat_loc_default) {
|
|
| 1106 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1107 | - $option = get_option($option_name); |
|
| 1108 | - $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1109 | - } |
|
| 1110 | - } |
|
| 1111 | - $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1112 | - } |
|
| 1113 | - } else if ($geodir_is_tag) {
|
|
| 1114 | - $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1115 | - } |
|
| 1116 | - } |
|
| 1117 | - } |
|
| 1086 | + $geodir_meta_keys = ''; |
|
| 1087 | + $geodir_meta_desc = ''; |
|
| 1088 | + if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1089 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1090 | + $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
| 1091 | + |
|
| 1092 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1093 | + $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
| 1094 | + |
|
| 1095 | + if ($geodir_is_category) {
|
|
| 1096 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1097 | + if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1098 | + $category_id = $category->term_id; |
|
| 1099 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1100 | + if ($location_id) {
|
|
| 1101 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1102 | + $cat_loc_option = get_option($option_name); |
|
| 1103 | + |
|
| 1104 | + $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
| 1105 | + if (!$gd_cat_loc_default) {
|
|
| 1106 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1107 | + $option = get_option($option_name); |
|
| 1108 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1109 | + } |
|
| 1110 | + } |
|
| 1111 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1112 | + } |
|
| 1113 | + } else if ($geodir_is_tag) {
|
|
| 1114 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1115 | + } |
|
| 1116 | + } |
|
| 1117 | + } |
|
| 1118 | 1118 | |
| 1119 | 1119 | |
| 1120 | - $gd_page = ''; |
|
| 1121 | - if(geodir_is_page('home')){
|
|
| 1122 | - $gd_page = 'home'; |
|
| 1123 | - $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1124 | - } |
|
| 1125 | - elseif(geodir_is_page('detail')){
|
|
| 1126 | - $gd_page = 'detail'; |
|
| 1127 | - $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1128 | - } |
|
| 1129 | - elseif(geodir_is_page('pt')){
|
|
| 1130 | - $gd_page = 'pt'; |
|
| 1131 | - $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1132 | - } |
|
| 1133 | - elseif(geodir_is_page('listing')){
|
|
| 1134 | - $gd_page = 'listing'; |
|
| 1135 | - $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1136 | - } |
|
| 1137 | - elseif(geodir_is_page('location')){
|
|
| 1138 | - $gd_page = 'location'; |
|
| 1139 | - $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1140 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1120 | + $gd_page = ''; |
|
| 1121 | + if(geodir_is_page('home')){
|
|
| 1122 | + $gd_page = 'home'; |
|
| 1123 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1124 | + } |
|
| 1125 | + elseif(geodir_is_page('detail')){
|
|
| 1126 | + $gd_page = 'detail'; |
|
| 1127 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1128 | + } |
|
| 1129 | + elseif(geodir_is_page('pt')){
|
|
| 1130 | + $gd_page = 'pt'; |
|
| 1131 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1132 | + } |
|
| 1133 | + elseif(geodir_is_page('listing')){
|
|
| 1134 | + $gd_page = 'listing'; |
|
| 1135 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1136 | + } |
|
| 1137 | + elseif(geodir_is_page('location')){
|
|
| 1138 | + $gd_page = 'location'; |
|
| 1139 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1140 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1141 | 1141 | |
| 1142 | - } |
|
| 1143 | - elseif(geodir_is_page('search')){
|
|
| 1144 | - $gd_page = 'search'; |
|
| 1145 | - $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1146 | - } |
|
| 1147 | - elseif(geodir_is_page('add-listing')){
|
|
| 1148 | - $gd_page = 'add-listing'; |
|
| 1149 | - $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1150 | - } |
|
| 1151 | - elseif(geodir_is_page('author')){
|
|
| 1152 | - $gd_page = 'author'; |
|
| 1153 | - $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1154 | - } |
|
| 1155 | - elseif(geodir_is_page('login')){
|
|
| 1156 | - $gd_page = 'login'; |
|
| 1157 | - $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1158 | - } |
|
| 1159 | - elseif(geodir_is_page('listing-success')){
|
|
| 1160 | - $gd_page = 'listing-success'; |
|
| 1161 | - $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1162 | - } |
|
| 1142 | + } |
|
| 1143 | + elseif(geodir_is_page('search')){
|
|
| 1144 | + $gd_page = 'search'; |
|
| 1145 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1146 | + } |
|
| 1147 | + elseif(geodir_is_page('add-listing')){
|
|
| 1148 | + $gd_page = 'add-listing'; |
|
| 1149 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1150 | + } |
|
| 1151 | + elseif(geodir_is_page('author')){
|
|
| 1152 | + $gd_page = 'author'; |
|
| 1153 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1154 | + } |
|
| 1155 | + elseif(geodir_is_page('login')){
|
|
| 1156 | + $gd_page = 'login'; |
|
| 1157 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1158 | + } |
|
| 1159 | + elseif(geodir_is_page('listing-success')){
|
|
| 1160 | + $gd_page = 'listing-success'; |
|
| 1161 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1162 | + } |
|
| 1163 | 1163 | |
| 1164 | 1164 | |
| 1165 | - /* |
|
| 1165 | + /* |
|
| 1166 | 1166 | $geodir_meta_desc = $geodir_meta_desc != '' ? $geodir_meta_desc : $meta_desc; |
| 1167 | 1167 | if ($geodir_meta_desc != '') {
|
| 1168 | 1168 | $geodir_meta_desc = strip_tags($geodir_meta_desc); |
@@ -1175,74 +1175,74 @@ discard block |
||
| 1175 | 1175 | */ |
| 1176 | 1176 | |
| 1177 | 1177 | |
| 1178 | - if ($meta_desc) {
|
|
| 1179 | - $meta_desc = stripslashes_deep($meta_desc); |
|
| 1180 | - /** |
|
| 1181 | - * Filter page description to replace variables. |
|
| 1182 | - * |
|
| 1183 | - * @since 1.5.4 |
|
| 1184 | - * @param string $title The page description including variables. |
|
| 1185 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1186 | - */ |
|
| 1187 | - $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1188 | - |
|
| 1189 | - /** |
|
| 1190 | - * Filter SEO meta description. |
|
| 1191 | - * |
|
| 1192 | - * @since 1.0.0 |
|
| 1193 | - * @param string $meta_desc Meta description content. |
|
| 1194 | - */ |
|
| 1195 | - echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1196 | - } |
|
| 1178 | + if ($meta_desc) {
|
|
| 1179 | + $meta_desc = stripslashes_deep($meta_desc); |
|
| 1180 | + /** |
|
| 1181 | + * Filter page description to replace variables. |
|
| 1182 | + * |
|
| 1183 | + * @since 1.5.4 |
|
| 1184 | + * @param string $title The page description including variables. |
|
| 1185 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1186 | + */ |
|
| 1187 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1188 | + |
|
| 1189 | + /** |
|
| 1190 | + * Filter SEO meta description. |
|
| 1191 | + * |
|
| 1192 | + * @since 1.0.0 |
|
| 1193 | + * @param string $meta_desc Meta description content. |
|
| 1194 | + */ |
|
| 1195 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1196 | + } |
|
| 1197 | 1197 | |
| 1198 | - // meta keywords |
|
| 1199 | - if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1200 | - $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1201 | - $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1202 | - |
|
| 1203 | - $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1204 | - } else {
|
|
| 1205 | - $posttags = get_the_tags(); |
|
| 1206 | - if ($posttags) {
|
|
| 1207 | - foreach ($posttags as $tag) {
|
|
| 1208 | - $meta_key .= $tag->name . ' '; |
|
| 1209 | - } |
|
| 1210 | - } else {
|
|
| 1211 | - $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1212 | - $xt = 1; |
|
| 1198 | + // meta keywords |
|
| 1199 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1200 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1201 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1202 | + |
|
| 1203 | + $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1204 | + } else {
|
|
| 1205 | + $posttags = get_the_tags(); |
|
| 1206 | + if ($posttags) {
|
|
| 1207 | + foreach ($posttags as $tag) {
|
|
| 1208 | + $meta_key .= $tag->name . ' '; |
|
| 1209 | + } |
|
| 1210 | + } else {
|
|
| 1211 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1212 | + $xt = 1; |
|
| 1213 | 1213 | |
| 1214 | - foreach ($tags as $tag) {
|
|
| 1215 | - if ($xt <= 20) {
|
|
| 1216 | - $meta_key .= $tag->name . ", "; |
|
| 1217 | - } |
|
| 1214 | + foreach ($tags as $tag) {
|
|
| 1215 | + if ($xt <= 20) {
|
|
| 1216 | + $meta_key .= $tag->name . ", "; |
|
| 1217 | + } |
|
| 1218 | 1218 | |
| 1219 | - $xt++; |
|
| 1220 | - } |
|
| 1221 | - } |
|
| 1222 | - } |
|
| 1219 | + $xt++; |
|
| 1220 | + } |
|
| 1221 | + } |
|
| 1222 | + } |
|
| 1223 | 1223 | |
| 1224 | - $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1225 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1226 | - if ($geodir_meta_keys != '') {
|
|
| 1227 | - $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1228 | - $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1229 | - $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1230 | - $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1231 | - $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1224 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1225 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1226 | + if ($geodir_meta_keys != '') {
|
|
| 1227 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1228 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1229 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1230 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1231 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1232 | 1232 | |
| 1233 | - $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1234 | - } |
|
| 1233 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1234 | + } |
|
| 1235 | 1235 | |
| 1236 | - if ($meta_key) {
|
|
| 1237 | - $meta_key = stripslashes_deep($meta_key); |
|
| 1238 | - /** |
|
| 1239 | - * Filter SEO meta keywords. |
|
| 1240 | - * |
|
| 1241 | - * @since 1.0.0 |
|
| 1242 | - * @param string $meta_desc Meta keywords. |
|
| 1243 | - */ |
|
| 1244 | - echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1245 | - } |
|
| 1236 | + if ($meta_key) {
|
|
| 1237 | + $meta_key = stripslashes_deep($meta_key); |
|
| 1238 | + /** |
|
| 1239 | + * Filter SEO meta keywords. |
|
| 1240 | + * |
|
| 1241 | + * @since 1.0.0 |
|
| 1242 | + * @param string $meta_desc Meta keywords. |
|
| 1243 | + */ |
|
| 1244 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1245 | + } |
|
| 1246 | 1246 | |
| 1247 | 1247 | } |
| 1248 | 1248 | |
@@ -1257,14 +1257,14 @@ discard block |
||
| 1257 | 1257 | */ |
| 1258 | 1258 | function geodir_detail_page_tabs_key_value_array() |
| 1259 | 1259 | {
|
| 1260 | - $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1260 | + $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1261 | 1261 | |
| 1262 | - $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1262 | + $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1263 | 1263 | |
| 1264 | - foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1265 | - $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1266 | - } |
|
| 1267 | - return $geodir_detail_page_tabs_key_value_array; |
|
| 1264 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1265 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1266 | + } |
|
| 1267 | + return $geodir_detail_page_tabs_key_value_array; |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | /** |
@@ -1277,73 +1277,73 @@ discard block |
||
| 1277 | 1277 | function geodir_detail_page_tabs_array() |
| 1278 | 1278 | {
|
| 1279 | 1279 | |
| 1280 | - $arr_tabs = array(); |
|
| 1281 | - /** |
|
| 1282 | - * Filter detail page tab display. |
|
| 1283 | - * |
|
| 1284 | - * @since 1.0.0 |
|
| 1285 | - */ |
|
| 1286 | - $arr_tabs['post_profile'] = array( |
|
| 1287 | - 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1288 | - 'is_active_tab' => true, |
|
| 1289 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1290 | - 'tab_content' => '' |
|
| 1291 | - ); |
|
| 1292 | - $arr_tabs['post_info'] = array( |
|
| 1293 | - 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1294 | - 'is_active_tab' => false, |
|
| 1295 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1296 | - 'tab_content' => '' |
|
| 1297 | - ); |
|
| 1298 | - |
|
| 1299 | - $arr_tabs['post_images'] = array( |
|
| 1300 | - 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1301 | - 'is_active_tab' => false, |
|
| 1302 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1303 | - 'tab_content' => '' |
|
| 1304 | - ); |
|
| 1305 | - |
|
| 1306 | - $arr_tabs['post_video'] = array( |
|
| 1307 | - 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1308 | - 'is_active_tab' => false, |
|
| 1309 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1310 | - 'tab_content' => '' |
|
| 1311 | - ); |
|
| 1312 | - |
|
| 1313 | - $arr_tabs['special_offers'] = array( |
|
| 1314 | - 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1315 | - 'is_active_tab' => false, |
|
| 1316 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1317 | - 'tab_content' => '' |
|
| 1318 | - ); |
|
| 1319 | - |
|
| 1320 | - $arr_tabs['post_map'] = array( |
|
| 1321 | - 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1322 | - 'is_active_tab' => false, |
|
| 1323 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1324 | - 'tab_content' => '' |
|
| 1325 | - ); |
|
| 1326 | - |
|
| 1327 | - $arr_tabs['reviews'] = array( |
|
| 1328 | - 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1329 | - 'is_active_tab' => false, |
|
| 1330 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1331 | - 'tab_content' => 'review display' |
|
| 1332 | - ); |
|
| 1333 | - |
|
| 1334 | - $arr_tabs['related_listing'] = array( |
|
| 1335 | - 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1336 | - 'is_active_tab' => false, |
|
| 1337 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1338 | - 'tab_content' => '' |
|
| 1339 | - ); |
|
| 1340 | - |
|
| 1341 | - /** |
|
| 1342 | - * Filter the tabs array. |
|
| 1343 | - * |
|
| 1344 | - * @since 1.0.0 |
|
| 1345 | - */ |
|
| 1346 | - return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1280 | + $arr_tabs = array(); |
|
| 1281 | + /** |
|
| 1282 | + * Filter detail page tab display. |
|
| 1283 | + * |
|
| 1284 | + * @since 1.0.0 |
|
| 1285 | + */ |
|
| 1286 | + $arr_tabs['post_profile'] = array( |
|
| 1287 | + 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1288 | + 'is_active_tab' => true, |
|
| 1289 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1290 | + 'tab_content' => '' |
|
| 1291 | + ); |
|
| 1292 | + $arr_tabs['post_info'] = array( |
|
| 1293 | + 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1294 | + 'is_active_tab' => false, |
|
| 1295 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1296 | + 'tab_content' => '' |
|
| 1297 | + ); |
|
| 1298 | + |
|
| 1299 | + $arr_tabs['post_images'] = array( |
|
| 1300 | + 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1301 | + 'is_active_tab' => false, |
|
| 1302 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1303 | + 'tab_content' => '' |
|
| 1304 | + ); |
|
| 1305 | + |
|
| 1306 | + $arr_tabs['post_video'] = array( |
|
| 1307 | + 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1308 | + 'is_active_tab' => false, |
|
| 1309 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1310 | + 'tab_content' => '' |
|
| 1311 | + ); |
|
| 1312 | + |
|
| 1313 | + $arr_tabs['special_offers'] = array( |
|
| 1314 | + 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1315 | + 'is_active_tab' => false, |
|
| 1316 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1317 | + 'tab_content' => '' |
|
| 1318 | + ); |
|
| 1319 | + |
|
| 1320 | + $arr_tabs['post_map'] = array( |
|
| 1321 | + 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1322 | + 'is_active_tab' => false, |
|
| 1323 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1324 | + 'tab_content' => '' |
|
| 1325 | + ); |
|
| 1326 | + |
|
| 1327 | + $arr_tabs['reviews'] = array( |
|
| 1328 | + 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1329 | + 'is_active_tab' => false, |
|
| 1330 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1331 | + 'tab_content' => 'review display' |
|
| 1332 | + ); |
|
| 1333 | + |
|
| 1334 | + $arr_tabs['related_listing'] = array( |
|
| 1335 | + 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1336 | + 'is_active_tab' => false, |
|
| 1337 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1338 | + 'tab_content' => '' |
|
| 1339 | + ); |
|
| 1340 | + |
|
| 1341 | + /** |
|
| 1342 | + * Filter the tabs array. |
|
| 1343 | + * |
|
| 1344 | + * @since 1.0.0 |
|
| 1345 | + */ |
|
| 1346 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1347 | 1347 | |
| 1348 | 1348 | |
| 1349 | 1349 | } |
@@ -1358,15 +1358,15 @@ discard block |
||
| 1358 | 1358 | */ |
| 1359 | 1359 | function geodir_detail_page_tabs_list() |
| 1360 | 1360 | {
|
| 1361 | - $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1362 | - $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1363 | - if (!empty($tabs_excluded)) {
|
|
| 1364 | - foreach ($tabs_excluded as $tab) {
|
|
| 1365 | - if (array_key_exists($tab, $tabs_array)) |
|
| 1366 | - unset($tabs_array[$tab]); |
|
| 1367 | - } |
|
| 1368 | - } |
|
| 1369 | - return $tabs_array; |
|
| 1361 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1362 | + $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1363 | + if (!empty($tabs_excluded)) {
|
|
| 1364 | + foreach ($tabs_excluded as $tab) {
|
|
| 1365 | + if (array_key_exists($tab, $tabs_array)) |
|
| 1366 | + unset($tabs_array[$tab]); |
|
| 1367 | + } |
|
| 1368 | + } |
|
| 1369 | + return $tabs_array; |
|
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | 1372 | |
@@ -1384,156 +1384,156 @@ discard block |
||
| 1384 | 1384 | */ |
| 1385 | 1385 | function geodir_show_detail_page_tabs() |
| 1386 | 1386 | {
|
| 1387 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1387 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1388 | 1388 | |
| 1389 | - $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1390 | - $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1391 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1389 | + $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1390 | + $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1391 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1392 | 1392 | |
| 1393 | - if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1394 | - $post = geodir_get_post_info($request_post_id); |
|
| 1395 | - setup_postdata($post); |
|
| 1396 | - } |
|
| 1393 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1394 | + $post = geodir_get_post_info($request_post_id); |
|
| 1395 | + setup_postdata($post); |
|
| 1396 | + } |
|
| 1397 | 1397 | |
| 1398 | - $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1399 | - |
|
| 1400 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1401 | - |
|
| 1402 | - if (geodir_is_page('detail')) {
|
|
| 1403 | - $video = geodir_get_video($post->ID); |
|
| 1404 | - $special_offers = geodir_get_special_offers($post->ID); |
|
| 1405 | - $related_listing_array = array(); |
|
| 1406 | - if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1407 | - $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1408 | - |
|
| 1409 | - $related_listing = ''; |
|
| 1410 | - if (in_array($post->post_type, $related_listing_array) && isset($arr_detail_page_tabs['related_listing']['is_display']) && $arr_detail_page_tabs['related_listing']['is_display']) {
|
|
| 1411 | - $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1412 | - 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1413 | - 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1414 | - 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1415 | - 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1416 | - 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1417 | - |
|
| 1418 | - if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1419 | - $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1420 | - } else {
|
|
| 1421 | - $related_listing = geodir_related_posts_display($request); |
|
| 1422 | - } |
|
| 1398 | + $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1399 | + |
|
| 1400 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1401 | + |
|
| 1402 | + if (geodir_is_page('detail')) {
|
|
| 1403 | + $video = geodir_get_video($post->ID); |
|
| 1404 | + $special_offers = geodir_get_special_offers($post->ID); |
|
| 1405 | + $related_listing_array = array(); |
|
| 1406 | + if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1407 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1408 | + |
|
| 1409 | + $related_listing = ''; |
|
| 1410 | + if (in_array($post->post_type, $related_listing_array) && isset($arr_detail_page_tabs['related_listing']['is_display']) && $arr_detail_page_tabs['related_listing']['is_display']) {
|
|
| 1411 | + $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1412 | + 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1413 | + 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1414 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1415 | + 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1416 | + 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1417 | + |
|
| 1418 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1419 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1420 | + } else {
|
|
| 1421 | + $related_listing = geodir_related_posts_display($request); |
|
| 1422 | + } |
|
| 1423 | 1423 | |
| 1424 | - } |
|
| 1424 | + } |
|
| 1425 | 1425 | |
| 1426 | - $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1427 | - $thumb_image = ''; |
|
| 1428 | - if (!empty($post_images)) {
|
|
| 1429 | - foreach ($post_images as $image) {
|
|
| 1430 | - $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1431 | - $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1432 | - $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1433 | - $thumb_image .= '</a>'; |
|
| 1434 | - } |
|
| 1435 | - } |
|
| 1426 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1427 | + $thumb_image = ''; |
|
| 1428 | + if (!empty($post_images)) {
|
|
| 1429 | + foreach ($post_images as $image) {
|
|
| 1430 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1431 | + $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1432 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1433 | + $thumb_image .= '</a>'; |
|
| 1434 | + } |
|
| 1435 | + } |
|
| 1436 | 1436 | |
| 1437 | - $map_args = array(); |
|
| 1438 | - $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1439 | - $map_args['width'] = '600'; |
|
| 1440 | - $map_args['height'] = '300'; |
|
| 1441 | - if ($post->post_mapzoom) {
|
|
| 1442 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1443 | - } |
|
| 1444 | - $map_args['autozoom'] = false; |
|
| 1445 | - $map_args['child_collapse'] = '0'; |
|
| 1446 | - $map_args['enable_cat_filters'] = false; |
|
| 1447 | - $map_args['enable_text_search'] = false; |
|
| 1448 | - $map_args['enable_post_type_filters'] = false; |
|
| 1449 | - $map_args['enable_location_filters'] = false; |
|
| 1450 | - $map_args['enable_jason_on_load'] = true; |
|
| 1451 | - $map_args['enable_map_direction'] = true; |
|
| 1452 | - $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1453 | - $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1454 | - } else if (geodir_is_page('preview')) {
|
|
| 1455 | - $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1456 | - $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1457 | - |
|
| 1458 | - if (isset($post->post_images)) |
|
| 1459 | - $post->post_images = trim($post->post_images, ","); |
|
| 1460 | - |
|
| 1461 | - if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1462 | - $post_images = explode(",", $post->post_images);
|
|
| 1463 | - |
|
| 1464 | - $thumb_image = ''; |
|
| 1465 | - if (!empty($post_images)) {
|
|
| 1466 | - foreach ($post_images as $image) {
|
|
| 1467 | - if ($image != '') {
|
|
| 1468 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1469 | - $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1470 | - $thumb_image .= '</a>'; |
|
| 1471 | - } |
|
| 1472 | - } |
|
| 1473 | - } |
|
| 1437 | + $map_args = array(); |
|
| 1438 | + $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1439 | + $map_args['width'] = '600'; |
|
| 1440 | + $map_args['height'] = '300'; |
|
| 1441 | + if ($post->post_mapzoom) {
|
|
| 1442 | + $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1443 | + } |
|
| 1444 | + $map_args['autozoom'] = false; |
|
| 1445 | + $map_args['child_collapse'] = '0'; |
|
| 1446 | + $map_args['enable_cat_filters'] = false; |
|
| 1447 | + $map_args['enable_text_search'] = false; |
|
| 1448 | + $map_args['enable_post_type_filters'] = false; |
|
| 1449 | + $map_args['enable_location_filters'] = false; |
|
| 1450 | + $map_args['enable_jason_on_load'] = true; |
|
| 1451 | + $map_args['enable_map_direction'] = true; |
|
| 1452 | + $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1453 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1454 | + } else if (geodir_is_page('preview')) {
|
|
| 1455 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1456 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1457 | + |
|
| 1458 | + if (isset($post->post_images)) |
|
| 1459 | + $post->post_images = trim($post->post_images, ","); |
|
| 1460 | + |
|
| 1461 | + if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1462 | + $post_images = explode(",", $post->post_images);
|
|
| 1463 | + |
|
| 1464 | + $thumb_image = ''; |
|
| 1465 | + if (!empty($post_images)) {
|
|
| 1466 | + foreach ($post_images as $image) {
|
|
| 1467 | + if ($image != '') {
|
|
| 1468 | + $thumb_image .= '<a href="' . $image . '">'; |
|
| 1469 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1470 | + $thumb_image .= '</a>'; |
|
| 1471 | + } |
|
| 1472 | + } |
|
| 1473 | + } |
|
| 1474 | 1474 | |
| 1475 | - global $map_jason; |
|
| 1476 | - $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1477 | - $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1478 | - $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1479 | - $marker_json['w'] = $icon_size['w']; |
|
| 1480 | - $marker_json['h'] = $icon_size['h']; |
|
| 1481 | - $map_jason[] = json_encode($marker_json); |
|
| 1482 | - |
|
| 1483 | - $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1484 | - $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1485 | - $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1486 | - $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1487 | - if (!$mapzoom) {
|
|
| 1488 | - $mapzoom = 12; |
|
| 1489 | - } |
|
| 1475 | + global $map_jason; |
|
| 1476 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1477 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1478 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1479 | + $marker_json['w'] = $icon_size['w']; |
|
| 1480 | + $marker_json['h'] = $icon_size['h']; |
|
| 1481 | + $map_jason[] = json_encode($marker_json); |
|
| 1482 | + |
|
| 1483 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1484 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1485 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1486 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1487 | + if (!$mapzoom) {
|
|
| 1488 | + $mapzoom = 12; |
|
| 1489 | + } |
|
| 1490 | 1490 | |
| 1491 | - $map_args = array(); |
|
| 1492 | - $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1493 | - $map_args['width'] = '950'; |
|
| 1494 | - $map_args['height'] = '300'; |
|
| 1495 | - $map_args['child_collapse'] = '0'; |
|
| 1496 | - $map_args['maptype'] = $mapview; |
|
| 1497 | - $map_args['autozoom'] = false; |
|
| 1498 | - $map_args['zoom'] = "$mapzoom"; |
|
| 1499 | - $map_args['latitude'] = $address_latitude; |
|
| 1500 | - $map_args['longitude'] = $address_longitude; |
|
| 1501 | - $map_args['enable_cat_filters'] = false; |
|
| 1502 | - $map_args['enable_text_search'] = false; |
|
| 1503 | - $map_args['enable_post_type_filters'] = false; |
|
| 1504 | - $map_args['enable_location_filters'] = false; |
|
| 1505 | - $map_args['enable_jason_on_load'] = true; |
|
| 1506 | - $map_args['enable_map_direction'] = true; |
|
| 1507 | - $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1508 | - } |
|
| 1491 | + $map_args = array(); |
|
| 1492 | + $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1493 | + $map_args['width'] = '950'; |
|
| 1494 | + $map_args['height'] = '300'; |
|
| 1495 | + $map_args['child_collapse'] = '0'; |
|
| 1496 | + $map_args['maptype'] = $mapview; |
|
| 1497 | + $map_args['autozoom'] = false; |
|
| 1498 | + $map_args['zoom'] = "$mapzoom"; |
|
| 1499 | + $map_args['latitude'] = $address_latitude; |
|
| 1500 | + $map_args['longitude'] = $address_longitude; |
|
| 1501 | + $map_args['enable_cat_filters'] = false; |
|
| 1502 | + $map_args['enable_text_search'] = false; |
|
| 1503 | + $map_args['enable_post_type_filters'] = false; |
|
| 1504 | + $map_args['enable_location_filters'] = false; |
|
| 1505 | + $map_args['enable_jason_on_load'] = true; |
|
| 1506 | + $map_args['enable_map_direction'] = true; |
|
| 1507 | + $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1508 | + } |
|
| 1509 | 1509 | |
| 1510 | - $active_tab = ''; |
|
| 1511 | - $active_tab_name = ''; |
|
| 1512 | - $default_tab = ''; |
|
| 1513 | - $default_tab_name = ''; |
|
| 1514 | - foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1515 | - if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1516 | - $active_tab = $tab_index; |
|
| 1517 | - $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1518 | - } |
|
| 1510 | + $active_tab = ''; |
|
| 1511 | + $active_tab_name = ''; |
|
| 1512 | + $default_tab = ''; |
|
| 1513 | + $default_tab_name = ''; |
|
| 1514 | + foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1515 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1516 | + $active_tab = $tab_index; |
|
| 1517 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1518 | + } |
|
| 1519 | 1519 | |
| 1520 | - if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1521 | - $default_tab = $tab_index; |
|
| 1522 | - $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1523 | - } |
|
| 1524 | - } |
|
| 1520 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1521 | + $default_tab = $tab_index; |
|
| 1522 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1523 | + } |
|
| 1524 | + } |
|
| 1525 | 1525 | |
| 1526 | - if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1527 | - if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1528 | - $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1529 | - } |
|
| 1526 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1527 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1528 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1529 | + } |
|
| 1530 | 1530 | |
| 1531 | - $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1532 | - $active_tab = $default_tab; |
|
| 1533 | - $active_tab_name = $default_tab_name; |
|
| 1534 | - } |
|
| 1535 | - $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1536 | - ?> |
|
| 1531 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1532 | + $active_tab = $default_tab; |
|
| 1533 | + $active_tab_name = $default_tab_name; |
|
| 1534 | + } |
|
| 1535 | + $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1536 | + ?> |
|
| 1537 | 1537 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1538 | 1538 | <?php if(!$tab_list){ ?>
|
| 1539 | 1539 | <div id="geodir-tab-mobile-menu"> |
@@ -1543,166 +1543,166 @@ discard block |
||
| 1543 | 1543 | </div> |
| 1544 | 1544 | <dl class="geodir-tab-head"> |
| 1545 | 1545 | <?php |
| 1546 | - } |
|
| 1547 | - /** |
|
| 1548 | - * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1549 | - * |
|
| 1550 | - * @since 1.0.0 |
|
| 1551 | - * @see 'geodir_after_tab_list' |
|
| 1552 | - */ |
|
| 1553 | - do_action('geodir_before_tab_list'); ?>
|
|
| 1546 | + } |
|
| 1547 | + /** |
|
| 1548 | + * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1549 | + * |
|
| 1550 | + * @since 1.0.0 |
|
| 1551 | + * @see 'geodir_after_tab_list' |
|
| 1552 | + */ |
|
| 1553 | + do_action('geodir_before_tab_list'); ?>
|
|
| 1554 | 1554 | <?php |
| 1555 | 1555 | |
| 1556 | - foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1557 | - if ($detail_page_tab['is_display']) {
|
|
| 1556 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1557 | + if ($detail_page_tab['is_display']) {
|
|
| 1558 | 1558 | |
| 1559 | - if(!$tab_list) {
|
|
| 1560 | - ?> |
|
| 1559 | + if(!$tab_list) {
|
|
| 1560 | + ?> |
|
| 1561 | 1561 | <dt></dt> <!-- added to comply with validation --> |
| 1562 | 1562 | <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
|
| 1563 | 1563 | data-tab="#<?php echo $tab_index; ?>" |
| 1564 | 1564 | data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
| 1565 | 1565 | </dd> |
| 1566 | 1566 | <?php |
| 1567 | - } |
|
| 1568 | - ob_start() // start tab content buffering |
|
| 1569 | - ?> |
|
| 1567 | + } |
|
| 1568 | + ob_start() // start tab content buffering |
|
| 1569 | + ?> |
|
| 1570 | 1570 | <li id="<?php echo $tab_index;?>Tab"> |
| 1571 | 1571 | <?php if($tab_list){
|
| 1572 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1573 | - /** |
|
| 1574 | - * Filter the tab list title html. |
|
| 1575 | - * |
|
| 1576 | - * @since 1.6.1 |
|
| 1577 | - * @param string $tab_title The html for the tab title. |
|
| 1578 | - * @param string $tab_index The tab index type. |
|
| 1579 | - * @param array $detail_page_tab The array of values including title text. |
|
| 1580 | - */ |
|
| 1581 | - echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1582 | - }?> |
|
| 1572 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1573 | + /** |
|
| 1574 | + * Filter the tab list title html. |
|
| 1575 | + * |
|
| 1576 | + * @since 1.6.1 |
|
| 1577 | + * @param string $tab_title The html for the tab title. |
|
| 1578 | + * @param string $tab_index The tab index type. |
|
| 1579 | + * @param array $detail_page_tab The array of values including title text. |
|
| 1580 | + */ |
|
| 1581 | + echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1582 | + }?> |
|
| 1583 | 1583 | <div id="<?php echo $tab_index;?>" class="hash-offset"></div> |
| 1584 | 1584 | <?php |
| 1585 | - /** |
|
| 1586 | - * Called before the details tab content is output per tab. |
|
| 1587 | - * |
|
| 1588 | - * @since 1.0.0 |
|
| 1589 | - * @param string $tab_index The tab name ID. |
|
| 1590 | - */ |
|
| 1591 | - do_action('geodir_before_tab_content', $tab_index);
|
|
| 1592 | - |
|
| 1593 | - /** |
|
| 1594 | - * Called before the details tab content is output per tab. |
|
| 1595 | - * |
|
| 1596 | - * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1597 | - * |
|
| 1598 | - * @since 1.0.0 |
|
| 1599 | - * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1600 | - */ |
|
| 1601 | - do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1602 | - /// write a code to generate content of each tab |
|
| 1603 | - switch ($tab_index) {
|
|
| 1604 | - case 'post_profile': |
|
| 1605 | - /** |
|
| 1606 | - * Called before the listing description content on the details page tab. |
|
| 1607 | - * |
|
| 1608 | - * @since 1.0.0 |
|
| 1609 | - */ |
|
| 1610 | - do_action('geodir_before_description_on_listing_detail');
|
|
| 1611 | - if (geodir_is_page('detail')) {
|
|
| 1612 | - the_content(); |
|
| 1613 | - } else {
|
|
| 1614 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1615 | - echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1616 | - } |
|
| 1617 | - |
|
| 1618 | - /** |
|
| 1619 | - * Called after the listing description content on the details page tab. |
|
| 1620 | - * |
|
| 1621 | - * @since 1.0.0 |
|
| 1622 | - */ |
|
| 1623 | - do_action('geodir_after_description_on_listing_detail');
|
|
| 1624 | - break; |
|
| 1625 | - case 'post_info': |
|
| 1626 | - echo $geodir_post_detail_fields; |
|
| 1627 | - break; |
|
| 1628 | - case 'post_images': |
|
| 1629 | - echo $thumb_image; |
|
| 1630 | - break; |
|
| 1631 | - case 'post_video': |
|
| 1632 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1633 | - echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1634 | - break; |
|
| 1635 | - case 'special_offers': |
|
| 1636 | - echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1637 | - |
|
| 1638 | - break; |
|
| 1639 | - case 'post_map': |
|
| 1640 | - geodir_draw_map($map_args); |
|
| 1641 | - break; |
|
| 1642 | - case 'reviews': |
|
| 1643 | - comments_template(); |
|
| 1644 | - break; |
|
| 1645 | - case 'related_listing': |
|
| 1646 | - echo $related_listing; |
|
| 1647 | - break; |
|
| 1648 | - default: {
|
|
| 1649 | - if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
|
|
| 1650 | - echo $detail_page_tab['tab_content']; |
|
| 1651 | - } |
|
| 1652 | - } |
|
| 1653 | - break; |
|
| 1654 | - } |
|
| 1655 | - |
|
| 1656 | - /** |
|
| 1657 | - * Called after the details tab content is output per tab. |
|
| 1658 | - * |
|
| 1659 | - * @since 1.0.0 |
|
| 1660 | - */ |
|
| 1661 | - do_action('geodir_after_tab_content', $tab_index);
|
|
| 1662 | - |
|
| 1663 | - /** |
|
| 1664 | - * Called after the details tab content is output per tab. |
|
| 1665 | - * |
|
| 1666 | - * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1667 | - * |
|
| 1668 | - * @since 1.0.0 |
|
| 1669 | - * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1670 | - */ |
|
| 1671 | - do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1672 | - ?> </li> |
|
| 1585 | + /** |
|
| 1586 | + * Called before the details tab content is output per tab. |
|
| 1587 | + * |
|
| 1588 | + * @since 1.0.0 |
|
| 1589 | + * @param string $tab_index The tab name ID. |
|
| 1590 | + */ |
|
| 1591 | + do_action('geodir_before_tab_content', $tab_index);
|
|
| 1592 | + |
|
| 1593 | + /** |
|
| 1594 | + * Called before the details tab content is output per tab. |
|
| 1595 | + * |
|
| 1596 | + * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1597 | + * |
|
| 1598 | + * @since 1.0.0 |
|
| 1599 | + * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1600 | + */ |
|
| 1601 | + do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1602 | + /// write a code to generate content of each tab |
|
| 1603 | + switch ($tab_index) {
|
|
| 1604 | + case 'post_profile': |
|
| 1605 | + /** |
|
| 1606 | + * Called before the listing description content on the details page tab. |
|
| 1607 | + * |
|
| 1608 | + * @since 1.0.0 |
|
| 1609 | + */ |
|
| 1610 | + do_action('geodir_before_description_on_listing_detail');
|
|
| 1611 | + if (geodir_is_page('detail')) {
|
|
| 1612 | + the_content(); |
|
| 1613 | + } else {
|
|
| 1614 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1615 | + echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1616 | + } |
|
| 1617 | + |
|
| 1618 | + /** |
|
| 1619 | + * Called after the listing description content on the details page tab. |
|
| 1620 | + * |
|
| 1621 | + * @since 1.0.0 |
|
| 1622 | + */ |
|
| 1623 | + do_action('geodir_after_description_on_listing_detail');
|
|
| 1624 | + break; |
|
| 1625 | + case 'post_info': |
|
| 1626 | + echo $geodir_post_detail_fields; |
|
| 1627 | + break; |
|
| 1628 | + case 'post_images': |
|
| 1629 | + echo $thumb_image; |
|
| 1630 | + break; |
|
| 1631 | + case 'post_video': |
|
| 1632 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1633 | + echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1634 | + break; |
|
| 1635 | + case 'special_offers': |
|
| 1636 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1637 | + |
|
| 1638 | + break; |
|
| 1639 | + case 'post_map': |
|
| 1640 | + geodir_draw_map($map_args); |
|
| 1641 | + break; |
|
| 1642 | + case 'reviews': |
|
| 1643 | + comments_template(); |
|
| 1644 | + break; |
|
| 1645 | + case 'related_listing': |
|
| 1646 | + echo $related_listing; |
|
| 1647 | + break; |
|
| 1648 | + default: {
|
|
| 1649 | + if ((isset($post->{$tab_index}) || (!isset($post->{$tab_index}) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
|
|
| 1650 | + echo $detail_page_tab['tab_content']; |
|
| 1651 | + } |
|
| 1652 | + } |
|
| 1653 | + break; |
|
| 1654 | + } |
|
| 1655 | + |
|
| 1656 | + /** |
|
| 1657 | + * Called after the details tab content is output per tab. |
|
| 1658 | + * |
|
| 1659 | + * @since 1.0.0 |
|
| 1660 | + */ |
|
| 1661 | + do_action('geodir_after_tab_content', $tab_index);
|
|
| 1662 | + |
|
| 1663 | + /** |
|
| 1664 | + * Called after the details tab content is output per tab. |
|
| 1665 | + * |
|
| 1666 | + * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1667 | + * |
|
| 1668 | + * @since 1.0.0 |
|
| 1669 | + * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1670 | + */ |
|
| 1671 | + do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1672 | + ?> </li> |
|
| 1673 | 1673 | <?php |
| 1674 | - /** |
|
| 1675 | - * Filter the current tab content. |
|
| 1676 | - * |
|
| 1677 | - * @since 1.0.0 |
|
| 1678 | - */ |
|
| 1679 | - $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1680 | - } // end of if for is_display |
|
| 1681 | - }// end of foreach |
|
| 1682 | - |
|
| 1683 | - /** |
|
| 1684 | - * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1685 | - * |
|
| 1686 | - * @since 1.0.0 |
|
| 1687 | - * @see 'geodir_before_tab_list' |
|
| 1688 | - */ |
|
| 1689 | - do_action('geodir_after_tab_list');
|
|
| 1690 | - ?> |
|
| 1674 | + /** |
|
| 1675 | + * Filter the current tab content. |
|
| 1676 | + * |
|
| 1677 | + * @since 1.0.0 |
|
| 1678 | + */ |
|
| 1679 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1680 | + } // end of if for is_display |
|
| 1681 | + }// end of foreach |
|
| 1682 | + |
|
| 1683 | + /** |
|
| 1684 | + * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1685 | + * |
|
| 1686 | + * @since 1.0.0 |
|
| 1687 | + * @see 'geodir_before_tab_list' |
|
| 1688 | + */ |
|
| 1689 | + do_action('geodir_after_tab_list');
|
|
| 1690 | + ?> |
|
| 1691 | 1691 | <?php if(!$tab_list){?></dl><?php }?>
|
| 1692 | 1692 | <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
|
| 1693 | 1693 | <?php |
| 1694 | - foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1695 | - if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1696 | - echo $detail_page_tab['tab_content']; |
|
| 1697 | - }// end of if |
|
| 1698 | - }// end of foreach |
|
| 1699 | - |
|
| 1700 | - /** |
|
| 1701 | - * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1702 | - * |
|
| 1703 | - * @since 1.0.0 |
|
| 1704 | - */ |
|
| 1705 | - do_action('geodir_add_tab_content'); ?>
|
|
| 1694 | + foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1695 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1696 | + echo $detail_page_tab['tab_content']; |
|
| 1697 | + }// end of if |
|
| 1698 | + }// end of foreach |
|
| 1699 | + |
|
| 1700 | + /** |
|
| 1701 | + * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1702 | + * |
|
| 1703 | + * @since 1.0.0 |
|
| 1704 | + */ |
|
| 1705 | + do_action('geodir_add_tab_content'); ?>
|
|
| 1706 | 1706 | </ul> |
| 1707 | 1707 | <!--gd-tabs-content ul end--> |
| 1708 | 1708 | </div> |
@@ -1725,7 +1725,7 @@ discard block |
||
| 1725 | 1725 | }); |
| 1726 | 1726 | </script> |
| 1727 | 1727 | <?php |
| 1728 | - } |
|
| 1728 | + } |
|
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | /** |
@@ -1738,127 +1738,127 @@ discard block |
||
| 1738 | 1738 | */ |
| 1739 | 1739 | function geodir_exif($file) |
| 1740 | 1740 | {
|
| 1741 | - if (empty($file) || !is_array($file)) {
|
|
| 1742 | - return $file; |
|
| 1743 | - } |
|
| 1741 | + if (empty($file) || !is_array($file)) {
|
|
| 1742 | + return $file; |
|
| 1743 | + } |
|
| 1744 | 1744 | |
| 1745 | - $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1746 | - if (!($file_path && file_exists($file_path))) {
|
|
| 1747 | - return $file; |
|
| 1748 | - } |
|
| 1749 | - $file['file'] = $file_path; |
|
| 1745 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1746 | + if (!($file_path && file_exists($file_path))) {
|
|
| 1747 | + return $file; |
|
| 1748 | + } |
|
| 1749 | + $file['file'] = $file_path; |
|
| 1750 | 1750 | |
| 1751 | - if (!file_is_valid_image($file_path)) {
|
|
| 1752 | - return $file; // Bail if file is not an image. |
|
| 1753 | - } |
|
| 1751 | + if (!file_is_valid_image($file_path)) {
|
|
| 1752 | + return $file; // Bail if file is not an image. |
|
| 1753 | + } |
|
| 1754 | 1754 | |
| 1755 | - if (!function_exists('wp_get_image_editor')) {
|
|
| 1756 | - return $file; |
|
| 1757 | - } |
|
| 1755 | + if (!function_exists('wp_get_image_editor')) {
|
|
| 1756 | + return $file; |
|
| 1757 | + } |
|
| 1758 | 1758 | |
| 1759 | - $mime_type = $file['type']; |
|
| 1760 | - $exif = array(); |
|
| 1761 | - if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1762 | - try {
|
|
| 1763 | - $exif = exif_read_data($file_path); |
|
| 1764 | - } catch(Exception $e) {
|
|
| 1765 | - $exif = array(); |
|
| 1766 | - } |
|
| 1767 | - } |
|
| 1759 | + $mime_type = $file['type']; |
|
| 1760 | + $exif = array(); |
|
| 1761 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1762 | + try {
|
|
| 1763 | + $exif = exif_read_data($file_path); |
|
| 1764 | + } catch(Exception $e) {
|
|
| 1765 | + $exif = array(); |
|
| 1766 | + } |
|
| 1767 | + } |
|
| 1768 | 1768 | |
| 1769 | - $rotate = false; |
|
| 1770 | - $flip = false; |
|
| 1771 | - $modify = false; |
|
| 1772 | - $orientation = 0; |
|
| 1773 | - if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1774 | - switch ((int)$exif['Orientation']) {
|
|
| 1775 | - case 1: |
|
| 1776 | - // do nothing |
|
| 1777 | - break; |
|
| 1778 | - case 2: |
|
| 1779 | - $flip = array(false, true); |
|
| 1780 | - $modify = true; |
|
| 1781 | - break; |
|
| 1782 | - case 3: |
|
| 1783 | - $orientation = -180; |
|
| 1784 | - $rotate = true; |
|
| 1785 | - $modify = true; |
|
| 1786 | - break; |
|
| 1787 | - case 4: |
|
| 1788 | - $flip = array(true, false); |
|
| 1789 | - $modify = true; |
|
| 1790 | - break; |
|
| 1791 | - case 5: |
|
| 1792 | - $orientation = -90; |
|
| 1793 | - $rotate = true; |
|
| 1794 | - $flip = array(false, true); |
|
| 1795 | - $modify = true; |
|
| 1796 | - break; |
|
| 1797 | - case 6: |
|
| 1798 | - $orientation = -90; |
|
| 1799 | - $rotate = true; |
|
| 1800 | - $modify = true; |
|
| 1801 | - break; |
|
| 1802 | - case 7: |
|
| 1803 | - $orientation = -270; |
|
| 1804 | - $rotate = true; |
|
| 1805 | - $flip = array(false, true); |
|
| 1806 | - $modify = true; |
|
| 1807 | - break; |
|
| 1808 | - case 8: |
|
| 1809 | - case 9: |
|
| 1810 | - $orientation = -270; |
|
| 1811 | - $rotate = true; |
|
| 1812 | - $modify = true; |
|
| 1813 | - break; |
|
| 1814 | - default: |
|
| 1815 | - $orientation = 0; |
|
| 1816 | - $rotate = true; |
|
| 1817 | - $modify = true; |
|
| 1818 | - break; |
|
| 1819 | - } |
|
| 1820 | - } |
|
| 1769 | + $rotate = false; |
|
| 1770 | + $flip = false; |
|
| 1771 | + $modify = false; |
|
| 1772 | + $orientation = 0; |
|
| 1773 | + if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1774 | + switch ((int)$exif['Orientation']) {
|
|
| 1775 | + case 1: |
|
| 1776 | + // do nothing |
|
| 1777 | + break; |
|
| 1778 | + case 2: |
|
| 1779 | + $flip = array(false, true); |
|
| 1780 | + $modify = true; |
|
| 1781 | + break; |
|
| 1782 | + case 3: |
|
| 1783 | + $orientation = -180; |
|
| 1784 | + $rotate = true; |
|
| 1785 | + $modify = true; |
|
| 1786 | + break; |
|
| 1787 | + case 4: |
|
| 1788 | + $flip = array(true, false); |
|
| 1789 | + $modify = true; |
|
| 1790 | + break; |
|
| 1791 | + case 5: |
|
| 1792 | + $orientation = -90; |
|
| 1793 | + $rotate = true; |
|
| 1794 | + $flip = array(false, true); |
|
| 1795 | + $modify = true; |
|
| 1796 | + break; |
|
| 1797 | + case 6: |
|
| 1798 | + $orientation = -90; |
|
| 1799 | + $rotate = true; |
|
| 1800 | + $modify = true; |
|
| 1801 | + break; |
|
| 1802 | + case 7: |
|
| 1803 | + $orientation = -270; |
|
| 1804 | + $rotate = true; |
|
| 1805 | + $flip = array(false, true); |
|
| 1806 | + $modify = true; |
|
| 1807 | + break; |
|
| 1808 | + case 8: |
|
| 1809 | + case 9: |
|
| 1810 | + $orientation = -270; |
|
| 1811 | + $rotate = true; |
|
| 1812 | + $modify = true; |
|
| 1813 | + break; |
|
| 1814 | + default: |
|
| 1815 | + $orientation = 0; |
|
| 1816 | + $rotate = true; |
|
| 1817 | + $modify = true; |
|
| 1818 | + break; |
|
| 1819 | + } |
|
| 1820 | + } |
|
| 1821 | 1821 | |
| 1822 | - $quality = null; |
|
| 1823 | - /** |
|
| 1824 | - * Filter the image quality. |
|
| 1825 | - * |
|
| 1826 | - * @since 1.5.7 |
|
| 1827 | - * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1828 | - * @param string $quality Image mime type. |
|
| 1829 | - */ |
|
| 1830 | - $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1831 | - if ($quality !== null) {
|
|
| 1832 | - $modify = true; |
|
| 1833 | - } |
|
| 1822 | + $quality = null; |
|
| 1823 | + /** |
|
| 1824 | + * Filter the image quality. |
|
| 1825 | + * |
|
| 1826 | + * @since 1.5.7 |
|
| 1827 | + * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1828 | + * @param string $quality Image mime type. |
|
| 1829 | + */ |
|
| 1830 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1831 | + if ($quality !== null) {
|
|
| 1832 | + $modify = true; |
|
| 1833 | + } |
|
| 1834 | 1834 | |
| 1835 | - if (!$modify) {
|
|
| 1836 | - return $file; // no change |
|
| 1837 | - } |
|
| 1835 | + if (!$modify) {
|
|
| 1836 | + return $file; // no change |
|
| 1837 | + } |
|
| 1838 | 1838 | |
| 1839 | - $image = wp_get_image_editor($file_path); |
|
| 1840 | - if (!is_wp_error($image)) {
|
|
| 1841 | - if ($rotate) {
|
|
| 1842 | - $image->rotate($orientation); |
|
| 1843 | - } |
|
| 1839 | + $image = wp_get_image_editor($file_path); |
|
| 1840 | + if (!is_wp_error($image)) {
|
|
| 1841 | + if ($rotate) {
|
|
| 1842 | + $image->rotate($orientation); |
|
| 1843 | + } |
|
| 1844 | 1844 | |
| 1845 | - if (!empty($flip)) {
|
|
| 1846 | - $image->flip($flip[0], $flip[1]); |
|
| 1847 | - } |
|
| 1845 | + if (!empty($flip)) {
|
|
| 1846 | + $image->flip($flip[0], $flip[1]); |
|
| 1847 | + } |
|
| 1848 | 1848 | |
| 1849 | - if ($quality !== null) {
|
|
| 1850 | - $image->set_quality((int)$quality); |
|
| 1851 | - } |
|
| 1849 | + if ($quality !== null) {
|
|
| 1850 | + $image->set_quality((int)$quality); |
|
| 1851 | + } |
|
| 1852 | 1852 | |
| 1853 | - $result = $image->save($file_path); |
|
| 1854 | - if (!is_wp_error($result)) {
|
|
| 1855 | - $file['file'] = $result['path']; |
|
| 1856 | - $file['tmp_name'] = $result['path']; |
|
| 1857 | - } |
|
| 1858 | - } |
|
| 1853 | + $result = $image->save($file_path); |
|
| 1854 | + if (!is_wp_error($result)) {
|
|
| 1855 | + $file['file'] = $result['path']; |
|
| 1856 | + $file['tmp_name'] = $result['path']; |
|
| 1857 | + } |
|
| 1858 | + } |
|
| 1859 | 1859 | |
| 1860 | - // The image orientation is fixed, pass it back for further processing |
|
| 1861 | - return $file; |
|
| 1860 | + // The image orientation is fixed, pass it back for further processing |
|
| 1861 | + return $file; |
|
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | 1864 | /** |
@@ -1877,138 +1877,138 @@ discard block |
||
| 1877 | 1877 | * @return string Returns the recent reviews html. |
| 1878 | 1878 | */ |
| 1879 | 1879 | function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
|
| 1880 | - global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1881 | - $tablecomments = $wpdb->comments; |
|
| 1882 | - $tableposts = $wpdb->posts; |
|
| 1883 | - |
|
| 1884 | - $comments_echo = ''; |
|
| 1885 | - $city_filter = ''; |
|
| 1886 | - $region_filter = ''; |
|
| 1887 | - $country_filter = ''; |
|
| 1888 | - |
|
| 1889 | - if ($gd_session->get('gd_multi_location')) {
|
|
| 1890 | - if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1891 | - $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1892 | - } |
|
| 1880 | + global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1881 | + $tablecomments = $wpdb->comments; |
|
| 1882 | + $tableposts = $wpdb->posts; |
|
| 1883 | + |
|
| 1884 | + $comments_echo = ''; |
|
| 1885 | + $city_filter = ''; |
|
| 1886 | + $region_filter = ''; |
|
| 1887 | + $country_filter = ''; |
|
| 1888 | + |
|
| 1889 | + if ($gd_session->get('gd_multi_location')) {
|
|
| 1890 | + if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1891 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1892 | + } |
|
| 1893 | 1893 | |
| 1894 | - if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1895 | - $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1896 | - } |
|
| 1894 | + if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1895 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1896 | + } |
|
| 1897 | 1897 | |
| 1898 | - if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1899 | - $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1900 | - } |
|
| 1901 | - } |
|
| 1898 | + if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1899 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1900 | + } |
|
| 1901 | + } |
|
| 1902 | 1902 | |
| 1903 | - $review_table = GEODIR_REVIEW_TABLE; |
|
| 1904 | - $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments"; |
|
| 1905 | - |
|
| 1906 | - $comments = $wpdb->get_results($request); |
|
| 1907 | - |
|
| 1908 | - foreach ($comments as $comment) {
|
|
| 1909 | - // Set the extra comment info needed. |
|
| 1910 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1911 | - //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1912 | - $comment->comment_content = $comment_extra->comment_content; |
|
| 1913 | - $comment->comment_author = $comment_extra->comment_author; |
|
| 1914 | - $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1915 | - |
|
| 1916 | - $comment_id = ''; |
|
| 1917 | - $comment_id = $comment->comment_ID; |
|
| 1918 | - $comment_content = strip_tags($comment->comment_content); |
|
| 1919 | - |
|
| 1920 | - $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1921 | - |
|
| 1922 | - $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1923 | - $comment_author_email = $comment->comment_author_email; |
|
| 1924 | - $comment_post_ID = $comment->post_id; |
|
| 1925 | - |
|
| 1926 | - $na = true; |
|
| 1927 | - if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1928 | - $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1929 | - if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1930 | - } else {
|
|
| 1931 | - $na = false; |
|
| 1932 | - } |
|
| 1933 | - } |
|
| 1903 | + $review_table = GEODIR_REVIEW_TABLE; |
|
| 1904 | + $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments"; |
|
| 1905 | + |
|
| 1906 | + $comments = $wpdb->get_results($request); |
|
| 1907 | + |
|
| 1908 | + foreach ($comments as $comment) {
|
|
| 1909 | + // Set the extra comment info needed. |
|
| 1910 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1911 | + //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1912 | + $comment->comment_content = $comment_extra->comment_content; |
|
| 1913 | + $comment->comment_author = $comment_extra->comment_author; |
|
| 1914 | + $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1915 | + |
|
| 1916 | + $comment_id = ''; |
|
| 1917 | + $comment_id = $comment->comment_ID; |
|
| 1918 | + $comment_content = strip_tags($comment->comment_content); |
|
| 1919 | + |
|
| 1920 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1921 | + |
|
| 1922 | + $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1923 | + $comment_author_email = $comment->comment_author_email; |
|
| 1924 | + $comment_post_ID = $comment->post_id; |
|
| 1925 | + |
|
| 1926 | + $na = true; |
|
| 1927 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1928 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1929 | + if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1930 | + } else {
|
|
| 1931 | + $na = false; |
|
| 1932 | + } |
|
| 1933 | + } |
|
| 1934 | 1934 | |
| 1935 | - $post_title = get_the_title($comment_post_ID); |
|
| 1936 | - $permalink = get_permalink($comment_post_ID); |
|
| 1937 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1938 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1935 | + $post_title = get_the_title($comment_post_ID); |
|
| 1936 | + $permalink = get_permalink($comment_post_ID); |
|
| 1937 | + $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1938 | + $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1939 | 1939 | |
| 1940 | - $comment_content_length = strlen($comment_content); |
|
| 1941 | - if ($comment_content_length > $comment_lenth) {
|
|
| 1942 | - $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1943 | - } else {
|
|
| 1944 | - $comment_excerpt = $comment_content; |
|
| 1945 | - } |
|
| 1940 | + $comment_content_length = strlen($comment_content); |
|
| 1941 | + if ($comment_content_length > $comment_lenth) {
|
|
| 1942 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1943 | + } else {
|
|
| 1944 | + $comment_excerpt = $comment_content; |
|
| 1945 | + } |
|
| 1946 | 1946 | |
| 1947 | - if ($comment->user_id) {
|
|
| 1948 | - $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1949 | - } else {
|
|
| 1950 | - $user_profile_url = ''; |
|
| 1951 | - } |
|
| 1947 | + if ($comment->user_id) {
|
|
| 1948 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1949 | + } else {
|
|
| 1950 | + $user_profile_url = ''; |
|
| 1951 | + } |
|
| 1952 | 1952 | |
| 1953 | - if ($comment_id && $na) {
|
|
| 1954 | - $comments_echo .= '<li class="clearfix">'; |
|
| 1955 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1956 | - if (function_exists('get_avatar')) {
|
|
| 1957 | - if (!isset($comment->comment_type)) {
|
|
| 1958 | - if ($user_profile_url) {
|
|
| 1959 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1960 | - } |
|
| 1961 | - $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1962 | - if ($user_profile_url) {
|
|
| 1963 | - $comments_echo .= '</a>'; |
|
| 1964 | - } |
|
| 1965 | - } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1966 | - if ($user_profile_url) {
|
|
| 1967 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1968 | - } |
|
| 1969 | - $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1970 | - } |
|
| 1971 | - } elseif (function_exists('gravatar')) {
|
|
| 1972 | - if ($user_profile_url) {
|
|
| 1973 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1974 | - } |
|
| 1975 | - $comments_echo .= "<img src=\""; |
|
| 1976 | - if ('' == $comment->comment_type) {
|
|
| 1977 | - $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1978 | - if ($user_profile_url) {
|
|
| 1979 | - $comments_echo .= '</a>'; |
|
| 1980 | - } |
|
| 1981 | - } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1982 | - if ($user_profile_url) {
|
|
| 1983 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1984 | - } |
|
| 1985 | - $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1986 | - if ($user_profile_url) {
|
|
| 1987 | - $comments_echo .= '</a>'; |
|
| 1988 | - } |
|
| 1989 | - } |
|
| 1990 | - $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 1991 | - } |
|
| 1953 | + if ($comment_id && $na) {
|
|
| 1954 | + $comments_echo .= '<li class="clearfix">'; |
|
| 1955 | + $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1956 | + if (function_exists('get_avatar')) {
|
|
| 1957 | + if (!isset($comment->comment_type)) {
|
|
| 1958 | + if ($user_profile_url) {
|
|
| 1959 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1960 | + } |
|
| 1961 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1962 | + if ($user_profile_url) {
|
|
| 1963 | + $comments_echo .= '</a>'; |
|
| 1964 | + } |
|
| 1965 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1966 | + if ($user_profile_url) {
|
|
| 1967 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1968 | + } |
|
| 1969 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1970 | + } |
|
| 1971 | + } elseif (function_exists('gravatar')) {
|
|
| 1972 | + if ($user_profile_url) {
|
|
| 1973 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1974 | + } |
|
| 1975 | + $comments_echo .= "<img src=\""; |
|
| 1976 | + if ('' == $comment->comment_type) {
|
|
| 1977 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1978 | + if ($user_profile_url) {
|
|
| 1979 | + $comments_echo .= '</a>'; |
|
| 1980 | + } |
|
| 1981 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1982 | + if ($user_profile_url) {
|
|
| 1983 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1984 | + } |
|
| 1985 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1986 | + if ($user_profile_url) {
|
|
| 1987 | + $comments_echo .= '</a>'; |
|
| 1988 | + } |
|
| 1989 | + } |
|
| 1990 | + $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 1991 | + } |
|
| 1992 | 1992 | |
| 1993 | - $comments_echo .= "</span>\n"; |
|
| 1994 | - |
|
| 1995 | - $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 1996 | - if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 1997 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 1998 | - if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 1999 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 2000 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2001 | - $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2002 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2003 | - //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 2004 | - $comments_echo .= '</p>'; |
|
| 2005 | - |
|
| 2006 | - $comments_echo .= "</span>\n"; |
|
| 2007 | - $comments_echo .= '</li>'; |
|
| 2008 | - } |
|
| 2009 | - } |
|
| 1993 | + $comments_echo .= "</span>\n"; |
|
| 1994 | + |
|
| 1995 | + $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 1996 | + if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 1997 | + $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 1998 | + if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 1999 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 2000 | + $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2001 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2002 | + $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2003 | + //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 2004 | + $comments_echo .= '</p>'; |
|
| 2005 | + |
|
| 2006 | + $comments_echo .= "</span>\n"; |
|
| 2007 | + $comments_echo .= '</li>'; |
|
| 2008 | + } |
|
| 2009 | + } |
|
| 2010 | 2010 | |
| 2011 | - return $comments_echo; |
|
| 2011 | + return $comments_echo; |
|
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | 2014 | /** |
@@ -2020,29 +2020,29 @@ discard block |
||
| 2020 | 2020 | */ |
| 2021 | 2021 | function geodir_home_map_cats_key_value_array() |
| 2022 | 2022 | {
|
| 2023 | - $post_types = geodir_get_posttypes('object');
|
|
| 2024 | - |
|
| 2025 | - $return = array(); |
|
| 2026 | - if (!empty($post_types)) {
|
|
| 2027 | - foreach ($post_types as $key => $post_type) {
|
|
| 2028 | - $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2029 | - $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 2030 | - $taxonomies = geodir_get_taxonomies($key); |
|
| 2031 | - $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2032 | - $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2033 | - |
|
| 2034 | - if (!empty($cat_terms)) {
|
|
| 2035 | - $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2036 | - |
|
| 2037 | - foreach ($cat_terms as $cat_term) {
|
|
| 2038 | - $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2039 | - } |
|
| 2023 | + $post_types = geodir_get_posttypes('object');
|
|
| 2040 | 2024 | |
| 2041 | - $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2042 | - } |
|
| 2043 | - } |
|
| 2044 | - } |
|
| 2045 | - return $return; |
|
| 2025 | + $return = array(); |
|
| 2026 | + if (!empty($post_types)) {
|
|
| 2027 | + foreach ($post_types as $key => $post_type) {
|
|
| 2028 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2029 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 2030 | + $taxonomies = geodir_get_taxonomies($key); |
|
| 2031 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2032 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2033 | + |
|
| 2034 | + if (!empty($cat_terms)) {
|
|
| 2035 | + $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2036 | + |
|
| 2037 | + foreach ($cat_terms as $cat_term) {
|
|
| 2038 | + $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2039 | + } |
|
| 2040 | + |
|
| 2041 | + $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2042 | + } |
|
| 2043 | + } |
|
| 2044 | + } |
|
| 2045 | + return $return; |
|
| 2046 | 2046 | } |
| 2047 | 2047 | |
| 2048 | 2048 | /** |
@@ -2054,7 +2054,7 @@ discard block |
||
| 2054 | 2054 | */ |
| 2055 | 2055 | function geodir_twitter_tweet_button() |
| 2056 | 2056 | {
|
| 2057 | - ?> |
|
| 2057 | + ?> |
|
| 2058 | 2058 | <a href="http://twitter.com/share" |
| 2059 | 2059 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
| 2060 | 2060 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
@@ -2071,11 +2071,11 @@ discard block |
||
| 2071 | 2071 | * @global object $post The current post object. |
| 2072 | 2072 | */ |
| 2073 | 2073 | function geodir_fb_like_button() {
|
| 2074 | - global $post; |
|
| 2075 | - ?> |
|
| 2074 | + global $post; |
|
| 2075 | + ?> |
|
| 2076 | 2076 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
| 2077 | - echo 'allowtransparency="true"'; |
|
| 2078 | - } ?> class="facebook" |
|
| 2077 | + echo 'allowtransparency="true"'; |
|
| 2078 | + } ?> class="facebook" |
|
| 2079 | 2079 | src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
| 2080 | 2080 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 2081 | 2081 | <?php |
@@ -2090,7 +2090,7 @@ discard block |
||
| 2090 | 2090 | * @package GeoDirectory |
| 2091 | 2091 | */ |
| 2092 | 2092 | function geodir_google_plus_button() {
|
| 2093 | - ?> |
|
| 2093 | + ?> |
|
| 2094 | 2094 | <div id="plusone-div" class="g-plusone" data-size="medium"></div> |
| 2095 | 2095 | <script type="text/javascript"> |
| 2096 | 2096 | (function () {
|
@@ -2115,8 +2115,8 @@ discard block |
||
| 2115 | 2115 | * @global object $post The current post object. |
| 2116 | 2116 | */ |
| 2117 | 2117 | function geodir_share_this_button_code() {
|
| 2118 | - global $post; |
|
| 2119 | - ?> |
|
| 2118 | + global $post; |
|
| 2119 | + ?> |
|
| 2120 | 2120 | <div class="addthis_toolbox addthis_default_style"> |
| 2121 | 2121 | <span id='st_sharethis'></span> |
| 2122 | 2122 | <script type="text/javascript">var switchTo5x = false;</script> |
@@ -2141,8 +2141,8 @@ discard block |
||
| 2141 | 2141 | } |
| 2142 | 2142 | |
| 2143 | 2143 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2144 | - if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2145 | - ?> |
|
| 2144 | + if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2145 | + ?> |
|
| 2146 | 2146 | <script> |
| 2147 | 2147 | jQuery(function ($) {
|
| 2148 | 2148 | if (typeof(animate_marker) == 'function') {
|
@@ -2159,27 +2159,27 @@ discard block |
||
| 2159 | 2159 | }); |
| 2160 | 2160 | </script> |
| 2161 | 2161 | <?php |
| 2162 | - } |
|
| 2162 | + } |
|
| 2163 | 2163 | } |
| 2164 | 2164 | add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
|
| 2165 | 2165 | |
| 2166 | 2166 | add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
|
| 2167 | 2167 | function geodir_output_favourite_html_listings( $post_id){
|
| 2168 | - geodir_favourite_html('', $post_id);
|
|
| 2168 | + geodir_favourite_html('', $post_id);
|
|
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
| 2172 | 2172 | function geodir_output_pinpoint_html_listings( $post_id, $post){
|
| 2173 | - global $wp_query; |
|
| 2173 | + global $wp_query; |
|
| 2174 | 2174 | |
| 2175 | - $show_pin_point = $wp_query->is_main_query(); |
|
| 2175 | + $show_pin_point = $wp_query->is_main_query(); |
|
| 2176 | 2176 | |
| 2177 | - if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2178 | - $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2179 | - $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2180 | - ?> |
|
| 2177 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2178 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2179 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2180 | + ?> |
|
| 2181 | 2181 | <span class="geodir-pinpoint" style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
|
| 2182 | 2182 | <a class="geodir-pinpoint-link" href="javascript:void(0)" onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')" onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
|
| 2183 | 2183 | <?php |
| 2184 | - } |
|
| 2184 | + } |
|
| 2185 | 2185 | } |
| 2186 | 2186 | \ No newline at end of file |