@@ -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,69 +697,69 @@ 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; |
|
| 714 | - $origi_post = $post; |
|
| 715 | - $post_type = ''; |
|
| 716 | - $post_id = ''; |
|
| 717 | - $category_taxonomy = ''; |
|
| 718 | - $tax_field = 'id'; |
|
| 719 | - $category = array(); |
|
| 720 | - |
|
| 721 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 722 | - $post = (object)$gd_session->get('listing');
|
|
| 723 | - $post_type = $post->listing_type; |
|
| 724 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 725 | - $post_id = $_REQUEST['pid']; |
|
| 726 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 727 | - $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 728 | - $post_type = $post->post_type; |
|
| 729 | - $post_id = $_REQUEST['pid']; |
|
| 730 | - } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 731 | - $post_type = $post->post_type; |
|
| 732 | - $post_id = $post->ID; |
|
| 733 | - } |
|
| 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; |
|
| 714 | + $origi_post = $post; |
|
| 715 | + $post_type = ''; |
|
| 716 | + $post_id = ''; |
|
| 717 | + $category_taxonomy = ''; |
|
| 718 | + $tax_field = 'id'; |
|
| 719 | + $category = array(); |
|
| 720 | + |
|
| 721 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 722 | + $post = (object)$gd_session->get('listing');
|
|
| 723 | + $post_type = $post->listing_type; |
|
| 724 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 725 | + $post_id = $_REQUEST['pid']; |
|
| 726 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 727 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 728 | + $post_type = $post->post_type; |
|
| 729 | + $post_id = $_REQUEST['pid']; |
|
| 730 | + } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 731 | + $post_type = $post->post_type; |
|
| 732 | + $post_id = $post->ID; |
|
| 733 | + } |
|
| 734 | 734 | |
| 735 | - if ($relate_to == 'category') {
|
|
| 735 | + if ($relate_to == 'category') {
|
|
| 736 | 736 | |
| 737 | - $category_taxonomy = $post_type . $relate_to; |
|
| 738 | - if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 739 | - $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 737 | + $category_taxonomy = $post_type . $relate_to; |
|
| 738 | + if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 739 | + $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 740 | 740 | |
| 741 | - } elseif ($relate_to == 'tags') {
|
|
| 741 | + } elseif ($relate_to == 'tags') {
|
|
| 742 | 742 | |
| 743 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 744 | - if ($post->post_tags != '') |
|
| 745 | - $category = explode(',', trim($post->post_tags, ','));
|
|
| 746 | - $tax_field = 'name'; |
|
| 747 | - } |
|
| 743 | + $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 744 | + if ($post->post_tags != '') |
|
| 745 | + $category = explode(',', trim($post->post_tags, ','));
|
|
| 746 | + $tax_field = 'name'; |
|
| 747 | + } |
|
| 748 | 748 | |
| 749 | - /* --- return false in invalid request --- */ |
|
| 750 | - if (empty($category)) |
|
| 751 | - return false; |
|
| 749 | + /* --- return false in invalid request --- */ |
|
| 750 | + if (empty($category)) |
|
| 751 | + return false; |
|
| 752 | 752 | |
| 753 | - $all_postypes = geodir_get_posttypes(); |
|
| 753 | + $all_postypes = geodir_get_posttypes(); |
|
| 754 | 754 | |
| 755 | - if (!in_array($post_type, $all_postypes)) |
|
| 756 | - return false; |
|
| 755 | + if (!in_array($post_type, $all_postypes)) |
|
| 756 | + return false; |
|
| 757 | 757 | |
| 758 | - /* --- return false in invalid request --- */ |
|
| 758 | + /* --- return false in invalid request --- */ |
|
| 759 | 759 | |
| 760 | - $location_url = ''; |
|
| 761 | - if ($add_location_filter != '0') {
|
|
| 762 | - $location_url = array(); |
|
| 760 | + $location_url = ''; |
|
| 761 | + if ($add_location_filter != '0') {
|
|
| 762 | + $location_url = array(); |
|
| 763 | 763 | $geodir_show_location_url = get_option('geodir_show_location_url');
|
| 764 | 764 | |
| 765 | 765 | $gd_city = get_query_var('gd_city');
|
@@ -767,13 +767,13 @@ discard block |
||
| 767 | 767 | if ($gd_city) {
|
| 768 | 768 | $gd_country = get_query_var('gd_country');
|
| 769 | 769 | $gd_region = get_query_var('gd_region');
|
| 770 | - } else {
|
|
| 771 | - $location = geodir_get_default_location(); |
|
| 770 | + } else {
|
|
| 771 | + $location = geodir_get_default_location(); |
|
| 772 | 772 | |
| 773 | 773 | $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
| 774 | 774 | $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
| 775 | 775 | $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
| 776 | - } |
|
| 776 | + } |
|
| 777 | 777 | |
| 778 | 778 | if ($geodir_show_location_url == 'all') {
|
| 779 | 779 | $location_url[] = $gd_country; |
@@ -786,92 +786,92 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | $location_url[] = $gd_city; |
| 788 | 788 | |
| 789 | - $location_url = implode('/', $location_url);
|
|
| 790 | - } |
|
| 789 | + $location_url = implode('/', $location_url);
|
|
| 790 | + } |
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | - if (!empty($category)) {
|
|
| 794 | - global $geodir_add_location_url; |
|
| 795 | - $geodir_add_location_url = '0'; |
|
| 796 | - if ($add_location_filter != '0') {
|
|
| 797 | - $geodir_add_location_url = '1'; |
|
| 798 | - } |
|
| 799 | - $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 800 | - $geodir_add_location_url = NULL; |
|
| 801 | - } |
|
| 802 | - ob_start(); |
|
| 803 | - ?> |
|
| 793 | + if (!empty($category)) {
|
|
| 794 | + global $geodir_add_location_url; |
|
| 795 | + $geodir_add_location_url = '0'; |
|
| 796 | + if ($add_location_filter != '0') {
|
|
| 797 | + $geodir_add_location_url = '1'; |
|
| 798 | + } |
|
| 799 | + $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 800 | + $geodir_add_location_url = NULL; |
|
| 801 | + } |
|
| 802 | + ob_start(); |
|
| 803 | + ?> |
|
| 804 | 804 | |
| 805 | 805 | |
| 806 | 806 | <div class="geodir_locations geodir_location_listing"> |
| 807 | 807 | |
| 808 | 808 | <?php |
| 809 | - if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 810 | - /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 811 | - $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 812 | - /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 813 | - $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 814 | - ?> |
|
| 809 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 810 | + /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 811 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 812 | + /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 813 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 814 | + ?> |
|
| 815 | 815 | <div class="location_list_heading clearfix"> |
| 816 | 816 | <?php echo $before_title . $title . $after_title; ?> |
| 817 | 817 | </div> |
| 818 | 818 | <?php |
| 819 | - } |
|
| 820 | - $query_args = array( |
|
| 821 | - 'posts_per_page' => $post_number, |
|
| 822 | - 'is_geodir_loop' => true, |
|
| 823 | - 'gd_location' => ($add_location_filter) ? true : false, |
|
| 824 | - 'post_type' => $post_type, |
|
| 825 | - 'order_by' => $list_sort, |
|
| 826 | - 'post__not_in' => array($post_id), |
|
| 827 | - 'excerpt_length' => $character_count, |
|
| 828 | - ); |
|
| 819 | + } |
|
| 820 | + $query_args = array( |
|
| 821 | + 'posts_per_page' => $post_number, |
|
| 822 | + 'is_geodir_loop' => true, |
|
| 823 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
| 824 | + 'post_type' => $post_type, |
|
| 825 | + 'order_by' => $list_sort, |
|
| 826 | + 'post__not_in' => array($post_id), |
|
| 827 | + 'excerpt_length' => $character_count, |
|
| 828 | + ); |
|
| 829 | 829 | |
| 830 | - $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 831 | - 'field' => $tax_field, |
|
| 832 | - 'terms' => $category |
|
| 833 | - ); |
|
| 830 | + $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 831 | + 'field' => $tax_field, |
|
| 832 | + 'terms' => $category |
|
| 833 | + ); |
|
| 834 | 834 | |
| 835 | - $query_args['tax_query'] = array($tax_query); |
|
| 835 | + $query_args['tax_query'] = array($tax_query); |
|
| 836 | 836 | |
| 837 | 837 | |
| 838 | - global $gridview_columns, $post; |
|
| 838 | + global $gridview_columns, $post; |
|
| 839 | 839 | |
| 840 | 840 | |
| 841 | - query_posts($query_args); |
|
| 841 | + query_posts($query_args); |
|
| 842 | 842 | |
| 843 | - if (strstr($layout, 'gridview')) {
|
|
| 844 | - $listing_view_exp = explode('_', $layout);
|
|
| 845 | - $gridview_columns = $layout; |
|
| 846 | - $layout = $listing_view_exp[0]; |
|
| 847 | - } else if ($layout == 'list') {
|
|
| 848 | - $gridview_columns = ''; |
|
| 849 | - } |
|
| 850 | - $related_posts = true; |
|
| 851 | - |
|
| 852 | - /** |
|
| 853 | - * Filters related listing listview template. |
|
| 854 | - * |
|
| 855 | - * @since 1.0.0 |
|
| 856 | - */ |
|
| 857 | - $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 858 | - |
|
| 859 | - /** |
|
| 860 | - * Includes related listing listview template. |
|
| 861 | - * |
|
| 862 | - * @since 1.0.0 |
|
| 863 | - */ |
|
| 864 | - include($template); |
|
| 865 | - |
|
| 866 | - wp_reset_query(); |
|
| 867 | - $post = $origi_post; |
|
| 868 | - ?> |
|
| 843 | + if (strstr($layout, 'gridview')) {
|
|
| 844 | + $listing_view_exp = explode('_', $layout);
|
|
| 845 | + $gridview_columns = $layout; |
|
| 846 | + $layout = $listing_view_exp[0]; |
|
| 847 | + } else if ($layout == 'list') {
|
|
| 848 | + $gridview_columns = ''; |
|
| 849 | + } |
|
| 850 | + $related_posts = true; |
|
| 851 | + |
|
| 852 | + /** |
|
| 853 | + * Filters related listing listview template. |
|
| 854 | + * |
|
| 855 | + * @since 1.0.0 |
|
| 856 | + */ |
|
| 857 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 858 | + |
|
| 859 | + /** |
|
| 860 | + * Includes related listing listview template. |
|
| 861 | + * |
|
| 862 | + * @since 1.0.0 |
|
| 863 | + */ |
|
| 864 | + include($template); |
|
| 865 | + |
|
| 866 | + wp_reset_query(); |
|
| 867 | + $post = $origi_post; |
|
| 868 | + ?> |
|
| 869 | 869 | |
| 870 | 870 | </div> |
| 871 | 871 | <?php |
| 872 | - return $html = ob_get_clean(); |
|
| 872 | + return $html = ob_get_clean(); |
|
| 873 | 873 | |
| 874 | - } |
|
| 874 | + } |
|
| 875 | 875 | |
| 876 | 876 | } |
| 877 | 877 | |
@@ -887,17 +887,17 @@ discard block |
||
| 887 | 887 | */ |
| 888 | 888 | function geodir_category_count_script() |
| 889 | 889 | {
|
| 890 | - global $geodir_post_category_str; |
|
| 890 | + global $geodir_post_category_str; |
|
| 891 | 891 | |
| 892 | - if (!empty($geodir_post_category_str)) {
|
|
| 893 | - $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 894 | - } |
|
| 892 | + if (!empty($geodir_post_category_str)) {
|
|
| 893 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 894 | + } |
|
| 895 | 895 | |
| 896 | - $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 897 | - $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 898 | - echo '<script>'; |
|
| 899 | - echo $script; |
|
| 900 | - echo '</script>'; |
|
| 896 | + $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 897 | + $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 898 | + echo '<script>'; |
|
| 899 | + echo $script; |
|
| 900 | + echo '</script>'; |
|
| 901 | 901 | |
| 902 | 902 | } |
| 903 | 903 | |
@@ -910,16 +910,16 @@ discard block |
||
| 910 | 910 | */ |
| 911 | 911 | function geodir_get_map_default_language() |
| 912 | 912 | {
|
| 913 | - $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 914 | - if (empty($geodir_default_map_language)) |
|
| 915 | - $geodir_default_map_language = 'en'; |
|
| 916 | - /** |
|
| 917 | - * Filter default map language. |
|
| 918 | - * |
|
| 919 | - * @since 1.0.0 |
|
| 920 | - * @param string $geodir_default_map_language Default map language. |
|
| 921 | - */ |
|
| 922 | - return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 913 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 914 | + if (empty($geodir_default_map_language)) |
|
| 915 | + $geodir_default_map_language = 'en'; |
|
| 916 | + /** |
|
| 917 | + * Filter default map language. |
|
| 918 | + * |
|
| 919 | + * @since 1.0.0 |
|
| 920 | + * @param string $geodir_default_map_language Default map language. |
|
| 921 | + */ |
|
| 922 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | |
@@ -936,12 +936,12 @@ discard block |
||
| 936 | 936 | */ |
| 937 | 937 | function geodir_add_meta_keywords() |
| 938 | 938 | {
|
| 939 | - global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 939 | + global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 940 | 940 | |
| 941 | - $is_geodir_page = geodir_is_geodir_page(); |
|
| 942 | - if (!$is_geodir_page) {
|
|
| 943 | - return; |
|
| 944 | - }// if non GD page, bail |
|
| 941 | + $is_geodir_page = geodir_is_geodir_page(); |
|
| 942 | + if (!$is_geodir_page) {
|
|
| 943 | + return; |
|
| 944 | + }// if non GD page, bail |
|
| 945 | 945 | |
| 946 | 946 | $use_gd_meta = true; |
| 947 | 947 | if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
|
@@ -956,182 +956,182 @@ discard block |
||
| 956 | 956 | return; |
| 957 | 957 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
| 958 | 958 | |
| 959 | - $current_term = $wp_query->get_queried_object(); |
|
| 959 | + $current_term = $wp_query->get_queried_object(); |
|
| 960 | 960 | |
| 961 | - $all_postypes = geodir_get_posttypes(); |
|
| 961 | + $all_postypes = geodir_get_posttypes(); |
|
| 962 | 962 | |
| 963 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 963 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 964 | 964 | |
| 965 | - $meta_desc = ''; |
|
| 966 | - $meta_key = ''; |
|
| 967 | - if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 968 | - /** |
|
| 969 | - * Filter SEO meta location description. |
|
| 970 | - * |
|
| 971 | - * @since 1.0.0 |
|
| 972 | - */ |
|
| 973 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 974 | - $meta_desc .= ''; |
|
| 975 | - } |
|
| 976 | - if (have_posts() && is_single() OR is_page()) {
|
|
| 977 | - while (have_posts()) {
|
|
| 978 | - the_post(); |
|
| 979 | - |
|
| 980 | - if (has_excerpt()) {
|
|
| 981 | - $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 982 | - if (empty($out_excerpt)) {
|
|
| 983 | - $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 984 | - } |
|
| 985 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 986 | - } else {
|
|
| 987 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 988 | - $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 989 | - if (empty($out_excerpt)) {
|
|
| 990 | - $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 991 | - } |
|
| 992 | - $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 993 | - } |
|
| 965 | + $meta_desc = ''; |
|
| 966 | + $meta_key = ''; |
|
| 967 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 968 | + /** |
|
| 969 | + * Filter SEO meta location description. |
|
| 970 | + * |
|
| 971 | + * @since 1.0.0 |
|
| 972 | + */ |
|
| 973 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 974 | + $meta_desc .= ''; |
|
| 975 | + } |
|
| 976 | + if (have_posts() && is_single() OR is_page()) {
|
|
| 977 | + while (have_posts()) {
|
|
| 978 | + the_post(); |
|
| 979 | + |
|
| 980 | + if (has_excerpt()) {
|
|
| 981 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 982 | + if (empty($out_excerpt)) {
|
|
| 983 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 984 | + } |
|
| 985 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 986 | + } else {
|
|
| 987 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 988 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 989 | + if (empty($out_excerpt)) {
|
|
| 990 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 991 | + } |
|
| 992 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 993 | + } |
|
| 994 | 994 | |
| 995 | - $meta_desc .= $out_excerpt; |
|
| 996 | - } |
|
| 997 | - } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 998 | - if (is_category()) {
|
|
| 999 | - $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1000 | - } elseif (is_tag()) {
|
|
| 1001 | - $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1002 | - } |
|
| 1003 | - } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1004 | - $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1005 | - } |
|
| 995 | + $meta_desc .= $out_excerpt; |
|
| 996 | + } |
|
| 997 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 998 | + if (is_category()) {
|
|
| 999 | + $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1000 | + } elseif (is_tag()) {
|
|
| 1001 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1002 | + } |
|
| 1003 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1004 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1005 | + } |
|
| 1006 | 1006 | |
| 1007 | 1007 | |
| 1008 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 1009 | - $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1010 | - $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1011 | - |
|
| 1012 | - $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1013 | - $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1014 | - |
|
| 1015 | - $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1016 | - $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1017 | - |
|
| 1018 | - $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1019 | - $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1020 | - $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1021 | - $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1022 | - $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1023 | - $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1024 | - $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1025 | - $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1026 | - $location_id = NULL; |
|
| 1027 | - if ($geodir_location_manager) {
|
|
| 1028 | - $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1029 | - $location_id = (int)$wpdb->get_var($sql); |
|
| 1030 | - $location_type = geodir_what_is_current_location(); |
|
| 1031 | - if ($location_type == 'city') {
|
|
| 1032 | - $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1033 | - } elseif ($location_type == 'region') {
|
|
| 1034 | - $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1035 | - } elseif ($location_type == 'country') {
|
|
| 1036 | - $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1037 | - $replace_location = __($replace_location, 'geodirectory'); |
|
| 1038 | - } |
|
| 1039 | - $country = get_query_var('gd_country');
|
|
| 1040 | - $region = get_query_var('gd_region');
|
|
| 1041 | - $city = get_query_var('gd_city');
|
|
| 1042 | - $current_location = ''; |
|
| 1043 | - if ($country != '') {
|
|
| 1044 | - $current_location = get_actual_location_name('country', $country, true);
|
|
| 1045 | - } |
|
| 1046 | - if ($region != '') {
|
|
| 1047 | - $current_location = get_actual_location_name('region', $region);
|
|
| 1048 | - } |
|
| 1049 | - if ($city != '') {
|
|
| 1050 | - $current_location = get_actual_location_name('city', $city);
|
|
| 1051 | - } |
|
| 1052 | - $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1053 | - } |
|
| 1008 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 1009 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1010 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1011 | + |
|
| 1012 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1013 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1014 | + |
|
| 1015 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1016 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1017 | + |
|
| 1018 | + $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1019 | + $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1020 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1021 | + $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1022 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1023 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1024 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1025 | + $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1026 | + $location_id = NULL; |
|
| 1027 | + if ($geodir_location_manager) {
|
|
| 1028 | + $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1029 | + $location_id = (int)$wpdb->get_var($sql); |
|
| 1030 | + $location_type = geodir_what_is_current_location(); |
|
| 1031 | + if ($location_type == 'city') {
|
|
| 1032 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1033 | + } elseif ($location_type == 'region') {
|
|
| 1034 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1035 | + } elseif ($location_type == 'country') {
|
|
| 1036 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1037 | + $replace_location = __($replace_location, 'geodirectory'); |
|
| 1038 | + } |
|
| 1039 | + $country = get_query_var('gd_country');
|
|
| 1040 | + $region = get_query_var('gd_region');
|
|
| 1041 | + $city = get_query_var('gd_city');
|
|
| 1042 | + $current_location = ''; |
|
| 1043 | + if ($country != '') {
|
|
| 1044 | + $current_location = get_actual_location_name('country', $country, true);
|
|
| 1045 | + } |
|
| 1046 | + if ($region != '') {
|
|
| 1047 | + $current_location = get_actual_location_name('region', $region);
|
|
| 1048 | + } |
|
| 1049 | + if ($city != '') {
|
|
| 1050 | + $current_location = get_actual_location_name('city', $city);
|
|
| 1051 | + } |
|
| 1052 | + $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1053 | + } |
|
| 1054 | 1054 | |
| 1055 | - $geodir_meta_keys = ''; |
|
| 1056 | - $geodir_meta_desc = ''; |
|
| 1057 | - if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1058 | - if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1059 | - $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; |
|
| 1060 | - |
|
| 1061 | - $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1062 | - $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; |
|
| 1063 | - |
|
| 1064 | - if ($geodir_is_category) {
|
|
| 1065 | - $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1066 | - if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1067 | - $category_id = $category->term_id; |
|
| 1068 | - $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1069 | - if ($location_id) {
|
|
| 1070 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1071 | - $cat_loc_option = get_option($option_name); |
|
| 1072 | - |
|
| 1073 | - $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; |
|
| 1074 | - if (!$gd_cat_loc_default) {
|
|
| 1075 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1076 | - $option = get_option($option_name); |
|
| 1077 | - $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1078 | - } |
|
| 1079 | - } |
|
| 1080 | - $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1081 | - } |
|
| 1082 | - } else if ($geodir_is_tag) {
|
|
| 1083 | - $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1084 | - } |
|
| 1085 | - } |
|
| 1086 | - } |
|
| 1055 | + $geodir_meta_keys = ''; |
|
| 1056 | + $geodir_meta_desc = ''; |
|
| 1057 | + if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1058 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1059 | + $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; |
|
| 1060 | + |
|
| 1061 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1062 | + $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; |
|
| 1063 | + |
|
| 1064 | + if ($geodir_is_category) {
|
|
| 1065 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1066 | + if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1067 | + $category_id = $category->term_id; |
|
| 1068 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1069 | + if ($location_id) {
|
|
| 1070 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1071 | + $cat_loc_option = get_option($option_name); |
|
| 1072 | + |
|
| 1073 | + $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; |
|
| 1074 | + if (!$gd_cat_loc_default) {
|
|
| 1075 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1076 | + $option = get_option($option_name); |
|
| 1077 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1078 | + } |
|
| 1079 | + } |
|
| 1080 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1081 | + } |
|
| 1082 | + } else if ($geodir_is_tag) {
|
|
| 1083 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1084 | + } |
|
| 1085 | + } |
|
| 1086 | + } |
|
| 1087 | 1087 | |
| 1088 | 1088 | |
| 1089 | - $gd_page = ''; |
|
| 1090 | - if(geodir_is_page('home')){
|
|
| 1091 | - $gd_page = 'home'; |
|
| 1092 | - $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1093 | - } |
|
| 1094 | - elseif(geodir_is_page('detail')){
|
|
| 1095 | - $gd_page = 'detail'; |
|
| 1096 | - $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1097 | - } |
|
| 1098 | - elseif(geodir_is_page('pt')){
|
|
| 1099 | - $gd_page = 'pt'; |
|
| 1100 | - $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1101 | - } |
|
| 1102 | - elseif(geodir_is_page('listing')){
|
|
| 1103 | - $gd_page = 'listing'; |
|
| 1104 | - $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1105 | - } |
|
| 1106 | - elseif(geodir_is_page('location')){
|
|
| 1107 | - $gd_page = 'location'; |
|
| 1108 | - $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1109 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1089 | + $gd_page = ''; |
|
| 1090 | + if(geodir_is_page('home')){
|
|
| 1091 | + $gd_page = 'home'; |
|
| 1092 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1093 | + } |
|
| 1094 | + elseif(geodir_is_page('detail')){
|
|
| 1095 | + $gd_page = 'detail'; |
|
| 1096 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1097 | + } |
|
| 1098 | + elseif(geodir_is_page('pt')){
|
|
| 1099 | + $gd_page = 'pt'; |
|
| 1100 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1101 | + } |
|
| 1102 | + elseif(geodir_is_page('listing')){
|
|
| 1103 | + $gd_page = 'listing'; |
|
| 1104 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1105 | + } |
|
| 1106 | + elseif(geodir_is_page('location')){
|
|
| 1107 | + $gd_page = 'location'; |
|
| 1108 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1109 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1110 | 1110 | |
| 1111 | - } |
|
| 1112 | - elseif(geodir_is_page('search')){
|
|
| 1113 | - $gd_page = 'search'; |
|
| 1114 | - $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1115 | - } |
|
| 1116 | - elseif(geodir_is_page('add-listing')){
|
|
| 1117 | - $gd_page = 'add-listing'; |
|
| 1118 | - $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1119 | - } |
|
| 1120 | - elseif(geodir_is_page('author')){
|
|
| 1121 | - $gd_page = 'author'; |
|
| 1122 | - $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1123 | - } |
|
| 1124 | - elseif(geodir_is_page('login')){
|
|
| 1125 | - $gd_page = 'login'; |
|
| 1126 | - $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1127 | - } |
|
| 1128 | - elseif(geodir_is_page('listing-success')){
|
|
| 1129 | - $gd_page = 'listing-success'; |
|
| 1130 | - $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1131 | - } |
|
| 1111 | + } |
|
| 1112 | + elseif(geodir_is_page('search')){
|
|
| 1113 | + $gd_page = 'search'; |
|
| 1114 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1115 | + } |
|
| 1116 | + elseif(geodir_is_page('add-listing')){
|
|
| 1117 | + $gd_page = 'add-listing'; |
|
| 1118 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1119 | + } |
|
| 1120 | + elseif(geodir_is_page('author')){
|
|
| 1121 | + $gd_page = 'author'; |
|
| 1122 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1123 | + } |
|
| 1124 | + elseif(geodir_is_page('login')){
|
|
| 1125 | + $gd_page = 'login'; |
|
| 1126 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1127 | + } |
|
| 1128 | + elseif(geodir_is_page('listing-success')){
|
|
| 1129 | + $gd_page = 'listing-success'; |
|
| 1130 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1131 | + } |
|
| 1132 | 1132 | |
| 1133 | 1133 | |
| 1134 | - /* |
|
| 1134 | + /* |
|
| 1135 | 1135 | $geodir_meta_desc = $geodir_meta_desc != '' ? $geodir_meta_desc : $meta_desc; |
| 1136 | 1136 | if ($geodir_meta_desc != '') {
|
| 1137 | 1137 | $geodir_meta_desc = strip_tags($geodir_meta_desc); |
@@ -1144,74 +1144,74 @@ discard block |
||
| 1144 | 1144 | */ |
| 1145 | 1145 | |
| 1146 | 1146 | |
| 1147 | - if ($meta_desc) {
|
|
| 1148 | - $meta_desc = stripslashes_deep($meta_desc); |
|
| 1149 | - /** |
|
| 1150 | - * Filter page description to replace variables. |
|
| 1151 | - * |
|
| 1152 | - * @since 1.5.4 |
|
| 1153 | - * @param string $title The page description including variables. |
|
| 1154 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1155 | - */ |
|
| 1156 | - $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1157 | - |
|
| 1158 | - /** |
|
| 1159 | - * Filter SEO meta description. |
|
| 1160 | - * |
|
| 1161 | - * @since 1.0.0 |
|
| 1162 | - * @param string $meta_desc Meta description content. |
|
| 1163 | - */ |
|
| 1164 | - echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1165 | - } |
|
| 1147 | + if ($meta_desc) {
|
|
| 1148 | + $meta_desc = stripslashes_deep($meta_desc); |
|
| 1149 | + /** |
|
| 1150 | + * Filter page description to replace variables. |
|
| 1151 | + * |
|
| 1152 | + * @since 1.5.4 |
|
| 1153 | + * @param string $title The page description including variables. |
|
| 1154 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1155 | + */ |
|
| 1156 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1157 | + |
|
| 1158 | + /** |
|
| 1159 | + * Filter SEO meta description. |
|
| 1160 | + * |
|
| 1161 | + * @since 1.0.0 |
|
| 1162 | + * @param string $meta_desc Meta description content. |
|
| 1163 | + */ |
|
| 1164 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1165 | + } |
|
| 1166 | 1166 | |
| 1167 | - // meta keywords |
|
| 1168 | - if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1169 | - $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1170 | - $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1171 | - |
|
| 1172 | - $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1173 | - } else {
|
|
| 1174 | - $posttags = get_the_tags(); |
|
| 1175 | - if ($posttags) {
|
|
| 1176 | - foreach ($posttags as $tag) {
|
|
| 1177 | - $meta_key .= $tag->name . ' '; |
|
| 1178 | - } |
|
| 1179 | - } else {
|
|
| 1180 | - $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1181 | - $xt = 1; |
|
| 1167 | + // meta keywords |
|
| 1168 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1169 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1170 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1171 | + |
|
| 1172 | + $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1173 | + } else {
|
|
| 1174 | + $posttags = get_the_tags(); |
|
| 1175 | + if ($posttags) {
|
|
| 1176 | + foreach ($posttags as $tag) {
|
|
| 1177 | + $meta_key .= $tag->name . ' '; |
|
| 1178 | + } |
|
| 1179 | + } else {
|
|
| 1180 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1181 | + $xt = 1; |
|
| 1182 | 1182 | |
| 1183 | - foreach ($tags as $tag) {
|
|
| 1184 | - if ($xt <= 20) {
|
|
| 1185 | - $meta_key .= $tag->name . ", "; |
|
| 1186 | - } |
|
| 1183 | + foreach ($tags as $tag) {
|
|
| 1184 | + if ($xt <= 20) {
|
|
| 1185 | + $meta_key .= $tag->name . ", "; |
|
| 1186 | + } |
|
| 1187 | 1187 | |
| 1188 | - $xt++; |
|
| 1189 | - } |
|
| 1190 | - } |
|
| 1191 | - } |
|
| 1188 | + $xt++; |
|
| 1189 | + } |
|
| 1190 | + } |
|
| 1191 | + } |
|
| 1192 | 1192 | |
| 1193 | - $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1194 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1195 | - if ($geodir_meta_keys != '') {
|
|
| 1196 | - $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1197 | - $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1198 | - $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1199 | - $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1200 | - $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1193 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1194 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1195 | + if ($geodir_meta_keys != '') {
|
|
| 1196 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1197 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1198 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1199 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1200 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1201 | 1201 | |
| 1202 | - $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1203 | - } |
|
| 1202 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1203 | + } |
|
| 1204 | 1204 | |
| 1205 | - if ($meta_key) {
|
|
| 1206 | - $meta_key = stripslashes_deep($meta_key); |
|
| 1207 | - /** |
|
| 1208 | - * Filter SEO meta keywords. |
|
| 1209 | - * |
|
| 1210 | - * @since 1.0.0 |
|
| 1211 | - * @param string $meta_desc Meta keywords. |
|
| 1212 | - */ |
|
| 1213 | - echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1214 | - } |
|
| 1205 | + if ($meta_key) {
|
|
| 1206 | + $meta_key = stripslashes_deep($meta_key); |
|
| 1207 | + /** |
|
| 1208 | + * Filter SEO meta keywords. |
|
| 1209 | + * |
|
| 1210 | + * @since 1.0.0 |
|
| 1211 | + * @param string $meta_desc Meta keywords. |
|
| 1212 | + */ |
|
| 1213 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1214 | + } |
|
| 1215 | 1215 | |
| 1216 | 1216 | } |
| 1217 | 1217 | |
@@ -1226,14 +1226,14 @@ discard block |
||
| 1226 | 1226 | */ |
| 1227 | 1227 | function geodir_detail_page_tabs_key_value_array() |
| 1228 | 1228 | {
|
| 1229 | - $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1229 | + $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1230 | 1230 | |
| 1231 | - $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1231 | + $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1232 | 1232 | |
| 1233 | - foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1234 | - $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1235 | - } |
|
| 1236 | - return $geodir_detail_page_tabs_key_value_array; |
|
| 1233 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1234 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1235 | + } |
|
| 1236 | + return $geodir_detail_page_tabs_key_value_array; |
|
| 1237 | 1237 | } |
| 1238 | 1238 | |
| 1239 | 1239 | /** |
@@ -1246,73 +1246,73 @@ discard block |
||
| 1246 | 1246 | function geodir_detail_page_tabs_array() |
| 1247 | 1247 | {
|
| 1248 | 1248 | |
| 1249 | - $arr_tabs = array(); |
|
| 1250 | - /** |
|
| 1251 | - * Filter detail page tab display. |
|
| 1252 | - * |
|
| 1253 | - * @since 1.0.0 |
|
| 1254 | - */ |
|
| 1255 | - $arr_tabs['post_profile'] = array( |
|
| 1256 | - 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1257 | - 'is_active_tab' => true, |
|
| 1258 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1259 | - 'tab_content' => '' |
|
| 1260 | - ); |
|
| 1261 | - $arr_tabs['post_info'] = array( |
|
| 1262 | - 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1263 | - 'is_active_tab' => false, |
|
| 1264 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1265 | - 'tab_content' => '' |
|
| 1266 | - ); |
|
| 1267 | - |
|
| 1268 | - $arr_tabs['post_images'] = array( |
|
| 1269 | - 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1270 | - 'is_active_tab' => false, |
|
| 1271 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1272 | - 'tab_content' => '' |
|
| 1273 | - ); |
|
| 1274 | - |
|
| 1275 | - $arr_tabs['post_video'] = array( |
|
| 1276 | - 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1277 | - 'is_active_tab' => false, |
|
| 1278 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1279 | - 'tab_content' => '' |
|
| 1280 | - ); |
|
| 1281 | - |
|
| 1282 | - $arr_tabs['special_offers'] = array( |
|
| 1283 | - 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1284 | - 'is_active_tab' => false, |
|
| 1285 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1286 | - 'tab_content' => '' |
|
| 1287 | - ); |
|
| 1288 | - |
|
| 1289 | - $arr_tabs['post_map'] = array( |
|
| 1290 | - 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1291 | - 'is_active_tab' => false, |
|
| 1292 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1293 | - 'tab_content' => '' |
|
| 1294 | - ); |
|
| 1295 | - |
|
| 1296 | - $arr_tabs['reviews'] = array( |
|
| 1297 | - 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1298 | - 'is_active_tab' => false, |
|
| 1299 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1300 | - 'tab_content' => 'review display' |
|
| 1301 | - ); |
|
| 1302 | - |
|
| 1303 | - $arr_tabs['related_listing'] = array( |
|
| 1304 | - 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1305 | - 'is_active_tab' => false, |
|
| 1306 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1307 | - 'tab_content' => '' |
|
| 1308 | - ); |
|
| 1309 | - |
|
| 1310 | - /** |
|
| 1311 | - * Filter the tabs array. |
|
| 1312 | - * |
|
| 1313 | - * @since 1.0.0 |
|
| 1314 | - */ |
|
| 1315 | - return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1249 | + $arr_tabs = array(); |
|
| 1250 | + /** |
|
| 1251 | + * Filter detail page tab display. |
|
| 1252 | + * |
|
| 1253 | + * @since 1.0.0 |
|
| 1254 | + */ |
|
| 1255 | + $arr_tabs['post_profile'] = array( |
|
| 1256 | + 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1257 | + 'is_active_tab' => true, |
|
| 1258 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1259 | + 'tab_content' => '' |
|
| 1260 | + ); |
|
| 1261 | + $arr_tabs['post_info'] = array( |
|
| 1262 | + 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1263 | + 'is_active_tab' => false, |
|
| 1264 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1265 | + 'tab_content' => '' |
|
| 1266 | + ); |
|
| 1267 | + |
|
| 1268 | + $arr_tabs['post_images'] = array( |
|
| 1269 | + 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1270 | + 'is_active_tab' => false, |
|
| 1271 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1272 | + 'tab_content' => '' |
|
| 1273 | + ); |
|
| 1274 | + |
|
| 1275 | + $arr_tabs['post_video'] = array( |
|
| 1276 | + 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1277 | + 'is_active_tab' => false, |
|
| 1278 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1279 | + 'tab_content' => '' |
|
| 1280 | + ); |
|
| 1281 | + |
|
| 1282 | + $arr_tabs['special_offers'] = array( |
|
| 1283 | + 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1284 | + 'is_active_tab' => false, |
|
| 1285 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1286 | + 'tab_content' => '' |
|
| 1287 | + ); |
|
| 1288 | + |
|
| 1289 | + $arr_tabs['post_map'] = array( |
|
| 1290 | + 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1291 | + 'is_active_tab' => false, |
|
| 1292 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1293 | + 'tab_content' => '' |
|
| 1294 | + ); |
|
| 1295 | + |
|
| 1296 | + $arr_tabs['reviews'] = array( |
|
| 1297 | + 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1298 | + 'is_active_tab' => false, |
|
| 1299 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1300 | + 'tab_content' => 'review display' |
|
| 1301 | + ); |
|
| 1302 | + |
|
| 1303 | + $arr_tabs['related_listing'] = array( |
|
| 1304 | + 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1305 | + 'is_active_tab' => false, |
|
| 1306 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1307 | + 'tab_content' => '' |
|
| 1308 | + ); |
|
| 1309 | + |
|
| 1310 | + /** |
|
| 1311 | + * Filter the tabs array. |
|
| 1312 | + * |
|
| 1313 | + * @since 1.0.0 |
|
| 1314 | + */ |
|
| 1315 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1316 | 1316 | |
| 1317 | 1317 | |
| 1318 | 1318 | } |
@@ -1327,15 +1327,15 @@ discard block |
||
| 1327 | 1327 | */ |
| 1328 | 1328 | function geodir_detail_page_tabs_list() |
| 1329 | 1329 | {
|
| 1330 | - $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1331 | - $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1332 | - if (!empty($tabs_excluded)) {
|
|
| 1333 | - foreach ($tabs_excluded as $tab) {
|
|
| 1334 | - if (array_key_exists($tab, $tabs_array)) |
|
| 1335 | - unset($tabs_array[$tab]); |
|
| 1336 | - } |
|
| 1337 | - } |
|
| 1338 | - return $tabs_array; |
|
| 1330 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1331 | + $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1332 | + if (!empty($tabs_excluded)) {
|
|
| 1333 | + foreach ($tabs_excluded as $tab) {
|
|
| 1334 | + if (array_key_exists($tab, $tabs_array)) |
|
| 1335 | + unset($tabs_array[$tab]); |
|
| 1336 | + } |
|
| 1337 | + } |
|
| 1338 | + return $tabs_array; |
|
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | |
@@ -1353,156 +1353,156 @@ discard block |
||
| 1353 | 1353 | */ |
| 1354 | 1354 | function geodir_show_detail_page_tabs() |
| 1355 | 1355 | {
|
| 1356 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1356 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1357 | 1357 | |
| 1358 | - $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1359 | - $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1360 | - $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 |
|
| 1358 | + $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1359 | + $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1360 | + $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 |
|
| 1361 | 1361 | |
| 1362 | - if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1363 | - $post = geodir_get_post_info($request_post_id); |
|
| 1364 | - setup_postdata($post); |
|
| 1365 | - } |
|
| 1362 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1363 | + $post = geodir_get_post_info($request_post_id); |
|
| 1364 | + setup_postdata($post); |
|
| 1365 | + } |
|
| 1366 | 1366 | |
| 1367 | - $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1368 | - |
|
| 1369 | - if (geodir_is_page('detail')) {
|
|
| 1370 | - $video = geodir_get_video($post->ID); |
|
| 1371 | - $special_offers = geodir_get_special_offers($post->ID); |
|
| 1372 | - $related_listing_array = array(); |
|
| 1373 | - if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1374 | - $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1375 | - |
|
| 1376 | - $related_listing = ''; |
|
| 1377 | - if (in_array($post->post_type, $related_listing_array)) {
|
|
| 1378 | - $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1379 | - 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1380 | - 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1381 | - 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1382 | - 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1383 | - 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1384 | - |
|
| 1385 | - if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1386 | - $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1387 | - } else {
|
|
| 1388 | - $related_listing = geodir_related_posts_display($request); |
|
| 1389 | - } |
|
| 1367 | + $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1368 | + |
|
| 1369 | + if (geodir_is_page('detail')) {
|
|
| 1370 | + $video = geodir_get_video($post->ID); |
|
| 1371 | + $special_offers = geodir_get_special_offers($post->ID); |
|
| 1372 | + $related_listing_array = array(); |
|
| 1373 | + if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1374 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1375 | + |
|
| 1376 | + $related_listing = ''; |
|
| 1377 | + if (in_array($post->post_type, $related_listing_array)) {
|
|
| 1378 | + $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1379 | + 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1380 | + 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1381 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1382 | + 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1383 | + 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1384 | + |
|
| 1385 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1386 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1387 | + } else {
|
|
| 1388 | + $related_listing = geodir_related_posts_display($request); |
|
| 1389 | + } |
|
| 1390 | 1390 | |
| 1391 | - } |
|
| 1391 | + } |
|
| 1392 | 1392 | |
| 1393 | - $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1394 | - $thumb_image = ''; |
|
| 1395 | - if (!empty($post_images)) {
|
|
| 1396 | - foreach ($post_images as $image) {
|
|
| 1397 | - $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1398 | - $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1399 | - $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1400 | - $thumb_image .= '</a>'; |
|
| 1401 | - } |
|
| 1402 | - } |
|
| 1393 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1394 | + $thumb_image = ''; |
|
| 1395 | + if (!empty($post_images)) {
|
|
| 1396 | + foreach ($post_images as $image) {
|
|
| 1397 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1398 | + $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1399 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1400 | + $thumb_image .= '</a>'; |
|
| 1401 | + } |
|
| 1402 | + } |
|
| 1403 | 1403 | |
| 1404 | - $map_args = array(); |
|
| 1405 | - $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1406 | - $map_args['width'] = '600'; |
|
| 1407 | - $map_args['height'] = '300'; |
|
| 1408 | - if ($post->post_mapzoom) {
|
|
| 1409 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1410 | - } |
|
| 1411 | - $map_args['autozoom'] = false; |
|
| 1412 | - $map_args['child_collapse'] = '0'; |
|
| 1413 | - $map_args['enable_cat_filters'] = false; |
|
| 1414 | - $map_args['enable_text_search'] = false; |
|
| 1415 | - $map_args['enable_post_type_filters'] = false; |
|
| 1416 | - $map_args['enable_location_filters'] = false; |
|
| 1417 | - $map_args['enable_jason_on_load'] = true; |
|
| 1418 | - $map_args['enable_map_direction'] = true; |
|
| 1419 | - $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1420 | - $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1421 | - } else if (geodir_is_page('preview')) {
|
|
| 1422 | - $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1423 | - $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1424 | - |
|
| 1425 | - if (isset($post->post_images)) |
|
| 1426 | - $post->post_images = trim($post->post_images, ","); |
|
| 1427 | - |
|
| 1428 | - if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1429 | - $post_images = explode(",", $post->post_images);
|
|
| 1430 | - |
|
| 1431 | - $thumb_image = ''; |
|
| 1432 | - if (!empty($post_images)) {
|
|
| 1433 | - foreach ($post_images as $image) {
|
|
| 1434 | - if ($image != '') {
|
|
| 1435 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1436 | - $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1437 | - $thumb_image .= '</a>'; |
|
| 1438 | - } |
|
| 1439 | - } |
|
| 1440 | - } |
|
| 1404 | + $map_args = array(); |
|
| 1405 | + $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1406 | + $map_args['width'] = '600'; |
|
| 1407 | + $map_args['height'] = '300'; |
|
| 1408 | + if ($post->post_mapzoom) {
|
|
| 1409 | + $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1410 | + } |
|
| 1411 | + $map_args['autozoom'] = false; |
|
| 1412 | + $map_args['child_collapse'] = '0'; |
|
| 1413 | + $map_args['enable_cat_filters'] = false; |
|
| 1414 | + $map_args['enable_text_search'] = false; |
|
| 1415 | + $map_args['enable_post_type_filters'] = false; |
|
| 1416 | + $map_args['enable_location_filters'] = false; |
|
| 1417 | + $map_args['enable_jason_on_load'] = true; |
|
| 1418 | + $map_args['enable_map_direction'] = true; |
|
| 1419 | + $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1420 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1421 | + } else if (geodir_is_page('preview')) {
|
|
| 1422 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1423 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1424 | + |
|
| 1425 | + if (isset($post->post_images)) |
|
| 1426 | + $post->post_images = trim($post->post_images, ","); |
|
| 1427 | + |
|
| 1428 | + if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1429 | + $post_images = explode(",", $post->post_images);
|
|
| 1430 | + |
|
| 1431 | + $thumb_image = ''; |
|
| 1432 | + if (!empty($post_images)) {
|
|
| 1433 | + foreach ($post_images as $image) {
|
|
| 1434 | + if ($image != '') {
|
|
| 1435 | + $thumb_image .= '<a href="' . $image . '">'; |
|
| 1436 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1437 | + $thumb_image .= '</a>'; |
|
| 1438 | + } |
|
| 1439 | + } |
|
| 1440 | + } |
|
| 1441 | 1441 | |
| 1442 | - global $map_jason; |
|
| 1443 | - $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1444 | - $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1445 | - $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1446 | - $marker_json['w'] = $icon_size['w']; |
|
| 1447 | - $marker_json['h'] = $icon_size['h']; |
|
| 1448 | - $map_jason[] = json_encode($marker_json); |
|
| 1449 | - |
|
| 1450 | - $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1451 | - $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1452 | - $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1453 | - $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1454 | - if (!$mapzoom) {
|
|
| 1455 | - $mapzoom = 12; |
|
| 1456 | - } |
|
| 1442 | + global $map_jason; |
|
| 1443 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1444 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1445 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1446 | + $marker_json['w'] = $icon_size['w']; |
|
| 1447 | + $marker_json['h'] = $icon_size['h']; |
|
| 1448 | + $map_jason[] = json_encode($marker_json); |
|
| 1449 | + |
|
| 1450 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1451 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1452 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1453 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1454 | + if (!$mapzoom) {
|
|
| 1455 | + $mapzoom = 12; |
|
| 1456 | + } |
|
| 1457 | 1457 | |
| 1458 | - $map_args = array(); |
|
| 1459 | - $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1460 | - $map_args['width'] = '950'; |
|
| 1461 | - $map_args['height'] = '300'; |
|
| 1462 | - $map_args['child_collapse'] = '0'; |
|
| 1463 | - $map_args['maptype'] = $mapview; |
|
| 1464 | - $map_args['autozoom'] = false; |
|
| 1465 | - $map_args['zoom'] = "$mapzoom"; |
|
| 1466 | - $map_args['latitude'] = $address_latitude; |
|
| 1467 | - $map_args['longitude'] = $address_longitude; |
|
| 1468 | - $map_args['enable_cat_filters'] = false; |
|
| 1469 | - $map_args['enable_text_search'] = false; |
|
| 1470 | - $map_args['enable_post_type_filters'] = false; |
|
| 1471 | - $map_args['enable_location_filters'] = false; |
|
| 1472 | - $map_args['enable_jason_on_load'] = true; |
|
| 1473 | - $map_args['enable_map_direction'] = true; |
|
| 1474 | - $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1475 | - } |
|
| 1458 | + $map_args = array(); |
|
| 1459 | + $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1460 | + $map_args['width'] = '950'; |
|
| 1461 | + $map_args['height'] = '300'; |
|
| 1462 | + $map_args['child_collapse'] = '0'; |
|
| 1463 | + $map_args['maptype'] = $mapview; |
|
| 1464 | + $map_args['autozoom'] = false; |
|
| 1465 | + $map_args['zoom'] = "$mapzoom"; |
|
| 1466 | + $map_args['latitude'] = $address_latitude; |
|
| 1467 | + $map_args['longitude'] = $address_longitude; |
|
| 1468 | + $map_args['enable_cat_filters'] = false; |
|
| 1469 | + $map_args['enable_text_search'] = false; |
|
| 1470 | + $map_args['enable_post_type_filters'] = false; |
|
| 1471 | + $map_args['enable_location_filters'] = false; |
|
| 1472 | + $map_args['enable_jason_on_load'] = true; |
|
| 1473 | + $map_args['enable_map_direction'] = true; |
|
| 1474 | + $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1475 | + } |
|
| 1476 | 1476 | |
| 1477 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1477 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1478 | 1478 | |
| 1479 | - $active_tab = ''; |
|
| 1480 | - $active_tab_name = ''; |
|
| 1481 | - $default_tab = ''; |
|
| 1482 | - $default_tab_name = ''; |
|
| 1483 | - foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1484 | - if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1485 | - $active_tab = $tab_index; |
|
| 1486 | - $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1487 | - } |
|
| 1479 | + $active_tab = ''; |
|
| 1480 | + $active_tab_name = ''; |
|
| 1481 | + $default_tab = ''; |
|
| 1482 | + $default_tab_name = ''; |
|
| 1483 | + foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1484 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1485 | + $active_tab = $tab_index; |
|
| 1486 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1487 | + } |
|
| 1488 | 1488 | |
| 1489 | - if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1490 | - $default_tab = $tab_index; |
|
| 1491 | - $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1492 | - } |
|
| 1493 | - } |
|
| 1489 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1490 | + $default_tab = $tab_index; |
|
| 1491 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1492 | + } |
|
| 1493 | + } |
|
| 1494 | 1494 | |
| 1495 | - if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1496 | - if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1497 | - $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1498 | - } |
|
| 1495 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1496 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1497 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1498 | + } |
|
| 1499 | 1499 | |
| 1500 | - $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1501 | - $active_tab = $default_tab; |
|
| 1502 | - $active_tab_name = $default_tab_name; |
|
| 1503 | - } |
|
| 1504 | - $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1505 | - ?> |
|
| 1500 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1501 | + $active_tab = $default_tab; |
|
| 1502 | + $active_tab_name = $default_tab_name; |
|
| 1503 | + } |
|
| 1504 | + $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1505 | + ?> |
|
| 1506 | 1506 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1507 | 1507 | <?php if(!$tab_list){ ?>
|
| 1508 | 1508 | <div id="geodir-tab-mobile-menu"> |
@@ -1512,166 +1512,166 @@ discard block |
||
| 1512 | 1512 | </div> |
| 1513 | 1513 | <dl class="geodir-tab-head"> |
| 1514 | 1514 | <?php |
| 1515 | - } |
|
| 1516 | - /** |
|
| 1517 | - * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1518 | - * |
|
| 1519 | - * @since 1.0.0 |
|
| 1520 | - * @see 'geodir_after_tab_list' |
|
| 1521 | - */ |
|
| 1522 | - do_action('geodir_before_tab_list'); ?>
|
|
| 1515 | + } |
|
| 1516 | + /** |
|
| 1517 | + * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1518 | + * |
|
| 1519 | + * @since 1.0.0 |
|
| 1520 | + * @see 'geodir_after_tab_list' |
|
| 1521 | + */ |
|
| 1522 | + do_action('geodir_before_tab_list'); ?>
|
|
| 1523 | 1523 | <?php |
| 1524 | 1524 | |
| 1525 | - foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1526 | - if ($detail_page_tab['is_display']) {
|
|
| 1525 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1526 | + if ($detail_page_tab['is_display']) {
|
|
| 1527 | 1527 | |
| 1528 | - if(!$tab_list) {
|
|
| 1529 | - ?> |
|
| 1528 | + if(!$tab_list) {
|
|
| 1529 | + ?> |
|
| 1530 | 1530 | <dt></dt> <!-- added to comply with validation --> |
| 1531 | 1531 | <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
|
| 1532 | 1532 | data-tab="#<?php echo $tab_index; ?>" |
| 1533 | 1533 | data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
| 1534 | 1534 | </dd> |
| 1535 | 1535 | <?php |
| 1536 | - } |
|
| 1537 | - ob_start() // start tab content buffering |
|
| 1538 | - ?> |
|
| 1536 | + } |
|
| 1537 | + ob_start() // start tab content buffering |
|
| 1538 | + ?> |
|
| 1539 | 1539 | <li id="<?php echo $tab_index;?>Tab"> |
| 1540 | 1540 | <?php if($tab_list){
|
| 1541 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1542 | - /** |
|
| 1543 | - * Filter the tab list title html. |
|
| 1544 | - * |
|
| 1545 | - * @since 1.6.1 |
|
| 1546 | - * @param string $tab_title The html for the tab title. |
|
| 1547 | - * @param string $tab_index The tab index type. |
|
| 1548 | - * @param array $detail_page_tab The array of values including title text. |
|
| 1549 | - */ |
|
| 1550 | - echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1551 | - }?> |
|
| 1541 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1542 | + /** |
|
| 1543 | + * Filter the tab list title html. |
|
| 1544 | + * |
|
| 1545 | + * @since 1.6.1 |
|
| 1546 | + * @param string $tab_title The html for the tab title. |
|
| 1547 | + * @param string $tab_index The tab index type. |
|
| 1548 | + * @param array $detail_page_tab The array of values including title text. |
|
| 1549 | + */ |
|
| 1550 | + echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1551 | + }?> |
|
| 1552 | 1552 | <div id="<?php echo $tab_index;?>" class="hash-offset"></div> |
| 1553 | 1553 | <?php |
| 1554 | - /** |
|
| 1555 | - * Called before the details tab content is output per tab. |
|
| 1556 | - * |
|
| 1557 | - * @since 1.0.0 |
|
| 1558 | - * @param string $tab_index The tab name ID. |
|
| 1559 | - */ |
|
| 1560 | - do_action('geodir_before_tab_content', $tab_index);
|
|
| 1561 | - |
|
| 1562 | - /** |
|
| 1563 | - * Called before the details tab content is output per tab. |
|
| 1564 | - * |
|
| 1565 | - * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1566 | - * |
|
| 1567 | - * @since 1.0.0 |
|
| 1568 | - * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1569 | - */ |
|
| 1570 | - do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1571 | - /// write a code to generate content of each tab |
|
| 1572 | - switch ($tab_index) {
|
|
| 1573 | - case 'post_profile': |
|
| 1574 | - /** |
|
| 1575 | - * Called before the listing description content on the details page tab. |
|
| 1576 | - * |
|
| 1577 | - * @since 1.0.0 |
|
| 1578 | - */ |
|
| 1579 | - do_action('geodir_before_description_on_listing_detail');
|
|
| 1580 | - if (geodir_is_page('detail')) {
|
|
| 1581 | - the_content(); |
|
| 1582 | - } else {
|
|
| 1583 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1584 | - echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1585 | - } |
|
| 1586 | - |
|
| 1587 | - /** |
|
| 1588 | - * Called after the listing description content on the details page tab. |
|
| 1589 | - * |
|
| 1590 | - * @since 1.0.0 |
|
| 1591 | - */ |
|
| 1592 | - do_action('geodir_after_description_on_listing_detail');
|
|
| 1593 | - break; |
|
| 1594 | - case 'post_info': |
|
| 1595 | - echo $geodir_post_detail_fields; |
|
| 1596 | - break; |
|
| 1597 | - case 'post_images': |
|
| 1598 | - echo $thumb_image; |
|
| 1599 | - break; |
|
| 1600 | - case 'post_video': |
|
| 1601 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1602 | - echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1603 | - break; |
|
| 1604 | - case 'special_offers': |
|
| 1605 | - echo wpautop(stripslashes($special_offers)); |
|
| 1606 | - |
|
| 1607 | - break; |
|
| 1608 | - case 'post_map': |
|
| 1609 | - geodir_draw_map($map_args); |
|
| 1610 | - break; |
|
| 1611 | - case 'reviews': |
|
| 1612 | - comments_template(); |
|
| 1613 | - break; |
|
| 1614 | - case 'related_listing': |
|
| 1615 | - echo $related_listing; |
|
| 1616 | - break; |
|
| 1617 | - default: {
|
|
| 1618 | - 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'])) {
|
|
| 1619 | - echo $detail_page_tab['tab_content']; |
|
| 1620 | - } |
|
| 1621 | - } |
|
| 1622 | - break; |
|
| 1623 | - } |
|
| 1624 | - |
|
| 1625 | - /** |
|
| 1626 | - * Called after the details tab content is output per tab. |
|
| 1627 | - * |
|
| 1628 | - * @since 1.0.0 |
|
| 1629 | - */ |
|
| 1630 | - do_action('geodir_after_tab_content', $tab_index);
|
|
| 1631 | - |
|
| 1632 | - /** |
|
| 1633 | - * Called after the details tab content is output per tab. |
|
| 1634 | - * |
|
| 1635 | - * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1636 | - * |
|
| 1637 | - * @since 1.0.0 |
|
| 1638 | - * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1639 | - */ |
|
| 1640 | - do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1641 | - ?> </li> |
|
| 1554 | + /** |
|
| 1555 | + * Called before the details tab content is output per tab. |
|
| 1556 | + * |
|
| 1557 | + * @since 1.0.0 |
|
| 1558 | + * @param string $tab_index The tab name ID. |
|
| 1559 | + */ |
|
| 1560 | + do_action('geodir_before_tab_content', $tab_index);
|
|
| 1561 | + |
|
| 1562 | + /** |
|
| 1563 | + * Called before the details tab content is output per tab. |
|
| 1564 | + * |
|
| 1565 | + * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1566 | + * |
|
| 1567 | + * @since 1.0.0 |
|
| 1568 | + * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1569 | + */ |
|
| 1570 | + do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1571 | + /// write a code to generate content of each tab |
|
| 1572 | + switch ($tab_index) {
|
|
| 1573 | + case 'post_profile': |
|
| 1574 | + /** |
|
| 1575 | + * Called before the listing description content on the details page tab. |
|
| 1576 | + * |
|
| 1577 | + * @since 1.0.0 |
|
| 1578 | + */ |
|
| 1579 | + do_action('geodir_before_description_on_listing_detail');
|
|
| 1580 | + if (geodir_is_page('detail')) {
|
|
| 1581 | + the_content(); |
|
| 1582 | + } else {
|
|
| 1583 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1584 | + echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1585 | + } |
|
| 1586 | + |
|
| 1587 | + /** |
|
| 1588 | + * Called after the listing description content on the details page tab. |
|
| 1589 | + * |
|
| 1590 | + * @since 1.0.0 |
|
| 1591 | + */ |
|
| 1592 | + do_action('geodir_after_description_on_listing_detail');
|
|
| 1593 | + break; |
|
| 1594 | + case 'post_info': |
|
| 1595 | + echo $geodir_post_detail_fields; |
|
| 1596 | + break; |
|
| 1597 | + case 'post_images': |
|
| 1598 | + echo $thumb_image; |
|
| 1599 | + break; |
|
| 1600 | + case 'post_video': |
|
| 1601 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1602 | + echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1603 | + break; |
|
| 1604 | + case 'special_offers': |
|
| 1605 | + echo wpautop(stripslashes($special_offers)); |
|
| 1606 | + |
|
| 1607 | + break; |
|
| 1608 | + case 'post_map': |
|
| 1609 | + geodir_draw_map($map_args); |
|
| 1610 | + break; |
|
| 1611 | + case 'reviews': |
|
| 1612 | + comments_template(); |
|
| 1613 | + break; |
|
| 1614 | + case 'related_listing': |
|
| 1615 | + echo $related_listing; |
|
| 1616 | + break; |
|
| 1617 | + default: {
|
|
| 1618 | + 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'])) {
|
|
| 1619 | + echo $detail_page_tab['tab_content']; |
|
| 1620 | + } |
|
| 1621 | + } |
|
| 1622 | + break; |
|
| 1623 | + } |
|
| 1624 | + |
|
| 1625 | + /** |
|
| 1626 | + * Called after the details tab content is output per tab. |
|
| 1627 | + * |
|
| 1628 | + * @since 1.0.0 |
|
| 1629 | + */ |
|
| 1630 | + do_action('geodir_after_tab_content', $tab_index);
|
|
| 1631 | + |
|
| 1632 | + /** |
|
| 1633 | + * Called after the details tab content is output per tab. |
|
| 1634 | + * |
|
| 1635 | + * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1636 | + * |
|
| 1637 | + * @since 1.0.0 |
|
| 1638 | + * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1639 | + */ |
|
| 1640 | + do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1641 | + ?> </li> |
|
| 1642 | 1642 | <?php |
| 1643 | - /** |
|
| 1644 | - * Filter the current tab content. |
|
| 1645 | - * |
|
| 1646 | - * @since 1.0.0 |
|
| 1647 | - */ |
|
| 1648 | - $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1649 | - } // end of if for is_display |
|
| 1650 | - }// end of foreach |
|
| 1651 | - |
|
| 1652 | - /** |
|
| 1653 | - * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1654 | - * |
|
| 1655 | - * @since 1.0.0 |
|
| 1656 | - * @see 'geodir_before_tab_list' |
|
| 1657 | - */ |
|
| 1658 | - do_action('geodir_after_tab_list');
|
|
| 1659 | - ?> |
|
| 1643 | + /** |
|
| 1644 | + * Filter the current tab content. |
|
| 1645 | + * |
|
| 1646 | + * @since 1.0.0 |
|
| 1647 | + */ |
|
| 1648 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1649 | + } // end of if for is_display |
|
| 1650 | + }// end of foreach |
|
| 1651 | + |
|
| 1652 | + /** |
|
| 1653 | + * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1654 | + * |
|
| 1655 | + * @since 1.0.0 |
|
| 1656 | + * @see 'geodir_before_tab_list' |
|
| 1657 | + */ |
|
| 1658 | + do_action('geodir_after_tab_list');
|
|
| 1659 | + ?> |
|
| 1660 | 1660 | <?php if(!$tab_list){?></dl><?php }?>
|
| 1661 | 1661 | <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
|
| 1662 | 1662 | <?php |
| 1663 | - foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1664 | - if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1665 | - echo $detail_page_tab['tab_content']; |
|
| 1666 | - }// end of if |
|
| 1667 | - }// end of foreach |
|
| 1668 | - |
|
| 1669 | - /** |
|
| 1670 | - * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1671 | - * |
|
| 1672 | - * @since 1.0.0 |
|
| 1673 | - */ |
|
| 1674 | - do_action('geodir_add_tab_content'); ?>
|
|
| 1663 | + foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1664 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1665 | + echo $detail_page_tab['tab_content']; |
|
| 1666 | + }// end of if |
|
| 1667 | + }// end of foreach |
|
| 1668 | + |
|
| 1669 | + /** |
|
| 1670 | + * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1671 | + * |
|
| 1672 | + * @since 1.0.0 |
|
| 1673 | + */ |
|
| 1674 | + do_action('geodir_add_tab_content'); ?>
|
|
| 1675 | 1675 | </ul> |
| 1676 | 1676 | <!--gd-tabs-content ul end--> |
| 1677 | 1677 | </div> |
@@ -1694,7 +1694,7 @@ discard block |
||
| 1694 | 1694 | }); |
| 1695 | 1695 | </script> |
| 1696 | 1696 | <?php |
| 1697 | - } |
|
| 1697 | + } |
|
| 1698 | 1698 | } |
| 1699 | 1699 | |
| 1700 | 1700 | /** |
@@ -1707,127 +1707,127 @@ discard block |
||
| 1707 | 1707 | */ |
| 1708 | 1708 | function geodir_exif($file) |
| 1709 | 1709 | {
|
| 1710 | - if (empty($file) || !is_array($file)) {
|
|
| 1711 | - return $file; |
|
| 1712 | - } |
|
| 1710 | + if (empty($file) || !is_array($file)) {
|
|
| 1711 | + return $file; |
|
| 1712 | + } |
|
| 1713 | 1713 | |
| 1714 | - $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1715 | - if (!($file_path && file_exists($file_path))) {
|
|
| 1716 | - return $file; |
|
| 1717 | - } |
|
| 1718 | - $file['file'] = $file_path; |
|
| 1714 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1715 | + if (!($file_path && file_exists($file_path))) {
|
|
| 1716 | + return $file; |
|
| 1717 | + } |
|
| 1718 | + $file['file'] = $file_path; |
|
| 1719 | 1719 | |
| 1720 | - if (!file_is_valid_image($file_path)) {
|
|
| 1721 | - return $file; // Bail if file is not an image. |
|
| 1722 | - } |
|
| 1720 | + if (!file_is_valid_image($file_path)) {
|
|
| 1721 | + return $file; // Bail if file is not an image. |
|
| 1722 | + } |
|
| 1723 | 1723 | |
| 1724 | - if (!function_exists('wp_get_image_editor')) {
|
|
| 1725 | - return $file; |
|
| 1726 | - } |
|
| 1724 | + if (!function_exists('wp_get_image_editor')) {
|
|
| 1725 | + return $file; |
|
| 1726 | + } |
|
| 1727 | 1727 | |
| 1728 | - $mime_type = $file['type']; |
|
| 1729 | - $exif = array(); |
|
| 1730 | - if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1731 | - try {
|
|
| 1732 | - $exif = exif_read_data($file_path); |
|
| 1733 | - } catch(Exception $e) {
|
|
| 1734 | - $exif = array(); |
|
| 1735 | - } |
|
| 1736 | - } |
|
| 1728 | + $mime_type = $file['type']; |
|
| 1729 | + $exif = array(); |
|
| 1730 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1731 | + try {
|
|
| 1732 | + $exif = exif_read_data($file_path); |
|
| 1733 | + } catch(Exception $e) {
|
|
| 1734 | + $exif = array(); |
|
| 1735 | + } |
|
| 1736 | + } |
|
| 1737 | 1737 | |
| 1738 | - $rotate = false; |
|
| 1739 | - $flip = false; |
|
| 1740 | - $modify = false; |
|
| 1741 | - $orientation = 0; |
|
| 1742 | - if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1743 | - switch ((int)$exif['Orientation']) {
|
|
| 1744 | - case 1: |
|
| 1745 | - // do nothing |
|
| 1746 | - break; |
|
| 1747 | - case 2: |
|
| 1748 | - $flip = array(false, true); |
|
| 1749 | - $modify = true; |
|
| 1750 | - break; |
|
| 1751 | - case 3: |
|
| 1752 | - $orientation = -180; |
|
| 1753 | - $rotate = true; |
|
| 1754 | - $modify = true; |
|
| 1755 | - break; |
|
| 1756 | - case 4: |
|
| 1757 | - $flip = array(true, false); |
|
| 1758 | - $modify = true; |
|
| 1759 | - break; |
|
| 1760 | - case 5: |
|
| 1761 | - $orientation = -90; |
|
| 1762 | - $rotate = true; |
|
| 1763 | - $flip = array(false, true); |
|
| 1764 | - $modify = true; |
|
| 1765 | - break; |
|
| 1766 | - case 6: |
|
| 1767 | - $orientation = -90; |
|
| 1768 | - $rotate = true; |
|
| 1769 | - $modify = true; |
|
| 1770 | - break; |
|
| 1771 | - case 7: |
|
| 1772 | - $orientation = -270; |
|
| 1773 | - $rotate = true; |
|
| 1774 | - $flip = array(false, true); |
|
| 1775 | - $modify = true; |
|
| 1776 | - break; |
|
| 1777 | - case 8: |
|
| 1778 | - case 9: |
|
| 1779 | - $orientation = -270; |
|
| 1780 | - $rotate = true; |
|
| 1781 | - $modify = true; |
|
| 1782 | - break; |
|
| 1783 | - default: |
|
| 1784 | - $orientation = 0; |
|
| 1785 | - $rotate = true; |
|
| 1786 | - $modify = true; |
|
| 1787 | - break; |
|
| 1788 | - } |
|
| 1789 | - } |
|
| 1738 | + $rotate = false; |
|
| 1739 | + $flip = false; |
|
| 1740 | + $modify = false; |
|
| 1741 | + $orientation = 0; |
|
| 1742 | + if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1743 | + switch ((int)$exif['Orientation']) {
|
|
| 1744 | + case 1: |
|
| 1745 | + // do nothing |
|
| 1746 | + break; |
|
| 1747 | + case 2: |
|
| 1748 | + $flip = array(false, true); |
|
| 1749 | + $modify = true; |
|
| 1750 | + break; |
|
| 1751 | + case 3: |
|
| 1752 | + $orientation = -180; |
|
| 1753 | + $rotate = true; |
|
| 1754 | + $modify = true; |
|
| 1755 | + break; |
|
| 1756 | + case 4: |
|
| 1757 | + $flip = array(true, false); |
|
| 1758 | + $modify = true; |
|
| 1759 | + break; |
|
| 1760 | + case 5: |
|
| 1761 | + $orientation = -90; |
|
| 1762 | + $rotate = true; |
|
| 1763 | + $flip = array(false, true); |
|
| 1764 | + $modify = true; |
|
| 1765 | + break; |
|
| 1766 | + case 6: |
|
| 1767 | + $orientation = -90; |
|
| 1768 | + $rotate = true; |
|
| 1769 | + $modify = true; |
|
| 1770 | + break; |
|
| 1771 | + case 7: |
|
| 1772 | + $orientation = -270; |
|
| 1773 | + $rotate = true; |
|
| 1774 | + $flip = array(false, true); |
|
| 1775 | + $modify = true; |
|
| 1776 | + break; |
|
| 1777 | + case 8: |
|
| 1778 | + case 9: |
|
| 1779 | + $orientation = -270; |
|
| 1780 | + $rotate = true; |
|
| 1781 | + $modify = true; |
|
| 1782 | + break; |
|
| 1783 | + default: |
|
| 1784 | + $orientation = 0; |
|
| 1785 | + $rotate = true; |
|
| 1786 | + $modify = true; |
|
| 1787 | + break; |
|
| 1788 | + } |
|
| 1789 | + } |
|
| 1790 | 1790 | |
| 1791 | - $quality = null; |
|
| 1792 | - /** |
|
| 1793 | - * Filter the image quality. |
|
| 1794 | - * |
|
| 1795 | - * @since 1.5.7 |
|
| 1796 | - * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1797 | - * @param string $quality Image mime type. |
|
| 1798 | - */ |
|
| 1799 | - $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1800 | - if ($quality !== null) {
|
|
| 1801 | - $modify = true; |
|
| 1802 | - } |
|
| 1791 | + $quality = null; |
|
| 1792 | + /** |
|
| 1793 | + * Filter the image quality. |
|
| 1794 | + * |
|
| 1795 | + * @since 1.5.7 |
|
| 1796 | + * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1797 | + * @param string $quality Image mime type. |
|
| 1798 | + */ |
|
| 1799 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1800 | + if ($quality !== null) {
|
|
| 1801 | + $modify = true; |
|
| 1802 | + } |
|
| 1803 | 1803 | |
| 1804 | - if (!$modify) {
|
|
| 1805 | - return $file; // no change |
|
| 1806 | - } |
|
| 1804 | + if (!$modify) {
|
|
| 1805 | + return $file; // no change |
|
| 1806 | + } |
|
| 1807 | 1807 | |
| 1808 | - $image = wp_get_image_editor($file_path); |
|
| 1809 | - if (!is_wp_error($image)) {
|
|
| 1810 | - if ($rotate) {
|
|
| 1811 | - $image->rotate($orientation); |
|
| 1812 | - } |
|
| 1808 | + $image = wp_get_image_editor($file_path); |
|
| 1809 | + if (!is_wp_error($image)) {
|
|
| 1810 | + if ($rotate) {
|
|
| 1811 | + $image->rotate($orientation); |
|
| 1812 | + } |
|
| 1813 | 1813 | |
| 1814 | - if (!empty($flip)) {
|
|
| 1815 | - $image->flip($flip[0], $flip[1]); |
|
| 1816 | - } |
|
| 1814 | + if (!empty($flip)) {
|
|
| 1815 | + $image->flip($flip[0], $flip[1]); |
|
| 1816 | + } |
|
| 1817 | 1817 | |
| 1818 | - if ($quality !== null) {
|
|
| 1819 | - $image->set_quality((int)$quality); |
|
| 1820 | - } |
|
| 1818 | + if ($quality !== null) {
|
|
| 1819 | + $image->set_quality((int)$quality); |
|
| 1820 | + } |
|
| 1821 | 1821 | |
| 1822 | - $result = $image->save($file_path); |
|
| 1823 | - if (!is_wp_error($result)) {
|
|
| 1824 | - $file['file'] = $result['path']; |
|
| 1825 | - $file['tmp_name'] = $result['path']; |
|
| 1826 | - } |
|
| 1827 | - } |
|
| 1822 | + $result = $image->save($file_path); |
|
| 1823 | + if (!is_wp_error($result)) {
|
|
| 1824 | + $file['file'] = $result['path']; |
|
| 1825 | + $file['tmp_name'] = $result['path']; |
|
| 1826 | + } |
|
| 1827 | + } |
|
| 1828 | 1828 | |
| 1829 | - // The image orientation is fixed, pass it back for further processing |
|
| 1830 | - return $file; |
|
| 1829 | + // The image orientation is fixed, pass it back for further processing |
|
| 1830 | + return $file; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | |
| 1833 | 1833 | /** |
@@ -1846,138 +1846,138 @@ discard block |
||
| 1846 | 1846 | * @return string Returns the recent reviews html. |
| 1847 | 1847 | */ |
| 1848 | 1848 | function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
|
| 1849 | - global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1850 | - $tablecomments = $wpdb->comments; |
|
| 1851 | - $tableposts = $wpdb->posts; |
|
| 1852 | - |
|
| 1853 | - $comments_echo = ''; |
|
| 1854 | - $city_filter = ''; |
|
| 1855 | - $region_filter = ''; |
|
| 1856 | - $country_filter = ''; |
|
| 1857 | - |
|
| 1858 | - if ($gd_session->get('gd_multi_location')) {
|
|
| 1859 | - if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1860 | - $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1861 | - } |
|
| 1849 | + global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1850 | + $tablecomments = $wpdb->comments; |
|
| 1851 | + $tableposts = $wpdb->posts; |
|
| 1852 | + |
|
| 1853 | + $comments_echo = ''; |
|
| 1854 | + $city_filter = ''; |
|
| 1855 | + $region_filter = ''; |
|
| 1856 | + $country_filter = ''; |
|
| 1857 | + |
|
| 1858 | + if ($gd_session->get('gd_multi_location')) {
|
|
| 1859 | + if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1860 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1861 | + } |
|
| 1862 | 1862 | |
| 1863 | - if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1864 | - $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1865 | - } |
|
| 1863 | + if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1864 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1865 | + } |
|
| 1866 | 1866 | |
| 1867 | - if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1868 | - $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1869 | - } |
|
| 1870 | - } |
|
| 1867 | + if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1868 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1869 | + } |
|
| 1870 | + } |
|
| 1871 | 1871 | |
| 1872 | - $review_table = GEODIR_REVIEW_TABLE; |
|
| 1873 | - $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"; |
|
| 1874 | - |
|
| 1875 | - $comments = $wpdb->get_results($request); |
|
| 1876 | - |
|
| 1877 | - foreach ($comments as $comment) {
|
|
| 1878 | - // Set the extra comment info needed. |
|
| 1879 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1880 | - //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1881 | - $comment->comment_content = $comment_extra->comment_content; |
|
| 1882 | - $comment->comment_author = $comment_extra->comment_author; |
|
| 1883 | - $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1884 | - |
|
| 1885 | - $comment_id = ''; |
|
| 1886 | - $comment_id = $comment->comment_ID; |
|
| 1887 | - $comment_content = strip_tags($comment->comment_content); |
|
| 1888 | - |
|
| 1889 | - $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1890 | - |
|
| 1891 | - $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1892 | - $comment_author_email = $comment->comment_author_email; |
|
| 1893 | - $comment_post_ID = $comment->post_id; |
|
| 1894 | - |
|
| 1895 | - $na = true; |
|
| 1896 | - if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1897 | - $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1898 | - if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1899 | - } else {
|
|
| 1900 | - $na = false; |
|
| 1901 | - } |
|
| 1902 | - } |
|
| 1872 | + $review_table = GEODIR_REVIEW_TABLE; |
|
| 1873 | + $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"; |
|
| 1874 | + |
|
| 1875 | + $comments = $wpdb->get_results($request); |
|
| 1876 | + |
|
| 1877 | + foreach ($comments as $comment) {
|
|
| 1878 | + // Set the extra comment info needed. |
|
| 1879 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1880 | + //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1881 | + $comment->comment_content = $comment_extra->comment_content; |
|
| 1882 | + $comment->comment_author = $comment_extra->comment_author; |
|
| 1883 | + $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1884 | + |
|
| 1885 | + $comment_id = ''; |
|
| 1886 | + $comment_id = $comment->comment_ID; |
|
| 1887 | + $comment_content = strip_tags($comment->comment_content); |
|
| 1888 | + |
|
| 1889 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1890 | + |
|
| 1891 | + $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1892 | + $comment_author_email = $comment->comment_author_email; |
|
| 1893 | + $comment_post_ID = $comment->post_id; |
|
| 1894 | + |
|
| 1895 | + $na = true; |
|
| 1896 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1897 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1898 | + if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1899 | + } else {
|
|
| 1900 | + $na = false; |
|
| 1901 | + } |
|
| 1902 | + } |
|
| 1903 | 1903 | |
| 1904 | - $post_title = get_the_title($comment_post_ID); |
|
| 1905 | - $permalink = get_permalink($comment_post_ID); |
|
| 1906 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1907 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1904 | + $post_title = get_the_title($comment_post_ID); |
|
| 1905 | + $permalink = get_permalink($comment_post_ID); |
|
| 1906 | + $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1907 | + $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1908 | 1908 | |
| 1909 | - $comment_content_length = strlen($comment_content); |
|
| 1910 | - if ($comment_content_length > $comment_lenth) {
|
|
| 1911 | - $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1912 | - } else {
|
|
| 1913 | - $comment_excerpt = $comment_content; |
|
| 1914 | - } |
|
| 1909 | + $comment_content_length = strlen($comment_content); |
|
| 1910 | + if ($comment_content_length > $comment_lenth) {
|
|
| 1911 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1912 | + } else {
|
|
| 1913 | + $comment_excerpt = $comment_content; |
|
| 1914 | + } |
|
| 1915 | 1915 | |
| 1916 | - if ($comment->user_id) {
|
|
| 1917 | - $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1918 | - } else {
|
|
| 1919 | - $user_profile_url = ''; |
|
| 1920 | - } |
|
| 1916 | + if ($comment->user_id) {
|
|
| 1917 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1918 | + } else {
|
|
| 1919 | + $user_profile_url = ''; |
|
| 1920 | + } |
|
| 1921 | 1921 | |
| 1922 | - if ($comment_id && $na) {
|
|
| 1923 | - $comments_echo .= '<li class="clearfix">'; |
|
| 1924 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1925 | - if (function_exists('get_avatar')) {
|
|
| 1926 | - if (!isset($comment->comment_type)) {
|
|
| 1927 | - if ($user_profile_url) {
|
|
| 1928 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1929 | - } |
|
| 1930 | - $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1931 | - if ($user_profile_url) {
|
|
| 1932 | - $comments_echo .= '</a>'; |
|
| 1933 | - } |
|
| 1934 | - } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1935 | - if ($user_profile_url) {
|
|
| 1936 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1937 | - } |
|
| 1938 | - $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1939 | - } |
|
| 1940 | - } elseif (function_exists('gravatar')) {
|
|
| 1941 | - if ($user_profile_url) {
|
|
| 1942 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1943 | - } |
|
| 1944 | - $comments_echo .= "<img src=\""; |
|
| 1945 | - if ('' == $comment->comment_type) {
|
|
| 1946 | - $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1947 | - if ($user_profile_url) {
|
|
| 1948 | - $comments_echo .= '</a>'; |
|
| 1949 | - } |
|
| 1950 | - } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1951 | - if ($user_profile_url) {
|
|
| 1952 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1953 | - } |
|
| 1954 | - $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1955 | - if ($user_profile_url) {
|
|
| 1956 | - $comments_echo .= '</a>'; |
|
| 1957 | - } |
|
| 1958 | - } |
|
| 1959 | - $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 1960 | - } |
|
| 1922 | + if ($comment_id && $na) {
|
|
| 1923 | + $comments_echo .= '<li class="clearfix">'; |
|
| 1924 | + $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1925 | + if (function_exists('get_avatar')) {
|
|
| 1926 | + if (!isset($comment->comment_type)) {
|
|
| 1927 | + if ($user_profile_url) {
|
|
| 1928 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1929 | + } |
|
| 1930 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1931 | + if ($user_profile_url) {
|
|
| 1932 | + $comments_echo .= '</a>'; |
|
| 1933 | + } |
|
| 1934 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1935 | + if ($user_profile_url) {
|
|
| 1936 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1937 | + } |
|
| 1938 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1939 | + } |
|
| 1940 | + } elseif (function_exists('gravatar')) {
|
|
| 1941 | + if ($user_profile_url) {
|
|
| 1942 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1943 | + } |
|
| 1944 | + $comments_echo .= "<img src=\""; |
|
| 1945 | + if ('' == $comment->comment_type) {
|
|
| 1946 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1947 | + if ($user_profile_url) {
|
|
| 1948 | + $comments_echo .= '</a>'; |
|
| 1949 | + } |
|
| 1950 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1951 | + if ($user_profile_url) {
|
|
| 1952 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1953 | + } |
|
| 1954 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1955 | + if ($user_profile_url) {
|
|
| 1956 | + $comments_echo .= '</a>'; |
|
| 1957 | + } |
|
| 1958 | + } |
|
| 1959 | + $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 1960 | + } |
|
| 1961 | 1961 | |
| 1962 | - $comments_echo .= "</span>\n"; |
|
| 1963 | - |
|
| 1964 | - $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 1965 | - if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 1966 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 1967 | - if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 1968 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 1969 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 1970 | - $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 1971 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 1972 | - //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 1973 | - $comments_echo .= '</p>'; |
|
| 1974 | - |
|
| 1975 | - $comments_echo .= "</span>\n"; |
|
| 1976 | - $comments_echo .= '</li>'; |
|
| 1977 | - } |
|
| 1978 | - } |
|
| 1962 | + $comments_echo .= "</span>\n"; |
|
| 1963 | + |
|
| 1964 | + $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 1965 | + if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 1966 | + $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 1967 | + if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 1968 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 1969 | + $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 1970 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 1971 | + $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 1972 | + //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 1973 | + $comments_echo .= '</p>'; |
|
| 1974 | + |
|
| 1975 | + $comments_echo .= "</span>\n"; |
|
| 1976 | + $comments_echo .= '</li>'; |
|
| 1977 | + } |
|
| 1978 | + } |
|
| 1979 | 1979 | |
| 1980 | - return $comments_echo; |
|
| 1980 | + return $comments_echo; |
|
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | 1983 | /** |
@@ -1989,29 +1989,29 @@ discard block |
||
| 1989 | 1989 | */ |
| 1990 | 1990 | function geodir_home_map_cats_key_value_array() |
| 1991 | 1991 | {
|
| 1992 | - $post_types = geodir_get_posttypes('object');
|
|
| 1993 | - |
|
| 1994 | - $return = array(); |
|
| 1995 | - if (!empty($post_types)) {
|
|
| 1996 | - foreach ($post_types as $key => $post_type) {
|
|
| 1997 | - $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 1998 | - $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 1999 | - $taxonomies = geodir_get_taxonomies($key); |
|
| 2000 | - $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2001 | - $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2002 | - |
|
| 2003 | - if (!empty($cat_terms)) {
|
|
| 2004 | - $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2005 | - |
|
| 2006 | - foreach ($cat_terms as $cat_term) {
|
|
| 2007 | - $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2008 | - } |
|
| 1992 | + $post_types = geodir_get_posttypes('object');
|
|
| 2009 | 1993 | |
| 2010 | - $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2011 | - } |
|
| 2012 | - } |
|
| 2013 | - } |
|
| 2014 | - return $return; |
|
| 1994 | + $return = array(); |
|
| 1995 | + if (!empty($post_types)) {
|
|
| 1996 | + foreach ($post_types as $key => $post_type) {
|
|
| 1997 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 1998 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 1999 | + $taxonomies = geodir_get_taxonomies($key); |
|
| 2000 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2001 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2002 | + |
|
| 2003 | + if (!empty($cat_terms)) {
|
|
| 2004 | + $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2005 | + |
|
| 2006 | + foreach ($cat_terms as $cat_term) {
|
|
| 2007 | + $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2011 | + } |
|
| 2012 | + } |
|
| 2013 | + } |
|
| 2014 | + return $return; |
|
| 2015 | 2015 | } |
| 2016 | 2016 | |
| 2017 | 2017 | /** |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | */ |
| 2024 | 2024 | function geodir_twitter_tweet_button() |
| 2025 | 2025 | {
|
| 2026 | - ?> |
|
| 2026 | + ?> |
|
| 2027 | 2027 | <a href="http://twitter.com/share" |
| 2028 | 2028 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
| 2029 | 2029 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
@@ -2040,11 +2040,11 @@ discard block |
||
| 2040 | 2040 | * @global object $post The current post object. |
| 2041 | 2041 | */ |
| 2042 | 2042 | function geodir_fb_like_button() {
|
| 2043 | - global $post; |
|
| 2044 | - ?> |
|
| 2043 | + global $post; |
|
| 2044 | + ?> |
|
| 2045 | 2045 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
| 2046 | - echo 'allowtransparency="true"'; |
|
| 2047 | - } ?> class="facebook" |
|
| 2046 | + echo 'allowtransparency="true"'; |
|
| 2047 | + } ?> class="facebook" |
|
| 2048 | 2048 | 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" |
| 2049 | 2049 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 2050 | 2050 | <?php |
@@ -2059,7 +2059,7 @@ discard block |
||
| 2059 | 2059 | * @package GeoDirectory |
| 2060 | 2060 | */ |
| 2061 | 2061 | function geodir_google_plus_button() {
|
| 2062 | - ?> |
|
| 2062 | + ?> |
|
| 2063 | 2063 | <div id="plusone-div" class="g-plusone" data-size="medium"></div> |
| 2064 | 2064 | <script type="text/javascript"> |
| 2065 | 2065 | (function () {
|
@@ -2084,8 +2084,8 @@ discard block |
||
| 2084 | 2084 | * @global object $post The current post object. |
| 2085 | 2085 | */ |
| 2086 | 2086 | function geodir_share_this_button_code() {
|
| 2087 | - global $post; |
|
| 2088 | - ?> |
|
| 2087 | + global $post; |
|
| 2088 | + ?> |
|
| 2089 | 2089 | <div class="addthis_toolbox addthis_default_style"> |
| 2090 | 2090 | <span id='st_sharethis'></span> |
| 2091 | 2091 | <script type="text/javascript">var switchTo5x = false;</script> |
@@ -2110,8 +2110,8 @@ discard block |
||
| 2110 | 2110 | } |
| 2111 | 2111 | |
| 2112 | 2112 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2113 | - if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2114 | - ?> |
|
| 2113 | + if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2114 | + ?> |
|
| 2115 | 2115 | <script> |
| 2116 | 2116 | jQuery(function ($) {
|
| 2117 | 2117 | if (typeof(animate_marker) == 'function') {
|
@@ -2125,27 +2125,27 @@ discard block |
||
| 2125 | 2125 | }); |
| 2126 | 2126 | </script> |
| 2127 | 2127 | <?php |
| 2128 | - } |
|
| 2128 | + } |
|
| 2129 | 2129 | } |
| 2130 | 2130 | add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
|
| 2131 | 2131 | |
| 2132 | 2132 | add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
|
| 2133 | 2133 | function geodir_output_favourite_html_listings( $post_id){
|
| 2134 | - geodir_favourite_html('', $post_id);
|
|
| 2134 | + geodir_favourite_html('', $post_id);
|
|
| 2135 | 2135 | } |
| 2136 | 2136 | |
| 2137 | 2137 | add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
| 2138 | 2138 | function geodir_output_pinpoint_html_listings( $post_id, $post){
|
| 2139 | - global $wp_query; |
|
| 2139 | + global $wp_query; |
|
| 2140 | 2140 | |
| 2141 | - $show_pin_point = $wp_query->is_main_query(); |
|
| 2141 | + $show_pin_point = $wp_query->is_main_query(); |
|
| 2142 | 2142 | |
| 2143 | - if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2144 | - $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2145 | - $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2146 | - ?> |
|
| 2143 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2144 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2145 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2146 | + ?> |
|
| 2147 | 2147 | <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>
|
| 2148 | 2148 | <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>
|
| 2149 | 2149 | <?php |
| 2150 | - } |
|
| 2150 | + } |
|
| 2151 | 2151 | } |
| 2152 | 2152 | \ No newline at end of file |