@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // We are submitting iframes etc so we turn this off to allow them to show on preview. |
| 13 | 13 | if(geodir_is_page('preview')){
|
| 14 | - header("X-XSS-Protection: 0");
|
|
| 14 | + header("X-XSS-Protection: 0");
|
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | ###### SIDEBAR ON LEFT ###### |
| 40 | 40 | if (get_option('geodir_detail_sidebar_left_section')) {
|
| 41 | - /** |
|
| 42 | - * Adds the details page sidebar to the details template page. |
|
| 43 | - * |
|
| 44 | - * @since 1.1.0 |
|
| 45 | - */ |
|
| 46 | - do_action('geodir_detail_sidebar');
|
|
| 41 | + /** |
|
| 42 | + * Adds the details page sidebar to the details template page. |
|
| 43 | + * |
|
| 44 | + * @since 1.1.0 |
|
| 45 | + */ |
|
| 46 | + do_action('geodir_detail_sidebar');
|
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | ###### MAIN CONTENT WRAPPERS OPEN ###### |
@@ -72,29 +72,29 @@ discard block |
||
| 72 | 72 | // this call the main page content |
| 73 | 73 | global $preview; |
| 74 | 74 | if (have_posts() && !$preview) {
|
| 75 | - the_post(); |
|
| 76 | - global $post, $post_images; |
|
| 77 | - /** |
|
| 78 | - * Calls the details page main content on the details template page. |
|
| 79 | - * |
|
| 80 | - * @since 1.1.0 |
|
| 81 | - * @param object $post The current post object. |
|
| 82 | - */ |
|
| 83 | - do_action('geodir_details_main_content', $post);
|
|
| 75 | + the_post(); |
|
| 76 | + global $post, $post_images; |
|
| 77 | + /** |
|
| 78 | + * Calls the details page main content on the details template page. |
|
| 79 | + * |
|
| 80 | + * @since 1.1.0 |
|
| 81 | + * @param object $post The current post object. |
|
| 82 | + */ |
|
| 83 | + do_action('geodir_details_main_content', $post);
|
|
| 84 | 84 | } elseif ($preview) {
|
| 85 | - /** |
|
| 86 | - * Called on the details page if the page is being previewed. |
|
| 87 | - * |
|
| 88 | - * This sets the value of `$post` to the preview values before the main content is called. |
|
| 89 | - * |
|
| 90 | - * @since 1.1.0 |
|
| 91 | - */ |
|
| 92 | - do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
|
| 93 | - if (defined( 'GD_TESTING_MODE' )) {
|
|
| 94 | - global $post; |
|
| 95 | - } |
|
| 96 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 97 | - do_action('geodir_details_main_content', $post);
|
|
| 85 | + /** |
|
| 86 | + * Called on the details page if the page is being previewed. |
|
| 87 | + * |
|
| 88 | + * This sets the value of `$post` to the preview values before the main content is called. |
|
| 89 | + * |
|
| 90 | + * @since 1.1.0 |
|
| 91 | + */ |
|
| 92 | + do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
|
| 93 | + if (defined( 'GD_TESTING_MODE' )) {
|
|
| 94 | + global $post; |
|
| 95 | + } |
|
| 96 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 97 | + do_action('geodir_details_main_content', $post);
|
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** This action is documented in geodirectory-templates/geodir-home.php */ |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | ###### SIDEBAR ON RIGHT ###### |
| 120 | 120 | if (!get_option('geodir_detail_sidebar_left_section')) {
|
| 121 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 122 | - do_action('geodir_detail_sidebar');
|
|
| 121 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
| 122 | + do_action('geodir_detail_sidebar');
|
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // We are submitting iframes etc so we turn this off to allow them to show on preview. |
| 13 | -if(geodir_is_page('preview')){
|
|
| 13 | +if (geodir_is_page('preview')) {
|
|
| 14 | 14 | header("X-XSS-Protection: 0");
|
| 15 | 15 | } |
| 16 | 16 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $itemtype The itemtype value of the HTML element. |
| 64 | 64 | * @see 'geodir_article_close' |
| 65 | 65 | */ |
| 66 | -do_action('geodir_article_open', 'details-page', 'post-' . get_the_ID(), get_post_class(), '');
|
|
| 66 | +do_action('geodir_article_open', 'details-page', 'post-'.get_the_ID(), get_post_class(), '');
|
|
| 67 | 67 | |
| 68 | 68 | ###### MAIN CONTENT ###### |
| 69 | 69 | /** This action is documented in geodirectory-templates/geodir-home.php */ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @since 1.1.0 |
| 91 | 91 | */ |
| 92 | 92 | do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values
|
| 93 | - if (defined( 'GD_TESTING_MODE' )) {
|
|
| 93 | + if (defined('GD_TESTING_MODE')) {
|
|
| 94 | 94 | global $post; |
| 95 | 95 | } |
| 96 | 96 | /** This action is documented in geodirectory-templates/listing-detail.php */ |
@@ -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,81 +697,81 @@ discard block |
||
| 697 | 697 | * @return string Returns related posts html. |
| 698 | 698 | */ |
| 699 | 699 | function geodir_related_posts_display($request) {
|
| 700 | - if (!empty($request)) {
|
|
| 701 | - $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
| 702 | - $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
| 703 | - |
|
| 704 | - $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
|
|
| 705 | - $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
| 706 | - $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
| 707 | - $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
| 708 | - $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
| 709 | - $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
| 710 | - $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
| 711 | - $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
| 712 | - |
|
| 713 | - global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
|
| 714 | - $related_parent_lat = $post->post_latitude; |
|
| 715 | - $related_parent_lon = $post->post_longitude; |
|
| 716 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
|
| 717 | - |
|
| 718 | - $related_listing_array = array(); |
|
| 719 | - if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 720 | - $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 721 | - if (in_array($post->post_type, $related_listing_array)) {
|
|
| 722 | - $arr_detail_page_tabs['related_listing']['is_display'] = true; |
|
| 723 | - } |
|
| 700 | + if (!empty($request)) {
|
|
| 701 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
| 702 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
| 703 | + |
|
| 704 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
|
|
| 705 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
| 706 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
| 707 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
| 708 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
| 709 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
| 710 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
| 711 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
| 712 | + |
|
| 713 | + global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
|
| 714 | + $related_parent_lat = $post->post_latitude; |
|
| 715 | + $related_parent_lon = $post->post_longitude; |
|
| 716 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
|
| 717 | + |
|
| 718 | + $related_listing_array = array(); |
|
| 719 | + if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 720 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 721 | + if (in_array($post->post_type, $related_listing_array)) {
|
|
| 722 | + $arr_detail_page_tabs['related_listing']['is_display'] = true; |
|
| 723 | + } |
|
| 724 | 724 | |
| 725 | - $is_display = $arr_detail_page_tabs['related_listing']['is_display']; |
|
| 726 | - $origi_post = $post; |
|
| 727 | - $post_type = ''; |
|
| 728 | - $post_id = ''; |
|
| 729 | - $category_taxonomy = ''; |
|
| 730 | - $tax_field = 'id'; |
|
| 731 | - $category = array(); |
|
| 732 | - |
|
| 733 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 734 | - $post = (object)$gd_session->get('listing');
|
|
| 735 | - $post_type = $post->listing_type; |
|
| 736 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 737 | - $post_id = $_REQUEST['pid']; |
|
| 738 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 739 | - $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 740 | - $post_type = $post->post_type; |
|
| 741 | - $post_id = $_REQUEST['pid']; |
|
| 742 | - } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 743 | - $post_type = $post->post_type; |
|
| 744 | - $post_id = $post->ID; |
|
| 745 | - } |
|
| 725 | + $is_display = $arr_detail_page_tabs['related_listing']['is_display']; |
|
| 726 | + $origi_post = $post; |
|
| 727 | + $post_type = ''; |
|
| 728 | + $post_id = ''; |
|
| 729 | + $category_taxonomy = ''; |
|
| 730 | + $tax_field = 'id'; |
|
| 731 | + $category = array(); |
|
| 732 | + |
|
| 733 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 734 | + $post = (object)$gd_session->get('listing');
|
|
| 735 | + $post_type = $post->listing_type; |
|
| 736 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 737 | + $post_id = $_REQUEST['pid']; |
|
| 738 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 739 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 740 | + $post_type = $post->post_type; |
|
| 741 | + $post_id = $_REQUEST['pid']; |
|
| 742 | + } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 743 | + $post_type = $post->post_type; |
|
| 744 | + $post_id = $post->ID; |
|
| 745 | + } |
|
| 746 | 746 | |
| 747 | - if ($relate_to == 'category') {
|
|
| 747 | + if ($relate_to == 'category') {
|
|
| 748 | 748 | |
| 749 | - $category_taxonomy = $post_type . $relate_to; |
|
| 750 | - if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 751 | - $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 749 | + $category_taxonomy = $post_type . $relate_to; |
|
| 750 | + if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
|
| 751 | + $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 752 | 752 | |
| 753 | - } elseif ($relate_to == 'tags') {
|
|
| 753 | + } elseif ($relate_to == 'tags') {
|
|
| 754 | 754 | |
| 755 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 756 | - if ($post->post_tags != '') |
|
| 757 | - $category = explode(',', trim($post->post_tags, ','));
|
|
| 758 | - $tax_field = 'name'; |
|
| 759 | - } |
|
| 755 | + $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 756 | + if ($post->post_tags != '') |
|
| 757 | + $category = explode(',', trim($post->post_tags, ','));
|
|
| 758 | + $tax_field = 'name'; |
|
| 759 | + } |
|
| 760 | 760 | |
| 761 | - /* --- return false in invalid request --- */ |
|
| 762 | - if (empty($category)) |
|
| 763 | - return false; |
|
| 761 | + /* --- return false in invalid request --- */ |
|
| 762 | + if (empty($category)) |
|
| 763 | + return false; |
|
| 764 | 764 | |
| 765 | - $all_postypes = geodir_get_posttypes(); |
|
| 765 | + $all_postypes = geodir_get_posttypes(); |
|
| 766 | 766 | |
| 767 | - if (!in_array($post_type, $all_postypes)) |
|
| 768 | - return false; |
|
| 767 | + if (!in_array($post_type, $all_postypes)) |
|
| 768 | + return false; |
|
| 769 | 769 | |
| 770 | - /* --- return false in invalid request --- */ |
|
| 770 | + /* --- return false in invalid request --- */ |
|
| 771 | 771 | |
| 772 | - $location_url = ''; |
|
| 773 | - if ($add_location_filter != '0') {
|
|
| 774 | - $location_url = array(); |
|
| 772 | + $location_url = ''; |
|
| 773 | + if ($add_location_filter != '0') {
|
|
| 774 | + $location_url = array(); |
|
| 775 | 775 | $geodir_show_location_url = get_option('geodir_show_location_url');
|
| 776 | 776 | |
| 777 | 777 | $gd_city = get_query_var('gd_city');
|
@@ -779,13 +779,13 @@ discard block |
||
| 779 | 779 | if ($gd_city) {
|
| 780 | 780 | $gd_country = get_query_var('gd_country');
|
| 781 | 781 | $gd_region = get_query_var('gd_region');
|
| 782 | - } else {
|
|
| 783 | - $location = geodir_get_default_location(); |
|
| 782 | + } else {
|
|
| 783 | + $location = geodir_get_default_location(); |
|
| 784 | 784 | |
| 785 | 785 | $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
| 786 | 786 | $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
| 787 | 787 | $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
| 788 | - } |
|
| 788 | + } |
|
| 789 | 789 | |
| 790 | 790 | if ($geodir_show_location_url == 'all') {
|
| 791 | 791 | $location_url[] = $gd_country; |
@@ -798,100 +798,100 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | $location_url[] = $gd_city; |
| 800 | 800 | |
| 801 | - $location_url = implode('/', $location_url);
|
|
| 802 | - } |
|
| 801 | + $location_url = implode('/', $location_url);
|
|
| 802 | + } |
|
| 803 | 803 | |
| 804 | 804 | |
| 805 | - if (!empty($category)) {
|
|
| 806 | - global $geodir_add_location_url; |
|
| 807 | - $geodir_add_location_url = '0'; |
|
| 808 | - if ($add_location_filter != '0') {
|
|
| 809 | - $geodir_add_location_url = '1'; |
|
| 810 | - } |
|
| 811 | - $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 812 | - $geodir_add_location_url = NULL; |
|
| 813 | - } |
|
| 814 | - ob_start(); |
|
| 815 | - ?> |
|
| 805 | + if (!empty($category)) {
|
|
| 806 | + global $geodir_add_location_url; |
|
| 807 | + $geodir_add_location_url = '0'; |
|
| 808 | + if ($add_location_filter != '0') {
|
|
| 809 | + $geodir_add_location_url = '1'; |
|
| 810 | + } |
|
| 811 | + $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 812 | + $geodir_add_location_url = NULL; |
|
| 813 | + } |
|
| 814 | + ob_start(); |
|
| 815 | + ?> |
|
| 816 | 816 | |
| 817 | 817 | |
| 818 | 818 | <div class="geodir_locations geodir_location_listing"> |
| 819 | 819 | |
| 820 | 820 | <?php |
| 821 | - if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 822 | - /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 823 | - $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 824 | - /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 825 | - $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 826 | - ?> |
|
| 821 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 822 | + /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
|
| 823 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 824 | + /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
|
| 825 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 826 | + ?> |
|
| 827 | 827 | <div class="location_list_heading clearfix"> |
| 828 | 828 | <?php echo $before_title . $title . $after_title; ?> |
| 829 | 829 | </div> |
| 830 | 830 | <?php |
| 831 | - } |
|
| 832 | - $query_args = array( |
|
| 833 | - 'posts_per_page' => $post_number, |
|
| 834 | - 'is_geodir_loop' => true, |
|
| 835 | - 'gd_location' => ($add_location_filter) ? true : false, |
|
| 836 | - 'post_type' => $post_type, |
|
| 837 | - 'order_by' => $list_sort, |
|
| 838 | - 'post__not_in' => array($post_id), |
|
| 839 | - 'excerpt_length' => $character_count, |
|
| 840 | - 'related_listings' => $is_display |
|
| 841 | - ); |
|
| 831 | + } |
|
| 832 | + $query_args = array( |
|
| 833 | + 'posts_per_page' => $post_number, |
|
| 834 | + 'is_geodir_loop' => true, |
|
| 835 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
| 836 | + 'post_type' => $post_type, |
|
| 837 | + 'order_by' => $list_sort, |
|
| 838 | + 'post__not_in' => array($post_id), |
|
| 839 | + 'excerpt_length' => $character_count, |
|
| 840 | + 'related_listings' => $is_display |
|
| 841 | + ); |
|
| 842 | 842 | |
| 843 | - $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 844 | - 'field' => $tax_field, |
|
| 845 | - 'terms' => $category |
|
| 846 | - ); |
|
| 843 | + $tax_query = array('taxonomy' => $category_taxonomy,
|
|
| 844 | + 'field' => $tax_field, |
|
| 845 | + 'terms' => $category |
|
| 846 | + ); |
|
| 847 | 847 | |
| 848 | - $query_args['tax_query'] = array($tax_query); |
|
| 848 | + $query_args['tax_query'] = array($tax_query); |
|
| 849 | 849 | |
| 850 | 850 | |
| 851 | - global $gridview_columns, $post; |
|
| 851 | + global $gridview_columns, $post; |
|
| 852 | 852 | |
| 853 | 853 | |
| 854 | - query_posts($query_args); |
|
| 854 | + query_posts($query_args); |
|
| 855 | 855 | |
| 856 | - if (strstr($layout, 'gridview')) {
|
|
| 857 | - $listing_view_exp = explode('_', $layout);
|
|
| 858 | - $gridview_columns = $layout; |
|
| 859 | - $layout = $listing_view_exp[0]; |
|
| 860 | - } else if ($layout == 'list') {
|
|
| 861 | - $gridview_columns = ''; |
|
| 862 | - } |
|
| 863 | - $related_posts = true; |
|
| 856 | + if (strstr($layout, 'gridview')) {
|
|
| 857 | + $listing_view_exp = explode('_', $layout);
|
|
| 858 | + $gridview_columns = $layout; |
|
| 859 | + $layout = $listing_view_exp[0]; |
|
| 860 | + } else if ($layout == 'list') {
|
|
| 861 | + $gridview_columns = ''; |
|
| 862 | + } |
|
| 863 | + $related_posts = true; |
|
| 864 | 864 | |
| 865 | - $related_nearest = false; |
|
| 866 | - if ($list_sort == 'nearest') {
|
|
| 867 | - $related_nearest = true; |
|
| 868 | - } |
|
| 865 | + $related_nearest = false; |
|
| 866 | + if ($list_sort == 'nearest') {
|
|
| 867 | + $related_nearest = true; |
|
| 868 | + } |
|
| 869 | 869 | |
| 870 | 870 | |
| 871 | - /** |
|
| 872 | - * Filters related listing listview template. |
|
| 873 | - * |
|
| 874 | - * @since 1.0.0 |
|
| 875 | - */ |
|
| 876 | - $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 871 | + /** |
|
| 872 | + * Filters related listing listview template. |
|
| 873 | + * |
|
| 874 | + * @since 1.0.0 |
|
| 875 | + */ |
|
| 876 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 877 | 877 | |
| 878 | - /** |
|
| 879 | - * Includes related listing listview template. |
|
| 880 | - * |
|
| 881 | - * @since 1.0.0 |
|
| 882 | - */ |
|
| 883 | - include($template); |
|
| 878 | + /** |
|
| 879 | + * Includes related listing listview template. |
|
| 880 | + * |
|
| 881 | + * @since 1.0.0 |
|
| 882 | + */ |
|
| 883 | + include($template); |
|
| 884 | 884 | |
| 885 | - wp_reset_query(); |
|
| 886 | - $post = $origi_post; |
|
| 887 | - $related_nearest = false; |
|
| 888 | - ?> |
|
| 885 | + wp_reset_query(); |
|
| 886 | + $post = $origi_post; |
|
| 887 | + $related_nearest = false; |
|
| 888 | + ?> |
|
| 889 | 889 | |
| 890 | 890 | </div> |
| 891 | 891 | <?php |
| 892 | - return $html = ob_get_clean(); |
|
| 892 | + return $html = ob_get_clean(); |
|
| 893 | 893 | |
| 894 | - } |
|
| 894 | + } |
|
| 895 | 895 | |
| 896 | 896 | } |
| 897 | 897 | |
@@ -907,17 +907,17 @@ discard block |
||
| 907 | 907 | */ |
| 908 | 908 | function geodir_category_count_script() |
| 909 | 909 | {
|
| 910 | - global $geodir_post_category_str; |
|
| 910 | + global $geodir_post_category_str; |
|
| 911 | 911 | |
| 912 | - if (!empty($geodir_post_category_str)) {
|
|
| 913 | - $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 914 | - } |
|
| 912 | + if (!empty($geodir_post_category_str)) {
|
|
| 913 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 914 | + } |
|
| 915 | 915 | |
| 916 | - $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 917 | - $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 918 | - echo '<script>'; |
|
| 919 | - echo $script; |
|
| 920 | - echo '</script>'; |
|
| 916 | + $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 917 | + $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 918 | + echo '<script>'; |
|
| 919 | + echo $script; |
|
| 920 | + echo '</script>'; |
|
| 921 | 921 | |
| 922 | 922 | } |
| 923 | 923 | |
@@ -930,16 +930,16 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | function geodir_get_map_default_language() |
| 932 | 932 | {
|
| 933 | - $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 934 | - if (empty($geodir_default_map_language)) |
|
| 935 | - $geodir_default_map_language = 'en'; |
|
| 936 | - /** |
|
| 937 | - * Filter default map language. |
|
| 938 | - * |
|
| 939 | - * @since 1.0.0 |
|
| 940 | - * @param string $geodir_default_map_language Default map language. |
|
| 941 | - */ |
|
| 942 | - return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 933 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 934 | + if (empty($geodir_default_map_language)) |
|
| 935 | + $geodir_default_map_language = 'en'; |
|
| 936 | + /** |
|
| 937 | + * Filter default map language. |
|
| 938 | + * |
|
| 939 | + * @since 1.0.0 |
|
| 940 | + * @param string $geodir_default_map_language Default map language. |
|
| 941 | + */ |
|
| 942 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | /** |
@@ -951,14 +951,14 @@ discard block |
||
| 951 | 951 | */ |
| 952 | 952 | function geodir_get_map_api_key() |
| 953 | 953 | {
|
| 954 | - $key = get_option('geodir_google_api_key');
|
|
| 955 | - /** |
|
| 956 | - * Filter Google maps api key. |
|
| 957 | - * |
|
| 958 | - * @since 1.6.4 |
|
| 959 | - * @param string $key Google maps api key. |
|
| 960 | - */ |
|
| 961 | - return apply_filters('geodir_google_api_key', $key);
|
|
| 954 | + $key = get_option('geodir_google_api_key');
|
|
| 955 | + /** |
|
| 956 | + * Filter Google maps api key. |
|
| 957 | + * |
|
| 958 | + * @since 1.6.4 |
|
| 959 | + * @param string $key Google maps api key. |
|
| 960 | + */ |
|
| 961 | + return apply_filters('geodir_google_api_key', $key);
|
|
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | |
@@ -975,12 +975,12 @@ discard block |
||
| 975 | 975 | */ |
| 976 | 976 | function geodir_add_meta_keywords() |
| 977 | 977 | {
|
| 978 | - global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 978 | + global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
|
| 979 | 979 | |
| 980 | - $is_geodir_page = geodir_is_geodir_page(); |
|
| 981 | - if (!$is_geodir_page) {
|
|
| 982 | - return; |
|
| 983 | - }// if non GD page, bail |
|
| 980 | + $is_geodir_page = geodir_is_geodir_page(); |
|
| 981 | + if (!$is_geodir_page) {
|
|
| 982 | + return; |
|
| 983 | + }// if non GD page, bail |
|
| 984 | 984 | |
| 985 | 985 | $use_gd_meta = true; |
| 986 | 986 | if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
|
@@ -995,182 +995,182 @@ discard block |
||
| 995 | 995 | return; |
| 996 | 996 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
| 997 | 997 | |
| 998 | - $current_term = $wp_query->get_queried_object(); |
|
| 998 | + $current_term = $wp_query->get_queried_object(); |
|
| 999 | 999 | |
| 1000 | - $all_postypes = geodir_get_posttypes(); |
|
| 1000 | + $all_postypes = geodir_get_posttypes(); |
|
| 1001 | 1001 | |
| 1002 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1002 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1003 | 1003 | |
| 1004 | - $meta_desc = ''; |
|
| 1005 | - $meta_key = ''; |
|
| 1006 | - if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 1007 | - /** |
|
| 1008 | - * Filter SEO meta location description. |
|
| 1009 | - * |
|
| 1010 | - * @since 1.0.0 |
|
| 1011 | - */ |
|
| 1012 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1013 | - $meta_desc .= ''; |
|
| 1014 | - } |
|
| 1015 | - if (have_posts() && is_single() OR is_page()) {
|
|
| 1016 | - while (have_posts()) {
|
|
| 1017 | - the_post(); |
|
| 1018 | - |
|
| 1019 | - if (has_excerpt()) {
|
|
| 1020 | - $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1021 | - if (empty($out_excerpt)) {
|
|
| 1022 | - $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1023 | - } |
|
| 1024 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1025 | - } else {
|
|
| 1026 | - $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1027 | - $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1028 | - if (empty($out_excerpt)) {
|
|
| 1029 | - $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1030 | - } |
|
| 1031 | - $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1032 | - } |
|
| 1004 | + $meta_desc = ''; |
|
| 1005 | + $meta_key = ''; |
|
| 1006 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 1007 | + /** |
|
| 1008 | + * Filter SEO meta location description. |
|
| 1009 | + * |
|
| 1010 | + * @since 1.0.0 |
|
| 1011 | + */ |
|
| 1012 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1013 | + $meta_desc .= ''; |
|
| 1014 | + } |
|
| 1015 | + if (have_posts() && is_single() OR is_page()) {
|
|
| 1016 | + while (have_posts()) {
|
|
| 1017 | + the_post(); |
|
| 1018 | + |
|
| 1019 | + if (has_excerpt()) {
|
|
| 1020 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1021 | + if (empty($out_excerpt)) {
|
|
| 1022 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1023 | + } |
|
| 1024 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1025 | + } else {
|
|
| 1026 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1027 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1028 | + if (empty($out_excerpt)) {
|
|
| 1029 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1030 | + } |
|
| 1031 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1032 | + } |
|
| 1033 | 1033 | |
| 1034 | - $meta_desc .= $out_excerpt; |
|
| 1035 | - } |
|
| 1036 | - } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1037 | - if (is_category()) {
|
|
| 1038 | - $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1039 | - } elseif (is_tag()) {
|
|
| 1040 | - $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1041 | - } |
|
| 1042 | - } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1043 | - $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1044 | - } |
|
| 1034 | + $meta_desc .= $out_excerpt; |
|
| 1035 | + } |
|
| 1036 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1037 | + if (is_category()) {
|
|
| 1038 | + $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1039 | + } elseif (is_tag()) {
|
|
| 1040 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1041 | + } |
|
| 1042 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1043 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1044 | + } |
|
| 1045 | 1045 | |
| 1046 | 1046 | |
| 1047 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 1048 | - $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1049 | - $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1050 | - |
|
| 1051 | - $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1052 | - $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1053 | - |
|
| 1054 | - $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1055 | - $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1056 | - |
|
| 1057 | - $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1058 | - $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1059 | - $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1060 | - $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1061 | - $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1062 | - $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1063 | - $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1064 | - $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1065 | - $location_id = NULL; |
|
| 1066 | - if ($geodir_location_manager) {
|
|
| 1067 | - $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1068 | - $location_id = (int)$wpdb->get_var($sql); |
|
| 1069 | - $location_type = geodir_what_is_current_location(); |
|
| 1070 | - if ($location_type == 'city') {
|
|
| 1071 | - $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1072 | - } elseif ($location_type == 'region') {
|
|
| 1073 | - $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1074 | - } elseif ($location_type == 'country') {
|
|
| 1075 | - $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1076 | - $replace_location = __($replace_location, 'geodirectory'); |
|
| 1077 | - } |
|
| 1078 | - $country = get_query_var('gd_country');
|
|
| 1079 | - $region = get_query_var('gd_region');
|
|
| 1080 | - $city = get_query_var('gd_city');
|
|
| 1081 | - $current_location = ''; |
|
| 1082 | - if ($country != '') {
|
|
| 1083 | - $current_location = get_actual_location_name('country', $country, true);
|
|
| 1084 | - } |
|
| 1085 | - if ($region != '') {
|
|
| 1086 | - $current_location = get_actual_location_name('region', $region);
|
|
| 1087 | - } |
|
| 1088 | - if ($city != '') {
|
|
| 1089 | - $current_location = get_actual_location_name('city', $city);
|
|
| 1090 | - } |
|
| 1091 | - $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1092 | - } |
|
| 1047 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 1048 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1049 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1050 | + |
|
| 1051 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1052 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1053 | + |
|
| 1054 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1055 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1056 | + |
|
| 1057 | + $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1058 | + $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1059 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1060 | + $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1061 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL; |
|
| 1062 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL; |
|
| 1063 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL; |
|
| 1064 | + $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1065 | + $location_id = NULL; |
|
| 1066 | + if ($geodir_location_manager) {
|
|
| 1067 | + $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1068 | + $location_id = (int)$wpdb->get_var($sql); |
|
| 1069 | + $location_type = geodir_what_is_current_location(); |
|
| 1070 | + if ($location_type == 'city') {
|
|
| 1071 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1072 | + } elseif ($location_type == 'region') {
|
|
| 1073 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1074 | + } elseif ($location_type == 'country') {
|
|
| 1075 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1076 | + $replace_location = __($replace_location, 'geodirectory'); |
|
| 1077 | + } |
|
| 1078 | + $country = get_query_var('gd_country');
|
|
| 1079 | + $region = get_query_var('gd_region');
|
|
| 1080 | + $city = get_query_var('gd_city');
|
|
| 1081 | + $current_location = ''; |
|
| 1082 | + if ($country != '') {
|
|
| 1083 | + $current_location = get_actual_location_name('country', $country, true);
|
|
| 1084 | + } |
|
| 1085 | + if ($region != '') {
|
|
| 1086 | + $current_location = get_actual_location_name('region', $region);
|
|
| 1087 | + } |
|
| 1088 | + if ($city != '') {
|
|
| 1089 | + $current_location = get_actual_location_name('city', $city);
|
|
| 1090 | + } |
|
| 1091 | + $replace_location = $current_location != '' ? $current_location : $replace_location; |
|
| 1092 | + } |
|
| 1093 | 1093 | |
| 1094 | - $geodir_meta_keys = ''; |
|
| 1095 | - $geodir_meta_desc = ''; |
|
| 1096 | - if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1097 | - if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1098 | - $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; |
|
| 1099 | - |
|
| 1100 | - $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1101 | - $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; |
|
| 1102 | - |
|
| 1103 | - if ($geodir_is_category) {
|
|
| 1104 | - $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1105 | - if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1106 | - $category_id = $category->term_id; |
|
| 1107 | - $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1108 | - if ($location_id) {
|
|
| 1109 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1110 | - $cat_loc_option = get_option($option_name); |
|
| 1111 | - |
|
| 1112 | - $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; |
|
| 1113 | - if (!$gd_cat_loc_default) {
|
|
| 1114 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1115 | - $option = get_option($option_name); |
|
| 1116 | - $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1117 | - } |
|
| 1118 | - } |
|
| 1119 | - $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1120 | - } |
|
| 1121 | - } else if ($geodir_is_tag) {
|
|
| 1122 | - $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1123 | - } |
|
| 1124 | - } |
|
| 1125 | - } |
|
| 1094 | + $geodir_meta_keys = ''; |
|
| 1095 | + $geodir_meta_desc = ''; |
|
| 1096 | + if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1097 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1098 | + $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; |
|
| 1099 | + |
|
| 1100 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1101 | + $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; |
|
| 1102 | + |
|
| 1103 | + if ($geodir_is_category) {
|
|
| 1104 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
|
|
| 1105 | + if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1106 | + $category_id = $category->term_id; |
|
| 1107 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1108 | + if ($location_id) {
|
|
| 1109 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1110 | + $cat_loc_option = get_option($option_name); |
|
| 1111 | + |
|
| 1112 | + $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; |
|
| 1113 | + if (!$gd_cat_loc_default) {
|
|
| 1114 | + $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1115 | + $option = get_option($option_name); |
|
| 1116 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1117 | + } |
|
| 1118 | + } |
|
| 1119 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1120 | + } |
|
| 1121 | + } else if ($geodir_is_tag) {
|
|
| 1122 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1123 | + } |
|
| 1124 | + } |
|
| 1125 | + } |
|
| 1126 | 1126 | |
| 1127 | 1127 | |
| 1128 | - $gd_page = ''; |
|
| 1129 | - if(geodir_is_page('home')){
|
|
| 1130 | - $gd_page = 'home'; |
|
| 1131 | - $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1132 | - } |
|
| 1133 | - elseif(geodir_is_page('detail')){
|
|
| 1134 | - $gd_page = 'detail'; |
|
| 1135 | - $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1136 | - } |
|
| 1137 | - elseif(geodir_is_page('pt')){
|
|
| 1138 | - $gd_page = 'pt'; |
|
| 1139 | - $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1140 | - } |
|
| 1141 | - elseif(geodir_is_page('listing')){
|
|
| 1142 | - $gd_page = 'listing'; |
|
| 1143 | - $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1144 | - } |
|
| 1145 | - elseif(geodir_is_page('location')){
|
|
| 1146 | - $gd_page = 'location'; |
|
| 1147 | - $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1148 | - $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1128 | + $gd_page = ''; |
|
| 1129 | + if(geodir_is_page('home')){
|
|
| 1130 | + $gd_page = 'home'; |
|
| 1131 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1132 | + } |
|
| 1133 | + elseif(geodir_is_page('detail')){
|
|
| 1134 | + $gd_page = 'detail'; |
|
| 1135 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1136 | + } |
|
| 1137 | + elseif(geodir_is_page('pt')){
|
|
| 1138 | + $gd_page = 'pt'; |
|
| 1139 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1140 | + } |
|
| 1141 | + elseif(geodir_is_page('listing')){
|
|
| 1142 | + $gd_page = 'listing'; |
|
| 1143 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1144 | + } |
|
| 1145 | + elseif(geodir_is_page('location')){
|
|
| 1146 | + $gd_page = 'location'; |
|
| 1147 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1148 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1149 | 1149 | |
| 1150 | - } |
|
| 1151 | - elseif(geodir_is_page('search')){
|
|
| 1152 | - $gd_page = 'search'; |
|
| 1153 | - $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1154 | - } |
|
| 1155 | - elseif(geodir_is_page('add-listing')){
|
|
| 1156 | - $gd_page = 'add-listing'; |
|
| 1157 | - $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1158 | - } |
|
| 1159 | - elseif(geodir_is_page('author')){
|
|
| 1160 | - $gd_page = 'author'; |
|
| 1161 | - $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1162 | - } |
|
| 1163 | - elseif(geodir_is_page('login')){
|
|
| 1164 | - $gd_page = 'login'; |
|
| 1165 | - $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1166 | - } |
|
| 1167 | - elseif(geodir_is_page('listing-success')){
|
|
| 1168 | - $gd_page = 'listing-success'; |
|
| 1169 | - $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1170 | - } |
|
| 1150 | + } |
|
| 1151 | + elseif(geodir_is_page('search')){
|
|
| 1152 | + $gd_page = 'search'; |
|
| 1153 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1154 | + } |
|
| 1155 | + elseif(geodir_is_page('add-listing')){
|
|
| 1156 | + $gd_page = 'add-listing'; |
|
| 1157 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1158 | + } |
|
| 1159 | + elseif(geodir_is_page('author')){
|
|
| 1160 | + $gd_page = 'author'; |
|
| 1161 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1162 | + } |
|
| 1163 | + elseif(geodir_is_page('login')){
|
|
| 1164 | + $gd_page = 'login'; |
|
| 1165 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1166 | + } |
|
| 1167 | + elseif(geodir_is_page('listing-success')){
|
|
| 1168 | + $gd_page = 'listing-success'; |
|
| 1169 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1170 | + } |
|
| 1171 | 1171 | |
| 1172 | 1172 | |
| 1173 | - /* |
|
| 1173 | + /* |
|
| 1174 | 1174 | $geodir_meta_desc = $geodir_meta_desc != '' ? $geodir_meta_desc : $meta_desc; |
| 1175 | 1175 | if ($geodir_meta_desc != '') {
|
| 1176 | 1176 | $geodir_meta_desc = strip_tags($geodir_meta_desc); |
@@ -1183,74 +1183,74 @@ discard block |
||
| 1183 | 1183 | */ |
| 1184 | 1184 | |
| 1185 | 1185 | |
| 1186 | - if ($meta_desc) {
|
|
| 1187 | - $meta_desc = stripslashes_deep($meta_desc); |
|
| 1188 | - /** |
|
| 1189 | - * Filter page description to replace variables. |
|
| 1190 | - * |
|
| 1191 | - * @since 1.5.4 |
|
| 1192 | - * @param string $title The page description including variables. |
|
| 1193 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1194 | - */ |
|
| 1195 | - $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1196 | - |
|
| 1197 | - /** |
|
| 1198 | - * Filter SEO meta description. |
|
| 1199 | - * |
|
| 1200 | - * @since 1.0.0 |
|
| 1201 | - * @param string $meta_desc Meta description content. |
|
| 1202 | - */ |
|
| 1203 | - echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1204 | - } |
|
| 1186 | + if ($meta_desc) {
|
|
| 1187 | + $meta_desc = stripslashes_deep($meta_desc); |
|
| 1188 | + /** |
|
| 1189 | + * Filter page description to replace variables. |
|
| 1190 | + * |
|
| 1191 | + * @since 1.5.4 |
|
| 1192 | + * @param string $title The page description including variables. |
|
| 1193 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1194 | + */ |
|
| 1195 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1196 | + |
|
| 1197 | + /** |
|
| 1198 | + * Filter SEO meta description. |
|
| 1199 | + * |
|
| 1200 | + * @since 1.0.0 |
|
| 1201 | + * @param string $meta_desc Meta description content. |
|
| 1202 | + */ |
|
| 1203 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1204 | + } |
|
| 1205 | 1205 | |
| 1206 | - // meta keywords |
|
| 1207 | - if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1208 | - $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1209 | - $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1210 | - |
|
| 1211 | - $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1212 | - } else {
|
|
| 1213 | - $posttags = get_the_tags(); |
|
| 1214 | - if ($posttags) {
|
|
| 1215 | - foreach ($posttags as $tag) {
|
|
| 1216 | - $meta_key .= $tag->name . ' '; |
|
| 1217 | - } |
|
| 1218 | - } else {
|
|
| 1219 | - $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1220 | - $xt = 1; |
|
| 1206 | + // meta keywords |
|
| 1207 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1208 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1209 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1210 | + |
|
| 1211 | + $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1212 | + } else {
|
|
| 1213 | + $posttags = get_the_tags(); |
|
| 1214 | + if ($posttags) {
|
|
| 1215 | + foreach ($posttags as $tag) {
|
|
| 1216 | + $meta_key .= $tag->name . ' '; |
|
| 1217 | + } |
|
| 1218 | + } else {
|
|
| 1219 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1220 | + $xt = 1; |
|
| 1221 | 1221 | |
| 1222 | - foreach ($tags as $tag) {
|
|
| 1223 | - if ($xt <= 20) {
|
|
| 1224 | - $meta_key .= $tag->name . ", "; |
|
| 1225 | - } |
|
| 1222 | + foreach ($tags as $tag) {
|
|
| 1223 | + if ($xt <= 20) {
|
|
| 1224 | + $meta_key .= $tag->name . ", "; |
|
| 1225 | + } |
|
| 1226 | 1226 | |
| 1227 | - $xt++; |
|
| 1228 | - } |
|
| 1229 | - } |
|
| 1230 | - } |
|
| 1227 | + $xt++; |
|
| 1228 | + } |
|
| 1229 | + } |
|
| 1230 | + } |
|
| 1231 | 1231 | |
| 1232 | - $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1233 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1234 | - if ($geodir_meta_keys != '') {
|
|
| 1235 | - $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1236 | - $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1237 | - $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1238 | - $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1239 | - $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1232 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1233 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1234 | + if ($geodir_meta_keys != '') {
|
|
| 1235 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1236 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1237 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1238 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1239 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1240 | 1240 | |
| 1241 | - $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1242 | - } |
|
| 1241 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1242 | + } |
|
| 1243 | 1243 | |
| 1244 | - if ($meta_key) {
|
|
| 1245 | - $meta_key = stripslashes_deep($meta_key); |
|
| 1246 | - /** |
|
| 1247 | - * Filter SEO meta keywords. |
|
| 1248 | - * |
|
| 1249 | - * @since 1.0.0 |
|
| 1250 | - * @param string $meta_desc Meta keywords. |
|
| 1251 | - */ |
|
| 1252 | - echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1253 | - } |
|
| 1244 | + if ($meta_key) {
|
|
| 1245 | + $meta_key = stripslashes_deep($meta_key); |
|
| 1246 | + /** |
|
| 1247 | + * Filter SEO meta keywords. |
|
| 1248 | + * |
|
| 1249 | + * @since 1.0.0 |
|
| 1250 | + * @param string $meta_desc Meta keywords. |
|
| 1251 | + */ |
|
| 1252 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1253 | + } |
|
| 1254 | 1254 | |
| 1255 | 1255 | } |
| 1256 | 1256 | |
@@ -1265,14 +1265,14 @@ discard block |
||
| 1265 | 1265 | */ |
| 1266 | 1266 | function geodir_detail_page_tabs_key_value_array() |
| 1267 | 1267 | {
|
| 1268 | - $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1268 | + $geodir_detail_page_tabs_key_value_array = array(); |
|
| 1269 | 1269 | |
| 1270 | - $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1270 | + $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
|
| 1271 | 1271 | |
| 1272 | - foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1273 | - $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1274 | - } |
|
| 1275 | - return $geodir_detail_page_tabs_key_value_array; |
|
| 1272 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1273 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1274 | + } |
|
| 1275 | + return $geodir_detail_page_tabs_key_value_array; |
|
| 1276 | 1276 | } |
| 1277 | 1277 | |
| 1278 | 1278 | /** |
@@ -1285,73 +1285,73 @@ discard block |
||
| 1285 | 1285 | function geodir_detail_page_tabs_array() |
| 1286 | 1286 | {
|
| 1287 | 1287 | |
| 1288 | - $arr_tabs = array(); |
|
| 1289 | - /** |
|
| 1290 | - * Filter detail page tab display. |
|
| 1291 | - * |
|
| 1292 | - * @since 1.0.0 |
|
| 1293 | - */ |
|
| 1294 | - $arr_tabs['post_profile'] = array( |
|
| 1295 | - 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1296 | - 'is_active_tab' => true, |
|
| 1297 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1298 | - 'tab_content' => '' |
|
| 1299 | - ); |
|
| 1300 | - $arr_tabs['post_info'] = array( |
|
| 1301 | - 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1302 | - 'is_active_tab' => false, |
|
| 1303 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1304 | - 'tab_content' => '' |
|
| 1305 | - ); |
|
| 1306 | - |
|
| 1307 | - $arr_tabs['post_images'] = array( |
|
| 1308 | - 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1309 | - 'is_active_tab' => false, |
|
| 1310 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1311 | - 'tab_content' => '' |
|
| 1312 | - ); |
|
| 1313 | - |
|
| 1314 | - $arr_tabs['post_video'] = array( |
|
| 1315 | - 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1316 | - 'is_active_tab' => false, |
|
| 1317 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1318 | - 'tab_content' => '' |
|
| 1319 | - ); |
|
| 1320 | - |
|
| 1321 | - $arr_tabs['special_offers'] = array( |
|
| 1322 | - 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1323 | - 'is_active_tab' => false, |
|
| 1324 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1325 | - 'tab_content' => '' |
|
| 1326 | - ); |
|
| 1327 | - |
|
| 1328 | - $arr_tabs['post_map'] = array( |
|
| 1329 | - 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1330 | - 'is_active_tab' => false, |
|
| 1331 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1332 | - 'tab_content' => '' |
|
| 1333 | - ); |
|
| 1334 | - |
|
| 1335 | - $arr_tabs['reviews'] = array( |
|
| 1336 | - 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1337 | - 'is_active_tab' => false, |
|
| 1338 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1339 | - 'tab_content' => 'review display' |
|
| 1340 | - ); |
|
| 1341 | - |
|
| 1342 | - $arr_tabs['related_listing'] = array( |
|
| 1343 | - 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1344 | - 'is_active_tab' => false, |
|
| 1345 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1346 | - 'tab_content' => '' |
|
| 1347 | - ); |
|
| 1348 | - |
|
| 1349 | - /** |
|
| 1350 | - * Filter the tabs array. |
|
| 1351 | - * |
|
| 1352 | - * @since 1.0.0 |
|
| 1353 | - */ |
|
| 1354 | - return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1288 | + $arr_tabs = array(); |
|
| 1289 | + /** |
|
| 1290 | + * Filter detail page tab display. |
|
| 1291 | + * |
|
| 1292 | + * @since 1.0.0 |
|
| 1293 | + */ |
|
| 1294 | + $arr_tabs['post_profile'] = array( |
|
| 1295 | + 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1296 | + 'is_active_tab' => true, |
|
| 1297 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1298 | + 'tab_content' => '' |
|
| 1299 | + ); |
|
| 1300 | + $arr_tabs['post_info'] = array( |
|
| 1301 | + 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1302 | + 'is_active_tab' => false, |
|
| 1303 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1304 | + 'tab_content' => '' |
|
| 1305 | + ); |
|
| 1306 | + |
|
| 1307 | + $arr_tabs['post_images'] = array( |
|
| 1308 | + 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1309 | + 'is_active_tab' => false, |
|
| 1310 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1311 | + 'tab_content' => '' |
|
| 1312 | + ); |
|
| 1313 | + |
|
| 1314 | + $arr_tabs['post_video'] = array( |
|
| 1315 | + 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1316 | + 'is_active_tab' => false, |
|
| 1317 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1318 | + 'tab_content' => '' |
|
| 1319 | + ); |
|
| 1320 | + |
|
| 1321 | + $arr_tabs['special_offers'] = array( |
|
| 1322 | + 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1323 | + 'is_active_tab' => false, |
|
| 1324 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1325 | + 'tab_content' => '' |
|
| 1326 | + ); |
|
| 1327 | + |
|
| 1328 | + $arr_tabs['post_map'] = array( |
|
| 1329 | + 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1330 | + 'is_active_tab' => false, |
|
| 1331 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1332 | + 'tab_content' => '' |
|
| 1333 | + ); |
|
| 1334 | + |
|
| 1335 | + $arr_tabs['reviews'] = array( |
|
| 1336 | + 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1337 | + 'is_active_tab' => false, |
|
| 1338 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1339 | + 'tab_content' => 'review display' |
|
| 1340 | + ); |
|
| 1341 | + |
|
| 1342 | + $arr_tabs['related_listing'] = array( |
|
| 1343 | + 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1344 | + 'is_active_tab' => false, |
|
| 1345 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1346 | + 'tab_content' => '' |
|
| 1347 | + ); |
|
| 1348 | + |
|
| 1349 | + /** |
|
| 1350 | + * Filter the tabs array. |
|
| 1351 | + * |
|
| 1352 | + * @since 1.0.0 |
|
| 1353 | + */ |
|
| 1354 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1355 | 1355 | |
| 1356 | 1356 | |
| 1357 | 1357 | } |
@@ -1366,15 +1366,15 @@ discard block |
||
| 1366 | 1366 | */ |
| 1367 | 1367 | function geodir_detail_page_tabs_list() |
| 1368 | 1368 | {
|
| 1369 | - $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1370 | - $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1371 | - if (!empty($tabs_excluded)) {
|
|
| 1372 | - foreach ($tabs_excluded as $tab) {
|
|
| 1373 | - if (array_key_exists($tab, $tabs_array)) |
|
| 1374 | - unset($tabs_array[$tab]); |
|
| 1375 | - } |
|
| 1376 | - } |
|
| 1377 | - return $tabs_array; |
|
| 1369 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1370 | + $tabs_array = geodir_detail_page_tabs_array(); |
|
| 1371 | + if (!empty($tabs_excluded)) {
|
|
| 1372 | + foreach ($tabs_excluded as $tab) {
|
|
| 1373 | + if (array_key_exists($tab, $tabs_array)) |
|
| 1374 | + unset($tabs_array[$tab]); |
|
| 1375 | + } |
|
| 1376 | + } |
|
| 1377 | + return $tabs_array; |
|
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | 1380 | |
@@ -1392,161 +1392,161 @@ discard block |
||
| 1392 | 1392 | */ |
| 1393 | 1393 | function geodir_show_detail_page_tabs() |
| 1394 | 1394 | {
|
| 1395 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1395 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
| 1396 | 1396 | |
| 1397 | - $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1398 | - $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1399 | - $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 |
|
| 1397 | + $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1398 | + $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1399 | + $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 |
|
| 1400 | 1400 | |
| 1401 | - if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1402 | - $post = geodir_get_post_info($request_post_id); |
|
| 1403 | - setup_postdata($post); |
|
| 1404 | - } |
|
| 1401 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1402 | + $post = geodir_get_post_info($request_post_id); |
|
| 1403 | + setup_postdata($post); |
|
| 1404 | + } |
|
| 1405 | 1405 | |
| 1406 | - $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1406 | + $geodir_post_detail_fields = geodir_show_listing_info('detail');
|
|
| 1407 | 1407 | |
| 1408 | 1408 | |
| 1409 | - if (geodir_is_page('detail')) {
|
|
| 1410 | - $video = geodir_get_video($post->ID); |
|
| 1411 | - $special_offers = geodir_get_special_offers($post->ID); |
|
| 1412 | - $related_listing_array = array(); |
|
| 1413 | - if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1414 | - $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1409 | + if (geodir_is_page('detail')) {
|
|
| 1410 | + $video = geodir_get_video($post->ID); |
|
| 1411 | + $special_offers = geodir_get_special_offers($post->ID); |
|
| 1412 | + $related_listing_array = array(); |
|
| 1413 | + if (get_option('geodir_add_related_listing_posttypes'))
|
|
| 1414 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1415 | 1415 | |
| 1416 | 1416 | |
| 1417 | - $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1418 | - if(!$excluded_tabs){$excluded_tabs = array();}
|
|
| 1417 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1418 | + if(!$excluded_tabs){$excluded_tabs = array();}
|
|
| 1419 | 1419 | |
| 1420 | - $related_listing = ''; |
|
| 1421 | - if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
|
|
| 1422 | - $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1423 | - 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1424 | - 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1425 | - 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1426 | - 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1427 | - 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1420 | + $related_listing = ''; |
|
| 1421 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
|
|
| 1422 | + $request = array('post_number' => get_option('geodir_related_post_count'),
|
|
| 1423 | + 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1424 | + 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1425 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1426 | + 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1427 | + 'character_count' => get_option('geodir_related_post_excerpt'));
|
|
| 1428 | 1428 | |
| 1429 | - if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1430 | - $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1431 | - } else {
|
|
| 1432 | - $related_listing = geodir_related_posts_display($request); |
|
| 1433 | - } |
|
| 1429 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1430 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1431 | + } else {
|
|
| 1432 | + $related_listing = geodir_related_posts_display($request); |
|
| 1433 | + } |
|
| 1434 | 1434 | |
| 1435 | - } |
|
| 1435 | + } |
|
| 1436 | 1436 | |
| 1437 | - $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1438 | - $thumb_image = ''; |
|
| 1439 | - if (!empty($post_images)) {
|
|
| 1440 | - foreach ($post_images as $image) {
|
|
| 1441 | - $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1442 | - $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1443 | - $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1444 | - $thumb_image .= '</a>'; |
|
| 1445 | - } |
|
| 1446 | - } |
|
| 1437 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1438 | + $thumb_image = ''; |
|
| 1439 | + if (!empty($post_images)) {
|
|
| 1440 | + foreach ($post_images as $image) {
|
|
| 1441 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1442 | + $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1443 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1444 | + $thumb_image .= '</a>'; |
|
| 1445 | + } |
|
| 1446 | + } |
|
| 1447 | 1447 | |
| 1448 | - $map_args = array(); |
|
| 1449 | - $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1450 | - $map_args['width'] = '600'; |
|
| 1451 | - $map_args['height'] = '300'; |
|
| 1452 | - if ($post->post_mapzoom) {
|
|
| 1453 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1454 | - } |
|
| 1455 | - $map_args['autozoom'] = false; |
|
| 1456 | - $map_args['child_collapse'] = '0'; |
|
| 1457 | - $map_args['enable_cat_filters'] = false; |
|
| 1458 | - $map_args['enable_text_search'] = false; |
|
| 1459 | - $map_args['enable_post_type_filters'] = false; |
|
| 1460 | - $map_args['enable_location_filters'] = false; |
|
| 1461 | - $map_args['enable_jason_on_load'] = true; |
|
| 1462 | - $map_args['enable_map_direction'] = true; |
|
| 1463 | - $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1464 | - $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1465 | - } else if (geodir_is_page('preview')) {
|
|
| 1466 | - $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1467 | - $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1468 | - |
|
| 1469 | - if (isset($post->post_images)) |
|
| 1470 | - $post->post_images = trim($post->post_images, ","); |
|
| 1471 | - |
|
| 1472 | - if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1473 | - $post_images = explode(",", $post->post_images);
|
|
| 1474 | - |
|
| 1475 | - $thumb_image = ''; |
|
| 1476 | - if (!empty($post_images)) {
|
|
| 1477 | - foreach ($post_images as $image) {
|
|
| 1478 | - if ($image != '') {
|
|
| 1479 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1480 | - $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1481 | - $thumb_image .= '</a>'; |
|
| 1482 | - } |
|
| 1483 | - } |
|
| 1484 | - } |
|
| 1448 | + $map_args = array(); |
|
| 1449 | + $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
|
| 1450 | + $map_args['width'] = '600'; |
|
| 1451 | + $map_args['height'] = '300'; |
|
| 1452 | + if ($post->post_mapzoom) {
|
|
| 1453 | + $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1454 | + } |
|
| 1455 | + $map_args['autozoom'] = false; |
|
| 1456 | + $map_args['child_collapse'] = '0'; |
|
| 1457 | + $map_args['enable_cat_filters'] = false; |
|
| 1458 | + $map_args['enable_text_search'] = false; |
|
| 1459 | + $map_args['enable_post_type_filters'] = false; |
|
| 1460 | + $map_args['enable_location_filters'] = false; |
|
| 1461 | + $map_args['enable_jason_on_load'] = true; |
|
| 1462 | + $map_args['enable_map_direction'] = true; |
|
| 1463 | + $map_args['map_class_name'] = 'geodir-map-detail-page'; |
|
| 1464 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1465 | + } else if (geodir_is_page('preview')) {
|
|
| 1466 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1467 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1468 | + |
|
| 1469 | + if (isset($post->post_images)) |
|
| 1470 | + $post->post_images = trim($post->post_images, ","); |
|
| 1471 | + |
|
| 1472 | + if (isset($post->post_images) && !empty($post->post_images)) |
|
| 1473 | + $post_images = explode(",", $post->post_images);
|
|
| 1474 | + |
|
| 1475 | + $thumb_image = ''; |
|
| 1476 | + if (!empty($post_images)) {
|
|
| 1477 | + foreach ($post_images as $image) {
|
|
| 1478 | + if ($image != '') {
|
|
| 1479 | + $thumb_image .= '<a href="' . $image . '">'; |
|
| 1480 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1481 | + $thumb_image .= '</a>'; |
|
| 1482 | + } |
|
| 1483 | + } |
|
| 1484 | + } |
|
| 1485 | 1485 | |
| 1486 | - global $map_jason; |
|
| 1487 | - $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1488 | - $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1489 | - $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1490 | - $marker_json['w'] = $icon_size['w']; |
|
| 1491 | - $marker_json['h'] = $icon_size['h']; |
|
| 1492 | - $map_jason[] = json_encode($marker_json); |
|
| 1493 | - |
|
| 1494 | - $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1495 | - $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1496 | - $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1497 | - $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1498 | - if (!$mapzoom) {
|
|
| 1499 | - $mapzoom = 12; |
|
| 1500 | - } |
|
| 1486 | + global $map_jason; |
|
| 1487 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1488 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1489 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1490 | + $marker_json['w'] = $icon_size['w']; |
|
| 1491 | + $marker_json['h'] = $icon_size['h']; |
|
| 1492 | + $map_jason[] = json_encode($marker_json); |
|
| 1493 | + |
|
| 1494 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1495 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1496 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1497 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1498 | + if (!$mapzoom) {
|
|
| 1499 | + $mapzoom = 12; |
|
| 1500 | + } |
|
| 1501 | 1501 | |
| 1502 | - $map_args = array(); |
|
| 1503 | - $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1504 | - $map_args['width'] = '950'; |
|
| 1505 | - $map_args['height'] = '300'; |
|
| 1506 | - $map_args['child_collapse'] = '0'; |
|
| 1507 | - $map_args['maptype'] = $mapview; |
|
| 1508 | - $map_args['autozoom'] = false; |
|
| 1509 | - $map_args['zoom'] = "$mapzoom"; |
|
| 1510 | - $map_args['latitude'] = $address_latitude; |
|
| 1511 | - $map_args['longitude'] = $address_longitude; |
|
| 1512 | - $map_args['enable_cat_filters'] = false; |
|
| 1513 | - $map_args['enable_text_search'] = false; |
|
| 1514 | - $map_args['enable_post_type_filters'] = false; |
|
| 1515 | - $map_args['enable_location_filters'] = false; |
|
| 1516 | - $map_args['enable_jason_on_load'] = true; |
|
| 1517 | - $map_args['enable_map_direction'] = true; |
|
| 1518 | - $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1519 | - } |
|
| 1502 | + $map_args = array(); |
|
| 1503 | + $map_args['map_canvas_name'] = 'preview_map_canvas'; |
|
| 1504 | + $map_args['width'] = '950'; |
|
| 1505 | + $map_args['height'] = '300'; |
|
| 1506 | + $map_args['child_collapse'] = '0'; |
|
| 1507 | + $map_args['maptype'] = $mapview; |
|
| 1508 | + $map_args['autozoom'] = false; |
|
| 1509 | + $map_args['zoom'] = "$mapzoom"; |
|
| 1510 | + $map_args['latitude'] = $address_latitude; |
|
| 1511 | + $map_args['longitude'] = $address_longitude; |
|
| 1512 | + $map_args['enable_cat_filters'] = false; |
|
| 1513 | + $map_args['enable_text_search'] = false; |
|
| 1514 | + $map_args['enable_post_type_filters'] = false; |
|
| 1515 | + $map_args['enable_location_filters'] = false; |
|
| 1516 | + $map_args['enable_jason_on_load'] = true; |
|
| 1517 | + $map_args['enable_map_direction'] = true; |
|
| 1518 | + $map_args['map_class_name'] = 'geodir-map-preview-page'; |
|
| 1519 | + } |
|
| 1520 | 1520 | |
| 1521 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1521 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1522 | 1522 | |
| 1523 | - $active_tab = ''; |
|
| 1524 | - $active_tab_name = ''; |
|
| 1525 | - $default_tab = ''; |
|
| 1526 | - $default_tab_name = ''; |
|
| 1527 | - foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1528 | - if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1529 | - $active_tab = $tab_index; |
|
| 1530 | - $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1531 | - } |
|
| 1523 | + $active_tab = ''; |
|
| 1524 | + $active_tab_name = ''; |
|
| 1525 | + $default_tab = ''; |
|
| 1526 | + $default_tab_name = ''; |
|
| 1527 | + foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1528 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1529 | + $active_tab = $tab_index; |
|
| 1530 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1531 | + } |
|
| 1532 | 1532 | |
| 1533 | - if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1534 | - $default_tab = $tab_index; |
|
| 1535 | - $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1536 | - } |
|
| 1537 | - } |
|
| 1533 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1534 | + $default_tab = $tab_index; |
|
| 1535 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1536 | + } |
|
| 1537 | + } |
|
| 1538 | 1538 | |
| 1539 | - if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1540 | - if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1541 | - $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1542 | - } |
|
| 1539 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1540 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1541 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1542 | + } |
|
| 1543 | 1543 | |
| 1544 | - $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1545 | - $active_tab = $default_tab; |
|
| 1546 | - $active_tab_name = $default_tab_name; |
|
| 1547 | - } |
|
| 1548 | - $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1549 | - ?> |
|
| 1544 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1545 | + $active_tab = $default_tab; |
|
| 1546 | + $active_tab_name = $default_tab_name; |
|
| 1547 | + } |
|
| 1548 | + $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1549 | + ?> |
|
| 1550 | 1550 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1551 | 1551 | <?php if(!$tab_list){ ?>
|
| 1552 | 1552 | <div id="geodir-tab-mobile-menu"> |
@@ -1556,166 +1556,166 @@ discard block |
||
| 1556 | 1556 | </div> |
| 1557 | 1557 | <dl class="geodir-tab-head"> |
| 1558 | 1558 | <?php |
| 1559 | - } |
|
| 1560 | - /** |
|
| 1561 | - * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1562 | - * |
|
| 1563 | - * @since 1.0.0 |
|
| 1564 | - * @see 'geodir_after_tab_list' |
|
| 1565 | - */ |
|
| 1566 | - do_action('geodir_before_tab_list'); ?>
|
|
| 1559 | + } |
|
| 1560 | + /** |
|
| 1561 | + * Called before the details page tab list headings, inside the `dl` tag. |
|
| 1562 | + * |
|
| 1563 | + * @since 1.0.0 |
|
| 1564 | + * @see 'geodir_after_tab_list' |
|
| 1565 | + */ |
|
| 1566 | + do_action('geodir_before_tab_list'); ?>
|
|
| 1567 | 1567 | <?php |
| 1568 | 1568 | |
| 1569 | - foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1570 | - if ($detail_page_tab['is_display']) {
|
|
| 1569 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1570 | + if ($detail_page_tab['is_display']) {
|
|
| 1571 | 1571 | |
| 1572 | - if(!$tab_list) {
|
|
| 1573 | - ?> |
|
| 1572 | + if(!$tab_list) {
|
|
| 1573 | + ?> |
|
| 1574 | 1574 | <dt></dt> <!-- added to comply with validation --> |
| 1575 | 1575 | <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
|
| 1576 | 1576 | data-tab="#<?php echo $tab_index; ?>" |
| 1577 | 1577 | data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
| 1578 | 1578 | </dd> |
| 1579 | 1579 | <?php |
| 1580 | - } |
|
| 1581 | - ob_start() // start tab content buffering |
|
| 1582 | - ?> |
|
| 1580 | + } |
|
| 1581 | + ob_start() // start tab content buffering |
|
| 1582 | + ?> |
|
| 1583 | 1583 | <li id="<?php echo $tab_index;?>Tab"> |
| 1584 | 1584 | <?php if($tab_list){
|
| 1585 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1586 | - /** |
|
| 1587 | - * Filter the tab list title html. |
|
| 1588 | - * |
|
| 1589 | - * @since 1.6.1 |
|
| 1590 | - * @param string $tab_title The html for the tab title. |
|
| 1591 | - * @param string $tab_index The tab index type. |
|
| 1592 | - * @param array $detail_page_tab The array of values including title text. |
|
| 1593 | - */ |
|
| 1594 | - echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1595 | - }?> |
|
| 1585 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1586 | + /** |
|
| 1587 | + * Filter the tab list title html. |
|
| 1588 | + * |
|
| 1589 | + * @since 1.6.1 |
|
| 1590 | + * @param string $tab_title The html for the tab title. |
|
| 1591 | + * @param string $tab_index The tab index type. |
|
| 1592 | + * @param array $detail_page_tab The array of values including title text. |
|
| 1593 | + */ |
|
| 1594 | + echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1595 | + }?> |
|
| 1596 | 1596 | <div id="<?php echo $tab_index;?>" class="hash-offset"></div> |
| 1597 | 1597 | <?php |
| 1598 | - /** |
|
| 1599 | - * Called before the details tab content is output per tab. |
|
| 1600 | - * |
|
| 1601 | - * @since 1.0.0 |
|
| 1602 | - * @param string $tab_index The tab name ID. |
|
| 1603 | - */ |
|
| 1604 | - do_action('geodir_before_tab_content', $tab_index);
|
|
| 1605 | - |
|
| 1606 | - /** |
|
| 1607 | - * Called before the details tab content is output per tab. |
|
| 1608 | - * |
|
| 1609 | - * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1610 | - * |
|
| 1611 | - * @since 1.0.0 |
|
| 1612 | - * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1613 | - */ |
|
| 1614 | - do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1615 | - /// write a code to generate content of each tab |
|
| 1616 | - switch ($tab_index) {
|
|
| 1617 | - case 'post_profile': |
|
| 1618 | - /** |
|
| 1619 | - * Called before the listing description content on the details page tab. |
|
| 1620 | - * |
|
| 1621 | - * @since 1.0.0 |
|
| 1622 | - */ |
|
| 1623 | - do_action('geodir_before_description_on_listing_detail');
|
|
| 1624 | - if (geodir_is_page('detail')) {
|
|
| 1625 | - the_content(); |
|
| 1626 | - } else {
|
|
| 1627 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1628 | - echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1629 | - } |
|
| 1630 | - |
|
| 1631 | - /** |
|
| 1632 | - * Called after the listing description content on the details page tab. |
|
| 1633 | - * |
|
| 1634 | - * @since 1.0.0 |
|
| 1635 | - */ |
|
| 1636 | - do_action('geodir_after_description_on_listing_detail');
|
|
| 1637 | - break; |
|
| 1638 | - case 'post_info': |
|
| 1639 | - echo $geodir_post_detail_fields; |
|
| 1640 | - break; |
|
| 1641 | - case 'post_images': |
|
| 1642 | - echo $thumb_image; |
|
| 1643 | - break; |
|
| 1644 | - case 'post_video': |
|
| 1645 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1646 | - echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1647 | - break; |
|
| 1648 | - case 'special_offers': |
|
| 1649 | - echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1650 | - |
|
| 1651 | - break; |
|
| 1652 | - case 'post_map': |
|
| 1653 | - geodir_draw_map($map_args); |
|
| 1654 | - break; |
|
| 1655 | - case 'reviews': |
|
| 1656 | - comments_template(); |
|
| 1657 | - break; |
|
| 1658 | - case 'related_listing': |
|
| 1659 | - echo $related_listing; |
|
| 1660 | - break; |
|
| 1661 | - default: {
|
|
| 1662 | - 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'])) {
|
|
| 1663 | - echo $detail_page_tab['tab_content']; |
|
| 1664 | - } |
|
| 1665 | - } |
|
| 1666 | - break; |
|
| 1667 | - } |
|
| 1668 | - |
|
| 1669 | - /** |
|
| 1670 | - * Called after the details tab content is output per tab. |
|
| 1671 | - * |
|
| 1672 | - * @since 1.0.0 |
|
| 1673 | - */ |
|
| 1674 | - do_action('geodir_after_tab_content', $tab_index);
|
|
| 1675 | - |
|
| 1676 | - /** |
|
| 1677 | - * Called after the details tab content is output per tab. |
|
| 1678 | - * |
|
| 1679 | - * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1680 | - * |
|
| 1681 | - * @since 1.0.0 |
|
| 1682 | - * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1683 | - */ |
|
| 1684 | - do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1685 | - ?> </li> |
|
| 1598 | + /** |
|
| 1599 | + * Called before the details tab content is output per tab. |
|
| 1600 | + * |
|
| 1601 | + * @since 1.0.0 |
|
| 1602 | + * @param string $tab_index The tab name ID. |
|
| 1603 | + */ |
|
| 1604 | + do_action('geodir_before_tab_content', $tab_index);
|
|
| 1605 | + |
|
| 1606 | + /** |
|
| 1607 | + * Called before the details tab content is output per tab. |
|
| 1608 | + * |
|
| 1609 | + * Uses dynamic hook name: geodir_before_$tab_index_tab_content |
|
| 1610 | + * |
|
| 1611 | + * @since 1.0.0 |
|
| 1612 | + * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
|
| 1613 | + */ |
|
| 1614 | + do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1615 | + /// write a code to generate content of each tab |
|
| 1616 | + switch ($tab_index) {
|
|
| 1617 | + case 'post_profile': |
|
| 1618 | + /** |
|
| 1619 | + * Called before the listing description content on the details page tab. |
|
| 1620 | + * |
|
| 1621 | + * @since 1.0.0 |
|
| 1622 | + */ |
|
| 1623 | + do_action('geodir_before_description_on_listing_detail');
|
|
| 1624 | + if (geodir_is_page('detail')) {
|
|
| 1625 | + the_content(); |
|
| 1626 | + } else {
|
|
| 1627 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1628 | + echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1629 | + } |
|
| 1630 | + |
|
| 1631 | + /** |
|
| 1632 | + * Called after the listing description content on the details page tab. |
|
| 1633 | + * |
|
| 1634 | + * @since 1.0.0 |
|
| 1635 | + */ |
|
| 1636 | + do_action('geodir_after_description_on_listing_detail');
|
|
| 1637 | + break; |
|
| 1638 | + case 'post_info': |
|
| 1639 | + echo $geodir_post_detail_fields; |
|
| 1640 | + break; |
|
| 1641 | + case 'post_images': |
|
| 1642 | + echo $thumb_image; |
|
| 1643 | + break; |
|
| 1644 | + case 'post_video': |
|
| 1645 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1646 | + echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1647 | + break; |
|
| 1648 | + case 'special_offers': |
|
| 1649 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1650 | + |
|
| 1651 | + break; |
|
| 1652 | + case 'post_map': |
|
| 1653 | + geodir_draw_map($map_args); |
|
| 1654 | + break; |
|
| 1655 | + case 'reviews': |
|
| 1656 | + comments_template(); |
|
| 1657 | + break; |
|
| 1658 | + case 'related_listing': |
|
| 1659 | + echo $related_listing; |
|
| 1660 | + break; |
|
| 1661 | + default: {
|
|
| 1662 | + 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'])) {
|
|
| 1663 | + echo $detail_page_tab['tab_content']; |
|
| 1664 | + } |
|
| 1665 | + } |
|
| 1666 | + break; |
|
| 1667 | + } |
|
| 1668 | + |
|
| 1669 | + /** |
|
| 1670 | + * Called after the details tab content is output per tab. |
|
| 1671 | + * |
|
| 1672 | + * @since 1.0.0 |
|
| 1673 | + */ |
|
| 1674 | + do_action('geodir_after_tab_content', $tab_index);
|
|
| 1675 | + |
|
| 1676 | + /** |
|
| 1677 | + * Called after the details tab content is output per tab. |
|
| 1678 | + * |
|
| 1679 | + * Uses dynamic hook name: geodir_after_$tab_index_tab_content |
|
| 1680 | + * |
|
| 1681 | + * @since 1.0.0 |
|
| 1682 | + * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
|
| 1683 | + */ |
|
| 1684 | + do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1685 | + ?> </li> |
|
| 1686 | 1686 | <?php |
| 1687 | - /** |
|
| 1688 | - * Filter the current tab content. |
|
| 1689 | - * |
|
| 1690 | - * @since 1.0.0 |
|
| 1691 | - */ |
|
| 1692 | - $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1693 | - } // end of if for is_display |
|
| 1694 | - }// end of foreach |
|
| 1695 | - |
|
| 1696 | - /** |
|
| 1697 | - * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1698 | - * |
|
| 1699 | - * @since 1.0.0 |
|
| 1700 | - * @see 'geodir_before_tab_list' |
|
| 1701 | - */ |
|
| 1702 | - do_action('geodir_after_tab_list');
|
|
| 1703 | - ?> |
|
| 1687 | + /** |
|
| 1688 | + * Filter the current tab content. |
|
| 1689 | + * |
|
| 1690 | + * @since 1.0.0 |
|
| 1691 | + */ |
|
| 1692 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1693 | + } // end of if for is_display |
|
| 1694 | + }// end of foreach |
|
| 1695 | + |
|
| 1696 | + /** |
|
| 1697 | + * Called after the details page tab list headings, inside the `dl` tag. |
|
| 1698 | + * |
|
| 1699 | + * @since 1.0.0 |
|
| 1700 | + * @see 'geodir_before_tab_list' |
|
| 1701 | + */ |
|
| 1702 | + do_action('geodir_after_tab_list');
|
|
| 1703 | + ?> |
|
| 1704 | 1704 | <?php if(!$tab_list){?></dl><?php }?>
|
| 1705 | 1705 | <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
|
| 1706 | 1706 | <?php |
| 1707 | - foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1708 | - if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1709 | - echo $detail_page_tab['tab_content']; |
|
| 1710 | - }// end of if |
|
| 1711 | - }// end of foreach |
|
| 1712 | - |
|
| 1713 | - /** |
|
| 1714 | - * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1715 | - * |
|
| 1716 | - * @since 1.0.0 |
|
| 1717 | - */ |
|
| 1718 | - do_action('geodir_add_tab_content'); ?>
|
|
| 1707 | + foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1708 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1709 | + echo $detail_page_tab['tab_content']; |
|
| 1710 | + }// end of if |
|
| 1711 | + }// end of foreach |
|
| 1712 | + |
|
| 1713 | + /** |
|
| 1714 | + * Called after all the tab content is output in `li` tags, called before the closing `ul` tag. |
|
| 1715 | + * |
|
| 1716 | + * @since 1.0.0 |
|
| 1717 | + */ |
|
| 1718 | + do_action('geodir_add_tab_content'); ?>
|
|
| 1719 | 1719 | </ul> |
| 1720 | 1720 | <!--gd-tabs-content ul end--> |
| 1721 | 1721 | </div> |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | }); |
| 1739 | 1739 | </script> |
| 1740 | 1740 | <?php |
| 1741 | - } |
|
| 1741 | + } |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
@@ -1751,127 +1751,127 @@ discard block |
||
| 1751 | 1751 | */ |
| 1752 | 1752 | function geodir_exif($file) |
| 1753 | 1753 | {
|
| 1754 | - if (empty($file) || !is_array($file)) {
|
|
| 1755 | - return $file; |
|
| 1756 | - } |
|
| 1754 | + if (empty($file) || !is_array($file)) {
|
|
| 1755 | + return $file; |
|
| 1756 | + } |
|
| 1757 | 1757 | |
| 1758 | - $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1759 | - if (!($file_path && file_exists($file_path))) {
|
|
| 1760 | - return $file; |
|
| 1761 | - } |
|
| 1762 | - $file['file'] = $file_path; |
|
| 1758 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1759 | + if (!($file_path && file_exists($file_path))) {
|
|
| 1760 | + return $file; |
|
| 1761 | + } |
|
| 1762 | + $file['file'] = $file_path; |
|
| 1763 | 1763 | |
| 1764 | - if (!file_is_valid_image($file_path)) {
|
|
| 1765 | - return $file; // Bail if file is not an image. |
|
| 1766 | - } |
|
| 1764 | + if (!file_is_valid_image($file_path)) {
|
|
| 1765 | + return $file; // Bail if file is not an image. |
|
| 1766 | + } |
|
| 1767 | 1767 | |
| 1768 | - if (!function_exists('wp_get_image_editor')) {
|
|
| 1769 | - return $file; |
|
| 1770 | - } |
|
| 1768 | + if (!function_exists('wp_get_image_editor')) {
|
|
| 1769 | + return $file; |
|
| 1770 | + } |
|
| 1771 | 1771 | |
| 1772 | - $mime_type = $file['type']; |
|
| 1773 | - $exif = array(); |
|
| 1774 | - if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1775 | - try {
|
|
| 1776 | - $exif = exif_read_data($file_path); |
|
| 1777 | - } catch(Exception $e) {
|
|
| 1778 | - $exif = array(); |
|
| 1779 | - } |
|
| 1780 | - } |
|
| 1772 | + $mime_type = $file['type']; |
|
| 1773 | + $exif = array(); |
|
| 1774 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1775 | + try {
|
|
| 1776 | + $exif = exif_read_data($file_path); |
|
| 1777 | + } catch(Exception $e) {
|
|
| 1778 | + $exif = array(); |
|
| 1779 | + } |
|
| 1780 | + } |
|
| 1781 | 1781 | |
| 1782 | - $rotate = false; |
|
| 1783 | - $flip = false; |
|
| 1784 | - $modify = false; |
|
| 1785 | - $orientation = 0; |
|
| 1786 | - if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1787 | - switch ((int)$exif['Orientation']) {
|
|
| 1788 | - case 1: |
|
| 1789 | - // do nothing |
|
| 1790 | - break; |
|
| 1791 | - case 2: |
|
| 1792 | - $flip = array(false, true); |
|
| 1793 | - $modify = true; |
|
| 1794 | - break; |
|
| 1795 | - case 3: |
|
| 1796 | - $orientation = -180; |
|
| 1797 | - $rotate = true; |
|
| 1798 | - $modify = true; |
|
| 1799 | - break; |
|
| 1800 | - case 4: |
|
| 1801 | - $flip = array(true, false); |
|
| 1802 | - $modify = true; |
|
| 1803 | - break; |
|
| 1804 | - case 5: |
|
| 1805 | - $orientation = -90; |
|
| 1806 | - $rotate = true; |
|
| 1807 | - $flip = array(false, true); |
|
| 1808 | - $modify = true; |
|
| 1809 | - break; |
|
| 1810 | - case 6: |
|
| 1811 | - $orientation = -90; |
|
| 1812 | - $rotate = true; |
|
| 1813 | - $modify = true; |
|
| 1814 | - break; |
|
| 1815 | - case 7: |
|
| 1816 | - $orientation = -270; |
|
| 1817 | - $rotate = true; |
|
| 1818 | - $flip = array(false, true); |
|
| 1819 | - $modify = true; |
|
| 1820 | - break; |
|
| 1821 | - case 8: |
|
| 1822 | - case 9: |
|
| 1823 | - $orientation = -270; |
|
| 1824 | - $rotate = true; |
|
| 1825 | - $modify = true; |
|
| 1826 | - break; |
|
| 1827 | - default: |
|
| 1828 | - $orientation = 0; |
|
| 1829 | - $rotate = true; |
|
| 1830 | - $modify = true; |
|
| 1831 | - break; |
|
| 1832 | - } |
|
| 1833 | - } |
|
| 1782 | + $rotate = false; |
|
| 1783 | + $flip = false; |
|
| 1784 | + $modify = false; |
|
| 1785 | + $orientation = 0; |
|
| 1786 | + if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1787 | + switch ((int)$exif['Orientation']) {
|
|
| 1788 | + case 1: |
|
| 1789 | + // do nothing |
|
| 1790 | + break; |
|
| 1791 | + case 2: |
|
| 1792 | + $flip = array(false, true); |
|
| 1793 | + $modify = true; |
|
| 1794 | + break; |
|
| 1795 | + case 3: |
|
| 1796 | + $orientation = -180; |
|
| 1797 | + $rotate = true; |
|
| 1798 | + $modify = true; |
|
| 1799 | + break; |
|
| 1800 | + case 4: |
|
| 1801 | + $flip = array(true, false); |
|
| 1802 | + $modify = true; |
|
| 1803 | + break; |
|
| 1804 | + case 5: |
|
| 1805 | + $orientation = -90; |
|
| 1806 | + $rotate = true; |
|
| 1807 | + $flip = array(false, true); |
|
| 1808 | + $modify = true; |
|
| 1809 | + break; |
|
| 1810 | + case 6: |
|
| 1811 | + $orientation = -90; |
|
| 1812 | + $rotate = true; |
|
| 1813 | + $modify = true; |
|
| 1814 | + break; |
|
| 1815 | + case 7: |
|
| 1816 | + $orientation = -270; |
|
| 1817 | + $rotate = true; |
|
| 1818 | + $flip = array(false, true); |
|
| 1819 | + $modify = true; |
|
| 1820 | + break; |
|
| 1821 | + case 8: |
|
| 1822 | + case 9: |
|
| 1823 | + $orientation = -270; |
|
| 1824 | + $rotate = true; |
|
| 1825 | + $modify = true; |
|
| 1826 | + break; |
|
| 1827 | + default: |
|
| 1828 | + $orientation = 0; |
|
| 1829 | + $rotate = true; |
|
| 1830 | + $modify = true; |
|
| 1831 | + break; |
|
| 1832 | + } |
|
| 1833 | + } |
|
| 1834 | 1834 | |
| 1835 | - $quality = null; |
|
| 1836 | - /** |
|
| 1837 | - * Filter the image quality. |
|
| 1838 | - * |
|
| 1839 | - * @since 1.5.7 |
|
| 1840 | - * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1841 | - * @param string $quality Image mime type. |
|
| 1842 | - */ |
|
| 1843 | - $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1844 | - if ($quality !== null) {
|
|
| 1845 | - $modify = true; |
|
| 1846 | - } |
|
| 1835 | + $quality = null; |
|
| 1836 | + /** |
|
| 1837 | + * Filter the image quality. |
|
| 1838 | + * |
|
| 1839 | + * @since 1.5.7 |
|
| 1840 | + * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
|
| 1841 | + * @param string $quality Image mime type. |
|
| 1842 | + */ |
|
| 1843 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1844 | + if ($quality !== null) {
|
|
| 1845 | + $modify = true; |
|
| 1846 | + } |
|
| 1847 | 1847 | |
| 1848 | - if (!$modify) {
|
|
| 1849 | - return $file; // no change |
|
| 1850 | - } |
|
| 1848 | + if (!$modify) {
|
|
| 1849 | + return $file; // no change |
|
| 1850 | + } |
|
| 1851 | 1851 | |
| 1852 | - $image = wp_get_image_editor($file_path); |
|
| 1853 | - if (!is_wp_error($image)) {
|
|
| 1854 | - if ($rotate) {
|
|
| 1855 | - $image->rotate($orientation); |
|
| 1856 | - } |
|
| 1852 | + $image = wp_get_image_editor($file_path); |
|
| 1853 | + if (!is_wp_error($image)) {
|
|
| 1854 | + if ($rotate) {
|
|
| 1855 | + $image->rotate($orientation); |
|
| 1856 | + } |
|
| 1857 | 1857 | |
| 1858 | - if (!empty($flip)) {
|
|
| 1859 | - $image->flip($flip[0], $flip[1]); |
|
| 1860 | - } |
|
| 1858 | + if (!empty($flip)) {
|
|
| 1859 | + $image->flip($flip[0], $flip[1]); |
|
| 1860 | + } |
|
| 1861 | 1861 | |
| 1862 | - if ($quality !== null) {
|
|
| 1863 | - $image->set_quality((int)$quality); |
|
| 1864 | - } |
|
| 1862 | + if ($quality !== null) {
|
|
| 1863 | + $image->set_quality((int)$quality); |
|
| 1864 | + } |
|
| 1865 | 1865 | |
| 1866 | - $result = $image->save($file_path); |
|
| 1867 | - if (!is_wp_error($result)) {
|
|
| 1868 | - $file['file'] = $result['path']; |
|
| 1869 | - $file['tmp_name'] = $result['path']; |
|
| 1870 | - } |
|
| 1871 | - } |
|
| 1866 | + $result = $image->save($file_path); |
|
| 1867 | + if (!is_wp_error($result)) {
|
|
| 1868 | + $file['file'] = $result['path']; |
|
| 1869 | + $file['tmp_name'] = $result['path']; |
|
| 1870 | + } |
|
| 1871 | + } |
|
| 1872 | 1872 | |
| 1873 | - // The image orientation is fixed, pass it back for further processing |
|
| 1874 | - return $file; |
|
| 1873 | + // The image orientation is fixed, pass it back for further processing |
|
| 1874 | + return $file; |
|
| 1875 | 1875 | } |
| 1876 | 1876 | |
| 1877 | 1877 | /** |
@@ -1890,138 +1890,138 @@ discard block |
||
| 1890 | 1890 | * @return string Returns the recent reviews html. |
| 1891 | 1891 | */ |
| 1892 | 1892 | function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
|
| 1893 | - global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1894 | - $tablecomments = $wpdb->comments; |
|
| 1895 | - $tableposts = $wpdb->posts; |
|
| 1896 | - |
|
| 1897 | - $comments_echo = ''; |
|
| 1898 | - $city_filter = ''; |
|
| 1899 | - $region_filter = ''; |
|
| 1900 | - $country_filter = ''; |
|
| 1901 | - |
|
| 1902 | - if ($gd_session->get('gd_multi_location')) {
|
|
| 1903 | - if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1904 | - $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1905 | - } |
|
| 1893 | + global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
|
| 1894 | + $tablecomments = $wpdb->comments; |
|
| 1895 | + $tableposts = $wpdb->posts; |
|
| 1896 | + |
|
| 1897 | + $comments_echo = ''; |
|
| 1898 | + $city_filter = ''; |
|
| 1899 | + $region_filter = ''; |
|
| 1900 | + $country_filter = ''; |
|
| 1901 | + |
|
| 1902 | + if ($gd_session->get('gd_multi_location')) {
|
|
| 1903 | + if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1904 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1905 | + } |
|
| 1906 | 1906 | |
| 1907 | - if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1908 | - $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1909 | - } |
|
| 1907 | + if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1908 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1909 | + } |
|
| 1910 | 1910 | |
| 1911 | - if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1912 | - $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1913 | - } |
|
| 1914 | - } |
|
| 1911 | + if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1912 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1913 | + } |
|
| 1914 | + } |
|
| 1915 | 1915 | |
| 1916 | - $review_table = GEODIR_REVIEW_TABLE; |
|
| 1917 | - $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"; |
|
| 1918 | - |
|
| 1919 | - $comments = $wpdb->get_results($request); |
|
| 1920 | - |
|
| 1921 | - foreach ($comments as $comment) {
|
|
| 1922 | - // Set the extra comment info needed. |
|
| 1923 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1924 | - //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1925 | - $comment->comment_content = $comment_extra->comment_content; |
|
| 1926 | - $comment->comment_author = $comment_extra->comment_author; |
|
| 1927 | - $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1928 | - |
|
| 1929 | - $comment_id = ''; |
|
| 1930 | - $comment_id = $comment->comment_ID; |
|
| 1931 | - $comment_content = strip_tags($comment->comment_content); |
|
| 1932 | - |
|
| 1933 | - $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1934 | - |
|
| 1935 | - $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1936 | - $comment_author_email = $comment->comment_author_email; |
|
| 1937 | - $comment_post_ID = $comment->post_id; |
|
| 1938 | - |
|
| 1939 | - $na = true; |
|
| 1940 | - if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1941 | - $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1942 | - if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1943 | - } else {
|
|
| 1944 | - $na = false; |
|
| 1945 | - } |
|
| 1946 | - } |
|
| 1916 | + $review_table = GEODIR_REVIEW_TABLE; |
|
| 1917 | + $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"; |
|
| 1918 | + |
|
| 1919 | + $comments = $wpdb->get_results($request); |
|
| 1920 | + |
|
| 1921 | + foreach ($comments as $comment) {
|
|
| 1922 | + // Set the extra comment info needed. |
|
| 1923 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1924 | + //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
|
| 1925 | + $comment->comment_content = $comment_extra->comment_content; |
|
| 1926 | + $comment->comment_author = $comment_extra->comment_author; |
|
| 1927 | + $comment->comment_author_email = $comment_extra->comment_author_email; |
|
| 1928 | + |
|
| 1929 | + $comment_id = ''; |
|
| 1930 | + $comment_id = $comment->comment_ID; |
|
| 1931 | + $comment_content = strip_tags($comment->comment_content); |
|
| 1932 | + |
|
| 1933 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1934 | + |
|
| 1935 | + $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1936 | + $comment_author_email = $comment->comment_author_email; |
|
| 1937 | + $comment_post_ID = $comment->post_id; |
|
| 1938 | + |
|
| 1939 | + $na = true; |
|
| 1940 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 1941 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 1942 | + if ($comment_post_ID == $comment_post_ID2) {
|
|
| 1943 | + } else {
|
|
| 1944 | + $na = false; |
|
| 1945 | + } |
|
| 1946 | + } |
|
| 1947 | 1947 | |
| 1948 | - $post_title = get_the_title($comment_post_ID); |
|
| 1949 | - $permalink = get_permalink($comment_post_ID); |
|
| 1950 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1951 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1948 | + $post_title = get_the_title($comment_post_ID); |
|
| 1949 | + $permalink = get_permalink($comment_post_ID); |
|
| 1950 | + $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1951 | + $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1952 | 1952 | |
| 1953 | - $comment_content_length = strlen($comment_content); |
|
| 1954 | - if ($comment_content_length > $comment_lenth) {
|
|
| 1955 | - $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1956 | - } else {
|
|
| 1957 | - $comment_excerpt = $comment_content; |
|
| 1958 | - } |
|
| 1953 | + $comment_content_length = strlen($comment_content); |
|
| 1954 | + if ($comment_content_length > $comment_lenth) {
|
|
| 1955 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1956 | + } else {
|
|
| 1957 | + $comment_excerpt = $comment_content; |
|
| 1958 | + } |
|
| 1959 | 1959 | |
| 1960 | - if ($comment->user_id) {
|
|
| 1961 | - $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1962 | - } else {
|
|
| 1963 | - $user_profile_url = ''; |
|
| 1964 | - } |
|
| 1960 | + if ($comment->user_id) {
|
|
| 1961 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 1962 | + } else {
|
|
| 1963 | + $user_profile_url = ''; |
|
| 1964 | + } |
|
| 1965 | 1965 | |
| 1966 | - if ($comment_id && $na) {
|
|
| 1967 | - $comments_echo .= '<li class="clearfix">'; |
|
| 1968 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1969 | - if (function_exists('get_avatar')) {
|
|
| 1970 | - if (!isset($comment->comment_type)) {
|
|
| 1971 | - if ($user_profile_url) {
|
|
| 1972 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1973 | - } |
|
| 1974 | - $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1975 | - if ($user_profile_url) {
|
|
| 1976 | - $comments_echo .= '</a>'; |
|
| 1977 | - } |
|
| 1978 | - } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1979 | - if ($user_profile_url) {
|
|
| 1980 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1981 | - } |
|
| 1982 | - $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1983 | - } |
|
| 1984 | - } elseif (function_exists('gravatar')) {
|
|
| 1985 | - if ($user_profile_url) {
|
|
| 1986 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1987 | - } |
|
| 1988 | - $comments_echo .= "<img src=\""; |
|
| 1989 | - if ('' == $comment->comment_type) {
|
|
| 1990 | - $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1991 | - if ($user_profile_url) {
|
|
| 1992 | - $comments_echo .= '</a>'; |
|
| 1993 | - } |
|
| 1994 | - } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1995 | - if ($user_profile_url) {
|
|
| 1996 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1997 | - } |
|
| 1998 | - $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1999 | - if ($user_profile_url) {
|
|
| 2000 | - $comments_echo .= '</a>'; |
|
| 2001 | - } |
|
| 2002 | - } |
|
| 2003 | - $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 2004 | - } |
|
| 1966 | + if ($comment_id && $na) {
|
|
| 1967 | + $comments_echo .= '<li class="clearfix">'; |
|
| 1968 | + $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1969 | + if (function_exists('get_avatar')) {
|
|
| 1970 | + if (!isset($comment->comment_type)) {
|
|
| 1971 | + if ($user_profile_url) {
|
|
| 1972 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1973 | + } |
|
| 1974 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1975 | + if ($user_profile_url) {
|
|
| 1976 | + $comments_echo .= '</a>'; |
|
| 1977 | + } |
|
| 1978 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 1979 | + if ($user_profile_url) {
|
|
| 1980 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1981 | + } |
|
| 1982 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1983 | + } |
|
| 1984 | + } elseif (function_exists('gravatar')) {
|
|
| 1985 | + if ($user_profile_url) {
|
|
| 1986 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1987 | + } |
|
| 1988 | + $comments_echo .= "<img src=\""; |
|
| 1989 | + if ('' == $comment->comment_type) {
|
|
| 1990 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1991 | + if ($user_profile_url) {
|
|
| 1992 | + $comments_echo .= '</a>'; |
|
| 1993 | + } |
|
| 1994 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 1995 | + if ($user_profile_url) {
|
|
| 1996 | + $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1997 | + } |
|
| 1998 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1999 | + if ($user_profile_url) {
|
|
| 2000 | + $comments_echo .= '</a>'; |
|
| 2001 | + } |
|
| 2002 | + } |
|
| 2003 | + $comments_echo .= "\" alt=\"\" class=\"avatar\" />"; |
|
| 2004 | + } |
|
| 2005 | 2005 | |
| 2006 | - $comments_echo .= "</span>\n"; |
|
| 2007 | - |
|
| 2008 | - $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 2009 | - if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 2010 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 2011 | - if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 2012 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 2013 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2014 | - $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2015 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2016 | - //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 2017 | - $comments_echo .= '</p>'; |
|
| 2018 | - |
|
| 2019 | - $comments_echo .= "</span>\n"; |
|
| 2020 | - $comments_echo .= '</li>'; |
|
| 2021 | - } |
|
| 2022 | - } |
|
| 2006 | + $comments_echo .= "</span>\n"; |
|
| 2007 | + |
|
| 2008 | + $comments_echo .= '<span class="geodir_reviewer_content">'; |
|
| 2009 | + if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 2010 | + $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 2011 | + if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 2012 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 2013 | + $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2014 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2015 | + $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2016 | + //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
|
| 2017 | + $comments_echo .= '</p>'; |
|
| 2018 | + |
|
| 2019 | + $comments_echo .= "</span>\n"; |
|
| 2020 | + $comments_echo .= '</li>'; |
|
| 2021 | + } |
|
| 2022 | + } |
|
| 2023 | 2023 | |
| 2024 | - return $comments_echo; |
|
| 2024 | + return $comments_echo; |
|
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | /** |
@@ -2033,29 +2033,29 @@ discard block |
||
| 2033 | 2033 | */ |
| 2034 | 2034 | function geodir_home_map_cats_key_value_array() |
| 2035 | 2035 | {
|
| 2036 | - $post_types = geodir_get_posttypes('object');
|
|
| 2037 | - |
|
| 2038 | - $return = array(); |
|
| 2039 | - if (!empty($post_types)) {
|
|
| 2040 | - foreach ($post_types as $key => $post_type) {
|
|
| 2041 | - $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2042 | - $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 2043 | - $taxonomies = geodir_get_taxonomies($key); |
|
| 2044 | - $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2045 | - $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2046 | - |
|
| 2047 | - if (!empty($cat_terms)) {
|
|
| 2048 | - $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2049 | - |
|
| 2050 | - foreach ($cat_terms as $cat_term) {
|
|
| 2051 | - $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2052 | - } |
|
| 2036 | + $post_types = geodir_get_posttypes('object');
|
|
| 2053 | 2037 | |
| 2054 | - $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2055 | - } |
|
| 2056 | - } |
|
| 2057 | - } |
|
| 2058 | - return $return; |
|
| 2038 | + $return = array(); |
|
| 2039 | + if (!empty($post_types)) {
|
|
| 2040 | + foreach ($post_types as $key => $post_type) {
|
|
| 2041 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2042 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 2043 | + $taxonomies = geodir_get_taxonomies($key); |
|
| 2044 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
|
| 2045 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
|
| 2046 | + |
|
| 2047 | + if (!empty($cat_terms)) {
|
|
| 2048 | + $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2049 | + |
|
| 2050 | + foreach ($cat_terms as $cat_term) {
|
|
| 2051 | + $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2052 | + } |
|
| 2053 | + |
|
| 2054 | + $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2055 | + } |
|
| 2056 | + } |
|
| 2057 | + } |
|
| 2058 | + return $return; |
|
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | 2061 | /** |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | */ |
| 2068 | 2068 | function geodir_twitter_tweet_button() |
| 2069 | 2069 | {
|
| 2070 | - ?> |
|
| 2070 | + ?> |
|
| 2071 | 2071 | <a href="http://twitter.com/share" |
| 2072 | 2072 | class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
| 2073 | 2073 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
@@ -2084,11 +2084,11 @@ discard block |
||
| 2084 | 2084 | * @global object $post The current post object. |
| 2085 | 2085 | */ |
| 2086 | 2086 | function geodir_fb_like_button() {
|
| 2087 | - global $post; |
|
| 2088 | - ?> |
|
| 2087 | + global $post; |
|
| 2088 | + ?> |
|
| 2089 | 2089 | <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
| 2090 | - echo 'allowtransparency="true"'; |
|
| 2091 | - } ?> class="facebook" |
|
| 2090 | + echo 'allowtransparency="true"'; |
|
| 2091 | + } ?> class="facebook" |
|
| 2092 | 2092 | 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" |
| 2093 | 2093 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 2094 | 2094 | <?php |
@@ -2103,7 +2103,7 @@ discard block |
||
| 2103 | 2103 | * @package GeoDirectory |
| 2104 | 2104 | */ |
| 2105 | 2105 | function geodir_google_plus_button() {
|
| 2106 | - ?> |
|
| 2106 | + ?> |
|
| 2107 | 2107 | <div id="plusone-div" class="g-plusone" data-size="medium"></div> |
| 2108 | 2108 | <script type="text/javascript"> |
| 2109 | 2109 | (function () {
|
@@ -2128,8 +2128,8 @@ discard block |
||
| 2128 | 2128 | * @global object $post The current post object. |
| 2129 | 2129 | */ |
| 2130 | 2130 | function geodir_share_this_button_code() {
|
| 2131 | - global $post; |
|
| 2132 | - ?> |
|
| 2131 | + global $post; |
|
| 2132 | + ?> |
|
| 2133 | 2133 | <div class="addthis_toolbox addthis_default_style"> |
| 2134 | 2134 | <span id='st_sharethis'></span> |
| 2135 | 2135 | <script type="text/javascript">var switchTo5x = false;</script> |
@@ -2154,8 +2154,8 @@ discard block |
||
| 2154 | 2154 | } |
| 2155 | 2155 | |
| 2156 | 2156 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2157 | - if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2158 | - ?> |
|
| 2157 | + if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2158 | + ?> |
|
| 2159 | 2159 | <script> |
| 2160 | 2160 | jQuery(function ($) {
|
| 2161 | 2161 | if (typeof(animate_marker) == 'function') {
|
@@ -2172,27 +2172,27 @@ discard block |
||
| 2172 | 2172 | }); |
| 2173 | 2173 | </script> |
| 2174 | 2174 | <?php |
| 2175 | - } |
|
| 2175 | + } |
|
| 2176 | 2176 | } |
| 2177 | 2177 | add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
|
| 2178 | 2178 | |
| 2179 | 2179 | add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
|
| 2180 | 2180 | function geodir_output_favourite_html_listings( $post_id){
|
| 2181 | - geodir_favourite_html('', $post_id);
|
|
| 2181 | + geodir_favourite_html('', $post_id);
|
|
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | 2184 | add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
| 2185 | 2185 | function geodir_output_pinpoint_html_listings( $post_id, $post){
|
| 2186 | - global $wp_query; |
|
| 2186 | + global $wp_query; |
|
| 2187 | 2187 | |
| 2188 | - $show_pin_point = $wp_query->is_main_query(); |
|
| 2188 | + $show_pin_point = $wp_query->is_main_query(); |
|
| 2189 | 2189 | |
| 2190 | - if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2191 | - $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2192 | - $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2193 | - ?> |
|
| 2190 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2191 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2192 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2193 | + ?> |
|
| 2194 | 2194 | <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>
|
| 2195 | 2195 | <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>
|
| 2196 | 2196 | <?php |
| 2197 | - } |
|
| 2197 | + } |
|
| 2198 | 2198 | } |
| 2199 | 2199 | \ No newline at end of file |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
|
|
| 54 | + jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
|
|
| 55 | 55 | //alert(data ); |
| 56 | 56 | }); |
| 57 | 57 | } |
| 58 | 58 | </script> |
| 59 | 59 | <div class="geodir-list-view-select"> |
| 60 | 60 | <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> |
| 61 | - <?php $listing_view = (int)$gd_session->get('gd_listing_view'); ?>
|
|
| 62 | - <option value=""><?php _e('View:', 'geodirectory');?></option>
|
|
| 63 | - <option value="1" <?php selected(1, $listing_view);?>><?php _e('View: List', 'geodirectory');?></option>
|
|
| 64 | - <option value="2" <?php selected(2, $listing_view);?>><?php _e('View: Grid 2', 'geodirectory');?></option>
|
|
| 65 | - <option value="3" <?php selected(3, $listing_view);?>><?php _e('View: Grid 3', 'geodirectory');?></option>
|
|
| 66 | - <option value="4" <?php selected(4, $listing_view);?>><?php _e('View: Grid 4', 'geodirectory');?></option>
|
|
| 67 | - <option value="5" <?php selected(5, $listing_view);?>><?php _e('View: Grid 5', 'geodirectory');?></option>
|
|
| 61 | + <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
|
|
| 62 | + <option value=""><?php _e('View:', 'geodirectory'); ?></option>
|
|
| 63 | + <option value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
|
|
| 64 | + <option value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
|
|
| 65 | + <option value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
|
|
| 66 | + <option value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
|
|
| 67 | + <option value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
|
|
| 68 | 68 | </select> |
| 69 | 69 | </div> |
| 70 | 70 | <?php |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $out .= $subex; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 118 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
| 119 | 119 | /** |
| 120 | 120 | * Filter excerpt read more text. |
| 121 | 121 | * |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
| 129 | 129 | $excut = -(mb_strlen($excerpt_more)); |
| 130 | 130 | $out .= mb_substr($excerpt, 0, $excut); |
| 131 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 131 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
| 132 | 132 | /** |
| 133 | 133 | * Filter excerpt read more text. |
| 134 | 134 | * |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param object|string $post The post object. |
| 185 | 185 | * @param string $post_type The post type. |
| 186 | 186 | */ |
| 187 | - return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
|
|
| 187 | + return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
|
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $post_title = $productinfo->post_title; |
| 239 | 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 | 243 | $user_info = get_userdata($author_id); |
| 244 | 244 | $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | do_action('geodir_after_send_enquiry', $request, 'Enquiry');
|
| 269 | 269 | |
| 270 | 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>.';
|
|
| 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 | 272 | /** |
| 273 | 273 | * Filter client message text. |
| 274 | 274 | * |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | // strip slashes message |
| 299 | 299 | $client_message = stripslashes_deep($client_message); |
| 300 | 300 | |
| 301 | - geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email |
|
| 301 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | do_action('geodir_after_send_enquiry_email', $request);
|
| 321 | 321 | $url = get_permalink($pid); |
| 322 | 322 | if (strstr($url, '?')) {
|
| 323 | - $url = $url . "&send_inquiry=success"; |
|
| 323 | + $url = $url."&send_inquiry=success"; |
|
| 324 | 324 | } else {
|
| 325 | - $url = $url . "?send_inquiry=success"; |
|
| 325 | + $url = $url."?send_inquiry=success"; |
|
| 326 | 326 | } |
| 327 | 327 | /** |
| 328 | 328 | * Filter redirect url after the send enquiry email is sent. |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * } |
| 404 | 404 | */ |
| 405 | 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 |
|
| 406 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email |
|
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | 409 | * Called after the send to friend email is sent. |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $url = get_permalink($pid); |
| 429 | 429 | if (strstr($url, '?')) {
|
| 430 | - $url = $url . "&sendtofrnd=success"; |
|
| 430 | + $url = $url."&sendtofrnd=success"; |
|
| 431 | 431 | } else {
|
| 432 | - $url = $url . "?sendtofrnd=success"; |
|
| 432 | + $url = $url."?sendtofrnd=success"; |
|
| 433 | 433 | } |
| 434 | 434 | /** |
| 435 | 435 | * Filter redirect url after the send to friend email is sent. |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * |
| 464 | 464 | * @since 1.0.0 |
| 465 | 465 | */ |
| 466 | - echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
|
|
| 466 | + echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
|
|
| 467 | 467 | break; |
| 468 | 468 | case 'reviews' : |
| 469 | 469 | echo '<div id="reviews-wrap" class="clearfix"> '; |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | if (!in_array($post_type, $all_postypes)) |
| 530 | 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 | 534 | if (!empty($sort_field_info)) |
| 535 | 535 | return $sort_field_info; |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | if (!in_array($post_type, $all_postypes)) |
| 558 | 558 | return false; |
| 559 | 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)));
|
|
| 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 | 561 | /** |
| 562 | 562 | * Filter post sort options. |
| 563 | 563 | * |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | * |
| 588 | 588 | * @since 1.4.4 |
| 589 | 589 | */ |
| 590 | - if ( is_search() ) {
|
|
| 590 | + if (is_search()) {
|
|
| 591 | 591 | return; |
| 592 | 592 | } |
| 593 | 593 | |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | if ($sort->field_type == 'random') {
|
| 612 | 612 | $key = $sort->field_type; |
| 613 | 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>';
|
|
| 614 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | if ($sort->htmlvar_name == 'comment_count') {
|
@@ -619,21 +619,21 @@ discard block |
||
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | if ($sort->sort_asc) {
|
| 622 | - $key = $sort->htmlvar_name . '_asc'; |
|
| 622 | + $key = $sort->htmlvar_name.'_asc'; |
|
| 623 | 623 | $label = $sort->site_title; |
| 624 | 624 | if ($sort->asc_title) |
| 625 | 625 | $label = $sort->asc_title; |
| 626 | 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>';
|
|
| 627 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | if ($sort->sort_desc) {
|
| 631 | - $key = $sort->htmlvar_name . '_desc'; |
|
| 631 | + $key = $sort->htmlvar_name.'_desc'; |
|
| 632 | 632 | $label = $sort->site_title; |
| 633 | 633 | if ($sort->desc_title) |
| 634 | 634 | $label = $sort->desc_title; |
| 635 | 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>';
|
|
| 636 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | } |
@@ -648,9 +648,9 @@ discard block |
||
| 648 | 648 | <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> |
| 649 | 649 | |
| 650 | 650 | <option |
| 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
|
|
| 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 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | $category = array(); |
| 732 | 732 | |
| 733 | 733 | if (isset($_REQUEST['backandedit'])) {
|
| 734 | - $post = (object)$gd_session->get('listing');
|
|
| 734 | + $post = (object) $gd_session->get('listing');
|
|
| 735 | 735 | $post_type = $post->listing_type; |
| 736 | 736 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
| 737 | 737 | $post_id = $_REQUEST['pid']; |
@@ -746,13 +746,13 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | if ($relate_to == 'category') {
|
| 748 | 748 | |
| 749 | - $category_taxonomy = $post_type . $relate_to; |
|
| 749 | + $category_taxonomy = $post_type.$relate_to; |
|
| 750 | 750 | if (isset($post->{$category_taxonomy}) && $post->{$category_taxonomy} != '')
|
| 751 | 751 | $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
| 752 | 752 | |
| 753 | 753 | } elseif ($relate_to == 'tags') {
|
| 754 | 754 | |
| 755 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 755 | + $category_taxonomy = $post_type.'_'.$relate_to; |
|
| 756 | 756 | if ($post->post_tags != '') |
| 757 | 757 | $category = explode(',', trim($post->post_tags, ','));
|
| 758 | 758 | $tax_field = 'name'; |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | if ($add_location_filter != '0') {
|
| 809 | 809 | $geodir_add_location_url = '1'; |
| 810 | 810 | } |
| 811 | - $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy); |
|
| 811 | + $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy); |
|
| 812 | 812 | $geodir_add_location_url = NULL; |
| 813 | 813 | } |
| 814 | 814 | ob_start(); |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
| 826 | 826 | ?> |
| 827 | 827 | <div class="location_list_heading clearfix"> |
| 828 | - <?php echo $before_title . $title . $after_title; ?> |
|
| 828 | + <?php echo $before_title.$title.$after_title; ?> |
|
| 829 | 829 | </div> |
| 830 | 830 | <?php |
| 831 | 831 | } |
@@ -913,8 +913,8 @@ discard block |
||
| 913 | 913 | $geodir_post_category_str = serialize($geodir_post_category_str); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 917 | - $script = "var post_category_array = " . json_encode($all_var) . ';'; |
|
| 916 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 917 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
| 918 | 918 | echo '<script>'; |
| 919 | 919 | echo $script; |
| 920 | 920 | echo '</script>'; |
@@ -1035,9 +1035,9 @@ discard block |
||
| 1035 | 1035 | } |
| 1036 | 1036 | } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
| 1037 | 1037 | if (is_category()) {
|
| 1038 | - $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
|
|
| 1038 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", FALSE));
|
|
| 1039 | 1039 | } elseif (is_tag()) {
|
| 1040 | - $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
|
|
| 1040 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", FALSE));
|
|
| 1041 | 1041 | } |
| 1042 | 1042 | } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
| 1043 | 1043 | $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | $replace_location = __('Everywhere', 'geodirectory');
|
| 1065 | 1065 | $location_id = NULL; |
| 1066 | 1066 | if ($geodir_location_manager) {
|
| 1067 | - $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1068 | - $location_id = (int)$wpdb->get_var($sql); |
|
| 1067 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1068 | + $location_id = (int) $wpdb->get_var($sql); |
|
| 1069 | 1069 | $location_type = geodir_what_is_current_location(); |
| 1070 | 1070 | if ($location_type == 'city') {
|
| 1071 | 1071 | $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
@@ -1106,65 +1106,65 @@ discard block |
||
| 1106 | 1106 | $category_id = $category->term_id; |
| 1107 | 1107 | $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
| 1108 | 1108 | if ($location_id) {
|
| 1109 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1109 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
| 1110 | 1110 | $cat_loc_option = get_option($option_name); |
| 1111 | 1111 | |
| 1112 | 1112 | $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; |
| 1113 | 1113 | if (!$gd_cat_loc_default) {
|
| 1114 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1114 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
| 1115 | 1115 | $option = get_option($option_name); |
| 1116 | 1116 | $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
| 1117 | 1117 | } |
| 1118 | 1118 | } |
| 1119 | - $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
|
|
| 1119 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", FALSE)).'. '.$category_desc;
|
|
| 1120 | 1120 | } |
| 1121 | 1121 | } else if ($geodir_is_tag) {
|
| 1122 | - $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
|
|
| 1122 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", FALSE)).'. '.$geodir_meta_desc;
|
|
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | |
| 1128 | 1128 | $gd_page = ''; |
| 1129 | - if(geodir_is_page('home')){
|
|
| 1129 | + if (geodir_is_page('home')) {
|
|
| 1130 | 1130 | $gd_page = 'home'; |
| 1131 | 1131 | $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
| 1132 | 1132 | } |
| 1133 | - elseif(geodir_is_page('detail')){
|
|
| 1133 | + elseif (geodir_is_page('detail')) {
|
|
| 1134 | 1134 | $gd_page = 'detail'; |
| 1135 | 1135 | $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
| 1136 | 1136 | } |
| 1137 | - elseif(geodir_is_page('pt')){
|
|
| 1137 | + elseif (geodir_is_page('pt')) {
|
|
| 1138 | 1138 | $gd_page = 'pt'; |
| 1139 | 1139 | $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
| 1140 | 1140 | } |
| 1141 | - elseif(geodir_is_page('listing')){
|
|
| 1141 | + elseif (geodir_is_page('listing')) {
|
|
| 1142 | 1142 | $gd_page = 'listing'; |
| 1143 | 1143 | $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
| 1144 | 1144 | } |
| 1145 | - elseif(geodir_is_page('location')){
|
|
| 1145 | + elseif (geodir_is_page('location')) {
|
|
| 1146 | 1146 | $gd_page = 'location'; |
| 1147 | 1147 | $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
| 1148 | 1148 | $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
| 1149 | 1149 | |
| 1150 | 1150 | } |
| 1151 | - elseif(geodir_is_page('search')){
|
|
| 1151 | + elseif (geodir_is_page('search')) {
|
|
| 1152 | 1152 | $gd_page = 'search'; |
| 1153 | 1153 | $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
| 1154 | 1154 | } |
| 1155 | - elseif(geodir_is_page('add-listing')){
|
|
| 1155 | + elseif (geodir_is_page('add-listing')) {
|
|
| 1156 | 1156 | $gd_page = 'add-listing'; |
| 1157 | 1157 | $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
| 1158 | 1158 | } |
| 1159 | - elseif(geodir_is_page('author')){
|
|
| 1159 | + elseif (geodir_is_page('author')) {
|
|
| 1160 | 1160 | $gd_page = 'author'; |
| 1161 | 1161 | $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
| 1162 | 1162 | } |
| 1163 | - elseif(geodir_is_page('login')){
|
|
| 1163 | + elseif (geodir_is_page('login')) {
|
|
| 1164 | 1164 | $gd_page = 'login'; |
| 1165 | 1165 | $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
| 1166 | 1166 | } |
| 1167 | - elseif(geodir_is_page('listing-success')){
|
|
| 1167 | + elseif (geodir_is_page('listing-success')) {
|
|
| 1168 | 1168 | $gd_page = 'listing-success'; |
| 1169 | 1169 | $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
| 1170 | 1170 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | * @param string $title The page description including variables. |
| 1193 | 1193 | * @param string $gd_page The GeoDirectory page type if any. |
| 1194 | 1194 | */ |
| 1195 | - $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
|
|
| 1195 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
|
|
| 1196 | 1196 | |
| 1197 | 1197 | /** |
| 1198 | 1198 | * Filter SEO meta description. |
@@ -1200,20 +1200,20 @@ discard block |
||
| 1200 | 1200 | * @since 1.0.0 |
| 1201 | 1201 | * @param string $meta_desc Meta description content. |
| 1202 | 1202 | */ |
| 1203 | - echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
|
|
| 1203 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
|
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | // meta keywords |
| 1207 | 1207 | if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
| 1208 | - $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
|
|
| 1209 | - $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
|
|
| 1208 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
|
|
| 1209 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
|
|
| 1210 | 1210 | |
| 1211 | - $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
|
|
| 1211 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
|
|
| 1212 | 1212 | } else {
|
| 1213 | 1213 | $posttags = get_the_tags(); |
| 1214 | 1214 | if ($posttags) {
|
| 1215 | 1215 | foreach ($posttags as $tag) {
|
| 1216 | - $meta_key .= $tag->name . ' '; |
|
| 1216 | + $meta_key .= $tag->name.' '; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | } else {
|
| 1219 | 1219 | $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | |
| 1222 | 1222 | foreach ($tags as $tag) {
|
| 1223 | 1223 | if ($xt <= 20) {
|
| 1224 | - $meta_key .= $tag->name . ", "; |
|
| 1224 | + $meta_key .= $tag->name.", "; |
|
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | $xt++; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | } |
| 1231 | 1231 | |
| 1232 | 1232 | $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
| 1233 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1233 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1234 | 1234 | if ($geodir_meta_keys != '') {
|
| 1235 | 1235 | $geodir_meta_keys = strip_tags($geodir_meta_keys); |
| 1236 | 1236 | $geodir_meta_keys = esc_html($geodir_meta_keys); |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | * @since 1.0.0 |
| 1250 | 1250 | * @param string $meta_desc Meta keywords. |
| 1251 | 1251 | */ |
| 1252 | - echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
|
|
| 1252 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
|
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | 1255 | } |
@@ -1394,8 +1394,8 @@ discard block |
||
| 1394 | 1394 | {
|
| 1395 | 1395 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
| 1396 | 1396 | |
| 1397 | - $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0; |
|
| 1398 | - $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0; |
|
| 1397 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
| 1398 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
| 1399 | 1399 | $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 |
| 1400 | 1400 | |
| 1401 | 1401 | if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | |
| 1416 | 1416 | |
| 1417 | 1417 | $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
|
| 1418 | - if(!$excluded_tabs){$excluded_tabs = array();}
|
|
| 1418 | + if (!$excluded_tabs) {$excluded_tabs = array(); }
|
|
| 1419 | 1419 | |
| 1420 | 1420 | $related_listing = ''; |
| 1421 | 1421 | if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
|
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | if (!empty($post_images)) {
|
| 1440 | 1440 | foreach ($post_images as $image) {
|
| 1441 | 1441 | $caption = (!empty($image->caption)) ? $image->caption : ''; |
| 1442 | - $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">'; |
|
| 1442 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
| 1443 | 1443 | $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
| 1444 | 1444 | $thumb_image .= '</a>'; |
| 1445 | 1445 | } |
@@ -1450,7 +1450,7 @@ discard block |
||
| 1450 | 1450 | $map_args['width'] = '600'; |
| 1451 | 1451 | $map_args['height'] = '300'; |
| 1452 | 1452 | if ($post->post_mapzoom) {
|
| 1453 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1453 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
| 1454 | 1454 | } |
| 1455 | 1455 | $map_args['autozoom'] = false; |
| 1456 | 1456 | $map_args['child_collapse'] = '0'; |
@@ -1476,7 +1476,7 @@ discard block |
||
| 1476 | 1476 | if (!empty($post_images)) {
|
| 1477 | 1477 | foreach ($post_images as $image) {
|
| 1478 | 1478 | if ($image != '') {
|
| 1479 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1479 | + $thumb_image .= '<a href="'.$image.'">'; |
|
| 1480 | 1480 | $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
| 1481 | 1481 | $thumb_image .= '</a>'; |
| 1482 | 1482 | } |
@@ -1518,13 +1518,13 @@ discard block |
||
| 1518 | 1518 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1521 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
| 1522 | 1522 | |
| 1523 | 1523 | $active_tab = ''; |
| 1524 | 1524 | $active_tab_name = ''; |
| 1525 | 1525 | $default_tab = ''; |
| 1526 | 1526 | $default_tab_name = ''; |
| 1527 | - foreach($arr_detail_page_tabs as $tab_index => $tabs){
|
|
| 1527 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
|
|
| 1528 | 1528 | if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
| 1529 | 1529 | $active_tab = $tab_index; |
| 1530 | 1530 | $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
@@ -1545,10 +1545,10 @@ discard block |
||
| 1545 | 1545 | $active_tab = $default_tab; |
| 1546 | 1546 | $active_tab_name = $default_tab_name; |
| 1547 | 1547 | } |
| 1548 | - $tab_list = (get_option('geodir_disable_tabs',false)) ? true : false;
|
|
| 1548 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
|
|
| 1549 | 1549 | ?> |
| 1550 | 1550 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1551 | - <?php if(!$tab_list){ ?>
|
|
| 1551 | + <?php if (!$tab_list) { ?>
|
|
| 1552 | 1552 | <div id="geodir-tab-mobile-menu"> |
| 1553 | 1553 | <i class="fa fa-bars"></i> |
| 1554 | 1554 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1569,10 +1569,10 @@ discard block |
||
| 1569 | 1569 | foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
| 1570 | 1570 | if ($detail_page_tab['is_display']) {
|
| 1571 | 1571 | |
| 1572 | - if(!$tab_list) {
|
|
| 1572 | + if (!$tab_list) {
|
|
| 1573 | 1573 | ?> |
| 1574 | 1574 | <dt></dt> <!-- added to comply with validation --> |
| 1575 | - <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1575 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1576 | 1576 | data-tab="#<?php echo $tab_index; ?>" |
| 1577 | 1577 | data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
| 1578 | 1578 | </dd> |
@@ -1580,9 +1580,9 @@ discard block |
||
| 1580 | 1580 | } |
| 1581 | 1581 | ob_start() // start tab content buffering |
| 1582 | 1582 | ?> |
| 1583 | - <li id="<?php echo $tab_index;?>Tab"> |
|
| 1584 | - <?php if($tab_list){
|
|
| 1585 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'],'geodirectory').'</a></span><hr />'; |
|
| 1583 | + <li id="<?php echo $tab_index; ?>Tab"> |
|
| 1584 | + <?php if ($tab_list) {
|
|
| 1585 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
| 1586 | 1586 | /** |
| 1587 | 1587 | * Filter the tab list title html. |
| 1588 | 1588 | * |
@@ -1591,9 +1591,9 @@ discard block |
||
| 1591 | 1591 | * @param string $tab_index The tab index type. |
| 1592 | 1592 | * @param array $detail_page_tab The array of values including title text. |
| 1593 | 1593 | */ |
| 1594 | - echo apply_filters('geodir_tab_list_title',$tab_title ,$tab_index ,$detail_page_tab);
|
|
| 1594 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
|
|
| 1595 | 1595 | }?> |
| 1596 | - <div id="<?php echo $tab_index;?>" class="hash-offset"></div> |
|
| 1596 | + <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
|
| 1597 | 1597 | <?php |
| 1598 | 1598 | /** |
| 1599 | 1599 | * Called before the details tab content is output per tab. |
@@ -1611,7 +1611,7 @@ discard block |
||
| 1611 | 1611 | * @since 1.0.0 |
| 1612 | 1612 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
| 1613 | 1613 | */ |
| 1614 | - do_action('geodir_before_' . $tab_index . '_tab_content');
|
|
| 1614 | + do_action('geodir_before_'.$tab_index.'_tab_content');
|
|
| 1615 | 1615 | /// write a code to generate content of each tab |
| 1616 | 1616 | switch ($tab_index) {
|
| 1617 | 1617 | case 'post_profile': |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | break; |
| 1644 | 1644 | case 'post_video': |
| 1645 | 1645 | /** This action is documented in geodirectory_template_actions.php */ |
| 1646 | - echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
|
|
| 1646 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
|
|
| 1647 | 1647 | break; |
| 1648 | 1648 | case 'special_offers': |
| 1649 | 1649 | echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | * @since 1.0.0 |
| 1682 | 1682 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
| 1683 | 1683 | */ |
| 1684 | - do_action('geodir_after_' . $tab_index . '_tab_content');
|
|
| 1684 | + do_action('geodir_after_'.$tab_index.'_tab_content');
|
|
| 1685 | 1685 | ?> </li> |
| 1686 | 1686 | <?php |
| 1687 | 1687 | /** |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | * |
| 1690 | 1690 | * @since 1.0.0 |
| 1691 | 1691 | */ |
| 1692 | - $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
|
|
| 1692 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
|
|
| 1693 | 1693 | } // end of if for is_display |
| 1694 | 1694 | }// end of foreach |
| 1695 | 1695 | |
@@ -1701,8 +1701,8 @@ discard block |
||
| 1701 | 1701 | */ |
| 1702 | 1702 | do_action('geodir_after_tab_list');
|
| 1703 | 1703 | ?> |
| 1704 | - <?php if(!$tab_list){?></dl><?php }?>
|
|
| 1705 | - <ul class="geodir-tabs-content entry-content <?php if($tab_list){?>geodir-tabs-list<?php }?>" style="position:relative;">
|
|
| 1704 | + <?php if (!$tab_list) {?></dl><?php }?>
|
|
| 1705 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) {?>geodir-tabs-list<?php }?>" style="position:relative;">
|
|
| 1706 | 1706 | <?php |
| 1707 | 1707 | foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
| 1708 | 1708 | if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | </ul> |
| 1720 | 1720 | <!--gd-tabs-content ul end--> |
| 1721 | 1721 | </div> |
| 1722 | - <?php if(!$tab_list){ ?>
|
|
| 1722 | + <?php if (!$tab_list) { ?>
|
|
| 1723 | 1723 | <script> |
| 1724 | 1724 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
|
| 1725 | 1725 | hashVal = window.location.hash; |
@@ -1774,7 +1774,7 @@ discard block |
||
| 1774 | 1774 | if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
| 1775 | 1775 | try {
|
| 1776 | 1776 | $exif = exif_read_data($file_path); |
| 1777 | - } catch(Exception $e) {
|
|
| 1777 | + } catch (Exception $e) {
|
|
| 1778 | 1778 | $exif = array(); |
| 1779 | 1779 | } |
| 1780 | 1780 | } |
@@ -1784,7 +1784,7 @@ discard block |
||
| 1784 | 1784 | $modify = false; |
| 1785 | 1785 | $orientation = 0; |
| 1786 | 1786 | if (!empty($exif) && isset($exif['Orientation'])) {
|
| 1787 | - switch ((int)$exif['Orientation']) {
|
|
| 1787 | + switch ((int) $exif['Orientation']) {
|
|
| 1788 | 1788 | case 1: |
| 1789 | 1789 | // do nothing |
| 1790 | 1790 | break; |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | if ($quality !== null) {
|
| 1863 | - $image->set_quality((int)$quality); |
|
| 1863 | + $image->set_quality((int) $quality); |
|
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | $result = $image->save($file_path); |
@@ -1932,7 +1932,7 @@ discard block |
||
| 1932 | 1932 | |
| 1933 | 1933 | $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
| 1934 | 1934 | |
| 1935 | - $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID; |
|
| 1935 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
| 1936 | 1936 | $comment_author_email = $comment->comment_author_email; |
| 1937 | 1937 | $comment_post_ID = $comment->post_id; |
| 1938 | 1938 | |
@@ -1947,12 +1947,12 @@ discard block |
||
| 1947 | 1947 | |
| 1948 | 1948 | $post_title = get_the_title($comment_post_ID); |
| 1949 | 1949 | $permalink = get_permalink($comment_post_ID); |
| 1950 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 1951 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
|
|
| 1950 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
| 1951 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
|
|
| 1952 | 1952 | |
| 1953 | 1953 | $comment_content_length = strlen($comment_content); |
| 1954 | 1954 | if ($comment_content_length > $comment_lenth) {
|
| 1955 | - $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more; |
|
| 1955 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
| 1956 | 1956 | } else {
|
| 1957 | 1957 | $comment_excerpt = $comment_content; |
| 1958 | 1958 | } |
@@ -1965,37 +1965,37 @@ discard block |
||
| 1965 | 1965 | |
| 1966 | 1966 | if ($comment_id && $na) {
|
| 1967 | 1967 | $comments_echo .= '<li class="clearfix">'; |
| 1968 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 1968 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
| 1969 | 1969 | if (function_exists('get_avatar')) {
|
| 1970 | 1970 | if (!isset($comment->comment_type)) {
|
| 1971 | 1971 | if ($user_profile_url) {
|
| 1972 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1972 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 1973 | 1973 | } |
| 1974 | - $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1974 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 1975 | 1975 | if ($user_profile_url) {
|
| 1976 | 1976 | $comments_echo .= '</a>'; |
| 1977 | 1977 | } |
| 1978 | 1978 | } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
| 1979 | 1979 | if ($user_profile_url) {
|
| 1980 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1980 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 1981 | 1981 | } |
| 1982 | - $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1982 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 1983 | 1983 | } |
| 1984 | 1984 | } elseif (function_exists('gravatar')) {
|
| 1985 | 1985 | if ($user_profile_url) {
|
| 1986 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1986 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 1987 | 1987 | } |
| 1988 | 1988 | $comments_echo .= "<img src=\""; |
| 1989 | 1989 | if ('' == $comment->comment_type) {
|
| 1990 | - $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1990 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 1991 | 1991 | if ($user_profile_url) {
|
| 1992 | 1992 | $comments_echo .= '</a>'; |
| 1993 | 1993 | } |
| 1994 | 1994 | } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
| 1995 | 1995 | if ($user_profile_url) {
|
| 1996 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 1996 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 1997 | 1997 | } |
| 1998 | - $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png'); |
|
| 1998 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 1999 | 1999 | if ($user_profile_url) {
|
| 2000 | 2000 | $comments_echo .= '</a>'; |
| 2001 | 2001 | } |
@@ -2006,13 +2006,13 @@ discard block |
||
| 2006 | 2006 | $comments_echo .= "</span>\n"; |
| 2007 | 2007 | |
| 2008 | 2008 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
| 2009 | - if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
|
|
| 2010 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 2011 | - if($comment->user_id){$comments_echo .= '</a>';}
|
|
| 2012 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
|
|
| 2013 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2009 | + if ($comment->user_id) {$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; }
|
|
| 2010 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
| 2011 | + if ($comment->user_id) {$comments_echo .= '</a>'; }
|
|
| 2012 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
|
|
| 2013 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
| 2014 | 2014 | $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
| 2015 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2015 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
| 2016 | 2016 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
| 2017 | 2017 | $comments_echo .= '</p>'; |
| 2018 | 2018 | |
@@ -2039,19 +2039,19 @@ discard block |
||
| 2039 | 2039 | if (!empty($post_types)) {
|
| 2040 | 2040 | foreach ($post_types as $key => $post_type) {
|
| 2041 | 2041 | $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
| 2042 | - $post_type_name = sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
|
|
| 2042 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
|
|
| 2043 | 2043 | $taxonomies = geodir_get_taxonomies($key); |
| 2044 | 2044 | $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL; |
| 2045 | 2045 | $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL; |
| 2046 | 2046 | |
| 2047 | 2047 | if (!empty($cat_terms)) {
|
| 2048 | - $return['optgroup_start-' . $key] = $post_type_name; |
|
| 2048 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
| 2049 | 2049 | |
| 2050 | 2050 | foreach ($cat_terms as $cat_term) {
|
| 2051 | - $return[$key . '_' . $cat_term->term_id] = $cat_term->name; |
|
| 2051 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
| 2052 | 2052 | } |
| 2053 | 2053 | |
| 2054 | - $return['optgroup_end-' . $key] = $post_type_name; |
|
| 2054 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
| 2055 | 2055 | } |
| 2056 | 2056 | } |
| 2057 | 2057 | } |
@@ -2143,10 +2143,10 @@ discard block |
||
| 2143 | 2143 | stWidget.addEntry({
|
| 2144 | 2144 | "service": "sharethis", |
| 2145 | 2145 | "element": document.getElementById('st_sharethis'),
|
| 2146 | - "url": "<?php echo geodir_curPageURL();?>", |
|
| 2147 | - "title": "<?php echo $post->post_title;?>", |
|
| 2146 | + "url": "<?php echo geodir_curPageURL(); ?>", |
|
| 2147 | + "title": "<?php echo $post->post_title; ?>", |
|
| 2148 | 2148 | "type": "chicklet", |
| 2149 | - "text": "<?php _e( 'Share', 'geodirectory' );?>" |
|
| 2149 | + "text": "<?php _e('Share', 'geodirectory'); ?>"
|
|
| 2150 | 2150 | }); |
| 2151 | 2151 | </script> |
| 2152 | 2152 | </div> |
@@ -2154,7 +2154,7 @@ discard block |
||
| 2154 | 2154 | } |
| 2155 | 2155 | |
| 2156 | 2156 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2157 | - if(get_option('geodir_listing_hover_bounce_map_pin',true)) {
|
|
| 2157 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
|
|
| 2158 | 2158 | ?> |
| 2159 | 2159 | <script> |
| 2160 | 2160 | jQuery(function ($) {
|
@@ -2174,15 +2174,15 @@ discard block |
||
| 2174 | 2174 | <?php |
| 2175 | 2175 | } |
| 2176 | 2176 | } |
| 2177 | -add_action('geodir_after_listing_listview','geodir_listing_bounce_map_pin_on_hover',10);
|
|
| 2177 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
|
|
| 2178 | 2178 | |
| 2179 | -add_action('geodir_after_favorite_html','geodir_output_favourite_html_listings',1,1);
|
|
| 2180 | -function geodir_output_favourite_html_listings( $post_id){
|
|
| 2179 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
|
|
| 2180 | +function geodir_output_favourite_html_listings($post_id) {
|
|
| 2181 | 2181 | geodir_favourite_html('', $post_id);
|
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2); |
|
| 2185 | -function geodir_output_pinpoint_html_listings( $post_id, $post){
|
|
| 2184 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
|
|
| 2185 | +function geodir_output_pinpoint_html_listings($post_id, $post) {
|
|
| 2186 | 2186 | global $wp_query; |
| 2187 | 2187 | |
| 2188 | 2188 | $show_pin_point = $wp_query->is_main_query(); |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function geodir_is_login($redirect = false) |
| 19 | 19 | {
|
| 20 | - global $current_user; |
|
| 21 | - if (!$current_user->ID) {
|
|
| 22 | - if ($redirect) {
|
|
| 23 | - ?> |
|
| 20 | + global $current_user; |
|
| 21 | + if (!$current_user->ID) {
|
|
| 22 | + if ($redirect) {
|
|
| 23 | + ?> |
|
| 24 | 24 | <script type="text/javascript"> |
| 25 | 25 | window.location.href = '<?php echo geodir_login_url();?>'; |
| 26 | 26 | </script> |
| 27 | 27 | <?php |
| 28 | - } else |
|
| 29 | - return false; |
|
| 30 | - } else |
|
| 31 | - return true; |
|
| 28 | + } else |
|
| 29 | + return false; |
|
| 30 | + } else |
|
| 31 | + return true; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | {
|
| 43 | 43 | |
| 44 | 44 | // Redirect to https login if forced to use SSL |
| 45 | - if (force_ssl_admin() && !is_ssl()) {
|
|
| 46 | - if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
|
|
| 47 | - wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
|
| 48 | - exit(); |
|
| 49 | - } else {
|
|
| 50 | - wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 51 | - exit(); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Filter the login message. |
|
| 57 | - * |
|
| 58 | - * @since 1.0.0 |
|
| 59 | - * |
|
| 60 | - * @param string $message Login message. |
|
| 61 | - */ |
|
| 62 | - $message = apply_filters('login_message', $message);
|
|
| 63 | - if (!empty($message)) echo $message . "\n"; |
|
| 45 | + if (force_ssl_admin() && !is_ssl()) {
|
|
| 46 | + if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
|
|
| 47 | + wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
|
|
| 48 | + exit(); |
|
| 49 | + } else {
|
|
| 50 | + wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
|
| 51 | + exit(); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Filter the login message. |
|
| 57 | + * |
|
| 58 | + * @since 1.0.0 |
|
| 59 | + * |
|
| 60 | + * @param string $message Login message. |
|
| 61 | + */ |
|
| 62 | + $message = apply_filters('login_message', $message);
|
|
| 63 | + if (!empty($message)) echo $message . "\n"; |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -73,59 +73,59 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | function geodir_get_site_email_id() |
| 75 | 75 | {
|
| 76 | - if (get_option('site_email')) {
|
|
| 76 | + if (get_option('site_email')) {
|
|
| 77 | 77 | |
| 78 | - return get_option('site_email');
|
|
| 78 | + return get_option('site_email');
|
|
| 79 | 79 | |
| 80 | - } else {
|
|
| 80 | + } else {
|
|
| 81 | 81 | |
| 82 | - return get_option('admin_email');
|
|
| 82 | + return get_option('admin_email');
|
|
| 83 | 83 | |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | if (!function_exists('get_site_emailName')) {
|
| 90 | - /** |
|
| 91 | - * Get site name for sending emails. |
|
| 92 | - * |
|
| 93 | - * @since 1.0.0 |
|
| 94 | - * @package GeoDirectory |
|
| 95 | - * @return string Site name. |
|
| 96 | - */ |
|
| 97 | - function get_site_emailName() |
|
| 90 | + /** |
|
| 91 | + * Get site name for sending emails. |
|
| 92 | + * |
|
| 93 | + * @since 1.0.0 |
|
| 94 | + * @package GeoDirectory |
|
| 95 | + * @return string Site name. |
|
| 96 | + */ |
|
| 97 | + function get_site_emailName() |
|
| 98 | 98 | |
| 99 | - {
|
|
| 99 | + {
|
|
| 100 | 100 | |
| 101 | - if (get_option('site_email_name')) {
|
|
| 101 | + if (get_option('site_email_name')) {
|
|
| 102 | 102 | |
| 103 | - return stripslashes(get_option('site_email_name'));
|
|
| 103 | + return stripslashes(get_option('site_email_name'));
|
|
| 104 | 104 | |
| 105 | - } else {
|
|
| 105 | + } else {
|
|
| 106 | 106 | |
| 107 | - return stripslashes(get_option('blogname'));
|
|
| 107 | + return stripslashes(get_option('blogname'));
|
|
| 108 | 108 | |
| 109 | - } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if (!function_exists('is_allow_user_register')) {
|
| 115 | - /** |
|
| 116 | - * Checks whether the site allowing user registration or not. |
|
| 117 | - * |
|
| 118 | - * @since 1.0.0 |
|
| 119 | - * @package GeoDirectory |
|
| 120 | - * @return bool|string |
|
| 121 | - */ |
|
| 122 | - function is_allow_user_register() |
|
| 115 | + /** |
|
| 116 | + * Checks whether the site allowing user registration or not. |
|
| 117 | + * |
|
| 118 | + * @since 1.0.0 |
|
| 119 | + * @package GeoDirectory |
|
| 120 | + * @return bool|string |
|
| 121 | + */ |
|
| 122 | + function is_allow_user_register() |
|
| 123 | 123 | |
| 124 | - {
|
|
| 124 | + {
|
|
| 125 | 125 | |
| 126 | - return get_option('users_can_register');
|
|
| 126 | + return get_option('users_can_register');
|
|
| 127 | 127 | |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -138,107 +138,107 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | function geodir_retrieve_password() |
| 140 | 140 | {
|
| 141 | - global $wpdb; |
|
| 142 | - |
|
| 143 | - $errors = new WP_Error(); |
|
| 144 | - if (empty($_POST['user_login']) && empty($_POST['user_email'])) |
|
| 145 | - $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
|
|
| 146 | - |
|
| 147 | - if (strpos($_POST['user_login'], '@')) {
|
|
| 148 | - //$user_data = get_user_by_email(trim($_POST['user_login'])); |
|
| 149 | - $user_data = get_user_by('email', trim($_POST['user_login']));
|
|
| 150 | - if (empty($user_data)) |
|
| 151 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
|
|
| 152 | - } else {
|
|
| 153 | - $login = trim($_POST['user_login']); |
|
| 154 | - $user_data = get_user_by('email', $login);
|
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent. |
|
| 159 | - * |
|
| 160 | - * @since 1.0.0 |
|
| 161 | - */ |
|
| 162 | - do_action('lostpassword_post');
|
|
| 163 | - |
|
| 164 | - if ($errors->get_error_code()) |
|
| 165 | - return $errors; |
|
| 166 | - |
|
| 167 | - if (!$user_data) {
|
|
| 168 | - $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
|
|
| 169 | - return $errors; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - // redefining user_login ensures we return the right case in the email |
|
| 173 | - $user_login = $user_data->user_login; |
|
| 174 | - $user_email = $user_data->user_email; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 178 | - * |
|
| 179 | - * @since 1.0.0 |
|
| 180 | - * @param string $user_login The users username. |
|
| 181 | - */ |
|
| 182 | - do_action('retrieve_password', $user_login);
|
|
| 183 | - |
|
| 184 | - //////////////////////////////////// |
|
| 185 | - $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
| 186 | - $user_login = $_POST['user_login']; |
|
| 187 | - |
|
| 188 | - $user = $wpdb->get_row( |
|
| 189 | - $wpdb->prepare( |
|
| 190 | - "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s", |
|
| 191 | - array($user_login, $user_login) |
|
| 192 | - ) |
|
| 193 | - ); |
|
| 194 | - |
|
| 195 | - if (empty($user)) |
|
| 196 | - return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
|
|
| 197 | - |
|
| 198 | - $new_pass = wp_generate_password(12, false); |
|
| 199 | - |
|
| 200 | - /** |
|
| 201 | - * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 202 | - * |
|
| 203 | - * @since 1.0.0 |
|
| 204 | - * @param object $user The user object. |
|
| 205 | - * @param string $new_pass The new pass being sent to the user. |
|
| 206 | - */ |
|
| 207 | - do_action('password_reset', $user, $new_pass);
|
|
| 208 | - |
|
| 209 | - wp_set_password($new_pass, $user->ID); |
|
| 210 | - update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
|
| 211 | - $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | - $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | - $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 214 | - //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
|
| 215 | - //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
|
| 216 | - $user_email = $user_data->user_email; |
|
| 217 | - $user_name = geodir_get_client_name($user->ID); |
|
| 218 | - $fromEmail = geodir_get_site_email_id(); |
|
| 219 | - $fromEmailName = get_site_emailName(); |
|
| 220 | - $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
|
|
| 221 | - /** |
|
| 222 | - * Filter the password reset email subject part. |
|
| 223 | - * |
|
| 224 | - * @since 1.0.0 |
|
| 225 | - * |
|
| 226 | - * @param string $title Password reset email subject. |
|
| 227 | - */ |
|
| 228 | - $title = apply_filters('password_reset_title', $title);
|
|
| 229 | - /** |
|
| 230 | - * Filter the password reset email message part. |
|
| 231 | - * |
|
| 232 | - * @since 1.0.0 |
|
| 233 | - * |
|
| 234 | - * @param string $message Password reset email message. |
|
| 235 | - * @param string $new_pass The new password string. |
|
| 236 | - */ |
|
| 237 | - $message = apply_filters('password_reset_message', $message, $new_pass);
|
|
| 238 | - //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
|
| 239 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 240 | - |
|
| 241 | - return true; |
|
| 141 | + global $wpdb; |
|
| 142 | + |
|
| 143 | + $errors = new WP_Error(); |
|
| 144 | + if (empty($_POST['user_login']) && empty($_POST['user_email'])) |
|
| 145 | + $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
|
|
| 146 | + |
|
| 147 | + if (strpos($_POST['user_login'], '@')) {
|
|
| 148 | + //$user_data = get_user_by_email(trim($_POST['user_login'])); |
|
| 149 | + $user_data = get_user_by('email', trim($_POST['user_login']));
|
|
| 150 | + if (empty($user_data)) |
|
| 151 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
|
|
| 152 | + } else {
|
|
| 153 | + $login = trim($_POST['user_login']); |
|
| 154 | + $user_data = get_user_by('email', $login);
|
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent. |
|
| 159 | + * |
|
| 160 | + * @since 1.0.0 |
|
| 161 | + */ |
|
| 162 | + do_action('lostpassword_post');
|
|
| 163 | + |
|
| 164 | + if ($errors->get_error_code()) |
|
| 165 | + return $errors; |
|
| 166 | + |
|
| 167 | + if (!$user_data) {
|
|
| 168 | + $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
|
|
| 169 | + return $errors; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + // redefining user_login ensures we return the right case in the email |
|
| 173 | + $user_login = $user_data->user_login; |
|
| 174 | + $user_email = $user_data->user_email; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 178 | + * |
|
| 179 | + * @since 1.0.0 |
|
| 180 | + * @param string $user_login The users username. |
|
| 181 | + */ |
|
| 182 | + do_action('retrieve_password', $user_login);
|
|
| 183 | + |
|
| 184 | + //////////////////////////////////// |
|
| 185 | + $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; |
|
| 186 | + $user_login = $_POST['user_login']; |
|
| 187 | + |
|
| 188 | + $user = $wpdb->get_row( |
|
| 189 | + $wpdb->prepare( |
|
| 190 | + "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s", |
|
| 191 | + array($user_login, $user_login) |
|
| 192 | + ) |
|
| 193 | + ); |
|
| 194 | + |
|
| 195 | + if (empty($user)) |
|
| 196 | + return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
|
|
| 197 | + |
|
| 198 | + $new_pass = wp_generate_password(12, false); |
|
| 199 | + |
|
| 200 | + /** |
|
| 201 | + * Called in the geodir_retrieve_password() function before any emails are sent. |
|
| 202 | + * |
|
| 203 | + * @since 1.0.0 |
|
| 204 | + * @param object $user The user object. |
|
| 205 | + * @param string $new_pass The new pass being sent to the user. |
|
| 206 | + */ |
|
| 207 | + do_action('password_reset', $user, $new_pass);
|
|
| 208 | + |
|
| 209 | + wp_set_password($new_pass, $user->ID); |
|
| 210 | + update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag. |
|
| 211 | + $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
|
|
| 212 | + $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
|
|
| 213 | + $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
|
|
| 214 | + //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is : ".home_url()."/?ptype=login</p>"; |
|
| 215 | + //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
|
|
| 216 | + $user_email = $user_data->user_email; |
|
| 217 | + $user_name = geodir_get_client_name($user->ID); |
|
| 218 | + $fromEmail = geodir_get_site_email_id(); |
|
| 219 | + $fromEmailName = get_site_emailName(); |
|
| 220 | + $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
|
|
| 221 | + /** |
|
| 222 | + * Filter the password reset email subject part. |
|
| 223 | + * |
|
| 224 | + * @since 1.0.0 |
|
| 225 | + * |
|
| 226 | + * @param string $title Password reset email subject. |
|
| 227 | + */ |
|
| 228 | + $title = apply_filters('password_reset_title', $title);
|
|
| 229 | + /** |
|
| 230 | + * Filter the password reset email message part. |
|
| 231 | + * |
|
| 232 | + * @since 1.0.0 |
|
| 233 | + * |
|
| 234 | + * @param string $message Password reset email message. |
|
| 235 | + * @param string $new_pass The new password string. |
|
| 236 | + */ |
|
| 237 | + $message = apply_filters('password_reset_message', $message, $new_pass);
|
|
| 238 | + //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email |
|
| 239 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email |
|
| 240 | + |
|
| 241 | + return true; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -253,80 +253,80 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | function geodir_register_new_user($user_login, $user_email) |
| 255 | 255 | {
|
| 256 | - global $wpdb; |
|
| 257 | - $errors = new WP_Error(); |
|
| 258 | - |
|
| 259 | - |
|
| 260 | - $user_login = sanitize_user($user_login); |
|
| 261 | - $user_login = str_replace(",", "", $user_login);
|
|
| 262 | - $user_email = str_replace(",", "", $user_email);
|
|
| 263 | - /** |
|
| 264 | - * Filter the user registration email. |
|
| 265 | - * |
|
| 266 | - * @since 1.0.0 |
|
| 267 | - * |
|
| 268 | - * @param string $user_email User registration email. |
|
| 269 | - */ |
|
| 270 | - $user_email = apply_filters('user_registration_email', $user_email);
|
|
| 271 | - |
|
| 272 | - |
|
| 273 | - if (get_option('geodir_allow_cpass')) {
|
|
| 274 | - $user_pass = $_REQUEST['user_pass']; |
|
| 275 | - $user_pass2 = $_REQUEST['user_pass2']; |
|
| 276 | - // Check the password |
|
| 277 | - if ($user_pass != $user_pass2) {
|
|
| 278 | - $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
|
|
| 279 | - } elseif (strlen($user_pass) < 7) {
|
|
| 280 | - $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
|
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - // Check the username |
|
| 285 | - if ($user_login == '') |
|
| 286 | - $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
|
|
| 287 | - elseif (!validate_username($user_login)) {
|
|
| 288 | - $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'geodirectory'));
|
|
| 289 | - $user_login = ''; |
|
| 290 | - } elseif (username_exists($user_login)) |
|
| 291 | - $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
|
|
| 292 | - |
|
| 293 | - // Check the e-mail address |
|
| 294 | - if ($user_email == '') {
|
|
| 295 | - $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
|
|
| 296 | - } elseif (!is_email($user_email)) {
|
|
| 297 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
|
|
| 298 | - $user_email = ''; |
|
| 299 | - } elseif (email_exists($user_email)) |
|
| 300 | - $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
|
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * Called when registering a new user. |
|
| 304 | - * |
|
| 305 | - * This is a WordPress core hook. |
|
| 306 | - * |
|
| 307 | - * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post |
|
| 308 | - * @since 1.0.0 |
|
| 309 | - */ |
|
| 310 | - do_action('register_post', $user_login, $user_email, $errors);
|
|
| 311 | - /** |
|
| 312 | - * Filter the registration error messages. |
|
| 313 | - * |
|
| 314 | - * @since 1.0.0 |
|
| 315 | - * |
|
| 316 | - * @param object $errors Registration error messages. |
|
| 317 | - */ |
|
| 318 | - $errors = apply_filters('registration_errors', $errors);
|
|
| 319 | - |
|
| 320 | - if ($errors->get_error_code()) |
|
| 321 | - return $errors; |
|
| 322 | - |
|
| 323 | - |
|
| 324 | - if (!isset($user_pass) || $user_pass == '') {
|
|
| 325 | - $user_pass = wp_generate_password(12, false); |
|
| 326 | - } |
|
| 327 | - $user_id = wp_create_user($user_login, $user_pass, $user_email); |
|
| 328 | - $user_web = ''; |
|
| 329 | - /*$user_add1 = $_POST['user_add1']; |
|
| 256 | + global $wpdb; |
|
| 257 | + $errors = new WP_Error(); |
|
| 258 | + |
|
| 259 | + |
|
| 260 | + $user_login = sanitize_user($user_login); |
|
| 261 | + $user_login = str_replace(",", "", $user_login);
|
|
| 262 | + $user_email = str_replace(",", "", $user_email);
|
|
| 263 | + /** |
|
| 264 | + * Filter the user registration email. |
|
| 265 | + * |
|
| 266 | + * @since 1.0.0 |
|
| 267 | + * |
|
| 268 | + * @param string $user_email User registration email. |
|
| 269 | + */ |
|
| 270 | + $user_email = apply_filters('user_registration_email', $user_email);
|
|
| 271 | + |
|
| 272 | + |
|
| 273 | + if (get_option('geodir_allow_cpass')) {
|
|
| 274 | + $user_pass = $_REQUEST['user_pass']; |
|
| 275 | + $user_pass2 = $_REQUEST['user_pass2']; |
|
| 276 | + // Check the password |
|
| 277 | + if ($user_pass != $user_pass2) {
|
|
| 278 | + $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
|
|
| 279 | + } elseif (strlen($user_pass) < 7) {
|
|
| 280 | + $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
|
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + // Check the username |
|
| 285 | + if ($user_login == '') |
|
| 286 | + $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
|
|
| 287 | + elseif (!validate_username($user_login)) {
|
|
| 288 | + $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'geodirectory'));
|
|
| 289 | + $user_login = ''; |
|
| 290 | + } elseif (username_exists($user_login)) |
|
| 291 | + $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
|
|
| 292 | + |
|
| 293 | + // Check the e-mail address |
|
| 294 | + if ($user_email == '') {
|
|
| 295 | + $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
|
|
| 296 | + } elseif (!is_email($user_email)) {
|
|
| 297 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
|
|
| 298 | + $user_email = ''; |
|
| 299 | + } elseif (email_exists($user_email)) |
|
| 300 | + $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
|
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * Called when registering a new user. |
|
| 304 | + * |
|
| 305 | + * This is a WordPress core hook. |
|
| 306 | + * |
|
| 307 | + * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post |
|
| 308 | + * @since 1.0.0 |
|
| 309 | + */ |
|
| 310 | + do_action('register_post', $user_login, $user_email, $errors);
|
|
| 311 | + /** |
|
| 312 | + * Filter the registration error messages. |
|
| 313 | + * |
|
| 314 | + * @since 1.0.0 |
|
| 315 | + * |
|
| 316 | + * @param object $errors Registration error messages. |
|
| 317 | + */ |
|
| 318 | + $errors = apply_filters('registration_errors', $errors);
|
|
| 319 | + |
|
| 320 | + if ($errors->get_error_code()) |
|
| 321 | + return $errors; |
|
| 322 | + |
|
| 323 | + |
|
| 324 | + if (!isset($user_pass) || $user_pass == '') {
|
|
| 325 | + $user_pass = wp_generate_password(12, false); |
|
| 326 | + } |
|
| 327 | + $user_id = wp_create_user($user_login, $user_pass, $user_email); |
|
| 328 | + $user_web = ''; |
|
| 329 | + /*$user_add1 = $_POST['user_add1']; |
|
| 330 | 330 | $user_add2 = $_POST['user_add2']; |
| 331 | 331 | $user_city = $_POST['user_city']; |
| 332 | 332 | $user_state = $_POST['user_state']; |
@@ -335,77 +335,77 @@ discard block |
||
| 335 | 335 | $user_web = $_POST['user_web']; |
| 336 | 336 | $user_phone = $_POST['user_phone']; |
| 337 | 337 | $user_twitter = $_POST['user_twitter']; */ |
| 338 | - $user_fname = sanitize_user($_POST['user_fname']); |
|
| 339 | - $user_fname = str_replace(",", "", $user_fname);
|
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Filter the submitted user meta. |
|
| 343 | - * |
|
| 344 | - * @since 1.0.0 |
|
| 345 | - * |
|
| 346 | - * @param int $user_id User ID. |
|
| 347 | - */ |
|
| 348 | - $user_address_info = apply_filters('geodir_manage_user_meta', array(
|
|
| 349 | - "user_add1" => '', |
|
| 350 | - "user_add2" => '', |
|
| 351 | - "user_city" => '', |
|
| 352 | - "user_state" => '', |
|
| 353 | - "user_country" => '', |
|
| 354 | - "user_postalcode" => '', |
|
| 355 | - "user_phone" => '', |
|
| 356 | - "user_twitter" => '', |
|
| 357 | - "first_name" => $user_fname, |
|
| 358 | - "last_name" => '', |
|
| 359 | - ), $user_id); |
|
| 360 | - foreach ($user_address_info as $key => $val) {
|
|
| 361 | - update_user_meta($user_id, $key, $val); // User Address Information Here |
|
| 362 | - } |
|
| 363 | - //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here |
|
| 364 | - $userName = $user_fname; |
|
| 365 | - update_user_meta($user_id, 'first_name', $userName); // User Address Information Here |
|
| 366 | - //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here |
|
| 367 | - |
|
| 368 | - // Changed by vikas sharma to enable all type of characters in author permalink... |
|
| 369 | - $user_nicename = sanitize_title($userName); |
|
| 370 | - |
|
| 371 | - $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
|
|
| 372 | - |
|
| 373 | - $wpdb->query($updateUsersql); |
|
| 374 | - |
|
| 375 | - if (!$user_id) {
|
|
| 376 | - $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
|
|
| 377 | - return $errors; |
|
| 378 | - } |
|
| 379 | - global $upload_folder_path; |
|
| 380 | - |
|
| 381 | - if ($user_id) {
|
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Called after registering a user and before the registration email is sent. |
|
| 385 | - * |
|
| 386 | - * @since 1.0.0 |
|
| 387 | - * @param int $user_id The user ID of the registered user. |
|
| 388 | - */ |
|
| 389 | - do_action('geodir_user_register', $user_id);
|
|
| 390 | - ///////REGISTRATION EMAIL START////// |
|
| 391 | - $fromEmail = geodir_get_site_email_id(); |
|
| 392 | - $fromEmailName = get_site_emailName(); |
|
| 393 | - $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 338 | + $user_fname = sanitize_user($_POST['user_fname']); |
|
| 339 | + $user_fname = str_replace(",", "", $user_fname);
|
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Filter the submitted user meta. |
|
| 343 | + * |
|
| 344 | + * @since 1.0.0 |
|
| 345 | + * |
|
| 346 | + * @param int $user_id User ID. |
|
| 347 | + */ |
|
| 348 | + $user_address_info = apply_filters('geodir_manage_user_meta', array(
|
|
| 349 | + "user_add1" => '', |
|
| 350 | + "user_add2" => '', |
|
| 351 | + "user_city" => '', |
|
| 352 | + "user_state" => '', |
|
| 353 | + "user_country" => '', |
|
| 354 | + "user_postalcode" => '', |
|
| 355 | + "user_phone" => '', |
|
| 356 | + "user_twitter" => '', |
|
| 357 | + "first_name" => $user_fname, |
|
| 358 | + "last_name" => '', |
|
| 359 | + ), $user_id); |
|
| 360 | + foreach ($user_address_info as $key => $val) {
|
|
| 361 | + update_user_meta($user_id, $key, $val); // User Address Information Here |
|
| 362 | + } |
|
| 363 | + //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here |
|
| 364 | + $userName = $user_fname; |
|
| 365 | + update_user_meta($user_id, 'first_name', $userName); // User Address Information Here |
|
| 366 | + //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here |
|
| 367 | + |
|
| 368 | + // Changed by vikas sharma to enable all type of characters in author permalink... |
|
| 369 | + $user_nicename = sanitize_title($userName); |
|
| 370 | + |
|
| 371 | + $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
|
|
| 372 | + |
|
| 373 | + $wpdb->query($updateUsersql); |
|
| 374 | + |
|
| 375 | + if (!$user_id) {
|
|
| 376 | + $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
|
|
| 377 | + return $errors; |
|
| 378 | + } |
|
| 379 | + global $upload_folder_path; |
|
| 380 | + |
|
| 381 | + if ($user_id) {
|
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Called after registering a user and before the registration email is sent. |
|
| 385 | + * |
|
| 386 | + * @since 1.0.0 |
|
| 387 | + * @param int $user_id The user ID of the registered user. |
|
| 388 | + */ |
|
| 389 | + do_action('geodir_user_register', $user_id);
|
|
| 390 | + ///////REGISTRATION EMAIL START////// |
|
| 391 | + $fromEmail = geodir_get_site_email_id(); |
|
| 392 | + $fromEmailName = get_site_emailName(); |
|
| 393 | + $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
|
|
| 394 | 394 | <p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
|
| 395 | 395 | <p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
|
| 396 | 396 | |
| 397 | - /////////////customer email////////////// |
|
| 398 | - //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
|
| 399 | - geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 400 | - //////REGISTRATION EMAIL END//////// |
|
| 401 | - } |
|
| 397 | + /////////////customer email////////////// |
|
| 398 | + //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email |
|
| 399 | + geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email |
|
| 400 | + //////REGISTRATION EMAIL END//////// |
|
| 401 | + } |
|
| 402 | 402 | |
| 403 | - if (get_option('ptthemes_auto_login')) {
|
|
| 404 | - $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
|
|
| 405 | - return $errors; |
|
| 406 | - } |
|
| 403 | + if (get_option('ptthemes_auto_login')) {
|
|
| 404 | + $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
|
|
| 405 | + return $errors; |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - return array($user_id, $user_pass); |
|
| 408 | + return array($user_id, $user_pass); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
@@ -418,317 +418,317 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | function geodir_user_signup() |
| 420 | 420 | {
|
| 421 | - global $errors; |
|
| 422 | - $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
|
| 423 | - |
|
| 424 | - $errors = new WP_Error(); |
|
| 425 | - |
|
| 426 | - if (isset($_GET['key'])) |
|
| 427 | - $action = 'resetpass'; |
|
| 428 | - |
|
| 429 | - // validate action so as to default to the login screen |
|
| 430 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 431 | - $action = 'login'; |
|
| 432 | - |
|
| 433 | - nocache_headers(); |
|
| 434 | - |
|
| 435 | - if (defined('RELOCATE')) { // Move flag is set
|
|
| 436 | - if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
| 437 | - $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 438 | - |
|
| 439 | - $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
|
| 440 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 442 | - } |
|
| 443 | - |
|
| 444 | - //Set a cookie now to see if they are supported by the browser. |
|
| 445 | - //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); |
|
| 446 | - if (SITECOOKIEPATH != COOKIEPATH) |
|
| 447 | - setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 448 | - |
|
| 449 | - /** |
|
| 450 | - * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page. |
|
| 451 | - * |
|
| 452 | - * Used dynamic hook login_form_$action |
|
| 453 | - * |
|
| 454 | - * @since 1.0.0 |
|
| 455 | - */ |
|
| 456 | - do_action('login_form_' . $action);
|
|
| 457 | - |
|
| 458 | - $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
|
| 459 | - |
|
| 460 | - switch ($action): |
|
| 461 | - |
|
| 462 | - case 'logout' : |
|
| 463 | - //check_admin_referer('log-out');
|
|
| 464 | - wp_logout(); |
|
| 465 | - |
|
| 466 | - $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 467 | - //$redirect_to = home_url().'/?ptype=login&loggedout=true'; |
|
| 468 | - if (isset($_REQUEST['redirect_to'])) |
|
| 469 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 470 | - $redirect_to = home_url(); |
|
| 471 | - wp_safe_redirect($redirect_to); |
|
| 472 | - exit(); |
|
| 473 | - |
|
| 474 | - break; |
|
| 475 | - |
|
| 476 | - case 'lostpassword' : |
|
| 477 | - case 'retrievepassword' : |
|
| 478 | - if ($http_post) {
|
|
| 479 | - $errors = geodir_retrieve_password(); |
|
| 480 | - $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : ''; |
|
| 481 | - if (!is_wp_error($errors)) {
|
|
| 482 | - wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
|
|
| 483 | - gd_die(); |
|
| 484 | - } else {
|
|
| 485 | - wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
|
|
| 486 | - gd_die(); |
|
| 487 | - } |
|
| 488 | - } |
|
| 489 | - if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
|
|
| 490 | - /** |
|
| 491 | - * Called in the geodir_user_signup() function during the lostpassword case. |
|
| 492 | - * |
|
| 493 | - * @since 1.0.0 |
|
| 494 | - */ |
|
| 495 | - do_action('lost_password');
|
|
| 496 | - $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 497 | - $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
|
| 498 | - |
|
| 499 | - break; |
|
| 500 | - |
|
| 501 | - case 'resetpass' : |
|
| 502 | - case 'rp' : |
|
| 503 | - $errors = reset_password($_GET['key'], $_GET['login']); |
|
| 504 | - |
|
| 505 | - if (!is_wp_error($errors)) {
|
|
| 506 | - wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
|
|
| 507 | - exit(); |
|
| 508 | - } |
|
| 509 | - |
|
| 510 | - wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 511 | - exit(); |
|
| 512 | - |
|
| 513 | - break; |
|
| 514 | - |
|
| 515 | - case 'register' : |
|
| 516 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 517 | - if (!get_option('users_can_register')) {
|
|
| 518 | - wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
|
|
| 519 | - exit(); |
|
| 520 | - } |
|
| 521 | - ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 522 | - global $user_email, $user_fname; |
|
| 523 | - $user_login = ''; |
|
| 524 | - $user_email = ''; |
|
| 525 | - if ($http_post) {
|
|
| 526 | - $user_login = $_POST['user_email']; |
|
| 527 | - $user_email = $_POST['user_email']; |
|
| 528 | - $user_fname = $_POST['user_fname']; |
|
| 529 | - |
|
| 530 | - $errors = geodir_register_new_user($user_login, $user_email); |
|
| 531 | - |
|
| 532 | - /* display error in registration form */ |
|
| 533 | - if (is_wp_error($errors)) {
|
|
| 534 | - $error_code = $errors->get_error_code(); |
|
| 535 | - $error_message = $errors->get_error_message($error_code); |
|
| 536 | - if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
|
|
| 537 | - if ($error_code == 'empty_username') {
|
|
| 538 | - $error_code = 'empty_email'; |
|
| 539 | - } else if ($error_code == 'invalid_username') {
|
|
| 540 | - $error_code = 'invalid_email'; |
|
| 541 | - } else if ($error_code == 'username_exists') {
|
|
| 542 | - $error_code = 'email_exists'; |
|
| 543 | - } |
|
| 544 | - |
|
| 545 | - $error_message = $errors->get_error_message($error_code); |
|
| 546 | - } |
|
| 547 | - global $geodir_signup_error; |
|
| 548 | - $geodir_signup_error = $error_message; |
|
| 549 | - } |
|
| 550 | - |
|
| 551 | - if (!is_wp_error($errors)) {
|
|
| 552 | - $_POST['log'] = $user_login; |
|
| 553 | - $_POST['pwd'] = $errors[1]; |
|
| 554 | - $_POST['testcookie'] = 1; |
|
| 555 | - |
|
| 556 | - $secure_cookie = ''; |
|
| 557 | - // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
| 558 | - if (!empty($_POST['log'])) {
|
|
| 559 | - $user_name = sanitize_user($_POST['log']); |
|
| 560 | - if ($user = get_user_by('email', $user_name)) {
|
|
| 561 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 562 | - $secure_cookie = true; |
|
| 563 | - force_ssl_admin(true); |
|
| 564 | - } |
|
| 565 | - } |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 569 | - |
|
| 570 | - if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 571 | - if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
|
|
| 572 | - $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 573 | - } else {
|
|
| 574 | - $redirect_to = home_url(); |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
|
|
| 580 | - |
|
| 581 | - $redirect_to = $_REQUEST['redirect_add_listing']; |
|
| 582 | - } |
|
| 583 | - |
|
| 584 | - |
|
| 585 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 586 | - $secure_cookie = false; |
|
| 587 | - |
|
| 588 | - $user = wp_signon('', $secure_cookie);
|
|
| 589 | - |
|
| 590 | - $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''); |
|
| 591 | - /** |
|
| 592 | - * Filter the login redirect URL. |
|
| 593 | - * |
|
| 594 | - * @since 1.4.9 |
|
| 595 | - * @param string $redirect_to The redirect destination URL. |
|
| 596 | - * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
| 597 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 598 | - */ |
|
| 599 | - $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
|
|
| 600 | - |
|
| 601 | - |
|
| 602 | - if (!is_wp_error($user)) {
|
|
| 603 | - wp_safe_redirect($redirect_to); |
|
| 604 | - exit(); |
|
| 605 | - } |
|
| 606 | - exit(); |
|
| 607 | - } |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - break; |
|
| 611 | - |
|
| 612 | - case 'login' : |
|
| 613 | - default: |
|
| 614 | - $secure_cookie = ''; |
|
| 615 | - |
|
| 616 | - if (!empty($_POST['log'])) {
|
|
| 617 | - $user_name = sanitize_user($_POST['log']); |
|
| 618 | - if ($user = get_user_by('login', $user_name)) {
|
|
| 619 | - |
|
| 620 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 621 | - $secure_cookie = true; |
|
| 622 | - force_ssl_admin(true); |
|
| 623 | - } |
|
| 624 | - } elseif ($user = get_user_by('email', $user_name)) {
|
|
| 625 | - $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login |
|
| 626 | - if (get_user_option('use_ssl', $user->ID)) {
|
|
| 627 | - $secure_cookie = true; |
|
| 628 | - force_ssl_admin(true); |
|
| 629 | - } |
|
| 630 | - } |
|
| 631 | - } |
|
| 632 | - /////////////////////////// |
|
| 633 | - if (isset($_REQUEST['redirect_add_listing'])) {
|
|
| 634 | - $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing']; |
|
| 635 | - } |
|
| 636 | - |
|
| 637 | - |
|
| 638 | - if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 639 | - if (is_user_logged_in()) : |
|
| 640 | - $user_ID = isset($user->ID) ? $user->ID : ''; |
|
| 641 | - $author_link = get_author_posts_url($user_ID); |
|
| 642 | - $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
|
|
| 643 | - |
|
| 644 | - /** |
|
| 645 | - * Filter the author link. |
|
| 646 | - * |
|
| 647 | - * @since 1.0.0 |
|
| 648 | - * |
|
| 649 | - * @param string $default_author_link Default author link. |
|
| 650 | - * @param int $user_ID The user ID. |
|
| 651 | - */ |
|
| 652 | - $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
|
|
| 653 | - |
|
| 654 | - $_REQUEST['redirect_to'] = $default_author_link; |
|
| 655 | - else: |
|
| 656 | - $_REQUEST['redirect_to'] = home_url(); |
|
| 657 | - endif; |
|
| 658 | - |
|
| 659 | - } |
|
| 660 | - if (isset($_REQUEST['redirect_to'])) {
|
|
| 661 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 662 | - // Redirect to https if user wants ssl |
|
| 663 | - if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
| 664 | - $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
|
| 665 | - } else {
|
|
| 666 | - $redirect_to = admin_url(); |
|
| 667 | - } |
|
| 668 | - |
|
| 669 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 670 | - $secure_cookie = false; |
|
| 671 | - $user = wp_signon('', $secure_cookie);
|
|
| 672 | - |
|
| 673 | - |
|
| 674 | - /** |
|
| 675 | - * Filter the login redirect URL. |
|
| 676 | - * |
|
| 677 | - * @since 1.4.9 |
|
| 678 | - * @param string $redirect_to The redirect destination URL. |
|
| 679 | - * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 680 | - */ |
|
| 681 | - $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
|
| 682 | - |
|
| 683 | - if (is_wp_error($user)) {
|
|
| 684 | - if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
|
| 685 | - wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - if (!is_wp_error($user)) {
|
|
| 689 | - |
|
| 690 | - // Some servers are not logging the user in properly after wp_signon, se we set the user here. |
|
| 691 | - //wp_set_current_user($user->ID); |
|
| 692 | - //echo '###';exit; |
|
| 693 | - |
|
| 694 | - if ($redirect_to) {
|
|
| 695 | - wp_redirect($redirect_to); |
|
| 696 | - } else {
|
|
| 697 | - wp_redirect(home_url()); |
|
| 698 | - } |
|
| 699 | - gd_die(); |
|
| 700 | - } |
|
| 701 | - |
|
| 702 | - $errors = $user; |
|
| 703 | - |
|
| 704 | - // Clear errors if loggedout is set. |
|
| 705 | - if (!empty($_GET['loggedout'])) |
|
| 706 | - $errors = new WP_Error(); |
|
| 707 | - // If cookies are disabled we can't log in even with a valid user+pass |
|
| 708 | - if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) |
|
| 709 | - $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
|
|
| 710 | - |
|
| 711 | - // Some parts of this script use the main login form to display a message |
|
| 712 | - if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
|
| 713 | - $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 714 | - } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
|
| 715 | - $successmsg = USER_REG_NOT_ALLOW_MSG; |
|
| 716 | - } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
|
| 717 | - $successmsg = EMAIL_CONFIRM_LINK_MSG; |
|
| 718 | - } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
|
|
| 719 | - $successmsg = NEW_PW_EMAIL_MSG; |
|
| 720 | - } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
|
|
| 721 | - $successmsg = REG_COMPLETE_MSG; |
|
| 722 | - } |
|
| 723 | - |
|
| 724 | - if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
|
| 725 | - if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
|
| 726 | - wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 727 | - } else {
|
|
| 728 | - wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 729 | - } |
|
| 730 | - gd_die(); |
|
| 731 | - } |
|
| 732 | - break; |
|
| 733 | - endswitch; // end action switch |
|
| 421 | + global $errors; |
|
| 422 | + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login'; |
|
| 423 | + |
|
| 424 | + $errors = new WP_Error(); |
|
| 425 | + |
|
| 426 | + if (isset($_GET['key'])) |
|
| 427 | + $action = 'resetpass'; |
|
| 428 | + |
|
| 429 | + // validate action so as to default to the login screen |
|
| 430 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 431 | + $action = 'login'; |
|
| 432 | + |
|
| 433 | + nocache_headers(); |
|
| 434 | + |
|
| 435 | + if (defined('RELOCATE')) { // Move flag is set
|
|
| 436 | + if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
| 437 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 438 | + |
|
| 439 | + $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
|
| 440 | + if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | + update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 442 | + } |
|
| 443 | + |
|
| 444 | + //Set a cookie now to see if they are supported by the browser. |
|
| 445 | + //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); |
|
| 446 | + if (SITECOOKIEPATH != COOKIEPATH) |
|
| 447 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 448 | + |
|
| 449 | + /** |
|
| 450 | + * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page. |
|
| 451 | + * |
|
| 452 | + * Used dynamic hook login_form_$action |
|
| 453 | + * |
|
| 454 | + * @since 1.0.0 |
|
| 455 | + */ |
|
| 456 | + do_action('login_form_' . $action);
|
|
| 457 | + |
|
| 458 | + $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
|
|
| 459 | + |
|
| 460 | + switch ($action): |
|
| 461 | + |
|
| 462 | + case 'logout' : |
|
| 463 | + //check_admin_referer('log-out');
|
|
| 464 | + wp_logout(); |
|
| 465 | + |
|
| 466 | + $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 467 | + //$redirect_to = home_url().'/?ptype=login&loggedout=true'; |
|
| 468 | + if (isset($_REQUEST['redirect_to'])) |
|
| 469 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 470 | + $redirect_to = home_url(); |
|
| 471 | + wp_safe_redirect($redirect_to); |
|
| 472 | + exit(); |
|
| 473 | + |
|
| 474 | + break; |
|
| 475 | + |
|
| 476 | + case 'lostpassword' : |
|
| 477 | + case 'retrievepassword' : |
|
| 478 | + if ($http_post) {
|
|
| 479 | + $errors = geodir_retrieve_password(); |
|
| 480 | + $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : ''; |
|
| 481 | + if (!is_wp_error($errors)) {
|
|
| 482 | + wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
|
|
| 483 | + gd_die(); |
|
| 484 | + } else {
|
|
| 485 | + wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
|
|
| 486 | + gd_die(); |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | + if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
|
|
| 490 | + /** |
|
| 491 | + * Called in the geodir_user_signup() function during the lostpassword case. |
|
| 492 | + * |
|
| 493 | + * @since 1.0.0 |
|
| 494 | + */ |
|
| 495 | + do_action('lost_password');
|
|
| 496 | + $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>'; |
|
| 497 | + $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; |
|
| 498 | + |
|
| 499 | + break; |
|
| 500 | + |
|
| 501 | + case 'resetpass' : |
|
| 502 | + case 'rp' : |
|
| 503 | + $errors = reset_password($_GET['key'], $_GET['login']); |
|
| 504 | + |
|
| 505 | + if (!is_wp_error($errors)) {
|
|
| 506 | + wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
|
|
| 507 | + exit(); |
|
| 508 | + } |
|
| 509 | + |
|
| 510 | + wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
|
|
| 511 | + exit(); |
|
| 512 | + |
|
| 513 | + break; |
|
| 514 | + |
|
| 515 | + case 'register' : |
|
| 516 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 517 | + if (!get_option('users_can_register')) {
|
|
| 518 | + wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
|
|
| 519 | + exit(); |
|
| 520 | + } |
|
| 521 | + ############################### fix by Stiofan - HebTech.co.uk ### SECURITY FIX ############################## |
|
| 522 | + global $user_email, $user_fname; |
|
| 523 | + $user_login = ''; |
|
| 524 | + $user_email = ''; |
|
| 525 | + if ($http_post) {
|
|
| 526 | + $user_login = $_POST['user_email']; |
|
| 527 | + $user_email = $_POST['user_email']; |
|
| 528 | + $user_fname = $_POST['user_fname']; |
|
| 529 | + |
|
| 530 | + $errors = geodir_register_new_user($user_login, $user_email); |
|
| 531 | + |
|
| 532 | + /* display error in registration form */ |
|
| 533 | + if (is_wp_error($errors)) {
|
|
| 534 | + $error_code = $errors->get_error_code(); |
|
| 535 | + $error_message = $errors->get_error_message($error_code); |
|
| 536 | + if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
|
|
| 537 | + if ($error_code == 'empty_username') {
|
|
| 538 | + $error_code = 'empty_email'; |
|
| 539 | + } else if ($error_code == 'invalid_username') {
|
|
| 540 | + $error_code = 'invalid_email'; |
|
| 541 | + } else if ($error_code == 'username_exists') {
|
|
| 542 | + $error_code = 'email_exists'; |
|
| 543 | + } |
|
| 544 | + |
|
| 545 | + $error_message = $errors->get_error_message($error_code); |
|
| 546 | + } |
|
| 547 | + global $geodir_signup_error; |
|
| 548 | + $geodir_signup_error = $error_message; |
|
| 549 | + } |
|
| 550 | + |
|
| 551 | + if (!is_wp_error($errors)) {
|
|
| 552 | + $_POST['log'] = $user_login; |
|
| 553 | + $_POST['pwd'] = $errors[1]; |
|
| 554 | + $_POST['testcookie'] = 1; |
|
| 555 | + |
|
| 556 | + $secure_cookie = ''; |
|
| 557 | + // If the user wants ssl but the session is not ssl, force a secure cookie. |
|
| 558 | + if (!empty($_POST['log'])) {
|
|
| 559 | + $user_name = sanitize_user($_POST['log']); |
|
| 560 | + if ($user = get_user_by('email', $user_name)) {
|
|
| 561 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 562 | + $secure_cookie = true; |
|
| 563 | + force_ssl_admin(true); |
|
| 564 | + } |
|
| 565 | + } |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 569 | + |
|
| 570 | + if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 571 | + if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
|
|
| 572 | + $redirect_to = $_SERVER['HTTP_REFERER']; |
|
| 573 | + } else {
|
|
| 574 | + $redirect_to = home_url(); |
|
| 575 | + } |
|
| 576 | + |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
|
|
| 580 | + |
|
| 581 | + $redirect_to = $_REQUEST['redirect_add_listing']; |
|
| 582 | + } |
|
| 583 | + |
|
| 584 | + |
|
| 585 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 586 | + $secure_cookie = false; |
|
| 587 | + |
|
| 588 | + $user = wp_signon('', $secure_cookie);
|
|
| 589 | + |
|
| 590 | + $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : ''); |
|
| 591 | + /** |
|
| 592 | + * Filter the login redirect URL. |
|
| 593 | + * |
|
| 594 | + * @since 1.4.9 |
|
| 595 | + * @param string $redirect_to The redirect destination URL. |
|
| 596 | + * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
| 597 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 598 | + */ |
|
| 599 | + $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
|
|
| 600 | + |
|
| 601 | + |
|
| 602 | + if (!is_wp_error($user)) {
|
|
| 603 | + wp_safe_redirect($redirect_to); |
|
| 604 | + exit(); |
|
| 605 | + } |
|
| 606 | + exit(); |
|
| 607 | + } |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + break; |
|
| 611 | + |
|
| 612 | + case 'login' : |
|
| 613 | + default: |
|
| 614 | + $secure_cookie = ''; |
|
| 615 | + |
|
| 616 | + if (!empty($_POST['log'])) {
|
|
| 617 | + $user_name = sanitize_user($_POST['log']); |
|
| 618 | + if ($user = get_user_by('login', $user_name)) {
|
|
| 619 | + |
|
| 620 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 621 | + $secure_cookie = true; |
|
| 622 | + force_ssl_admin(true); |
|
| 623 | + } |
|
| 624 | + } elseif ($user = get_user_by('email', $user_name)) {
|
|
| 625 | + $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login |
|
| 626 | + if (get_user_option('use_ssl', $user->ID)) {
|
|
| 627 | + $secure_cookie = true; |
|
| 628 | + force_ssl_admin(true); |
|
| 629 | + } |
|
| 630 | + } |
|
| 631 | + } |
|
| 632 | + /////////////////////////// |
|
| 633 | + if (isset($_REQUEST['redirect_add_listing'])) {
|
|
| 634 | + $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing']; |
|
| 635 | + } |
|
| 636 | + |
|
| 637 | + |
|
| 638 | + if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
|
|
| 639 | + if (is_user_logged_in()) : |
|
| 640 | + $user_ID = isset($user->ID) ? $user->ID : ''; |
|
| 641 | + $author_link = get_author_posts_url($user_ID); |
|
| 642 | + $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => 'gd_place'), false);
|
|
| 643 | + |
|
| 644 | + /** |
|
| 645 | + * Filter the author link. |
|
| 646 | + * |
|
| 647 | + * @since 1.0.0 |
|
| 648 | + * |
|
| 649 | + * @param string $default_author_link Default author link. |
|
| 650 | + * @param int $user_ID The user ID. |
|
| 651 | + */ |
|
| 652 | + $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
|
|
| 653 | + |
|
| 654 | + $_REQUEST['redirect_to'] = $default_author_link; |
|
| 655 | + else: |
|
| 656 | + $_REQUEST['redirect_to'] = home_url(); |
|
| 657 | + endif; |
|
| 658 | + |
|
| 659 | + } |
|
| 660 | + if (isset($_REQUEST['redirect_to'])) {
|
|
| 661 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 662 | + // Redirect to https if user wants ssl |
|
| 663 | + if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
| 664 | + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
|
| 665 | + } else {
|
|
| 666 | + $redirect_to = admin_url(); |
|
| 667 | + } |
|
| 668 | + |
|
| 669 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 670 | + $secure_cookie = false; |
|
| 671 | + $user = wp_signon('', $secure_cookie);
|
|
| 672 | + |
|
| 673 | + |
|
| 674 | + /** |
|
| 675 | + * Filter the login redirect URL. |
|
| 676 | + * |
|
| 677 | + * @since 1.4.9 |
|
| 678 | + * @param string $redirect_to The redirect destination URL. |
|
| 679 | + * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
| 680 | + */ |
|
| 681 | + $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
|
|
| 682 | + |
|
| 683 | + if (is_wp_error($user)) {
|
|
| 684 | + if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
|
|
| 685 | + wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1'); |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + if (!is_wp_error($user)) {
|
|
| 689 | + |
|
| 690 | + // Some servers are not logging the user in properly after wp_signon, se we set the user here. |
|
| 691 | + //wp_set_current_user($user->ID); |
|
| 692 | + //echo '###';exit; |
|
| 693 | + |
|
| 694 | + if ($redirect_to) {
|
|
| 695 | + wp_redirect($redirect_to); |
|
| 696 | + } else {
|
|
| 697 | + wp_redirect(home_url()); |
|
| 698 | + } |
|
| 699 | + gd_die(); |
|
| 700 | + } |
|
| 701 | + |
|
| 702 | + $errors = $user; |
|
| 703 | + |
|
| 704 | + // Clear errors if loggedout is set. |
|
| 705 | + if (!empty($_GET['loggedout'])) |
|
| 706 | + $errors = new WP_Error(); |
|
| 707 | + // If cookies are disabled we can't log in even with a valid user+pass |
|
| 708 | + if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) |
|
| 709 | + $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
|
|
| 710 | + |
|
| 711 | + // Some parts of this script use the main login form to display a message |
|
| 712 | + if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|
|
| 713 | + $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>'; |
|
| 714 | + } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
|
|
| 715 | + $successmsg = USER_REG_NOT_ALLOW_MSG; |
|
| 716 | + } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
|
|
| 717 | + $successmsg = EMAIL_CONFIRM_LINK_MSG; |
|
| 718 | + } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
|
|
| 719 | + $successmsg = NEW_PW_EMAIL_MSG; |
|
| 720 | + } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
|
|
| 721 | + $successmsg = REG_COMPLETE_MSG; |
|
| 722 | + } |
|
| 723 | + |
|
| 724 | + if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
|
|
| 725 | + if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
|
|
| 726 | + wp_redirect($_REQUEST['pagetype'] . '&emsg=1'); |
|
| 727 | + } else {
|
|
| 728 | + wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
|
|
| 729 | + } |
|
| 730 | + gd_die(); |
|
| 731 | + } |
|
| 732 | + break; |
|
| 733 | + endswitch; // end action switch |
|
| 734 | 734 | } |
| 735 | 735 | \ No newline at end of file |
@@ -25,11 +25,13 @@ discard block |
||
| 25 | 25 | window.location.href = '<?php echo geodir_login_url();?>'; |
| 26 | 26 | </script> |
| 27 | 27 | <?php |
| 28 | - } else |
|
| 29 | - return false; |
|
| 30 | - } else |
|
| 31 | - return true; |
|
| 32 | -} |
|
| 28 | + } else { |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 31 | + } else { |
|
| 32 | + return true; |
|
| 33 | + } |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | /** |
| 35 | 37 | * Redirect to SSL url, if SSL is being used. |
@@ -60,7 +62,9 @@ discard block |
||
| 60 | 62 | * @param string $message Login message. |
| 61 | 63 | */ |
| 62 | 64 | $message = apply_filters('login_message', $message);
|
| 63 | - if (!empty($message)) echo $message . "\n"; |
|
| 65 | + if (!empty($message)) { |
|
| 66 | + echo $message . "\n"; |
|
| 67 | + } |
|
| 64 | 68 | |
| 65 | 69 | } |
| 66 | 70 | |
@@ -141,14 +145,16 @@ discard block |
||
| 141 | 145 | global $wpdb; |
| 142 | 146 | |
| 143 | 147 | $errors = new WP_Error(); |
| 144 | - if (empty($_POST['user_login']) && empty($_POST['user_email'])) |
|
| 145 | - $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
|
|
| 148 | + if (empty($_POST['user_login']) && empty($_POST['user_email'])) { |
|
| 149 | + $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory')); |
|
| 150 | + } |
|
| 146 | 151 | |
| 147 | 152 | if (strpos($_POST['user_login'], '@')) {
|
| 148 | 153 | //$user_data = get_user_by_email(trim($_POST['user_login'])); |
| 149 | 154 | $user_data = get_user_by('email', trim($_POST['user_login']));
|
| 150 | - if (empty($user_data)) |
|
| 151 | - $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
|
|
| 155 | + if (empty($user_data)) { |
|
| 156 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory')); |
|
| 157 | + } |
|
| 152 | 158 | } else {
|
| 153 | 159 | $login = trim($_POST['user_login']); |
| 154 | 160 | $user_data = get_user_by('email', $login);
|
@@ -161,8 +167,9 @@ discard block |
||
| 161 | 167 | */ |
| 162 | 168 | do_action('lostpassword_post');
|
| 163 | 169 | |
| 164 | - if ($errors->get_error_code()) |
|
| 165 | - return $errors; |
|
| 170 | + if ($errors->get_error_code()) { |
|
| 171 | + return $errors; |
|
| 172 | + } |
|
| 166 | 173 | |
| 167 | 174 | if (!$user_data) {
|
| 168 | 175 | $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
|
@@ -192,8 +199,9 @@ discard block |
||
| 192 | 199 | ) |
| 193 | 200 | ); |
| 194 | 201 | |
| 195 | - if (empty($user)) |
|
| 196 | - return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
|
|
| 202 | + if (empty($user)) { |
|
| 203 | + return new WP_Error('invalid_key', __('Invalid key', 'geodirectory')); |
|
| 204 | + } |
|
| 197 | 205 | |
| 198 | 206 | $new_pass = wp_generate_password(12, false); |
| 199 | 207 | |
@@ -282,13 +290,14 @@ discard block |
||
| 282 | 290 | } |
| 283 | 291 | |
| 284 | 292 | // Check the username |
| 285 | - if ($user_login == '') |
|
| 286 | - $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
|
|
| 287 | - elseif (!validate_username($user_login)) {
|
|
| 293 | + if ($user_login == '') { |
|
| 294 | + $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory')); |
|
| 295 | + } elseif (!validate_username($user_login)) {
|
|
| 288 | 296 | $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid. Please enter a valid username.', 'geodirectory'));
|
| 289 | 297 | $user_login = ''; |
| 290 | - } elseif (username_exists($user_login)) |
|
| 291 | - $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
|
|
| 298 | + } elseif (username_exists($user_login)) { |
|
| 299 | + $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory')); |
|
| 300 | + } |
|
| 292 | 301 | |
| 293 | 302 | // Check the e-mail address |
| 294 | 303 | if ($user_email == '') {
|
@@ -296,8 +305,9 @@ discard block |
||
| 296 | 305 | } elseif (!is_email($user_email)) {
|
| 297 | 306 | $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.', 'geodirectory'));
|
| 298 | 307 | $user_email = ''; |
| 299 | - } elseif (email_exists($user_email)) |
|
| 300 | - $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
|
|
| 308 | + } elseif (email_exists($user_email)) { |
|
| 309 | + $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory')); |
|
| 310 | + } |
|
| 301 | 311 | |
| 302 | 312 | /** |
| 303 | 313 | * Called when registering a new user. |
@@ -317,8 +327,9 @@ discard block |
||
| 317 | 327 | */ |
| 318 | 328 | $errors = apply_filters('registration_errors', $errors);
|
| 319 | 329 | |
| 320 | - if ($errors->get_error_code()) |
|
| 321 | - return $errors; |
|
| 330 | + if ($errors->get_error_code()) { |
|
| 331 | + return $errors; |
|
| 332 | + } |
|
| 322 | 333 | |
| 323 | 334 | |
| 324 | 335 | if (!isset($user_pass) || $user_pass == '') {
|
@@ -423,28 +434,33 @@ discard block |
||
| 423 | 434 | |
| 424 | 435 | $errors = new WP_Error(); |
| 425 | 436 | |
| 426 | - if (isset($_GET['key'])) |
|
| 427 | - $action = 'resetpass'; |
|
| 437 | + if (isset($_GET['key'])) { |
|
| 438 | + $action = 'resetpass'; |
|
| 439 | + } |
|
| 428 | 440 | |
| 429 | 441 | // validate action so as to default to the login screen |
| 430 | - if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
|
|
| 431 | - $action = 'login'; |
|
| 442 | + if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) { |
|
| 443 | + $action = 'login'; |
|
| 444 | + } |
|
| 432 | 445 | |
| 433 | 446 | nocache_headers(); |
| 434 | 447 | |
| 435 | 448 | if (defined('RELOCATE')) { // Move flag is set
|
| 436 | - if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) |
|
| 437 | - $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 449 | + if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) { |
|
| 450 | + $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']); |
|
| 451 | + } |
|
| 438 | 452 | |
| 439 | 453 | $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://'; |
| 440 | - if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) |
|
| 441 | - update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
|
|
| 454 | + if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) { |
|
| 455 | + update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'])); |
|
| 456 | + } |
|
| 442 | 457 | } |
| 443 | 458 | |
| 444 | 459 | //Set a cookie now to see if they are supported by the browser. |
| 445 | 460 | //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); |
| 446 | - if (SITECOOKIEPATH != COOKIEPATH) |
|
| 447 | - setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 461 | + if (SITECOOKIEPATH != COOKIEPATH) { |
|
| 462 | + setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN); |
|
| 463 | + } |
|
| 448 | 464 | |
| 449 | 465 | /** |
| 450 | 466 | * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page. |
@@ -465,8 +481,9 @@ discard block |
||
| 465 | 481 | |
| 466 | 482 | $redirect_to = $_SERVER['HTTP_REFERER']; |
| 467 | 483 | //$redirect_to = home_url().'/?ptype=login&loggedout=true'; |
| 468 | - if (isset($_REQUEST['redirect_to'])) |
|
| 469 | - $redirect_to = $_REQUEST['redirect_to']; |
|
| 484 | + if (isset($_REQUEST['redirect_to'])) { |
|
| 485 | + $redirect_to = $_REQUEST['redirect_to']; |
|
| 486 | + } |
|
| 470 | 487 | $redirect_to = home_url(); |
| 471 | 488 | wp_safe_redirect($redirect_to); |
| 472 | 489 | exit(); |
@@ -486,7 +503,9 @@ discard block |
||
| 486 | 503 | gd_die(); |
| 487 | 504 | } |
| 488 | 505 | } |
| 489 | - if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
|
|
| 506 | + if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) { |
|
| 507 | + $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory')); |
|
| 508 | + } |
|
| 490 | 509 | /** |
| 491 | 510 | * Called in the geodir_user_signup() function during the lostpassword case. |
| 492 | 511 | * |
@@ -582,8 +601,9 @@ discard block |
||
| 582 | 601 | } |
| 583 | 602 | |
| 584 | 603 | |
| 585 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 586 | - $secure_cookie = false; |
|
| 604 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) { |
|
| 605 | + $secure_cookie = false; |
|
| 606 | + } |
|
| 587 | 607 | |
| 588 | 608 | $user = wp_signon('', $secure_cookie);
|
| 589 | 609 | |
@@ -652,22 +672,26 @@ discard block |
||
| 652 | 672 | $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
|
| 653 | 673 | |
| 654 | 674 | $_REQUEST['redirect_to'] = $default_author_link; |
| 655 | - else: |
|
| 656 | - $_REQUEST['redirect_to'] = home_url(); |
|
| 675 | + else { |
|
| 676 | + : |
|
| 677 | + $_REQUEST['redirect_to'] = home_url(); |
|
| 678 | + } |
|
| 657 | 679 | endif; |
| 658 | 680 | |
| 659 | 681 | } |
| 660 | 682 | if (isset($_REQUEST['redirect_to'])) {
|
| 661 | 683 | $redirect_to = $_REQUEST['redirect_to']; |
| 662 | 684 | // Redirect to https if user wants ssl |
| 663 | - if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) |
|
| 664 | - $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
|
|
| 685 | + if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) { |
|
| 686 | + $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to); |
|
| 687 | + } |
|
| 665 | 688 | } else {
|
| 666 | 689 | $redirect_to = admin_url(); |
| 667 | 690 | } |
| 668 | 691 | |
| 669 | - if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) |
|
| 670 | - $secure_cookie = false; |
|
| 692 | + if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) { |
|
| 693 | + $secure_cookie = false; |
|
| 694 | + } |
|
| 671 | 695 | $user = wp_signon('', $secure_cookie);
|
| 672 | 696 | |
| 673 | 697 | |
@@ -702,11 +726,13 @@ discard block |
||
| 702 | 726 | $errors = $user; |
| 703 | 727 | |
| 704 | 728 | // Clear errors if loggedout is set. |
| 705 | - if (!empty($_GET['loggedout'])) |
|
| 706 | - $errors = new WP_Error(); |
|
| 729 | + if (!empty($_GET['loggedout'])) { |
|
| 730 | + $errors = new WP_Error(); |
|
| 731 | + } |
|
| 707 | 732 | // If cookies are disabled we can't log in even with a valid user+pass |
| 708 | - if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) |
|
| 709 | - $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
|
|
| 733 | + if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) { |
|
| 734 | + $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory')); |
|
| 735 | + } |
|
| 710 | 736 | |
| 711 | 737 | // Some parts of this script use the main login form to display a message |
| 712 | 738 | if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
|