@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * Get All Plugin functions from WordPress |
| 12 | 12 | */ |
| 13 | -include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 13 | +include_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 14 | 14 | |
| 15 | 15 | /*-----------------------------------------------------------------------------------*/ |
| 16 | 16 | /* Helper functions */ |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function geodir_plugin_url() {
|
| 29 | 29 | |
| 30 | - if ( is_ssl() ) : |
|
| 31 | - return str_replace( 'http://', 'https://', WP_PLUGIN_URL ) . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
| 30 | + if (is_ssl()) : |
|
| 31 | + return str_replace('http://', 'https://', WP_PLUGIN_URL)."/".plugin_basename(dirname(dirname(__FILE__)));
|
|
| 32 | 32 | else : |
| 33 | - return WP_PLUGIN_URL . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
| 33 | + return WP_PLUGIN_URL."/".plugin_basename(dirname(dirname(__FILE__))); |
|
| 34 | 34 | endif; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | * @return string example url eg: /home/geo/public_html/wp-content/plugins/geodirectory |
| 46 | 46 | */ |
| 47 | 47 | function geodir_plugin_path() {
|
| 48 | - if ( defined( 'GD_TESTING_MODE' ) && GD_TESTING_MODE ) {
|
|
| 49 | - return dirname( dirname( __FILE__ ) ); |
|
| 48 | + if (defined('GD_TESTING_MODE') && GD_TESTING_MODE) {
|
|
| 49 | + return dirname(dirname(__FILE__)); |
|
| 50 | 50 | } else {
|
| 51 | - return WP_PLUGIN_DIR . "/" . plugin_basename( dirname( dirname( __FILE__ ) ) ); |
|
| 51 | + return WP_PLUGIN_DIR."/".plugin_basename(dirname(dirname(__FILE__))); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | * @return bool true or false. |
| 64 | 64 | * @todo check if this is faster than normal WP check and remove if not. |
| 65 | 65 | */ |
| 66 | -function geodir_is_plugin_active( $plugin ) {
|
|
| 67 | - $active_plugins = get_option( 'active_plugins' ); |
|
| 68 | - foreach ( $active_plugins as $key => $active_plugin ) {
|
|
| 69 | - if ( strstr( $active_plugin, $plugin ) ) {
|
|
| 66 | +function geodir_is_plugin_active($plugin) {
|
|
| 67 | + $active_plugins = get_option('active_plugins');
|
|
| 68 | + foreach ($active_plugins as $key => $active_plugin) {
|
|
| 69 | + if (strstr($active_plugin, $plugin)) {
|
|
| 70 | 70 | return true; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return bool|int|string the formatted date. |
| 90 | 90 | */ |
| 91 | -function geodir_get_formated_date( $date ) {
|
|
| 92 | - return mysql2date( get_option( 'date_format' ), $date ); |
|
| 91 | +function geodir_get_formated_date($date) {
|
|
| 92 | + return mysql2date(get_option('date_format'), $date);
|
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return bool|int|string the formatted time. |
| 107 | 107 | */ |
| 108 | -function geodir_get_formated_time( $time ) {
|
|
| 109 | - return mysql2date( get_option( 'time_format' ), $time, $translate = true ); |
|
| 108 | +function geodir_get_formated_time($time) {
|
|
| 109 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
@@ -124,35 +124,35 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return string Formatted link. |
| 126 | 126 | */ |
| 127 | -function geodir_getlink( $url, $params = array(), $use_existing_arguments = false ) {
|
|
| 128 | - if ( $use_existing_arguments ) {
|
|
| 127 | +function geodir_getlink($url, $params = array(), $use_existing_arguments = false) {
|
|
| 128 | + if ($use_existing_arguments) {
|
|
| 129 | 129 | $params = $params + $_GET; |
| 130 | 130 | } |
| 131 | - if ( ! $params ) {
|
|
| 131 | + if (!$params) {
|
|
| 132 | 132 | return $url; |
| 133 | 133 | } |
| 134 | 134 | $link = $url; |
| 135 | - if ( strpos( $link, '?' ) === false ) {
|
|
| 135 | + if (strpos($link, '?') === false) {
|
|
| 136 | 136 | $link .= '?'; |
| 137 | 137 | } //If there is no '?' add one at the end |
| 138 | - elseif ( strpos( $link, '//maps.google.com/maps/api/js?language=' ) ) {
|
|
| 138 | + elseif (strpos($link, '//maps.google.com/maps/api/js?language=')) {
|
|
| 139 | 139 | $link .= '&'; |
| 140 | 140 | } //If there is no '&' at the END, add one. |
| 141 | - elseif ( ! preg_match( '/(\?|\&(amp;)?)$/', $link ) ) {
|
|
| 141 | + elseif (!preg_match('/(\?|\&(amp;)?)$/', $link)) {
|
|
| 142 | 142 | $link .= '&'; |
| 143 | 143 | } //If there is no '&' at the END, add one. |
| 144 | 144 | |
| 145 | 145 | $params_arr = array(); |
| 146 | - foreach ( $params as $key => $value ) {
|
|
| 147 | - if ( gettype( $value ) == 'array' ) { //Handle array data properly
|
|
| 148 | - foreach ( $value as $val ) {
|
|
| 149 | - $params_arr[] = $key . '[]=' . urlencode( $val ); |
|
| 146 | + foreach ($params as $key => $value) {
|
|
| 147 | + if (gettype($value) == 'array') { //Handle array data properly
|
|
| 148 | + foreach ($value as $val) {
|
|
| 149 | + $params_arr[] = $key.'[]='.urlencode($val); |
|
| 150 | 150 | } |
| 151 | 151 | } else {
|
| 152 | - $params_arr[] = $key . '=' . urlencode( $value ); |
|
| 152 | + $params_arr[] = $key.'='.urlencode($value); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | - $link .= implode( '&', $params_arr ); |
|
| 155 | + $link .= implode('&', $params_arr);
|
|
| 156 | 156 | |
| 157 | 157 | return $link; |
| 158 | 158 | } |
@@ -169,18 +169,18 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @return string Listing page url if valid. Otherwise home url will be returned. |
| 171 | 171 | */ |
| 172 | -function geodir_get_addlisting_link( $post_type = '' ) {
|
|
| 172 | +function geodir_get_addlisting_link($post_type = '') {
|
|
| 173 | 173 | global $wpdb; |
| 174 | 174 | |
| 175 | 175 | //$check_pkg = $wpdb->get_var("SELECT pid FROM ".GEODIR_PRICE_TABLE." WHERE post_type='".$post_type."' and status != '0'");
|
| 176 | 176 | $check_pkg = 1; |
| 177 | - if ( post_type_exists( $post_type ) && $check_pkg ) {
|
|
| 177 | + if (post_type_exists($post_type) && $check_pkg) {
|
|
| 178 | 178 | |
| 179 | - $add_listing_link = get_page_link( geodir_add_listing_page_id() ); |
|
| 179 | + $add_listing_link = get_page_link(geodir_add_listing_page_id()); |
|
| 180 | 180 | |
| 181 | - return esc_url( add_query_arg( array( 'listing_type' => $post_type ), $add_listing_link ) ); |
|
| 181 | + return esc_url(add_query_arg(array('listing_type' => $post_type), $add_listing_link));
|
|
| 182 | 182 | } else {
|
| 183 | - return get_bloginfo( 'url' ); |
|
| 183 | + return get_bloginfo('url');
|
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (!empty($_SERVER['PHP_SELF']) && !empty($_SERVER['REQUEST_URI'])) {
|
| 209 | 209 | // To build the entire URI we need to prepend the protocol, and the http host |
| 210 | 210 | // to the URI string. |
| 211 | - $pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 211 | + $pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 212 | 212 | } else {
|
| 213 | 213 | /* |
| 214 | 214 | * Since we do not have REQUEST_URI to work with, we will assume we are |
@@ -217,11 +217,11 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS |
| 219 | 219 | */ |
| 220 | - $pageURL .= $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; |
|
| 220 | + $pageURL .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; |
|
| 221 | 221 | |
| 222 | 222 | // If the query string exists append it to the URI string |
| 223 | 223 | if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
|
| 224 | - $pageURL .= '?' . $_SERVER['QUERY_STRING']; |
|
| 224 | + $pageURL .= '?'.$_SERVER['QUERY_STRING']; |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param string $pageURL The URL of the current page. |
| 234 | 234 | */ |
| 235 | - return apply_filters( 'geodir_curPageURL', $pageURL ); |
|
| 235 | + return apply_filters('geodir_curPageURL', $pageURL);
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -247,12 +247,12 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return string Cleaned variable. |
| 249 | 249 | */ |
| 250 | -function geodir_clean( $string ) {
|
|
| 250 | +function geodir_clean($string) {
|
|
| 251 | 251 | |
| 252 | - $string = trim( strip_tags( stripslashes( $string ) ) ); |
|
| 253 | - $string = str_replace( " ", "-", $string ); // Replaces all spaces with hyphens. |
|
| 254 | - $string = preg_replace( '/[^A-Za-z0-9\-\_]/', '', $string ); // Removes special chars. |
|
| 255 | - $string = preg_replace( '/-+/', '-', $string ); // Replaces multiple hyphens with single one. |
|
| 252 | + $string = trim(strip_tags(stripslashes($string))); |
|
| 253 | + $string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
|
|
| 254 | + $string = preg_replace('/[^A-Za-z0-9\-\_]/', '', $string); // Removes special chars.
|
|
| 255 | + $string = preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
|
|
| 256 | 256 | |
| 257 | 257 | return $string; |
| 258 | 258 | } |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function geodir_get_weekday() {
|
| 268 | 268 | return array( |
| 269 | - __( 'Sunday', 'geodirectory' ), |
|
| 270 | - __( 'Monday', 'geodirectory' ), |
|
| 271 | - __( 'Tuesday', 'geodirectory' ), |
|
| 272 | - __( 'Wednesday', 'geodirectory' ), |
|
| 273 | - __( 'Thursday', 'geodirectory' ), |
|
| 274 | - __( 'Friday', 'geodirectory' ), |
|
| 275 | - __( 'Saturday', 'geodirectory' ) |
|
| 269 | + __('Sunday', 'geodirectory'),
|
|
| 270 | + __('Monday', 'geodirectory'),
|
|
| 271 | + __('Tuesday', 'geodirectory'),
|
|
| 272 | + __('Wednesday', 'geodirectory'),
|
|
| 273 | + __('Thursday', 'geodirectory'),
|
|
| 274 | + __('Friday', 'geodirectory'),
|
|
| 275 | + __('Saturday', 'geodirectory')
|
|
| 276 | 276 | ); |
| 277 | 277 | } |
| 278 | 278 | |
@@ -285,11 +285,11 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | function geodir_get_weeks() {
|
| 287 | 287 | return array( |
| 288 | - __( 'First', 'geodirectory' ), |
|
| 289 | - __( 'Second', 'geodirectory' ), |
|
| 290 | - __( 'Third', 'geodirectory' ), |
|
| 291 | - __( 'Fourth', 'geodirectory' ), |
|
| 292 | - __( 'Last', 'geodirectory' ) |
|
| 288 | + __('First', 'geodirectory'),
|
|
| 289 | + __('Second', 'geodirectory'),
|
|
| 290 | + __('Third', 'geodirectory'),
|
|
| 291 | + __('Fourth', 'geodirectory'),
|
|
| 292 | + __('Last', 'geodirectory')
|
|
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -308,112 +308,112 @@ discard block |
||
| 308 | 308 | * |
| 309 | 309 | * @return bool If valid returns true. Otherwise false. |
| 310 | 310 | */ |
| 311 | -function geodir_is_page( $gdpage = '' ) {
|
|
| 311 | +function geodir_is_page($gdpage = '') {
|
|
| 312 | 312 | |
| 313 | 313 | global $wp_query, $post, $wp; |
| 314 | 314 | //if(!is_admin()): |
| 315 | 315 | |
| 316 | - switch ( $gdpage ): |
|
| 316 | + switch ($gdpage): |
|
| 317 | 317 | case 'add-listing': |
| 318 | 318 | |
| 319 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_add_listing_page_id() ) {
|
|
| 319 | + if (is_page() && get_query_var('page_id') == geodir_add_listing_page_id()) {
|
|
| 320 | 320 | return true; |
| 321 | - } elseif ( is_page() && isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
|
|
| 321 | + } elseif (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
|
|
| 322 | 322 | return true; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | break; |
| 326 | 326 | case 'preview': |
| 327 | - if ( ( is_page() && get_query_var( 'page_id' ) == geodir_preview_page_id() ) && isset( $_REQUEST['listing_type'] ) |
|
| 328 | - && in_array( $_REQUEST['listing_type'], geodir_get_posttypes() ) |
|
| 327 | + if ((is_page() && get_query_var('page_id') == geodir_preview_page_id()) && isset($_REQUEST['listing_type'])
|
|
| 328 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
| 329 | 329 | ) {
|
| 330 | 330 | return true; |
| 331 | 331 | } |
| 332 | 332 | break; |
| 333 | 333 | case 'listing-success': |
| 334 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_success_page_id() ) {
|
|
| 334 | + if (is_page() && get_query_var('page_id') == geodir_success_page_id()) {
|
|
| 335 | 335 | return true; |
| 336 | 336 | } |
| 337 | 337 | break; |
| 338 | 338 | case 'detail': |
| 339 | - $post_type = get_query_var( 'post_type' ); |
|
| 340 | - if ( is_array( $post_type ) ) {
|
|
| 341 | - $post_type = reset( $post_type ); |
|
| 339 | + $post_type = get_query_var('post_type');
|
|
| 340 | + if (is_array($post_type)) {
|
|
| 341 | + $post_type = reset($post_type); |
|
| 342 | 342 | } |
| 343 | - if ( is_single() && in_array( $post_type, geodir_get_posttypes() ) ) {
|
|
| 343 | + if (is_single() && in_array($post_type, geodir_get_posttypes())) {
|
|
| 344 | 344 | return true; |
| 345 | 345 | } |
| 346 | 346 | break; |
| 347 | 347 | case 'pt': |
| 348 | - $post_type = get_query_var( 'post_type' ); |
|
| 349 | - if ( is_array( $post_type ) ) {
|
|
| 350 | - $post_type = reset( $post_type ); |
|
| 348 | + $post_type = get_query_var('post_type');
|
|
| 349 | + if (is_array($post_type)) {
|
|
| 350 | + $post_type = reset($post_type); |
|
| 351 | 351 | } |
| 352 | - if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) && ! is_tax() ) {
|
|
| 352 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes()) && !is_tax()) {
|
|
| 353 | 353 | return true; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | break; |
| 357 | 357 | case 'listing': |
| 358 | - if ( is_tax() && geodir_get_taxonomy_posttype() ) {
|
|
| 358 | + if (is_tax() && geodir_get_taxonomy_posttype()) {
|
|
| 359 | 359 | global $current_term, $taxonomy, $term; |
| 360 | 360 | |
| 361 | 361 | return true; |
| 362 | 362 | } |
| 363 | - $post_type = get_query_var( 'post_type' ); |
|
| 364 | - if ( is_array( $post_type ) ) {
|
|
| 365 | - $post_type = reset( $post_type ); |
|
| 363 | + $post_type = get_query_var('post_type');
|
|
| 364 | + if (is_array($post_type)) {
|
|
| 365 | + $post_type = reset($post_type); |
|
| 366 | 366 | } |
| 367 | - if ( is_post_type_archive() && in_array( $post_type, geodir_get_posttypes() ) ) {
|
|
| 367 | + if (is_post_type_archive() && in_array($post_type, geodir_get_posttypes())) {
|
|
| 368 | 368 | return true; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | break; |
| 372 | 372 | case 'home': |
| 373 | 373 | |
| 374 | - if ( ( is_page() && get_query_var( 'page_id' ) == geodir_home_page_id() ) || is_page_geodir_home() ) {
|
|
| 374 | + if ((is_page() && get_query_var('page_id') == geodir_home_page_id()) || is_page_geodir_home()) {
|
|
| 375 | 375 | return true; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | break; |
| 379 | 379 | case 'location': |
| 380 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_location_page_id() ) {
|
|
| 380 | + if (is_page() && get_query_var('page_id') == geodir_location_page_id()) {
|
|
| 381 | 381 | return true; |
| 382 | 382 | } |
| 383 | 383 | break; |
| 384 | 384 | case 'author': |
| 385 | - if ( is_author() && isset( $_REQUEST['geodir_dashbord'] ) ) {
|
|
| 385 | + if (is_author() && isset($_REQUEST['geodir_dashbord'])) {
|
|
| 386 | 386 | return true; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - if ( function_exists( 'bp_loggedin_user_id' ) && function_exists( 'bp_displayed_user_id' ) && $my_id = (int) bp_loggedin_user_id() ) {
|
|
| 390 | - if ( ( (bool) bp_is_current_component( 'listings' ) || (bool) bp_is_current_component( 'favorites' ) ) && $my_id > 0 && $my_id == (int) bp_displayed_user_id() ) {
|
|
| 389 | + if (function_exists('bp_loggedin_user_id') && function_exists('bp_displayed_user_id') && $my_id = (int) bp_loggedin_user_id()) {
|
|
| 390 | + if (((bool) bp_is_current_component('listings') || (bool) bp_is_current_component('favorites')) && $my_id > 0 && $my_id == (int) bp_displayed_user_id()) {
|
|
| 391 | 391 | return true; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | break; |
| 395 | 395 | case 'search': |
| 396 | - if ( is_search() && isset( $_REQUEST['geodir_search'] ) ) {
|
|
| 396 | + if (is_search() && isset($_REQUEST['geodir_search'])) {
|
|
| 397 | 397 | return true; |
| 398 | 398 | } |
| 399 | 399 | break; |
| 400 | 400 | case 'info': |
| 401 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_info_page_id() ) {
|
|
| 401 | + if (is_page() && get_query_var('page_id') == geodir_info_page_id()) {
|
|
| 402 | 402 | return true; |
| 403 | 403 | } |
| 404 | 404 | break; |
| 405 | 405 | case 'login': |
| 406 | - if ( is_page() && get_query_var( 'page_id' ) == geodir_login_page_id() ) {
|
|
| 406 | + if (is_page() && get_query_var('page_id') == geodir_login_page_id()) {
|
|
| 407 | 407 | return true; |
| 408 | 408 | } |
| 409 | 409 | break; |
| 410 | 410 | case 'checkout': |
| 411 | - if ( is_page() && function_exists( 'geodir_payment_checkout_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_checkout_page_id() ) {
|
|
| 411 | + if (is_page() && function_exists('geodir_payment_checkout_page_id') && get_query_var('page_id') == geodir_payment_checkout_page_id()) {
|
|
| 412 | 412 | return true; |
| 413 | 413 | } |
| 414 | 414 | break; |
| 415 | 415 | case 'invoices': |
| 416 | - if ( is_page() && function_exists( 'geodir_payment_invoices_page_id' ) && get_query_var( 'page_id' ) == geodir_payment_invoices_page_id() ) {
|
|
| 416 | + if (is_page() && function_exists('geodir_payment_invoices_page_id') && get_query_var('page_id') == geodir_payment_invoices_page_id()) {
|
|
| 417 | 417 | return true; |
| 418 | 418 | } |
| 419 | 419 | break; |
@@ -438,28 +438,28 @@ discard block |
||
| 438 | 438 | * |
| 439 | 439 | * @param object $wp WordPress object. |
| 440 | 440 | */ |
| 441 | -function geodir_set_is_geodir_page( $wp ) {
|
|
| 442 | - if ( ! is_admin() ) {
|
|
| 441 | +function geodir_set_is_geodir_page($wp) {
|
|
| 442 | + if (!is_admin()) {
|
|
| 443 | 443 | //$wp->query_vars['gd_is_geodir_page'] = false; |
| 444 | 444 | //print_r() |
| 445 | - if ( empty( $wp->query_vars ) || ! array_diff( array_keys( $wp->query_vars ), array( |
|
| 445 | + if (empty($wp->query_vars) || !array_diff(array_keys($wp->query_vars), array( |
|
| 446 | 446 | 'preview', |
| 447 | 447 | 'page', |
| 448 | 448 | 'paged', |
| 449 | 449 | 'cpage' |
| 450 | - ) ) |
|
| 450 | + )) |
|
| 451 | 451 | ) {
|
| 452 | - if ( get_option( 'geodir_set_as_home' ) ) {
|
|
| 452 | + if (get_option('geodir_set_as_home')) {
|
|
| 453 | 453 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 454 | 454 | } |
| 455 | - if ( geodir_is_page( 'home' ) ) {
|
|
| 455 | + if (geodir_is_page('home')) {
|
|
| 456 | 456 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['page_id'] ) ) {
|
|
| 462 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['page_id'])) {
|
|
| 463 | 463 | if ( |
| 464 | 464 | $wp->query_vars['page_id'] == geodir_add_listing_page_id() |
| 465 | 465 | || $wp->query_vars['page_id'] == geodir_preview_page_id() |
@@ -468,26 +468,26 @@ discard block |
||
| 468 | 468 | || $wp->query_vars['page_id'] == geodir_home_page_id() |
| 469 | 469 | || $wp->query_vars['page_id'] == geodir_info_page_id() |
| 470 | 470 | || $wp->query_vars['page_id'] == geodir_login_page_id() |
| 471 | - || ( function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() ) |
|
| 472 | - || ( function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() ) |
|
| 471 | + || (function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
|
|
| 472 | + || (function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
|
|
| 473 | 473 | ) {
|
| 474 | 474 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['pagename'] ) ) {
|
|
| 479 | - $page = get_page_by_path( $wp->query_vars['pagename'] ); |
|
| 478 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['pagename'])) {
|
|
| 479 | + $page = get_page_by_path($wp->query_vars['pagename']); |
|
| 480 | 480 | |
| 481 | - if ( ! empty( $page ) && ( |
|
| 481 | + if (!empty($page) && ( |
|
| 482 | 482 | $page->ID == geodir_add_listing_page_id() |
| 483 | 483 | || $page->ID == geodir_preview_page_id() |
| 484 | 484 | || $page->ID == geodir_success_page_id() |
| 485 | 485 | || $page->ID == geodir_location_page_id() |
| 486 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_home_page_id() ) |
|
| 487 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_info_page_id() ) |
|
| 488 | - || ( isset( $wp->query_vars['page_id'] ) && $wp->query_vars['page_id'] == geodir_login_page_id() ) |
|
| 489 | - || ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_checkout_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id() ) |
|
| 490 | - || ( isset( $wp->query_vars['page_id'] ) && function_exists( 'geodir_payment_invoices_page_id' ) && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id() ) |
|
| 486 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_home_page_id()) |
|
| 487 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_info_page_id()) |
|
| 488 | + || (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_login_page_id()) |
|
| 489 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_checkout_page_id') && $wp->query_vars['page_id'] == geodir_payment_checkout_page_id())
|
|
| 490 | + || (isset($wp->query_vars['page_id']) && function_exists('geodir_payment_invoices_page_id') && $wp->query_vars['page_id'] == geodir_payment_invoices_page_id())
|
|
| 491 | 491 | ) |
| 492 | 492 | ) {
|
| 493 | 493 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -495,20 +495,20 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | |
| 498 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['post_type'] ) && $wp->query_vars['post_type'] != '' ) {
|
|
| 498 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
|
|
| 499 | 499 | $requested_post_type = $wp->query_vars['post_type']; |
| 500 | 500 | // check if this post type is geodirectory post types |
| 501 | 501 | $post_type_array = geodir_get_posttypes(); |
| 502 | - if ( in_array( $requested_post_type, $post_type_array ) ) {
|
|
| 502 | + if (in_array($requested_post_type, $post_type_array)) {
|
|
| 503 | 503 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) ) {
|
|
| 508 | - $geodir_taxonomis = geodir_get_taxonomies( '', true ); |
|
| 509 | - if ( ! empty( $geodir_taxonomis ) ) {
|
|
| 510 | - foreach ( $geodir_taxonomis as $taxonomy ) {
|
|
| 511 | - if ( array_key_exists( $taxonomy, $wp->query_vars ) ) {
|
|
| 507 | + if (!isset($wp->query_vars['gd_is_geodir_page'])) {
|
|
| 508 | + $geodir_taxonomis = geodir_get_taxonomies('', true);
|
|
| 509 | + if (!empty($geodir_taxonomis)) {
|
|
| 510 | + foreach ($geodir_taxonomis as $taxonomy) {
|
|
| 511 | + if (array_key_exists($taxonomy, $wp->query_vars)) {
|
|
| 512 | 512 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 513 | 513 | break; |
| 514 | 514 | } |
@@ -517,20 +517,20 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $wp->query_vars['author_name'] ) && isset( $_REQUEST['geodir_dashbord'] ) ) {
|
|
| 520 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($wp->query_vars['author_name']) && isset($_REQUEST['geodir_dashbord'])) {
|
|
| 521 | 521 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | |
| 525 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) && isset( $_REQUEST['geodir_search'] ) ) {
|
|
| 525 | + if (!isset($wp->query_vars['gd_is_geodir_page']) && isset($_REQUEST['geodir_search'])) {
|
|
| 526 | 526 | $wp->query_vars['gd_is_geodir_page'] = true; |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | |
| 530 | 530 | //check if homepage |
| 531 | - if ( ! isset( $wp->query_vars['gd_is_geodir_page'] ) |
|
| 532 | - && ! isset( $wp->query_vars['page_id'] ) |
|
| 533 | - && ! isset( $wp->query_vars['pagename'] ) |
|
| 531 | + if (!isset($wp->query_vars['gd_is_geodir_page']) |
|
| 532 | + && !isset($wp->query_vars['page_id']) |
|
| 533 | + && !isset($wp->query_vars['pagename']) |
|
| 534 | 534 | && is_page_geodir_home() |
| 535 | 535 | ) {
|
| 536 | 536 | $wp->query_vars['gd_is_geodir_page'] = true; |
@@ -554,14 +554,14 @@ discard block |
||
| 554 | 554 | */ |
| 555 | 555 | function geodir_is_geodir_page() {
|
| 556 | 556 | global $wp; |
| 557 | - if ( isset( $wp->query_vars['gd_is_geodir_page'] ) && $wp->query_vars['gd_is_geodir_page'] ) {
|
|
| 557 | + if (isset($wp->query_vars['gd_is_geodir_page']) && $wp->query_vars['gd_is_geodir_page']) {
|
|
| 558 | 558 | return true; |
| 559 | 559 | } else {
|
| 560 | 560 | return false; |
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | -if ( ! function_exists( 'geodir_get_imagesize' ) ) {
|
|
| 564 | +if (!function_exists('geodir_get_imagesize')) {
|
|
| 565 | 565 | /** |
| 566 | 566 | * Get image size using the size key . |
| 567 | 567 | * |
@@ -572,13 +572,13 @@ discard block |
||
| 572 | 572 | * |
| 573 | 573 | * @return array|mixed|void|WP_Error If valid returns image size. Else returns error. |
| 574 | 574 | */ |
| 575 | - function geodir_get_imagesize( $size = '' ) {
|
|
| 575 | + function geodir_get_imagesize($size = '') {
|
|
| 576 | 576 | |
| 577 | 577 | $imagesizes = array( |
| 578 | - 'list-thumb' => array( 'w' => 283, 'h' => 188 ), |
|
| 579 | - 'thumbnail' => array( 'w' => 125, 'h' => 125 ), |
|
| 580 | - 'widget-thumb' => array( 'w' => 50, 'h' => 50 ), |
|
| 581 | - 'slider-thumb' => array( 'w' => 100, 'h' => 100 ) |
|
| 578 | + 'list-thumb' => array('w' => 283, 'h' => 188),
|
|
| 579 | + 'thumbnail' => array('w' => 125, 'h' => 125),
|
|
| 580 | + 'widget-thumb' => array('w' => 50, 'h' => 50),
|
|
| 581 | + 'slider-thumb' => array('w' => 100, 'h' => 100)
|
|
| 582 | 582 | ); |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -588,9 +588,9 @@ discard block |
||
| 588 | 588 | * |
| 589 | 589 | * @param array $imagesizes Image size array. |
| 590 | 590 | */ |
| 591 | - $imagesizes = apply_filters( 'geodir_imagesizes', $imagesizes ); |
|
| 591 | + $imagesizes = apply_filters('geodir_imagesizes', $imagesizes);
|
|
| 592 | 592 | |
| 593 | - if ( ! empty( $size ) && array_key_exists( $size, $imagesizes ) ) {
|
|
| 593 | + if (!empty($size) && array_key_exists($size, $imagesizes)) {
|
|
| 594 | 594 | /** |
| 595 | 595 | * Filters image size of the passed key. |
| 596 | 596 | * |
@@ -598,11 +598,11 @@ discard block |
||
| 598 | 598 | * |
| 599 | 599 | * @param array $imagesizes [$size] Image size array of the passed key. |
| 600 | 600 | */ |
| 601 | - return apply_filters( 'geodir_get_imagesize_' . $size, $imagesizes[ $size ] ); |
|
| 601 | + return apply_filters('geodir_get_imagesize_'.$size, $imagesizes[$size]);
|
|
| 602 | 602 | |
| 603 | - } elseif ( ! empty( $size ) ) {
|
|
| 603 | + } elseif (!empty($size)) {
|
|
| 604 | 604 | |
| 605 | - return new WP_Error( 'geodir_no_imagesize', __( "Given image size is not valid", 'geodirectory' ) ); |
|
| 605 | + return new WP_Error('geodir_no_imagesize', __("Given image size is not valid", 'geodirectory'));
|
|
| 606 | 606 | |
| 607 | 607 | } |
| 608 | 608 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | |
| 628 | 628 | |
| 629 | -if ( ! function_exists( 'createRandomString' ) ) {
|
|
| 629 | +if (!function_exists('createRandomString')) {
|
|
| 630 | 630 | /** |
| 631 | 631 | * Creates random string. |
| 632 | 632 | * |
@@ -636,21 +636,21 @@ discard block |
||
| 636 | 636 | */ |
| 637 | 637 | function createRandomString() {
|
| 638 | 638 | $chars = "abcdefghijkmlnopqrstuvwxyz1023456789"; |
| 639 | - srand( (double) microtime() * 1000000 ); |
|
| 639 | + srand((double) microtime() * 1000000); |
|
| 640 | 640 | $i = 0; |
| 641 | 641 | $rstring = ''; |
| 642 | - while ( $i <= 25 ) {
|
|
| 642 | + while ($i <= 25) {
|
|
| 643 | 643 | $num = rand() % 33; |
| 644 | - $tmp = substr( $chars, $num, 1 ); |
|
| 645 | - $rstring = $rstring . $tmp; |
|
| 646 | - $i ++; |
|
| 644 | + $tmp = substr($chars, $num, 1); |
|
| 645 | + $rstring = $rstring.$tmp; |
|
| 646 | + $i++; |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | return $rstring; |
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | -if ( ! function_exists( 'geodir_getDistanceRadius' ) ) {
|
|
| 653 | +if (!function_exists('geodir_getDistanceRadius')) {
|
|
| 654 | 654 | /** |
| 655 | 655 | * Calculates the distance radius. |
| 656 | 656 | * |
@@ -661,9 +661,9 @@ discard block |
||
| 661 | 661 | * |
| 662 | 662 | * @return float The mean radius. |
| 663 | 663 | */ |
| 664 | - function geodir_getDistanceRadius( $uom = 'km' ) {
|
|
| 664 | + function geodir_getDistanceRadius($uom = 'km') {
|
|
| 665 | 665 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
| 666 | - switch ( geodir_strtolower( $uom ) ): |
|
| 666 | + switch (geodir_strtolower($uom)): |
|
| 667 | 667 | case 'km' : |
| 668 | 668 | $earthMeanRadius = 6371.009; // km |
| 669 | 669 | break; |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | |
| 698 | -if ( ! function_exists( 'geodir_calculateDistanceFromLatLong' ) ) {
|
|
| 698 | +if (!function_exists('geodir_calculateDistanceFromLatLong')) {
|
|
| 699 | 699 | /** |
| 700 | 700 | * Calculate the great circle distance between two points identified by longitude and latitude. |
| 701 | 701 | * |
@@ -708,17 +708,17 @@ discard block |
||
| 708 | 708 | * |
| 709 | 709 | * @return float The distance. |
| 710 | 710 | */ |
| 711 | - function geodir_calculateDistanceFromLatLong( $point1, $point2, $uom = 'km' ) {
|
|
| 711 | + function geodir_calculateDistanceFromLatLong($point1, $point2, $uom = 'km') {
|
|
| 712 | 712 | // Use Haversine formula to calculate the great circle distance between two points identified by longitude and latitude |
| 713 | 713 | |
| 714 | - $earthMeanRadius = geodir_getDistanceRadius( $uom ); |
|
| 714 | + $earthMeanRadius = geodir_getDistanceRadius($uom); |
|
| 715 | 715 | |
| 716 | - $deltaLatitude = deg2rad( (float) $point2['latitude'] - (float) $point1['latitude'] ); |
|
| 717 | - $deltaLongitude = deg2rad( (float) $point2['longitude'] - (float) $point1['longitude'] ); |
|
| 718 | - $a = sin( $deltaLatitude / 2 ) * sin( $deltaLatitude / 2 ) + |
|
| 719 | - cos( deg2rad( (float) $point1['latitude'] ) ) * cos( deg2rad( (float) $point2['latitude'] ) ) * |
|
| 720 | - sin( $deltaLongitude / 2 ) * sin( $deltaLongitude / 2 ); |
|
| 721 | - $c = 2 * atan2( sqrt( $a ), sqrt( 1 - $a ) ); |
|
| 716 | + $deltaLatitude = deg2rad((float) $point2['latitude'] - (float) $point1['latitude']); |
|
| 717 | + $deltaLongitude = deg2rad((float) $point2['longitude'] - (float) $point1['longitude']); |
|
| 718 | + $a = sin($deltaLatitude / 2) * sin($deltaLatitude / 2) + |
|
| 719 | + cos(deg2rad((float) $point1['latitude'])) * cos(deg2rad((float) $point2['latitude'])) * |
|
| 720 | + sin($deltaLongitude / 2) * sin($deltaLongitude / 2); |
|
| 721 | + $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); |
|
| 722 | 722 | $distance = $earthMeanRadius * $c; |
| 723 | 723 | |
| 724 | 724 | return $distance; |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | |
| 730 | -if ( ! function_exists( 'geodir_sendEmail' ) ) {
|
|
| 730 | +if (!function_exists('geodir_sendEmail')) {
|
|
| 731 | 731 | /** |
| 732 | 732 | * The main function that send transactional emails using the args provided. |
| 733 | 733 | * |
@@ -746,83 +746,83 @@ discard block |
||
| 746 | 746 | * @param string $post_id The post ID. |
| 747 | 747 | * @param string $user_id The user ID. |
| 748 | 748 | */ |
| 749 | - function geodir_sendEmail( $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '' ) {
|
|
| 749 | + function geodir_sendEmail($fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra = '', $message_type, $post_id = '', $user_id = '') {
|
|
| 750 | 750 | $login_details = ''; |
| 751 | 751 | |
| 752 | 752 | // strip slashes from subject & message text |
| 753 | - $to_subject = stripslashes_deep( $to_subject ); |
|
| 754 | - $to_message = stripslashes_deep( $to_message ); |
|
| 755 | - |
|
| 756 | - if ( $message_type == 'send_friend' ) {
|
|
| 757 | - $subject = get_option( 'geodir_email_friend_subject' ); |
|
| 758 | - $message = get_option( 'geodir_email_friend_content' ); |
|
| 759 | - } elseif ( $message_type == 'send_enquiry' ) {
|
|
| 760 | - $subject = get_option( 'geodir_email_enquiry_subject' ); |
|
| 761 | - $message = get_option( 'geodir_email_enquiry_content' ); |
|
| 762 | - } elseif ( $message_type == 'forgot_password' ) {
|
|
| 763 | - $subject = get_option( 'geodir_forgot_password_subject' ); |
|
| 764 | - $message = get_option( 'geodir_forgot_password_content' ); |
|
| 753 | + $to_subject = stripslashes_deep($to_subject); |
|
| 754 | + $to_message = stripslashes_deep($to_message); |
|
| 755 | + |
|
| 756 | + if ($message_type == 'send_friend') {
|
|
| 757 | + $subject = get_option('geodir_email_friend_subject');
|
|
| 758 | + $message = get_option('geodir_email_friend_content');
|
|
| 759 | + } elseif ($message_type == 'send_enquiry') {
|
|
| 760 | + $subject = get_option('geodir_email_enquiry_subject');
|
|
| 761 | + $message = get_option('geodir_email_enquiry_content');
|
|
| 762 | + } elseif ($message_type == 'forgot_password') {
|
|
| 763 | + $subject = get_option('geodir_forgot_password_subject');
|
|
| 764 | + $message = get_option('geodir_forgot_password_content');
|
|
| 765 | 765 | $login_details = $to_message; |
| 766 | - } elseif ( $message_type == 'registration' ) {
|
|
| 767 | - $subject = get_option( 'geodir_registration_success_email_subject' ); |
|
| 768 | - $message = get_option( 'geodir_registration_success_email_content' ); |
|
| 766 | + } elseif ($message_type == 'registration') {
|
|
| 767 | + $subject = get_option('geodir_registration_success_email_subject');
|
|
| 768 | + $message = get_option('geodir_registration_success_email_content');
|
|
| 769 | 769 | $login_details = $to_message; |
| 770 | - } elseif ( $message_type == 'post_submit' ) {
|
|
| 771 | - $subject = get_option( 'geodir_post_submited_success_email_subject' ); |
|
| 772 | - $message = get_option( 'geodir_post_submited_success_email_content' ); |
|
| 773 | - } elseif ( $message_type == 'listing_published' ) {
|
|
| 774 | - $subject = get_option( 'geodir_post_published_email_subject' ); |
|
| 775 | - $message = get_option( 'geodir_post_published_email_content' ); |
|
| 776 | - } elseif ( $message_type == 'listing_edited' ) {
|
|
| 777 | - $subject = get_option( 'geodir_post_edited_email_subject_admin' ); |
|
| 778 | - $message = get_option( 'geodir_post_edited_email_content_admin' ); |
|
| 770 | + } elseif ($message_type == 'post_submit') {
|
|
| 771 | + $subject = get_option('geodir_post_submited_success_email_subject');
|
|
| 772 | + $message = get_option('geodir_post_submited_success_email_content');
|
|
| 773 | + } elseif ($message_type == 'listing_published') {
|
|
| 774 | + $subject = get_option('geodir_post_published_email_subject');
|
|
| 775 | + $message = get_option('geodir_post_published_email_content');
|
|
| 776 | + } elseif ($message_type == 'listing_edited') {
|
|
| 777 | + $subject = get_option('geodir_post_edited_email_subject_admin');
|
|
| 778 | + $message = get_option('geodir_post_edited_email_content_admin');
|
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - if ( ! empty( $subject ) ) {
|
|
| 782 | - $subject = __( stripslashes_deep( $subject ), 'geodirectory' ); |
|
| 781 | + if (!empty($subject)) {
|
|
| 782 | + $subject = __(stripslashes_deep($subject), 'geodirectory'); |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - if ( ! empty( $message ) ) {
|
|
| 786 | - $message = __( stripslashes_deep( $message ), 'geodirectory' ); |
|
| 785 | + if (!empty($message)) {
|
|
| 786 | + $message = __(stripslashes_deep($message), 'geodirectory'); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - $to_message = nl2br( $to_message ); |
|
| 790 | - $sitefromEmail = get_option( 'site_email' ); |
|
| 789 | + $to_message = nl2br($to_message); |
|
| 790 | + $sitefromEmail = get_option('site_email');
|
|
| 791 | 791 | $sitefromEmailName = get_site_emailName(); |
| 792 | - $productlink = get_permalink( $post_id ); |
|
| 792 | + $productlink = get_permalink($post_id); |
|
| 793 | 793 | |
| 794 | 794 | $user_login = ''; |
| 795 | - if ( $user_id > 0 && $user_info = get_userdata( $user_id ) ) {
|
|
| 795 | + if ($user_id > 0 && $user_info = get_userdata($user_id)) {
|
|
| 796 | 796 | $user_login = $user_info->user_login; |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | $posted_date = ''; |
| 800 | 800 | $listingLink = ''; |
| 801 | 801 | |
| 802 | - $post_info = get_post( $post_id ); |
|
| 802 | + $post_info = get_post($post_id); |
|
| 803 | 803 | |
| 804 | - if ( $post_info ) {
|
|
| 804 | + if ($post_info) {
|
|
| 805 | 805 | $posted_date = $post_info->post_date; |
| 806 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
| 806 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
| 807 | 807 | } |
| 808 | 808 | $siteurl = home_url(); |
| 809 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 809 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
| 810 | 810 | $loginurl = geodir_login_url(); |
| 811 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 811 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 812 | 812 | |
| 813 | - $post_author_id = ! empty( $post_info ) ? $post_info->post_author : 0; |
|
| 814 | - $post_author_name = geodir_get_client_name( $post_author_id ); |
|
| 815 | - $current_date = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); |
|
| 813 | + $post_author_id = !empty($post_info) ? $post_info->post_author : 0; |
|
| 814 | + $post_author_name = geodir_get_client_name($post_author_id); |
|
| 815 | + $current_date = date_i18n('Y-m-d H:i:s', current_time('timestamp'));
|
|
| 816 | 816 | |
| 817 | - if ( $fromEmail == '' ) {
|
|
| 818 | - $fromEmail = get_option( 'site_email' ); |
|
| 817 | + if ($fromEmail == '') {
|
|
| 818 | + $fromEmail = get_option('site_email');
|
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - if ( $fromEmailName == '' ) {
|
|
| 822 | - $fromEmailName = get_option( 'site_email_name' ); |
|
| 821 | + if ($fromEmailName == '') {
|
|
| 822 | + $fromEmailName = get_option('site_email_name');
|
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | - $search_array = array( |
|
| 825 | + $search_array = array( |
|
| 826 | 826 | '[#listing_link#]', |
| 827 | 827 | '[#site_name_url#]', |
| 828 | 828 | '[#post_id#]', |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | $post_author_name, |
| 863 | 863 | $current_date |
| 864 | 864 | ); |
| 865 | - $message = str_replace( $search_array, $replace_array, $message ); |
|
| 865 | + $message = str_replace($search_array, $replace_array, $message); |
|
| 866 | 866 | |
| 867 | 867 | $search_array = array( |
| 868 | 868 | '[#listing_link#]', |
@@ -898,12 +898,12 @@ discard block |
||
| 898 | 898 | $post_author_name, |
| 899 | 899 | $current_date |
| 900 | 900 | ); |
| 901 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
| 901 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
| 902 | 902 | |
| 903 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
| 904 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
| 905 | - $headers .= "Reply-To: " . $fromEmail . "\r\n"; |
|
| 906 | - $headers .= 'From: ' . $sitefromEmailName . ' <' . $sitefromEmail . '>' . "\r\n"; |
|
| 903 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
| 904 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
| 905 | + $headers .= "Reply-To: ".$fromEmail."\r\n"; |
|
| 906 | + $headers .= 'From: '.$sitefromEmailName.' <'.$sitefromEmail.'>'."\r\n"; |
|
| 907 | 907 | |
| 908 | 908 | $to = $toEmail; |
| 909 | 909 | |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | * @param string $post_id The post ID. |
| 926 | 926 | * @param string $user_id The user ID. |
| 927 | 927 | */ |
| 928 | - $to = apply_filters( 'geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
| 928 | + $to = apply_filters('geodir_sendEmail_to', $to, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 929 | 929 | /** |
| 930 | 930 | * Filter the client email subject. |
| 931 | 931 | * |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | * @param string $post_id The post ID. |
| 945 | 945 | * @param string $user_id The user ID. |
| 946 | 946 | */ |
| 947 | - $subject = apply_filters( 'geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
| 947 | + $subject = apply_filters('geodir_sendEmail_subject', $subject, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 948 | 948 | /** |
| 949 | 949 | * Filter the client email message. |
| 950 | 950 | * |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | * @param string $post_id The post ID. |
| 964 | 964 | * @param string $user_id The user ID. |
| 965 | 965 | */ |
| 966 | - $message = apply_filters( 'geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
| 966 | + $message = apply_filters('geodir_sendEmail_message', $message, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 967 | 967 | /** |
| 968 | 968 | * Filter the client email headers. |
| 969 | 969 | * |
@@ -982,39 +982,39 @@ discard block |
||
| 982 | 982 | * @param string $post_id The post ID. |
| 983 | 983 | * @param string $user_id The user ID. |
| 984 | 984 | */ |
| 985 | - $headers = apply_filters( 'geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id ); |
|
| 985 | + $headers = apply_filters('geodir_sendEmail_headers', $headers, $fromEmail, $fromEmailName, $toEmail, $toEmailName, $to_subject, $to_message, $extra, $message_type, $post_id, $user_id);
|
|
| 986 | 986 | |
| 987 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
| 987 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
| 988 | 988 | |
| 989 | - if ( ! $sent ) {
|
|
| 990 | - if ( is_array( $to ) ) {
|
|
| 991 | - $to = implode( ',', $to ); |
|
| 989 | + if (!$sent) {
|
|
| 990 | + if (is_array($to)) {
|
|
| 991 | + $to = implode(',', $to);
|
|
| 992 | 992 | } |
| 993 | 993 | $log_message = sprintf( |
| 994 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 994 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 995 | 995 | $message_type, |
| 996 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 996 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 997 | 997 | $to, |
| 998 | 998 | $subject |
| 999 | 999 | ); |
| 1000 | - geodir_error_log( $log_message ); |
|
| 1000 | + geodir_error_log($log_message); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | ///////// ADMIN BCC EMIALS |
| 1004 | - $adminEmail = get_bloginfo( 'admin_email' ); |
|
| 1004 | + $adminEmail = get_bloginfo('admin_email');
|
|
| 1005 | 1005 | $to = $adminEmail; |
| 1006 | 1006 | |
| 1007 | 1007 | $admin_bcc = false; |
| 1008 | - if ( $message_type == 'registration' ) {
|
|
| 1009 | - $message_raw = explode( __( "Password:", 'geodirectory' ), $message ); |
|
| 1010 | - $message_raw2 = explode( "</p>", $message_raw[1], 2 ); |
|
| 1011 | - $message = $message_raw[0] . __( 'Password:', 'geodirectory' ) . ' **********</p>' . $message_raw2[1]; |
|
| 1008 | + if ($message_type == 'registration') {
|
|
| 1009 | + $message_raw = explode(__("Password:", 'geodirectory'), $message);
|
|
| 1010 | + $message_raw2 = explode("</p>", $message_raw[1], 2);
|
|
| 1011 | + $message = $message_raw[0].__('Password:', 'geodirectory').' **********</p>'.$message_raw2[1];
|
|
| 1012 | 1012 | } |
| 1013 | - if ( $message_type == 'post_submit' ) {
|
|
| 1014 | - $subject = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_subject_admin' ) ), 'geodirectory' ); |
|
| 1015 | - $message = __( stripslashes_deep( get_option( 'geodir_post_submited_success_email_content_admin' ) ), 'geodirectory' ); |
|
| 1013 | + if ($message_type == 'post_submit') {
|
|
| 1014 | + $subject = __(stripslashes_deep(get_option('geodir_post_submited_success_email_subject_admin')), 'geodirectory');
|
|
| 1015 | + $message = __(stripslashes_deep(get_option('geodir_post_submited_success_email_content_admin')), 'geodirectory');
|
|
| 1016 | 1016 | |
| 1017 | - $search_array = array( |
|
| 1017 | + $search_array = array( |
|
| 1018 | 1018 | '[#listing_link#]', |
| 1019 | 1019 | '[#site_name_url#]', |
| 1020 | 1020 | '[#post_id#]', |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | $user_login, |
| 1047 | 1047 | $user_login |
| 1048 | 1048 | ); |
| 1049 | - $message = str_replace( $search_array, $replace_array, $message ); |
|
| 1049 | + $message = str_replace($search_array, $replace_array, $message); |
|
| 1050 | 1050 | |
| 1051 | 1051 | $search_array = array( |
| 1052 | 1052 | '[#listing_link#]', |
@@ -1074,40 +1074,40 @@ discard block |
||
| 1074 | 1074 | $user_login, |
| 1075 | 1075 | $user_login |
| 1076 | 1076 | ); |
| 1077 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
| 1077 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
| 1078 | 1078 | |
| 1079 | 1079 | $subject .= ' - ADMIN BCC COPY'; |
| 1080 | 1080 | $admin_bcc = true; |
| 1081 | 1081 | |
| 1082 | - } elseif ( $message_type == 'registration' && get_option( 'geodir_bcc_new_user' ) ) {
|
|
| 1082 | + } elseif ($message_type == 'registration' && get_option('geodir_bcc_new_user')) {
|
|
| 1083 | 1083 | $subject .= ' - ADMIN BCC COPY'; |
| 1084 | 1084 | $admin_bcc = true; |
| 1085 | - } elseif ( $message_type == 'send_friend' && get_option( 'geodir_bcc_friend' ) ) {
|
|
| 1085 | + } elseif ($message_type == 'send_friend' && get_option('geodir_bcc_friend')) {
|
|
| 1086 | 1086 | $subject .= ' - ADMIN BCC COPY'; |
| 1087 | 1087 | $admin_bcc = true; |
| 1088 | - } elseif ( $message_type == 'send_enquiry' && get_option( 'geodir_bcc_enquiry' ) ) {
|
|
| 1088 | + } elseif ($message_type == 'send_enquiry' && get_option('geodir_bcc_enquiry')) {
|
|
| 1089 | 1089 | $subject .= ' - ADMIN BCC COPY'; |
| 1090 | 1090 | $admin_bcc = true; |
| 1091 | - } elseif ( $message_type == 'listing_published' && get_option( 'geodir_bcc_listing_published' ) ) {
|
|
| 1091 | + } elseif ($message_type == 'listing_published' && get_option('geodir_bcc_listing_published')) {
|
|
| 1092 | 1092 | $subject .= ' - ADMIN BCC COPY'; |
| 1093 | 1093 | $admin_bcc = true; |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | - if ( $admin_bcc === true ) {
|
|
| 1097 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
| 1096 | + if ($admin_bcc === true) {
|
|
| 1097 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
| 1098 | 1098 | |
| 1099 | - if ( ! $sent ) {
|
|
| 1100 | - if ( is_array( $to ) ) {
|
|
| 1101 | - $to = implode( ',', $to ); |
|
| 1099 | + if (!$sent) {
|
|
| 1100 | + if (is_array($to)) {
|
|
| 1101 | + $to = implode(',', $to);
|
|
| 1102 | 1102 | } |
| 1103 | 1103 | $log_message = sprintf( |
| 1104 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 1104 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 1105 | 1105 | $message_type, |
| 1106 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 1106 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 1107 | 1107 | $to, |
| 1108 | 1108 | $subject |
| 1109 | 1109 | ); |
| 1110 | - geodir_error_log( $log_message ); |
|
| 1110 | + geodir_error_log($log_message); |
|
| 1111 | 1111 | } |
| 1112 | 1112 | } |
| 1113 | 1113 | |
@@ -1123,58 +1123,58 @@ discard block |
||
| 1123 | 1123 | */ |
| 1124 | 1124 | function geodir_taxonomy_breadcrumb() {
|
| 1125 | 1125 | |
| 1126 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 1126 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
|
|
| 1127 | 1127 | $parent = $term->parent; |
| 1128 | 1128 | |
| 1129 | - while ( $parent ): |
|
| 1129 | + while ($parent): |
|
| 1130 | 1130 | $parents[] = $parent; |
| 1131 | - $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) ); |
|
| 1131 | + $new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
|
|
| 1132 | 1132 | $parent = $new_parent->parent; |
| 1133 | 1133 | endwhile; |
| 1134 | 1134 | |
| 1135 | - if ( ! empty( $parents ) ): |
|
| 1136 | - $parents = array_reverse( $parents ); |
|
| 1135 | + if (!empty($parents)): |
|
| 1136 | + $parents = array_reverse($parents); |
|
| 1137 | 1137 | |
| 1138 | - foreach ( $parents as $parent ): |
|
| 1139 | - $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) ); |
|
| 1140 | - $url = get_term_link( $item, get_query_var( 'taxonomy' ) ); |
|
| 1141 | - echo '<li> > <a href="' . $url . '">' . $item->name . '</a></li>'; |
|
| 1138 | + foreach ($parents as $parent): |
|
| 1139 | + $item = get_term_by('id', $parent, get_query_var('taxonomy'));
|
|
| 1140 | + $url = get_term_link($item, get_query_var('taxonomy'));
|
|
| 1141 | + echo '<li> > <a href="'.$url.'">'.$item->name.'</a></li>'; |
|
| 1142 | 1142 | endforeach; |
| 1143 | 1143 | |
| 1144 | 1144 | endif; |
| 1145 | 1145 | |
| 1146 | - echo '<li> > ' . $term->name . '</li>'; |
|
| 1146 | + echo '<li> > '.$term->name.'</li>'; |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | -function geodir_wpml_post_type_archive_link($link, $post_type){
|
|
| 1149 | +function geodir_wpml_post_type_archive_link($link, $post_type) {
|
|
| 1150 | 1150 | |
| 1151 | - if(function_exists('icl_object_id')) {
|
|
| 1152 | - $post_types = get_option( 'geodir_post_types' ); |
|
| 1153 | - $slug = $post_types[ $post_type ]['rewrite']['slug']; |
|
| 1151 | + if (function_exists('icl_object_id')) {
|
|
| 1152 | + $post_types = get_option('geodir_post_types');
|
|
| 1153 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1154 | 1154 | |
| 1155 | - echo $link.'###'.gd_wpml_get_lang_from_url( $link) ; |
|
| 1155 | + echo $link.'###'.gd_wpml_get_lang_from_url($link); |
|
| 1156 | 1156 | |
| 1157 | 1157 | // Alter the CPT slug if WPML is set to do so |
| 1158 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 1159 | - if ( gd_wpml_slug_translation_turned_on( $post_type ) && $language_code = gd_wpml_get_lang_from_url( $link) ) {
|
|
| 1158 | + if (function_exists('icl_object_id')) {
|
|
| 1159 | + if (gd_wpml_slug_translation_turned_on($post_type) && $language_code = gd_wpml_get_lang_from_url($link)) {
|
|
| 1160 | 1160 | |
| 1161 | 1161 | $org_slug = $slug; |
| 1162 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1162 | + $slug = apply_filters('wpml_translate_single_string',
|
|
| 1163 | 1163 | $slug, |
| 1164 | 1164 | 'WordPress', |
| 1165 | - 'URL slug: ' . $slug, |
|
| 1166 | - $language_code ); |
|
| 1165 | + 'URL slug: '.$slug, |
|
| 1166 | + $language_code); |
|
| 1167 | 1167 | |
| 1168 | - if ( ! $slug ) {
|
|
| 1168 | + if (!$slug) {
|
|
| 1169 | 1169 | $slug = $org_slug; |
| 1170 | 1170 | } else {
|
| 1171 | - $link = str_replace( $org_slug, $slug, $link ); |
|
| 1171 | + $link = str_replace($org_slug, $slug, $link); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | } |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | - echo $link.'####'.gd_wpml_get_lang_from_url( $link) ; |
|
| 1177 | + echo $link.'####'.gd_wpml_get_lang_from_url($link); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | return $link; |
@@ -1199,9 +1199,9 @@ discard block |
||
| 1199 | 1199 | * |
| 1200 | 1200 | * @since 1.0.0 |
| 1201 | 1201 | */ |
| 1202 | - $separator = apply_filters( 'geodir_breadcrumb_separator', ' > ' ); |
|
| 1202 | + $separator = apply_filters('geodir_breadcrumb_separator', ' > ');
|
|
| 1203 | 1203 | |
| 1204 | - if ( ! geodir_is_page( 'home' ) ) {
|
|
| 1204 | + if (!geodir_is_page('home')) {
|
|
| 1205 | 1205 | $breadcrumb = ''; |
| 1206 | 1206 | $url_categoris = ''; |
| 1207 | 1207 | $breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">'; |
@@ -1210,162 +1210,162 @@ discard block |
||
| 1210 | 1210 | * |
| 1211 | 1211 | * @since 1.0.0 |
| 1212 | 1212 | */ |
| 1213 | - $breadcrumb .= '<li>' . apply_filters( 'geodir_breadcrumb_first_link', '<a href="' . home_url() . '">' . __( 'Home', 'geodirectory' ) . '</a>' ) . '</li>'; |
|
| 1213 | + $breadcrumb .= '<li>'.apply_filters('geodir_breadcrumb_first_link', '<a href="'.home_url().'">'.__('Home', 'geodirectory').'</a>').'</li>';
|
|
| 1214 | 1214 | |
| 1215 | 1215 | $gd_post_type = geodir_get_current_posttype(); |
| 1216 | - $post_type_info = get_post_type_object( $gd_post_type ); |
|
| 1216 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 1217 | 1217 | |
| 1218 | - remove_filter( 'post_type_archive_link', 'geodir_get_posttype_link' ); |
|
| 1218 | + remove_filter('post_type_archive_link', 'geodir_get_posttype_link');
|
|
| 1219 | 1219 | |
| 1220 | - $listing_link = get_post_type_archive_link( $gd_post_type ); |
|
| 1220 | + $listing_link = get_post_type_archive_link($gd_post_type); |
|
| 1221 | 1221 | |
| 1222 | - add_filter( 'post_type_archive_link', 'geodir_get_posttype_link', 10, 2 ); |
|
| 1223 | - $listing_link = rtrim( $listing_link, '/' ); |
|
| 1222 | + add_filter('post_type_archive_link', 'geodir_get_posttype_link', 10, 2);
|
|
| 1223 | + $listing_link = rtrim($listing_link, '/'); |
|
| 1224 | 1224 | $listing_link .= '/'; |
| 1225 | 1225 | |
| 1226 | 1226 | $post_type_for_location_link = $listing_link; |
| 1227 | - $location_terms = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
| 1227 | + $location_terms = geodir_get_current_location_terms('query_vars', $gd_post_type);
|
|
| 1228 | 1228 | |
| 1229 | 1229 | global $wp, $gd_session; |
| 1230 | 1230 | $location_link = $post_type_for_location_link; |
| 1231 | 1231 | |
| 1232 | - if ( geodir_is_page( 'detail' ) || geodir_is_page( 'listing' ) ) {
|
|
| 1232 | + if (geodir_is_page('detail') || geodir_is_page('listing')) {
|
|
| 1233 | 1233 | global $post; |
| 1234 | - $location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false; |
|
| 1235 | - $neighbourhood_active = $location_manager && get_option( 'location_neighbourhoods' ) ? true : false; |
|
| 1234 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1235 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1236 | 1236 | |
| 1237 | - if ( geodir_is_page( 'detail' ) && isset( $post->country_slug ) ) {
|
|
| 1237 | + if (geodir_is_page('detail') && isset($post->country_slug)) {
|
|
| 1238 | 1238 | $location_terms = array( |
| 1239 | 1239 | 'gd_country' => $post->country_slug, |
| 1240 | 1240 | 'gd_region' => $post->region_slug, |
| 1241 | 1241 | 'gd_city' => $post->city_slug |
| 1242 | 1242 | ); |
| 1243 | 1243 | |
| 1244 | - if ( $neighbourhood_active && ! empty( $location_terms['gd_city'] ) && $gd_ses_neighbourhood = $gd_session->get( 'gd_neighbourhood' ) ) {
|
|
| 1244 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1245 | 1245 | $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
| 1249 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1250 | 1250 | |
| 1251 | 1251 | $hide_url_part = array(); |
| 1252 | - if ( $location_manager ) {
|
|
| 1253 | - $hide_country_part = get_option( 'geodir_location_hide_country_part' ); |
|
| 1254 | - $hide_region_part = get_option( 'geodir_location_hide_region_part' ); |
|
| 1255 | - |
|
| 1256 | - if ( $hide_region_part && $hide_country_part ) {
|
|
| 1257 | - $hide_url_part = array( 'gd_country', 'gd_region' ); |
|
| 1258 | - } else if ( $hide_region_part && ! $hide_country_part ) {
|
|
| 1259 | - $hide_url_part = array( 'gd_region' ); |
|
| 1260 | - } else if ( ! $hide_region_part && $hide_country_part ) {
|
|
| 1261 | - $hide_url_part = array( 'gd_country' ); |
|
| 1252 | + if ($location_manager) {
|
|
| 1253 | + $hide_country_part = get_option('geodir_location_hide_country_part');
|
|
| 1254 | + $hide_region_part = get_option('geodir_location_hide_region_part');
|
|
| 1255 | + |
|
| 1256 | + if ($hide_region_part && $hide_country_part) {
|
|
| 1257 | + $hide_url_part = array('gd_country', 'gd_region');
|
|
| 1258 | + } else if ($hide_region_part && !$hide_country_part) {
|
|
| 1259 | + $hide_url_part = array('gd_region');
|
|
| 1260 | + } else if (!$hide_region_part && $hide_country_part) {
|
|
| 1261 | + $hide_url_part = array('gd_country');
|
|
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | $hide_text_part = array(); |
| 1266 | - if ( $geodir_show_location_url == 'country_city' ) {
|
|
| 1267 | - $hide_text_part = array( 'gd_region' ); |
|
| 1266 | + if ($geodir_show_location_url == 'country_city') {
|
|
| 1267 | + $hide_text_part = array('gd_region');
|
|
| 1268 | 1268 | |
| 1269 | - if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
|
|
| 1270 | - unset( $location_terms['gd_region'] ); |
|
| 1269 | + if (isset($location_terms['gd_region']) && !$location_manager) {
|
|
| 1270 | + unset($location_terms['gd_region']); |
|
| 1271 | 1271 | } |
| 1272 | - } else if ( $geodir_show_location_url == 'region_city' ) {
|
|
| 1273 | - $hide_text_part = array( 'gd_country' ); |
|
| 1272 | + } else if ($geodir_show_location_url == 'region_city') {
|
|
| 1273 | + $hide_text_part = array('gd_country');
|
|
| 1274 | 1274 | |
| 1275 | - if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
|
|
| 1276 | - unset( $location_terms['gd_country'] ); |
|
| 1275 | + if (isset($location_terms['gd_country']) && !$location_manager) {
|
|
| 1276 | + unset($location_terms['gd_country']); |
|
| 1277 | 1277 | } |
| 1278 | - } else if ( $geodir_show_location_url == 'city' ) {
|
|
| 1279 | - $hide_text_part = array( 'gd_country', 'gd_region' ); |
|
| 1278 | + } else if ($geodir_show_location_url == 'city') {
|
|
| 1279 | + $hide_text_part = array('gd_country', 'gd_region');
|
|
| 1280 | 1280 | |
| 1281 | - if ( isset( $location_terms['gd_country'] ) && ! $location_manager ) {
|
|
| 1282 | - unset( $location_terms['gd_country'] ); |
|
| 1281 | + if (isset($location_terms['gd_country']) && !$location_manager) {
|
|
| 1282 | + unset($location_terms['gd_country']); |
|
| 1283 | 1283 | } |
| 1284 | - if ( isset( $location_terms['gd_region'] ) && ! $location_manager ) {
|
|
| 1285 | - unset( $location_terms['gd_region'] ); |
|
| 1284 | + if (isset($location_terms['gd_region']) && !$location_manager) {
|
|
| 1285 | + unset($location_terms['gd_region']); |
|
| 1286 | 1286 | } |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | $is_location_last = ''; |
| 1290 | 1290 | $is_taxonomy_last = ''; |
| 1291 | 1291 | $breadcrumb .= '<li>'; |
| 1292 | - if ( get_query_var( $gd_post_type . 'category' ) ) {
|
|
| 1293 | - $gd_taxonomy = $gd_post_type . 'category'; |
|
| 1294 | - } elseif ( get_query_var( $gd_post_type . '_tags' ) ) {
|
|
| 1295 | - $gd_taxonomy = $gd_post_type . '_tags'; |
|
| 1292 | + if (get_query_var($gd_post_type.'category')) {
|
|
| 1293 | + $gd_taxonomy = $gd_post_type.'category'; |
|
| 1294 | + } elseif (get_query_var($gd_post_type.'_tags')) {
|
|
| 1295 | + $gd_taxonomy = $gd_post_type.'_tags'; |
|
| 1296 | 1296 | } |
| 1297 | 1297 | |
| 1298 | - $breadcrumb .= $separator . '<a href="' . $listing_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>'; |
|
| 1299 | - if ( ! empty( $gd_taxonomy ) || geodir_is_page( 'detail' ) ) {
|
|
| 1298 | + $breadcrumb .= $separator.'<a href="'.$listing_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
| 1299 | + if (!empty($gd_taxonomy) || geodir_is_page('detail')) {
|
|
| 1300 | 1300 | $is_location_last = false; |
| 1301 | 1301 | } else {
|
| 1302 | 1302 | $is_location_last = true; |
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | - if ( ! empty( $gd_taxonomy ) && geodir_is_page( 'listing' ) ) {
|
|
| 1305 | + if (!empty($gd_taxonomy) && geodir_is_page('listing')) {
|
|
| 1306 | 1306 | $is_taxonomy_last = true; |
| 1307 | 1307 | } else {
|
| 1308 | 1308 | $is_taxonomy_last = false; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - if ( ! empty( $location_terms ) ) {
|
|
| 1312 | - $geodir_get_locations = function_exists( 'get_actual_location_name' ) ? true : false; |
|
| 1311 | + if (!empty($location_terms)) {
|
|
| 1312 | + $geodir_get_locations = function_exists('get_actual_location_name') ? true : false;
|
|
| 1313 | 1313 | |
| 1314 | - foreach ( $location_terms as $key => $location_term ) {
|
|
| 1315 | - if ( $location_term != '' ) {
|
|
| 1316 | - if ( ! empty( $hide_url_part ) && in_array( $key, $hide_url_part ) ) { // Hide location part from url & breadcrumb.
|
|
| 1314 | + foreach ($location_terms as $key => $location_term) {
|
|
| 1315 | + if ($location_term != '') {
|
|
| 1316 | + if (!empty($hide_url_part) && in_array($key, $hide_url_part)) { // Hide location part from url & breadcrumb.
|
|
| 1317 | 1317 | continue; |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location_term ); |
|
| 1321 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
| 1322 | - $gd_location_link_text = ucfirst( $gd_location_link_text ); |
|
| 1320 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location_term);
|
|
| 1321 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
|
|
| 1322 | + $gd_location_link_text = ucfirst($gd_location_link_text); |
|
| 1323 | 1323 | |
| 1324 | 1324 | $location_term_actual_country = ''; |
| 1325 | 1325 | $location_term_actual_region = ''; |
| 1326 | 1326 | $location_term_actual_city = ''; |
| 1327 | - if ( $geodir_get_locations ) {
|
|
| 1328 | - if ( $key == 'gd_country' ) {
|
|
| 1329 | - $location_term_actual_country = get_actual_location_name( 'country', $location_term, true ); |
|
| 1330 | - } else if ( $key == 'gd_region' ) {
|
|
| 1331 | - $location_term_actual_region = get_actual_location_name( 'region', $location_term, true ); |
|
| 1332 | - } else if ( $key == 'gd_city' ) {
|
|
| 1333 | - $location_term_actual_city = get_actual_location_name( 'city', $location_term, true ); |
|
| 1327 | + if ($geodir_get_locations) {
|
|
| 1328 | + if ($key == 'gd_country') {
|
|
| 1329 | + $location_term_actual_country = get_actual_location_name('country', $location_term, true);
|
|
| 1330 | + } else if ($key == 'gd_region') {
|
|
| 1331 | + $location_term_actual_region = get_actual_location_name('region', $location_term, true);
|
|
| 1332 | + } else if ($key == 'gd_city') {
|
|
| 1333 | + $location_term_actual_city = get_actual_location_name('city', $location_term, true);
|
|
| 1334 | 1334 | } |
| 1335 | 1335 | } else {
|
| 1336 | 1336 | $location_info = geodir_get_location(); |
| 1337 | 1337 | |
| 1338 | - if ( ! empty( $location_info ) && isset( $location_info->location_id ) ) {
|
|
| 1339 | - if ( $key == 'gd_country' ) {
|
|
| 1340 | - $location_term_actual_country = __( $location_info->country, 'geodirectory' ); |
|
| 1341 | - } else if ( $key == 'gd_region' ) {
|
|
| 1342 | - $location_term_actual_region = __( $location_info->region, 'geodirectory' ); |
|
| 1343 | - } else if ( $key == 'gd_city' ) {
|
|
| 1344 | - $location_term_actual_city = __( $location_info->city, 'geodirectory' ); |
|
| 1338 | + if (!empty($location_info) && isset($location_info->location_id)) {
|
|
| 1339 | + if ($key == 'gd_country') {
|
|
| 1340 | + $location_term_actual_country = __($location_info->country, 'geodirectory'); |
|
| 1341 | + } else if ($key == 'gd_region') {
|
|
| 1342 | + $location_term_actual_region = __($location_info->region, 'geodirectory'); |
|
| 1343 | + } else if ($key == 'gd_city') {
|
|
| 1344 | + $location_term_actual_city = __($location_info->city, 'geodirectory'); |
|
| 1345 | 1345 | } |
| 1346 | 1346 | } |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | - if ( $is_location_last && $key == 'gd_country' && ! ( isset( $location_terms['gd_region'] ) && $location_terms['gd_region'] != '' ) && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
|
|
| 1350 | - $breadcrumb .= $location_term_actual_country != '' ? $separator . $location_term_actual_country : $separator . $gd_location_link_text; |
|
| 1351 | - } else if ( $is_location_last && $key == 'gd_region' && ! ( isset( $location_terms['gd_city'] ) && $location_terms['gd_city'] != '' ) ) {
|
|
| 1352 | - $breadcrumb .= $location_term_actual_region != '' ? $separator . $location_term_actual_region : $separator . $gd_location_link_text; |
|
| 1353 | - } else if ( $is_location_last && $key == 'gd_city' && empty( $location_terms['gd_neighbourhood'] ) ) {
|
|
| 1354 | - $breadcrumb .= $location_term_actual_city != '' ? $separator . $location_term_actual_city : $separator . $gd_location_link_text; |
|
| 1355 | - } else if ( $is_location_last && $key == 'gd_neighbourhood' ) {
|
|
| 1356 | - $breadcrumb .= $separator . $gd_location_link_text; |
|
| 1349 | + if ($is_location_last && $key == 'gd_country' && !(isset($location_terms['gd_region']) && $location_terms['gd_region'] != '') && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
|
|
| 1350 | + $breadcrumb .= $location_term_actual_country != '' ? $separator.$location_term_actual_country : $separator.$gd_location_link_text; |
|
| 1351 | + } else if ($is_location_last && $key == 'gd_region' && !(isset($location_terms['gd_city']) && $location_terms['gd_city'] != '')) {
|
|
| 1352 | + $breadcrumb .= $location_term_actual_region != '' ? $separator.$location_term_actual_region : $separator.$gd_location_link_text; |
|
| 1353 | + } else if ($is_location_last && $key == 'gd_city' && empty($location_terms['gd_neighbourhood'])) {
|
|
| 1354 | + $breadcrumb .= $location_term_actual_city != '' ? $separator.$location_term_actual_city : $separator.$gd_location_link_text; |
|
| 1355 | + } else if ($is_location_last && $key == 'gd_neighbourhood') {
|
|
| 1356 | + $breadcrumb .= $separator.$gd_location_link_text; |
|
| 1357 | 1357 | } else {
|
| 1358 | - if ( get_option( 'permalink_structure' ) != '' ) {
|
|
| 1359 | - $location_link .= $location_term . '/'; |
|
| 1358 | + if (get_option('permalink_structure') != '') {
|
|
| 1359 | + $location_link .= $location_term.'/'; |
|
| 1360 | 1360 | } else {
|
| 1361 | - $location_link .= "&$key=" . $location_term; |
|
| 1361 | + $location_link .= "&$key=".$location_term; |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | - if ( $key == 'gd_country' && $location_term_actual_country != '' ) {
|
|
| 1364 | + if ($key == 'gd_country' && $location_term_actual_country != '') {
|
|
| 1365 | 1365 | $gd_location_link_text = $location_term_actual_country; |
| 1366 | - } else if ( $key == 'gd_region' && $location_term_actual_region != '' ) {
|
|
| 1366 | + } else if ($key == 'gd_region' && $location_term_actual_region != '') {
|
|
| 1367 | 1367 | $gd_location_link_text = $location_term_actual_region; |
| 1368 | - } else if ( $key == 'gd_city' && $location_term_actual_city != '' ) {
|
|
| 1368 | + } else if ($key == 'gd_city' && $location_term_actual_city != '') {
|
|
| 1369 | 1369 | $gd_location_link_text = $location_term_actual_city; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
@@ -1375,76 +1375,76 @@ discard block |
||
| 1375 | 1375 | } |
| 1376 | 1376 | */ |
| 1377 | 1377 | |
| 1378 | - $breadcrumb .= $separator . '<a href="' . $location_link . '">' . $gd_location_link_text . '</a>'; |
|
| 1378 | + $breadcrumb .= $separator.'<a href="'.$location_link.'">'.$gd_location_link_text.'</a>'; |
|
| 1379 | 1379 | } |
| 1380 | 1380 | } |
| 1381 | 1381 | } |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | - if ( ! empty( $gd_taxonomy ) ) {
|
|
| 1384 | + if (!empty($gd_taxonomy)) {
|
|
| 1385 | 1385 | $term_index = 1; |
| 1386 | 1386 | |
| 1387 | 1387 | //if(get_option('geodir_add_categories_url'))
|
| 1388 | 1388 | {
|
| 1389 | - if ( get_query_var( $gd_post_type . '_tags' ) ) {
|
|
| 1390 | - $cat_link = $listing_link . 'tags/'; |
|
| 1389 | + if (get_query_var($gd_post_type.'_tags')) {
|
|
| 1390 | + $cat_link = $listing_link.'tags/'; |
|
| 1391 | 1391 | } else {
|
| 1392 | 1392 | $cat_link = $listing_link; |
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | - foreach ( $location_terms as $key => $location_term ) {
|
|
| 1396 | - if ( $location_manager && in_array( $key, $hide_url_part ) ) {
|
|
| 1395 | + foreach ($location_terms as $key => $location_term) {
|
|
| 1396 | + if ($location_manager && in_array($key, $hide_url_part)) {
|
|
| 1397 | 1397 | continue; |
| 1398 | 1398 | } |
| 1399 | 1399 | |
| 1400 | - if ( $location_term != '' ) {
|
|
| 1401 | - if ( get_option( 'permalink_structure' ) != '' ) {
|
|
| 1402 | - $cat_link .= $location_term . '/'; |
|
| 1400 | + if ($location_term != '') {
|
|
| 1401 | + if (get_option('permalink_structure') != '') {
|
|
| 1402 | + $cat_link .= $location_term.'/'; |
|
| 1403 | 1403 | } |
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | - $term_array = explode( "/", trim( $wp_query->query[ $gd_taxonomy ], "/" ) ); |
|
| 1408 | - foreach ( $term_array as $term ) {
|
|
| 1409 | - $term_link_text = preg_replace( '/-(\d+)$/', '', $term ); |
|
| 1410 | - $term_link_text = preg_replace( '/[_-]/', ' ', $term_link_text ); |
|
| 1407 | + $term_array = explode("/", trim($wp_query->query[$gd_taxonomy], "/"));
|
|
| 1408 | + foreach ($term_array as $term) {
|
|
| 1409 | + $term_link_text = preg_replace('/-(\d+)$/', '', $term);
|
|
| 1410 | + $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
|
|
| 1411 | 1411 | |
| 1412 | 1412 | // get term actual name |
| 1413 | - $term_info = get_term_by( 'slug', $term, $gd_taxonomy, 'ARRAY_A' ); |
|
| 1414 | - if ( ! empty( $term_info ) && isset( $term_info['name'] ) && $term_info['name'] != '' ) {
|
|
| 1415 | - $term_link_text = urldecode( $term_info['name'] ); |
|
| 1413 | + $term_info = get_term_by('slug', $term, $gd_taxonomy, 'ARRAY_A');
|
|
| 1414 | + if (!empty($term_info) && isset($term_info['name']) && $term_info['name'] != '') {
|
|
| 1415 | + $term_link_text = urldecode($term_info['name']); |
|
| 1416 | 1416 | } else {
|
| 1417 | 1417 | continue; |
| 1418 | 1418 | //$term_link_text = wp_strip_all_tags(geodir_ucwords(urldecode($term_link_text))); |
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | - if ( $term_index == count( $term_array ) && $is_taxonomy_last ) {
|
|
| 1422 | - $breadcrumb .= $separator . $term_link_text; |
|
| 1421 | + if ($term_index == count($term_array) && $is_taxonomy_last) {
|
|
| 1422 | + $breadcrumb .= $separator.$term_link_text; |
|
| 1423 | 1423 | } else {
|
| 1424 | - $cat_link .= $term . '/'; |
|
| 1425 | - $breadcrumb .= $separator . '<a href="' . $cat_link . '">' . $term_link_text . '</a>'; |
|
| 1424 | + $cat_link .= $term.'/'; |
|
| 1425 | + $breadcrumb .= $separator.'<a href="'.$cat_link.'">'.$term_link_text.'</a>'; |
|
| 1426 | 1426 | } |
| 1427 | - $term_index ++; |
|
| 1427 | + $term_index++; |
|
| 1428 | 1428 | } |
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | 1431 | |
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 1435 | - $breadcrumb .= $separator . get_the_title(); |
|
| 1434 | + if (geodir_is_page('detail')) {
|
|
| 1435 | + $breadcrumb .= $separator.get_the_title(); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | $breadcrumb .= '</li>'; |
| 1439 | 1439 | |
| 1440 | 1440 | |
| 1441 | - } elseif ( geodir_is_page( 'author' ) ) {
|
|
| 1441 | + } elseif (geodir_is_page('author')) {
|
|
| 1442 | 1442 | $user_id = get_current_user_id(); |
| 1443 | - $author_link = get_author_posts_url( $user_id ); |
|
| 1444 | - $default_author_link = geodir_getlink( $author_link, array( |
|
| 1443 | + $author_link = get_author_posts_url($user_id); |
|
| 1444 | + $default_author_link = geodir_getlink($author_link, array( |
|
| 1445 | 1445 | 'geodir_dashbord' => 'true', |
| 1446 | 1446 | 'stype' => 'gd_place' |
| 1447 | - ), false ); |
|
| 1447 | + ), false); |
|
| 1448 | 1448 | |
| 1449 | 1449 | /** |
| 1450 | 1450 | * Filter author page link. |
@@ -1454,16 +1454,16 @@ discard block |
||
| 1454 | 1454 | * @param string $default_author_link Default author link. |
| 1455 | 1455 | * @param int $user_id Author ID. |
| 1456 | 1456 | */ |
| 1457 | - $default_author_link = apply_filters( 'geodir_dashboard_author_link', $default_author_link, $user_id ); |
|
| 1457 | + $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_id);
|
|
| 1458 | 1458 | |
| 1459 | 1459 | $breadcrumb .= '<li>'; |
| 1460 | - $breadcrumb .= $separator . '<a href="' . $default_author_link . '">' . __( 'My Dashboard', 'geodirectory' ) . '</a>'; |
|
| 1460 | + $breadcrumb .= $separator.'<a href="'.$default_author_link.'">'.__('My Dashboard', 'geodirectory').'</a>';
|
|
| 1461 | 1461 | |
| 1462 | - if ( isset( $_REQUEST['list'] ) ) {
|
|
| 1463 | - $author_link = geodir_getlink( $author_link, array( |
|
| 1462 | + if (isset($_REQUEST['list'])) {
|
|
| 1463 | + $author_link = geodir_getlink($author_link, array( |
|
| 1464 | 1464 | 'geodir_dashbord' => 'true', |
| 1465 | 1465 | 'stype' => $_REQUEST['stype'] |
| 1466 | - ), false ); |
|
| 1466 | + ), false); |
|
| 1467 | 1467 | |
| 1468 | 1468 | /** |
| 1469 | 1469 | * Filter author page link. |
@@ -1474,61 +1474,61 @@ discard block |
||
| 1474 | 1474 | * @param int $user_id Author ID. |
| 1475 | 1475 | * @param string $_REQUEST ['stype'] Post type. |
| 1476 | 1476 | */ |
| 1477 | - $author_link = apply_filters( 'geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype'] ); |
|
| 1477 | + $author_link = apply_filters('geodir_dashboard_author_link', $author_link, $user_id, $_REQUEST['stype']);
|
|
| 1478 | 1478 | |
| 1479 | - $breadcrumb .= $separator . '<a href="' . $author_link . '">' . __( ucfirst( $post_type_info->label ), 'geodirectory' ) . '</a>'; |
|
| 1480 | - $breadcrumb .= $separator . ucfirst( __( 'My', 'geodirectory' ) . ' ' . $_REQUEST['list'] ); |
|
| 1479 | + $breadcrumb .= $separator.'<a href="'.$author_link.'">'.__(ucfirst($post_type_info->label), 'geodirectory').'</a>'; |
|
| 1480 | + $breadcrumb .= $separator.ucfirst(__('My', 'geodirectory').' '.$_REQUEST['list']);
|
|
| 1481 | 1481 | } else {
|
| 1482 | - $breadcrumb .= $separator . __( ucfirst( $post_type_info->label ), 'geodirectory' ); |
|
| 1482 | + $breadcrumb .= $separator.__(ucfirst($post_type_info->label), 'geodirectory'); |
|
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | 1485 | $breadcrumb .= '</li>'; |
| 1486 | - } elseif ( is_category() || is_single() ) {
|
|
| 1486 | + } elseif (is_category() || is_single()) {
|
|
| 1487 | 1487 | $category = get_the_category(); |
| 1488 | - if ( is_category() ) {
|
|
| 1489 | - $breadcrumb .= '<li>' . $separator . $category[0]->cat_name . '</li>'; |
|
| 1488 | + if (is_category()) {
|
|
| 1489 | + $breadcrumb .= '<li>'.$separator.$category[0]->cat_name.'</li>'; |
|
| 1490 | 1490 | } |
| 1491 | - if ( is_single() ) {
|
|
| 1492 | - $breadcrumb .= '<li>' . $separator . '<a href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . '</a></li>'; |
|
| 1493 | - $breadcrumb .= '<li>' . $separator . get_the_title() . '</li>'; |
|
| 1491 | + if (is_single()) {
|
|
| 1492 | + $breadcrumb .= '<li>'.$separator.'<a href="'.get_category_link($category[0]->term_id).'">'.$category[0]->cat_name.'</a></li>'; |
|
| 1493 | + $breadcrumb .= '<li>'.$separator.get_the_title().'</li>'; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | /* End of my version ##################################################### */ |
| 1496 | - } else if ( is_page() ) {
|
|
| 1496 | + } else if (is_page()) {
|
|
| 1497 | 1497 | $page_title = get_the_title(); |
| 1498 | 1498 | |
| 1499 | - if ( geodir_is_page( 'location' ) ) {
|
|
| 1499 | + if (geodir_is_page('location')) {
|
|
| 1500 | 1500 | $location_page_id = geodir_location_page_id(); |
| 1501 | - $loc_post = get_post( $location_page_id ); |
|
| 1501 | + $loc_post = get_post($location_page_id); |
|
| 1502 | 1502 | $post_name = $loc_post->post_name; |
| 1503 | - $slug = ucwords( str_replace( '-', ' ', $post_name ) ); |
|
| 1504 | - $page_title = ! empty( $slug ) ? $slug : __( 'Location', 'geodirectory' ); |
|
| 1503 | + $slug = ucwords(str_replace('-', ' ', $post_name));
|
|
| 1504 | + $page_title = !empty($slug) ? $slug : __('Location', 'geodirectory');
|
|
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | - $breadcrumb .= '<li>' . $separator; |
|
| 1508 | - $breadcrumb .= stripslashes_deep( $page_title ); |
|
| 1507 | + $breadcrumb .= '<li>'.$separator; |
|
| 1508 | + $breadcrumb .= stripslashes_deep($page_title); |
|
| 1509 | 1509 | $breadcrumb .= '</li>'; |
| 1510 | - } else if ( is_tag() ) {
|
|
| 1511 | - $breadcrumb .= "<li> " . $separator . single_tag_title( '', false ) . '</li>'; |
|
| 1512 | - } else if ( is_day() ) {
|
|
| 1513 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
| 1514 | - the_time( 'F jS, Y' ); |
|
| 1510 | + } else if (is_tag()) {
|
|
| 1511 | + $breadcrumb .= "<li> ".$separator.single_tag_title('', false).'</li>';
|
|
| 1512 | + } else if (is_day()) {
|
|
| 1513 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1514 | + the_time('F jS, Y');
|
|
| 1515 | 1515 | $breadcrumb .= '</li>'; |
| 1516 | - } else if ( is_month() ) {
|
|
| 1517 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
| 1518 | - the_time( 'F, Y' ); |
|
| 1516 | + } else if (is_month()) {
|
|
| 1517 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1518 | + the_time('F, Y');
|
|
| 1519 | 1519 | $breadcrumb .= '</li>'; |
| 1520 | - } else if ( is_year() ) {
|
|
| 1521 | - $breadcrumb .= "<li> " . $separator . __( " Archive for", 'geodirectory' ) . " "; |
|
| 1522 | - the_time( 'Y' ); |
|
| 1520 | + } else if (is_year()) {
|
|
| 1521 | + $breadcrumb .= "<li> ".$separator.__(" Archive for", 'geodirectory')." ";
|
|
| 1522 | + the_time('Y');
|
|
| 1523 | 1523 | $breadcrumb .= '</li>'; |
| 1524 | - } else if ( is_author() ) {
|
|
| 1525 | - $breadcrumb .= "<li> " . $separator . __( " Author Archive", 'geodirectory' ); |
|
| 1524 | + } else if (is_author()) {
|
|
| 1525 | + $breadcrumb .= "<li> ".$separator.__(" Author Archive", 'geodirectory');
|
|
| 1526 | 1526 | $breadcrumb .= '</li>'; |
| 1527 | - } else if ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
|
|
| 1528 | - $breadcrumb .= "<li>" . $separator . __( "Blog Archives", 'geodirectory' ); |
|
| 1527 | + } else if (isset($_GET['paged']) && !empty($_GET['paged'])) {
|
|
| 1528 | + $breadcrumb .= "<li>".$separator.__("Blog Archives", 'geodirectory');
|
|
| 1529 | 1529 | $breadcrumb .= '</li>'; |
| 1530 | - } else if ( is_search() ) {
|
|
| 1531 | - $breadcrumb .= "<li> " . $separator . __( " Search Results", 'geodirectory' ); |
|
| 1530 | + } else if (is_search()) {
|
|
| 1531 | + $breadcrumb .= "<li> ".$separator.__(" Search Results", 'geodirectory');
|
|
| 1532 | 1532 | $breadcrumb .= '</li>'; |
| 1533 | 1533 | } |
| 1534 | 1534 | $breadcrumb .= '</ul></div>'; |
@@ -1541,13 +1541,13 @@ discard block |
||
| 1541 | 1541 | * @param string $breadcrumb Breadcrumb HTML. |
| 1542 | 1542 | * @param string $separator Breadcrumb separator. |
| 1543 | 1543 | */ |
| 1544 | - echo $breadcrumb = apply_filters( 'geodir_breadcrumb', $breadcrumb, $separator ); |
|
| 1544 | + echo $breadcrumb = apply_filters('geodir_breadcrumb', $breadcrumb, $separator);
|
|
| 1545 | 1545 | } |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | |
| 1549 | -add_action( "admin_init", "geodir_allow_wpadmin" ); // check user is admin |
|
| 1550 | -if ( ! function_exists( 'geodir_allow_wpadmin' ) ) {
|
|
| 1549 | +add_action("admin_init", "geodir_allow_wpadmin"); // check user is admin
|
|
| 1550 | +if (!function_exists('geodir_allow_wpadmin')) {
|
|
| 1551 | 1551 | /** |
| 1552 | 1552 | * Allow only admins to access wp-admin. |
| 1553 | 1553 | * |
@@ -1559,12 +1559,12 @@ discard block |
||
| 1559 | 1559 | */ |
| 1560 | 1560 | function geodir_allow_wpadmin() {
|
| 1561 | 1561 | global $wpdb; |
| 1562 | - if ( get_option( 'geodir_allow_wpadmin' ) == '0' && is_user_logged_in() && ( ! defined( 'DOING_AJAX' ) ) ) // checking action in request to allow ajax request go through |
|
| 1562 | + if (get_option('geodir_allow_wpadmin') == '0' && is_user_logged_in() && (!defined('DOING_AJAX'))) // checking action in request to allow ajax request go through
|
|
| 1563 | 1563 | {
|
| 1564 | - if ( current_user_can( 'administrator' ) ) {
|
|
| 1564 | + if (current_user_can('administrator')) {
|
|
| 1565 | 1565 | } else {
|
| 1566 | 1566 | |
| 1567 | - wp_redirect( home_url() ); |
|
| 1567 | + wp_redirect(home_url()); |
|
| 1568 | 1568 | exit; |
| 1569 | 1569 | } |
| 1570 | 1570 | |
@@ -1583,23 +1583,23 @@ discard block |
||
| 1583 | 1583 | * |
| 1584 | 1584 | * @return array|WP_Error The uploaded data as array. When failure returns error. |
| 1585 | 1585 | */ |
| 1586 | -function fetch_remote_file( $url ) {
|
|
| 1586 | +function fetch_remote_file($url) {
|
|
| 1587 | 1587 | // extract the file name and extension from the url |
| 1588 | - require_once( ABSPATH . 'wp-includes/pluggable.php' ); |
|
| 1589 | - $file_name = basename( $url ); |
|
| 1590 | - if ( strpos( $file_name, '?' ) !== false ) {
|
|
| 1591 | - list( $file_name ) = explode( '?', $file_name ); |
|
| 1588 | + require_once(ABSPATH.'wp-includes/pluggable.php'); |
|
| 1589 | + $file_name = basename($url); |
|
| 1590 | + if (strpos($file_name, '?') !== false) {
|
|
| 1591 | + list($file_name) = explode('?', $file_name);
|
|
| 1592 | 1592 | } |
| 1593 | 1593 | $dummy = false; |
| 1594 | 1594 | $add_to_cache = false; |
| 1595 | 1595 | $key = null; |
| 1596 | - if ( strpos( $url, '/dummy/' ) !== false ) {
|
|
| 1596 | + if (strpos($url, '/dummy/') !== false) {
|
|
| 1597 | 1597 | $dummy = true; |
| 1598 | - $key = "dummy_" . str_replace( '.', '_', $file_name ); |
|
| 1599 | - $value = get_transient( 'cached_dummy_images' ); |
|
| 1600 | - if ( $value ) {
|
|
| 1601 | - if ( isset( $value[ $key ] ) ) {
|
|
| 1602 | - return $value[ $key ]; |
|
| 1598 | + $key = "dummy_".str_replace('.', '_', $file_name);
|
|
| 1599 | + $value = get_transient('cached_dummy_images');
|
|
| 1600 | + if ($value) {
|
|
| 1601 | + if (isset($value[$key])) {
|
|
| 1602 | + return $value[$key]; |
|
| 1603 | 1603 | } else {
|
| 1604 | 1604 | $add_to_cache = true; |
| 1605 | 1605 | } |
@@ -1610,58 +1610,58 @@ discard block |
||
| 1610 | 1610 | |
| 1611 | 1611 | // get placeholder file in the upload dir with a unique, sanitized filename |
| 1612 | 1612 | |
| 1613 | - $post_upload_date = isset( $post['upload_date'] ) ? $post['upload_date'] : ''; |
|
| 1613 | + $post_upload_date = isset($post['upload_date']) ? $post['upload_date'] : ''; |
|
| 1614 | 1614 | |
| 1615 | - $upload = wp_upload_bits( $file_name, 0, '', $post_upload_date ); |
|
| 1616 | - if ( $upload['error'] ) {
|
|
| 1617 | - return new WP_Error( 'upload_dir_error', $upload['error'] ); |
|
| 1615 | + $upload = wp_upload_bits($file_name, 0, '', $post_upload_date); |
|
| 1616 | + if ($upload['error']) {
|
|
| 1617 | + return new WP_Error('upload_dir_error', $upload['error']);
|
|
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | 1620 | |
| 1621 | - sleep( 0.3 );// if multiple remote file this can cause the remote server to timeout so we add a slight delay |
|
| 1621 | + sleep(0.3); // if multiple remote file this can cause the remote server to timeout so we add a slight delay |
|
| 1622 | 1622 | |
| 1623 | 1623 | // fetch the remote url and write it to the placeholder file |
| 1624 | - $headers = wp_remote_get( $url, array( 'stream' => true, 'filename' => $upload['file'] ) ); |
|
| 1624 | + $headers = wp_remote_get($url, array('stream' => true, 'filename' => $upload['file']));
|
|
| 1625 | 1625 | |
| 1626 | 1626 | $log_message = ''; |
| 1627 | - if ( is_wp_error( $headers ) ) {
|
|
| 1628 | - echo 'file: ' . $url; |
|
| 1627 | + if (is_wp_error($headers)) {
|
|
| 1628 | + echo 'file: '.$url; |
|
| 1629 | 1629 | |
| 1630 | - return new WP_Error( 'import_file_error', $headers->get_error_message() ); |
|
| 1630 | + return new WP_Error('import_file_error', $headers->get_error_message());
|
|
| 1631 | 1631 | } |
| 1632 | 1632 | |
| 1633 | - $filesize = filesize( $upload['file'] ); |
|
| 1633 | + $filesize = filesize($upload['file']); |
|
| 1634 | 1634 | // request failed |
| 1635 | - if ( ! $headers ) {
|
|
| 1636 | - $log_message = __( 'Remote server did not respond', 'geodirectory' ); |
|
| 1635 | + if (!$headers) {
|
|
| 1636 | + $log_message = __('Remote server did not respond', 'geodirectory');
|
|
| 1637 | 1637 | } // make sure the fetch was successful |
| 1638 | - elseif ( $headers['response']['code'] != '200' ) {
|
|
| 1639 | - $log_message = sprintf( __( 'Remote server returned error response %1$d %2$s', 'geodirectory' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) ); |
|
| 1640 | - } elseif ( isset( $headers['headers']['content-length'] ) && $filesize != $headers['headers']['content-length'] ) {
|
|
| 1641 | - $log_message = __( 'Remote file is incorrect size', 'geodirectory' ); |
|
| 1642 | - } elseif ( 0 == $filesize ) {
|
|
| 1643 | - $log_message = __( 'Zero size file downloaded', 'geodirectory' ); |
|
| 1644 | - } |
|
| 1645 | - |
|
| 1646 | - if ( $log_message ) {
|
|
| 1647 | - $del = unlink( $upload['file'] ); |
|
| 1648 | - if ( ! $del ) {
|
|
| 1649 | - geodir_error_log( __( 'GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory' ) ); |
|
| 1638 | + elseif ($headers['response']['code'] != '200') {
|
|
| 1639 | + $log_message = sprintf(__('Remote server returned error response %1$d %2$s', 'geodirectory'), esc_html($headers['response']), get_status_header_desc($headers['response']));
|
|
| 1640 | + } elseif (isset($headers['headers']['content-length']) && $filesize != $headers['headers']['content-length']) {
|
|
| 1641 | + $log_message = __('Remote file is incorrect size', 'geodirectory');
|
|
| 1642 | + } elseif (0 == $filesize) {
|
|
| 1643 | + $log_message = __('Zero size file downloaded', 'geodirectory');
|
|
| 1644 | + } |
|
| 1645 | + |
|
| 1646 | + if ($log_message) {
|
|
| 1647 | + $del = unlink($upload['file']); |
|
| 1648 | + if (!$del) {
|
|
| 1649 | + geodir_error_log(__('GeoDirectory: fetch_remote_file() failed to delete temp file.', 'geodirectory'));
|
|
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | - return new WP_Error( 'import_file_error', $log_message ); |
|
| 1652 | + return new WP_Error('import_file_error', $log_message);
|
|
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | - if ( $dummy && $add_to_cache && is_array( $upload ) ) {
|
|
| 1656 | - $images = get_transient( 'cached_dummy_images' ); |
|
| 1657 | - if ( is_array( $images ) ) {
|
|
| 1658 | - $images[ $key ] = $upload; |
|
| 1655 | + if ($dummy && $add_to_cache && is_array($upload)) {
|
|
| 1656 | + $images = get_transient('cached_dummy_images');
|
|
| 1657 | + if (is_array($images)) {
|
|
| 1658 | + $images[$key] = $upload; |
|
| 1659 | 1659 | } else {
|
| 1660 | - $images = array( $key => $upload ); |
|
| 1660 | + $images = array($key => $upload); |
|
| 1661 | 1661 | } |
| 1662 | 1662 | |
| 1663 | 1663 | //setting the cache using the WP Transient API |
| 1664 | - set_transient( 'cached_dummy_images', $images, 60 * 10 ); //10 minutes cache |
|
| 1664 | + set_transient('cached_dummy_images', $images, 60 * 10); //10 minutes cache
|
|
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | return $upload; |
@@ -1675,12 +1675,12 @@ discard block |
||
| 1675 | 1675 | * @return string|void Max upload size. |
| 1676 | 1676 | */ |
| 1677 | 1677 | function geodir_max_upload_size() {
|
| 1678 | - $max_filesize = (float) get_option( 'geodir_upload_max_filesize', 2 ); |
|
| 1678 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1679 | 1679 | |
| 1680 | - if ( $max_filesize > 0 && $max_filesize < 1 ) {
|
|
| 1681 | - $max_filesize = (int) ( $max_filesize * 1024 ) . 'kb'; |
|
| 1680 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1681 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1682 | 1682 | } else {
|
| 1683 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1683 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | /** |
@@ -1690,7 +1690,7 @@ discard block |
||
| 1690 | 1690 | * |
| 1691 | 1691 | * @param string $max_filesize Max file upload size. Ex. 10mb, 512kb. |
| 1692 | 1692 | */ |
| 1693 | - return apply_filters( 'geodir_default_image_upload_size_limit', $max_filesize ); |
|
| 1693 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | /** |
@@ -1703,8 +1703,8 @@ discard block |
||
| 1703 | 1703 | * @return bool If dummy folder exists returns true, else false. |
| 1704 | 1704 | */ |
| 1705 | 1705 | function geodir_dummy_folder_exists() {
|
| 1706 | - $path = geodir_plugin_path() . '/geodirectory-admin/dummy/'; |
|
| 1707 | - if ( ! is_dir( $path ) ) {
|
|
| 1706 | + $path = geodir_plugin_path().'/geodirectory-admin/dummy/'; |
|
| 1707 | + if (!is_dir($path)) {
|
|
| 1708 | 1708 | return false; |
| 1709 | 1709 | } else {
|
| 1710 | 1710 | return true; |
@@ -1723,17 +1723,17 @@ discard block |
||
| 1723 | 1723 | * |
| 1724 | 1724 | * @return object Author info. |
| 1725 | 1725 | */ |
| 1726 | -function geodir_get_author_info( $aid ) {
|
|
| 1726 | +function geodir_get_author_info($aid) {
|
|
| 1727 | 1727 | global $wpdb; |
| 1728 | 1728 | /*$infosql = "select * from $wpdb->users where ID=$aid";*/ |
| 1729 | - $infosql = $wpdb->prepare( "select * from $wpdb->users where ID=%d", array( $aid ) ); |
|
| 1730 | - $info = $wpdb->get_results( $infosql ); |
|
| 1731 | - if ( $info ) {
|
|
| 1729 | + $infosql = $wpdb->prepare("select * from $wpdb->users where ID=%d", array($aid));
|
|
| 1730 | + $info = $wpdb->get_results($infosql); |
|
| 1731 | + if ($info) {
|
|
| 1732 | 1732 | return $info[0]; |
| 1733 | 1733 | } |
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | -if ( ! function_exists( 'adminEmail' ) ) {
|
|
| 1736 | +if (!function_exists('adminEmail')) {
|
|
| 1737 | 1737 | /** |
| 1738 | 1738 | * Send emails to client on post submission, renew etc. |
| 1739 | 1739 | * |
@@ -1746,67 +1746,67 @@ discard block |
||
| 1746 | 1746 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1747 | 1747 | * @param string $custom_1 Custom data to be sent. |
| 1748 | 1748 | */ |
| 1749 | - function adminEmail( $page_id, $user_id, $message_type, $custom_1 = '' ) {
|
|
| 1749 | + function adminEmail($page_id, $user_id, $message_type, $custom_1 = '') {
|
|
| 1750 | 1750 | global $wpdb; |
| 1751 | - if ( $message_type == 'expiration' ) {
|
|
| 1752 | - $subject = stripslashes( __( get_option( 'renew_email_subject' ), 'geodirectory' ) ); |
|
| 1753 | - $client_message = stripslashes( __( get_option( 'renew_email_content' ), 'geodirectory' ) ); |
|
| 1754 | - } elseif ( $message_type == 'post_submited' ) {
|
|
| 1755 | - $subject = __( get_option( 'post_submited_success_email_subject_admin' ), 'geodirectory' ); |
|
| 1756 | - $client_message = __( get_option( 'post_submited_success_email_content_admin' ), 'geodirectory' ); |
|
| 1757 | - } elseif ( $message_type == 'renew' ) {
|
|
| 1758 | - $subject = __( get_option( 'post_renew_success_email_subject_admin' ), 'geodirectory' ); |
|
| 1759 | - $client_message = __( get_option( 'post_renew_success_email_content_admin' ), 'geodirectory' ); |
|
| 1760 | - } elseif ( $message_type == 'upgrade' ) {
|
|
| 1761 | - $subject = __( get_option( 'post_upgrade_success_email_subject_admin' ), 'geodirectory' ); |
|
| 1762 | - $client_message = __( get_option( 'post_upgrade_success_email_content_admin' ), 'geodirectory' ); |
|
| 1763 | - } elseif ( $message_type == 'claim_approved' ) {
|
|
| 1764 | - $subject = __( get_option( 'claim_approved_email_subject' ), 'geodirectory' ); |
|
| 1765 | - $client_message = __( get_option( 'claim_approved_email_content' ), 'geodirectory' ); |
|
| 1766 | - } elseif ( $message_type == 'claim_rejected' ) {
|
|
| 1767 | - $subject = __( get_option( 'claim_rejected_email_subject' ), 'geodirectory' ); |
|
| 1768 | - $client_message = __( get_option( 'claim_rejected_email_content' ), 'geodirectory' ); |
|
| 1769 | - } elseif ( $message_type == 'claim_requested' ) {
|
|
| 1770 | - $subject = __( get_option( 'claim_email_subject_admin' ), 'geodirectory' ); |
|
| 1771 | - $client_message = __( get_option( 'claim_email_content_admin' ), 'geodirectory' ); |
|
| 1772 | - } elseif ( $message_type == 'auto_claim' ) {
|
|
| 1773 | - $subject = __( get_option( 'auto_claim_email_subject' ), 'geodirectory' ); |
|
| 1774 | - $client_message = __( get_option( 'auto_claim_email_content' ), 'geodirectory' ); |
|
| 1775 | - } elseif ( $message_type == 'payment_success' ) {
|
|
| 1776 | - $subject = __( get_option( 'post_payment_success_admin_email_subject' ), 'geodirectory' ); |
|
| 1777 | - $client_message = __( get_option( 'post_payment_success_admin_email_content' ), 'geodirectory' ); |
|
| 1778 | - } elseif ( $message_type == 'payment_fail' ) {
|
|
| 1779 | - $subject = __( get_option( 'post_payment_fail_admin_email_subject' ), 'geodirectory' ); |
|
| 1780 | - $client_message = __( get_option( 'post_payment_fail_admin_email_content' ), 'geodirectory' ); |
|
| 1751 | + if ($message_type == 'expiration') {
|
|
| 1752 | + $subject = stripslashes(__(get_option('renew_email_subject'), 'geodirectory'));
|
|
| 1753 | + $client_message = stripslashes(__(get_option('renew_email_content'), 'geodirectory'));
|
|
| 1754 | + } elseif ($message_type == 'post_submited') {
|
|
| 1755 | + $subject = __(get_option('post_submited_success_email_subject_admin'), 'geodirectory');
|
|
| 1756 | + $client_message = __(get_option('post_submited_success_email_content_admin'), 'geodirectory');
|
|
| 1757 | + } elseif ($message_type == 'renew') {
|
|
| 1758 | + $subject = __(get_option('post_renew_success_email_subject_admin'), 'geodirectory');
|
|
| 1759 | + $client_message = __(get_option('post_renew_success_email_content_admin'), 'geodirectory');
|
|
| 1760 | + } elseif ($message_type == 'upgrade') {
|
|
| 1761 | + $subject = __(get_option('post_upgrade_success_email_subject_admin'), 'geodirectory');
|
|
| 1762 | + $client_message = __(get_option('post_upgrade_success_email_content_admin'), 'geodirectory');
|
|
| 1763 | + } elseif ($message_type == 'claim_approved') {
|
|
| 1764 | + $subject = __(get_option('claim_approved_email_subject'), 'geodirectory');
|
|
| 1765 | + $client_message = __(get_option('claim_approved_email_content'), 'geodirectory');
|
|
| 1766 | + } elseif ($message_type == 'claim_rejected') {
|
|
| 1767 | + $subject = __(get_option('claim_rejected_email_subject'), 'geodirectory');
|
|
| 1768 | + $client_message = __(get_option('claim_rejected_email_content'), 'geodirectory');
|
|
| 1769 | + } elseif ($message_type == 'claim_requested') {
|
|
| 1770 | + $subject = __(get_option('claim_email_subject_admin'), 'geodirectory');
|
|
| 1771 | + $client_message = __(get_option('claim_email_content_admin'), 'geodirectory');
|
|
| 1772 | + } elseif ($message_type == 'auto_claim') {
|
|
| 1773 | + $subject = __(get_option('auto_claim_email_subject'), 'geodirectory');
|
|
| 1774 | + $client_message = __(get_option('auto_claim_email_content'), 'geodirectory');
|
|
| 1775 | + } elseif ($message_type == 'payment_success') {
|
|
| 1776 | + $subject = __(get_option('post_payment_success_admin_email_subject'), 'geodirectory');
|
|
| 1777 | + $client_message = __(get_option('post_payment_success_admin_email_content'), 'geodirectory');
|
|
| 1778 | + } elseif ($message_type == 'payment_fail') {
|
|
| 1779 | + $subject = __(get_option('post_payment_fail_admin_email_subject'), 'geodirectory');
|
|
| 1780 | + $client_message = __(get_option('post_payment_fail_admin_email_content'), 'geodirectory');
|
|
| 1781 | 1781 | } |
| 1782 | 1782 | $transaction_details = $custom_1; |
| 1783 | - $fromEmail = get_option( 'site_email' ); |
|
| 1783 | + $fromEmail = get_option('site_email');
|
|
| 1784 | 1784 | $fromEmailName = get_site_emailName(); |
| 1785 | 1785 | //$alivedays = get_post_meta($page_id,'alive_days',true); |
| 1786 | - $pkg_limit = get_property_price_info_listing( $page_id ); |
|
| 1786 | + $pkg_limit = get_property_price_info_listing($page_id); |
|
| 1787 | 1787 | $alivedays = $pkg_limit['days']; |
| 1788 | - $productlink = get_permalink( $page_id ); |
|
| 1789 | - $post_info = get_post( $page_id ); |
|
| 1790 | - $post_date = date( 'dS F,Y', strtotime( $post_info->post_date ) ); |
|
| 1791 | - $listingLink = '<a href="' . $productlink . '"><b>' . $post_info->post_title . '</b></a>'; |
|
| 1788 | + $productlink = get_permalink($page_id); |
|
| 1789 | + $post_info = get_post($page_id); |
|
| 1790 | + $post_date = date('dS F,Y', strtotime($post_info->post_date));
|
|
| 1791 | + $listingLink = '<a href="'.$productlink.'"><b>'.$post_info->post_title.'</b></a>'; |
|
| 1792 | 1792 | $loginurl = geodir_login_url(); |
| 1793 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 1793 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 1794 | 1794 | $siteurl = home_url(); |
| 1795 | - $siteurl_link = '<a href="' . $siteurl . '">' . $fromEmailName . '</a>'; |
|
| 1796 | - $user_info = get_userdata( $user_id ); |
|
| 1795 | + $siteurl_link = '<a href="'.$siteurl.'">'.$fromEmailName.'</a>'; |
|
| 1796 | + $user_info = get_userdata($user_id); |
|
| 1797 | 1797 | $user_email = $user_info->user_email; |
| 1798 | - $display_name = geodir_get_client_name( $user_id ); |
|
| 1798 | + $display_name = geodir_get_client_name($user_id); |
|
| 1799 | 1799 | $user_login = $user_info->user_login; |
| 1800 | - $number_of_grace_days = get_option( 'ptthemes_listing_preexpiry_notice_days' ); |
|
| 1801 | - if ( $number_of_grace_days == '' ) {
|
|
| 1800 | + $number_of_grace_days = get_option('ptthemes_listing_preexpiry_notice_days');
|
|
| 1801 | + if ($number_of_grace_days == '') {
|
|
| 1802 | 1802 | $number_of_grace_days = 1; |
| 1803 | 1803 | } |
| 1804 | - if ( $post_info->post_type == 'event' ) {
|
|
| 1804 | + if ($post_info->post_type == 'event') {
|
|
| 1805 | 1805 | $post_type = 'event'; |
| 1806 | 1806 | } else {
|
| 1807 | 1807 | $post_type = 'listing'; |
| 1808 | 1808 | } |
| 1809 | - $renew_link = '<a href="' . $siteurl . '?ptype=post_' . $post_type . '&renew=1&pid=' . $page_id . '">' . RENEW_LINK . '</a>'; |
|
| 1809 | + $renew_link = '<a href="'.$siteurl.'?ptype=post_'.$post_type.'&renew=1&pid='.$page_id.'">'.RENEW_LINK.'</a>'; |
|
| 1810 | 1810 | $search_array = array( |
| 1811 | 1811 | '[#client_name#]', |
| 1812 | 1812 | '[#listing_link#]', |
@@ -1822,7 +1822,7 @@ discard block |
||
| 1822 | 1822 | '[#site_name#]', |
| 1823 | 1823 | '[#transaction_details#]' |
| 1824 | 1824 | ); |
| 1825 | - $replace_array = array( |
|
| 1825 | + $replace_array = array( |
|
| 1826 | 1826 | $display_name, |
| 1827 | 1827 | $listingLink, |
| 1828 | 1828 | $post_date, |
@@ -1837,11 +1837,11 @@ discard block |
||
| 1837 | 1837 | $fromEmailName, |
| 1838 | 1838 | $transaction_details |
| 1839 | 1839 | ); |
| 1840 | - $client_message = str_replace( $search_array, $replace_array, $client_message ); |
|
| 1841 | - $subject = str_replace( $search_array, $replace_array, $subject ); |
|
| 1842 | - $headers = 'MIME-Version: 1.0' . "\r\n"; |
|
| 1843 | - $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; |
|
| 1844 | - $headers .= 'From: ' . $fromEmailName . ' <' . $fromEmail . '>' . "\r\n"; |
|
| 1840 | + $client_message = str_replace($search_array, $replace_array, $client_message); |
|
| 1841 | + $subject = str_replace($search_array, $replace_array, $subject); |
|
| 1842 | + $headers = 'MIME-Version: 1.0'."\r\n"; |
|
| 1843 | + $headers .= 'Content-type: text/html; charset=UTF-8'."\r\n"; |
|
| 1844 | + $headers .= 'From: '.$fromEmailName.' <'.$fromEmail.'>'."\r\n"; |
|
| 1845 | 1845 | |
| 1846 | 1846 | $to = $fromEmail; |
| 1847 | 1847 | $message = $client_message; |
@@ -1859,7 +1859,7 @@ discard block |
||
| 1859 | 1859 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1860 | 1860 | * @param string $custom_1 Custom data to be sent. |
| 1861 | 1861 | */ |
| 1862 | - $to = apply_filters( 'geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1 ); |
|
| 1862 | + $to = apply_filters('geodir_adminEmail_to', $to, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1863 | 1863 | /** |
| 1864 | 1864 | * Filter the admin email subject. |
| 1865 | 1865 | * |
@@ -1872,7 +1872,7 @@ discard block |
||
| 1872 | 1872 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1873 | 1873 | * @param string $custom_1 Custom data to be sent. |
| 1874 | 1874 | */ |
| 1875 | - $subject = apply_filters( 'geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1 ); |
|
| 1875 | + $subject = apply_filters('geodir_adminEmail_subject', $subject, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1876 | 1876 | /** |
| 1877 | 1877 | * Filter the admin email message. |
| 1878 | 1878 | * |
@@ -1885,7 +1885,7 @@ discard block |
||
| 1885 | 1885 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1886 | 1886 | * @param string $custom_1 Custom data to be sent. |
| 1887 | 1887 | */ |
| 1888 | - $message = apply_filters( 'geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1 ); |
|
| 1888 | + $message = apply_filters('geodir_adminEmail_message', $message, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1889 | 1889 | /** |
| 1890 | 1890 | * Filter the admin email headers. |
| 1891 | 1891 | * |
@@ -1898,22 +1898,22 @@ discard block |
||
| 1898 | 1898 | * @param string $message_type Can be 'expiration','post_submited','renew','upgrade','claim_approved','claim_rejected','claim_requested','auto_claim','payment_success','payment_fail'. |
| 1899 | 1899 | * @param string $custom_1 Custom data to be sent. |
| 1900 | 1900 | */ |
| 1901 | - $headers = apply_filters( 'geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1 ); |
|
| 1901 | + $headers = apply_filters('geodir_adminEmail_headers', $headers, $page_id, $user_id, $message_type, $custom_1);
|
|
| 1902 | 1902 | |
| 1903 | 1903 | |
| 1904 | - $sent = wp_mail( $to, $subject, $message, $headers ); |
|
| 1905 | - if ( ! $sent ) {
|
|
| 1906 | - if ( is_array( $to ) ) {
|
|
| 1907 | - $to = implode( ',', $to ); |
|
| 1904 | + $sent = wp_mail($to, $subject, $message, $headers); |
|
| 1905 | + if (!$sent) {
|
|
| 1906 | + if (is_array($to)) {
|
|
| 1907 | + $to = implode(',', $to);
|
|
| 1908 | 1908 | } |
| 1909 | 1909 | $log_message = sprintf( |
| 1910 | - __( "Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory' ), |
|
| 1910 | + __("Email from GeoDirectory failed to send.\nMessage type: %s\nSend time: %s\nTo: %s\nSubject: %s\n\n", 'geodirectory'),
|
|
| 1911 | 1911 | $message_type, |
| 1912 | - date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), |
|
| 1912 | + date_i18n('F j Y H:i:s', current_time('timestamp')),
|
|
| 1913 | 1913 | $to, |
| 1914 | 1914 | $subject |
| 1915 | 1915 | ); |
| 1916 | - geodir_error_log( $log_message ); |
|
| 1916 | + geodir_error_log($log_message); |
|
| 1917 | 1917 | } |
| 1918 | 1918 | } |
| 1919 | 1919 | } |
@@ -1933,12 +1933,12 @@ discard block |
||
| 1933 | 1933 | * |
| 1934 | 1934 | * @return array Category IDs. |
| 1935 | 1935 | */ |
| 1936 | -function gd_lang_object_ids( $ids_array, $type ) {
|
|
| 1937 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 1936 | +function gd_lang_object_ids($ids_array, $type) {
|
|
| 1937 | + if (function_exists('icl_object_id')) {
|
|
| 1938 | 1938 | $res = array(); |
| 1939 | - foreach ( $ids_array as $id ) {
|
|
| 1940 | - $xlat = icl_object_id( $id, $type, false ); |
|
| 1941 | - if ( ! is_null( $xlat ) ) {
|
|
| 1939 | + foreach ($ids_array as $id) {
|
|
| 1940 | + $xlat = icl_object_id($id, $type, false); |
|
| 1941 | + if (!is_null($xlat)) {
|
|
| 1942 | 1942 | $res[] = $xlat; |
| 1943 | 1943 | } |
| 1944 | 1944 | } |
@@ -1962,20 +1962,20 @@ discard block |
||
| 1962 | 1962 | * |
| 1963 | 1963 | * @return array Modified Body CSS classes. |
| 1964 | 1964 | */ |
| 1965 | -function geodir_custom_posts_body_class( $classes ) {
|
|
| 1965 | +function geodir_custom_posts_body_class($classes) {
|
|
| 1966 | 1966 | global $wpdb, $wp; |
| 1967 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 1968 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
|
|
| 1967 | + $post_types = geodir_get_posttypes('object');
|
|
| 1968 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 1969 | 1969 | $classes[] = 'geodir_custom_posts'; |
| 1970 | 1970 | } |
| 1971 | 1971 | |
| 1972 | 1972 | // fix body class for signup page |
| 1973 | - if ( geodir_is_page( 'login' ) ) {
|
|
| 1973 | + if (geodir_is_page('login')) {
|
|
| 1974 | 1974 | $new_classes = array(); |
| 1975 | 1975 | $new_classes[] = 'signup page-geodir-signup'; |
| 1976 | - if ( ! empty( $classes ) ) {
|
|
| 1977 | - foreach ( $classes as $class ) {
|
|
| 1978 | - if ( $class && $class != 'home' && $class != 'blog' ) {
|
|
| 1976 | + if (!empty($classes)) {
|
|
| 1977 | + foreach ($classes as $class) {
|
|
| 1978 | + if ($class && $class != 'home' && $class != 'blog') {
|
|
| 1979 | 1979 | $new_classes[] = $class; |
| 1980 | 1980 | } |
| 1981 | 1981 | } |
@@ -1983,14 +1983,14 @@ discard block |
||
| 1983 | 1983 | $classes = $new_classes; |
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | - if ( geodir_is_geodir_page() ) {
|
|
| 1986 | + if (geodir_is_geodir_page()) {
|
|
| 1987 | 1987 | $classes[] = 'geodir-page'; |
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | 1990 | return $classes; |
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | -add_filter( 'body_class', 'geodir_custom_posts_body_class' ); // let's add a class to the body so we can style the new addition to the search |
|
| 1993 | +add_filter('body_class', 'geodir_custom_posts_body_class'); // let's add a class to the body so we can style the new addition to the search
|
|
| 1994 | 1994 | |
| 1995 | 1995 | |
| 1996 | 1996 | /** |
@@ -2006,7 +2006,7 @@ discard block |
||
| 2006 | 2006 | * |
| 2007 | 2007 | * @since 1.0.0 |
| 2008 | 2008 | */ |
| 2009 | - return apply_filters( 'geodir_map_zoom_level', array( |
|
| 2009 | + return apply_filters('geodir_map_zoom_level', array(
|
|
| 2010 | 2010 | 1, |
| 2011 | 2011 | 2, |
| 2012 | 2012 | 3, |
@@ -2026,7 +2026,7 @@ discard block |
||
| 2026 | 2026 | 17, |
| 2027 | 2027 | 18, |
| 2028 | 2028 | 19 |
| 2029 | - ) ); |
|
| 2029 | + )); |
|
| 2030 | 2030 | |
| 2031 | 2031 | } |
| 2032 | 2032 | |
@@ -2039,12 +2039,12 @@ discard block |
||
| 2039 | 2039 | * |
| 2040 | 2040 | * @param string $geodir_option_name Option key. |
| 2041 | 2041 | */ |
| 2042 | -function geodir_option_version_backup( $geodir_option_name ) {
|
|
| 2042 | +function geodir_option_version_backup($geodir_option_name) {
|
|
| 2043 | 2043 | $version_date = time(); |
| 2044 | - $geodir_option = get_option( $geodir_option_name ); |
|
| 2044 | + $geodir_option = get_option($geodir_option_name); |
|
| 2045 | 2045 | |
| 2046 | - if ( ! empty( $geodir_option ) ) {
|
|
| 2047 | - add_option( $geodir_option_name . '_' . $version_date, $geodir_option ); |
|
| 2046 | + if (!empty($geodir_option)) {
|
|
| 2047 | + add_option($geodir_option_name.'_'.$version_date, $geodir_option); |
|
| 2048 | 2048 | } |
| 2049 | 2049 | } |
| 2050 | 2050 | |
@@ -2058,10 +2058,10 @@ discard block |
||
| 2058 | 2058 | * |
| 2059 | 2059 | * @return int Page ID. |
| 2060 | 2060 | */ |
| 2061 | -function get_page_id_geodir_add_listing_page( $page_id ) {
|
|
| 2062 | - if ( geodir_wpml_multilingual_status() ) {
|
|
| 2061 | +function get_page_id_geodir_add_listing_page($page_id) {
|
|
| 2062 | + if (geodir_wpml_multilingual_status()) {
|
|
| 2063 | 2063 | $post_type = 'post_page'; |
| 2064 | - $page_id = geodir_get_wpml_element_id( $page_id, $post_type ); |
|
| 2064 | + $page_id = geodir_get_wpml_element_id($page_id, $post_type); |
|
| 2065 | 2065 | } |
| 2066 | 2066 | |
| 2067 | 2067 | return $page_id; |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | * @return bool Returns true when sitepress multilingual CMS active. else returns false. |
| 2076 | 2076 | */ |
| 2077 | 2077 | function geodir_wpml_multilingual_status() {
|
| 2078 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 2078 | + if (function_exists('icl_object_id')) {
|
|
| 2079 | 2079 | return true; |
| 2080 | 2080 | } |
| 2081 | 2081 | |
@@ -2093,19 +2093,19 @@ discard block |
||
| 2093 | 2093 | * |
| 2094 | 2094 | * @return int Element ID when exists. Else the page id. |
| 2095 | 2095 | */ |
| 2096 | -function geodir_get_wpml_element_id( $page_id, $post_type ) {
|
|
| 2096 | +function geodir_get_wpml_element_id($page_id, $post_type) {
|
|
| 2097 | 2097 | global $sitepress; |
| 2098 | - if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
|
|
| 2099 | - $trid = $sitepress->get_element_trid( $page_id, $post_type ); |
|
| 2098 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
|
|
| 2099 | + $trid = $sitepress->get_element_trid($page_id, $post_type); |
|
| 2100 | 2100 | |
| 2101 | - if ( $trid > 0 ) {
|
|
| 2102 | - $translations = $sitepress->get_element_translations( $trid, $post_type ); |
|
| 2101 | + if ($trid > 0) {
|
|
| 2102 | + $translations = $sitepress->get_element_translations($trid, $post_type); |
|
| 2103 | 2103 | |
| 2104 | 2104 | $lang = $sitepress->get_current_language(); |
| 2105 | 2105 | $lang = $lang ? $lang : $sitepress->get_default_language(); |
| 2106 | 2106 | |
| 2107 | - if ( ! empty( $translations ) && ! empty( $lang ) && isset( $translations[ $lang ] ) && isset( $translations[ $lang ]->element_id ) && ! empty( $translations[ $lang ]->element_id ) ) {
|
|
| 2108 | - $page_id = $translations[ $lang ]->element_id; |
|
| 2107 | + if (!empty($translations) && !empty($lang) && isset($translations[$lang]) && isset($translations[$lang]->element_id) && !empty($translations[$lang]->element_id)) {
|
|
| 2108 | + $page_id = $translations[$lang]->element_id; |
|
| 2109 | 2109 | } |
| 2110 | 2110 | } |
| 2111 | 2111 | } |
@@ -2122,15 +2122,15 @@ discard block |
||
| 2122 | 2122 | */ |
| 2123 | 2123 | function geodir_wpml_check_element_id() {
|
| 2124 | 2124 | global $sitepress; |
| 2125 | - if ( geodir_wpml_multilingual_status() && ! empty( $sitepress ) && isset( $sitepress->queries ) ) {
|
|
| 2125 | + if (geodir_wpml_multilingual_status() && !empty($sitepress) && isset($sitepress->queries)) {
|
|
| 2126 | 2126 | $el_type = 'post_page'; |
| 2127 | - $el_id = get_option( 'geodir_add_listing_page' ); |
|
| 2127 | + $el_id = get_option('geodir_add_listing_page');
|
|
| 2128 | 2128 | $default_lang = $sitepress->get_default_language(); |
| 2129 | - $el_details = $sitepress->get_element_language_details( $el_id, $el_type ); |
|
| 2129 | + $el_details = $sitepress->get_element_language_details($el_id, $el_type); |
|
| 2130 | 2130 | |
| 2131 | - if ( ! ( $el_id > 0 && $default_lang && ! empty( $el_details ) && isset( $el_details->language_code ) && $el_details->language_code == $default_lang ) ) {
|
|
| 2132 | - if ( ! $el_details->source_language_code ) {
|
|
| 2133 | - $sitepress->set_element_language_details( $el_id, $el_type, '', $default_lang ); |
|
| 2131 | + if (!($el_id > 0 && $default_lang && !empty($el_details) && isset($el_details->language_code) && $el_details->language_code == $default_lang)) {
|
|
| 2132 | + if (!$el_details->source_language_code) {
|
|
| 2133 | + $sitepress->set_element_language_details($el_id, $el_type, '', $default_lang); |
|
| 2134 | 2134 | $sitepress->icl_translations_cache->clear(); |
| 2135 | 2135 | } |
| 2136 | 2136 | } |
@@ -2149,41 +2149,41 @@ discard block |
||
| 2149 | 2149 | * |
| 2150 | 2150 | * @return string Orderby SQL. |
| 2151 | 2151 | */ |
| 2152 | -function geodir_widget_listings_get_order( $query_args ) {
|
|
| 2152 | +function geodir_widget_listings_get_order($query_args) {
|
|
| 2153 | 2153 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2154 | 2154 | |
| 2155 | 2155 | $query_args = $gd_query_args_widgets; |
| 2156 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2157 | - return $wpdb->posts . ".post_date DESC, "; |
|
| 2156 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2157 | + return $wpdb->posts.".post_date DESC, "; |
|
| 2158 | 2158 | } |
| 2159 | 2159 | |
| 2160 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
| 2161 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2160 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
| 2161 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2162 | 2162 | |
| 2163 | - $sort_by = ! empty( $query_args['order_by'] ) ? $query_args['order_by'] : ''; |
|
| 2163 | + $sort_by = !empty($query_args['order_by']) ? $query_args['order_by'] : ''; |
|
| 2164 | 2164 | |
| 2165 | - switch ( $sort_by ) {
|
|
| 2165 | + switch ($sort_by) {
|
|
| 2166 | 2166 | case 'latest': |
| 2167 | 2167 | case 'newest': |
| 2168 | - $orderby = $wpdb->posts . ".post_date DESC, "; |
|
| 2168 | + $orderby = $wpdb->posts.".post_date DESC, "; |
|
| 2169 | 2169 | break; |
| 2170 | 2170 | case 'featured': |
| 2171 | - $orderby = $table . ".is_featured ASC, "; |
|
| 2171 | + $orderby = $table.".is_featured ASC, "; |
|
| 2172 | 2172 | break; |
| 2173 | 2173 | case 'az': |
| 2174 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
| 2174 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
| 2175 | 2175 | break; |
| 2176 | 2176 | case 'high_review': |
| 2177 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 2177 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
| 2178 | 2178 | break; |
| 2179 | 2179 | case 'high_rating': |
| 2180 | - $orderby = "( " . $table . ".overall_rating ) DESC, "; |
|
| 2180 | + $orderby = "( ".$table.".overall_rating ) DESC, "; |
|
| 2181 | 2181 | break; |
| 2182 | 2182 | case 'random': |
| 2183 | 2183 | $orderby = "RAND(), "; |
| 2184 | 2184 | break; |
| 2185 | 2185 | default: |
| 2186 | - $orderby = $wpdb->posts . ".post_title ASC, "; |
|
| 2186 | + $orderby = $wpdb->posts.".post_title ASC, "; |
|
| 2187 | 2187 | break; |
| 2188 | 2188 | } |
| 2189 | 2189 | |
@@ -2205,15 +2205,15 @@ discard block |
||
| 2205 | 2205 | * |
| 2206 | 2206 | * @return mixed Result object. |
| 2207 | 2207 | */ |
| 2208 | -function geodir_get_widget_listings( $query_args = array(), $count_only = false ) {
|
|
| 2208 | +function geodir_get_widget_listings($query_args = array(), $count_only = false) {
|
|
| 2209 | 2209 | global $wpdb, $plugin_prefix, $table_prefix; |
| 2210 | 2210 | $GLOBALS['gd_query_args_widgets'] = $query_args; |
| 2211 | 2211 | $gd_query_args_widgets = $query_args; |
| 2212 | 2212 | |
| 2213 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
| 2214 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2213 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
| 2214 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2215 | 2215 | |
| 2216 | - $fields = $wpdb->posts . ".*, " . $table . ".*"; |
|
| 2216 | + $fields = $wpdb->posts.".*, ".$table.".*"; |
|
| 2217 | 2217 | /** |
| 2218 | 2218 | * Filter widget listing fields string part that is being used for query. |
| 2219 | 2219 | * |
@@ -2223,17 +2223,17 @@ discard block |
||
| 2223 | 2223 | * @param string $table Table name. |
| 2224 | 2224 | * @param string $post_type Post type. |
| 2225 | 2225 | */ |
| 2226 | - $fields = apply_filters( 'geodir_filter_widget_listings_fields', $fields, $table, $post_type ); |
|
| 2226 | + $fields = apply_filters('geodir_filter_widget_listings_fields', $fields, $table, $post_type);
|
|
| 2227 | 2227 | |
| 2228 | - $join = "INNER JOIN " . $table . " ON (" . $table . ".post_id = " . $wpdb->posts . ".ID)";
|
|
| 2228 | + $join = "INNER JOIN ".$table." ON (".$table.".post_id = ".$wpdb->posts.".ID)";
|
|
| 2229 | 2229 | |
| 2230 | 2230 | ########### WPML ########### |
| 2231 | 2231 | |
| 2232 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 2232 | + if (function_exists('icl_object_id')) {
|
|
| 2233 | 2233 | global $sitepress; |
| 2234 | 2234 | $lang_code = ICL_LANGUAGE_CODE; |
| 2235 | - if ( $lang_code ) {
|
|
| 2236 | - $join .= " JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 2235 | + if ($lang_code) {
|
|
| 2236 | + $join .= " JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
| 2237 | 2237 | } |
| 2238 | 2238 | } |
| 2239 | 2239 | |
@@ -2247,15 +2247,15 @@ discard block |
||
| 2247 | 2247 | * @param string $join Join clause string. |
| 2248 | 2248 | * @param string $post_type Post type. |
| 2249 | 2249 | */ |
| 2250 | - $join = apply_filters( 'geodir_filter_widget_listings_join', $join, $post_type ); |
|
| 2250 | + $join = apply_filters('geodir_filter_widget_listings_join', $join, $post_type);
|
|
| 2251 | 2251 | |
| 2252 | - $post_status = is_super_admin() ? " OR " . $wpdb->posts . ".post_status = 'private'" : ''; |
|
| 2252 | + $post_status = is_super_admin() ? " OR ".$wpdb->posts.".post_status = 'private'" : ''; |
|
| 2253 | 2253 | |
| 2254 | - $where = " AND ( " . $wpdb->posts . ".post_status = 'publish' " . $post_status . " ) AND " . $wpdb->posts . ".post_type = '" . $post_type . "'"; |
|
| 2254 | + $where = " AND ( ".$wpdb->posts.".post_status = 'publish' ".$post_status." ) AND ".$wpdb->posts.".post_type = '".$post_type."'"; |
|
| 2255 | 2255 | |
| 2256 | 2256 | ########### WPML ########### |
| 2257 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 2258 | - if ( $lang_code ) {
|
|
| 2257 | + if (function_exists('icl_object_id')) {
|
|
| 2258 | + if ($lang_code) {
|
|
| 2259 | 2259 | $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type = 'post_$post_type' "; |
| 2260 | 2260 | } |
| 2261 | 2261 | } |
@@ -2268,8 +2268,8 @@ discard block |
||
| 2268 | 2268 | * @param string $where Where clause string. |
| 2269 | 2269 | * @param string $post_type Post type. |
| 2270 | 2270 | */ |
| 2271 | - $where = apply_filters( 'geodir_filter_widget_listings_where', $where, $post_type ); |
|
| 2272 | - $where = $where != '' ? " WHERE 1=1 " . $where : ''; |
|
| 2271 | + $where = apply_filters('geodir_filter_widget_listings_where', $where, $post_type);
|
|
| 2272 | + $where = $where != '' ? " WHERE 1=1 ".$where : ''; |
|
| 2273 | 2273 | |
| 2274 | 2274 | $groupby = " GROUP BY $wpdb->posts.ID "; |
| 2275 | 2275 | /** |
@@ -2280,15 +2280,15 @@ discard block |
||
| 2280 | 2280 | * @param string $groupby Group by clause string. |
| 2281 | 2281 | * @param string $post_type Post type. |
| 2282 | 2282 | */ |
| 2283 | - $groupby = apply_filters( 'geodir_filter_widget_listings_groupby', $groupby, $post_type ); |
|
| 2283 | + $groupby = apply_filters('geodir_filter_widget_listings_groupby', $groupby, $post_type);
|
|
| 2284 | 2284 | |
| 2285 | - if ( $count_only ) {
|
|
| 2286 | - $sql = "SELECT COUNT(" . $wpdb->posts . ".ID) AS total FROM " . $wpdb->posts . "
|
|
| 2287 | - " . $join . " |
|
| 2285 | + if ($count_only) {
|
|
| 2286 | + $sql = "SELECT COUNT(".$wpdb->posts.".ID) AS total FROM ".$wpdb->posts."
|
|
| 2287 | + " . $join." |
|
| 2288 | 2288 | " . $where; |
| 2289 | - $rows = (int) $wpdb->get_var( $sql ); |
|
| 2289 | + $rows = (int) $wpdb->get_var($sql); |
|
| 2290 | 2290 | } else {
|
| 2291 | - $orderby = geodir_widget_listings_get_order( $query_args ); |
|
| 2291 | + $orderby = geodir_widget_listings_get_order($query_args); |
|
| 2292 | 2292 | /** |
| 2293 | 2293 | * Filter widget listing orderby clause string part that is being used for query. |
| 2294 | 2294 | * |
@@ -2298,11 +2298,11 @@ discard block |
||
| 2298 | 2298 | * @param string $table Table name. |
| 2299 | 2299 | * @param string $post_type Post type. |
| 2300 | 2300 | */ |
| 2301 | - $orderby = apply_filters( 'geodir_filter_widget_listings_orderby', $orderby, $table, $post_type ); |
|
| 2302 | - $orderby .= $wpdb->posts . ".post_title ASC"; |
|
| 2303 | - $orderby = $orderby != '' ? " ORDER BY " . $orderby : ''; |
|
| 2301 | + $orderby = apply_filters('geodir_filter_widget_listings_orderby', $orderby, $table, $post_type);
|
|
| 2302 | + $orderby .= $wpdb->posts.".post_title ASC"; |
|
| 2303 | + $orderby = $orderby != '' ? " ORDER BY ".$orderby : ''; |
|
| 2304 | 2304 | |
| 2305 | - $limit = ! empty( $query_args['posts_per_page'] ) ? $query_args['posts_per_page'] : 5; |
|
| 2305 | + $limit = !empty($query_args['posts_per_page']) ? $query_args['posts_per_page'] : 5; |
|
| 2306 | 2306 | /** |
| 2307 | 2307 | * Filter widget listing limit that is being used for query. |
| 2308 | 2308 | * |
@@ -2311,26 +2311,26 @@ discard block |
||
| 2311 | 2311 | * @param int $limit Query results limit. |
| 2312 | 2312 | * @param string $post_type Post type. |
| 2313 | 2313 | */ |
| 2314 | - $limit = apply_filters( 'geodir_filter_widget_listings_limit', $limit, $post_type ); |
|
| 2314 | + $limit = apply_filters('geodir_filter_widget_listings_limit', $limit, $post_type);
|
|
| 2315 | 2315 | |
| 2316 | - $page = ! empty( $query_args['pageno'] ) ? absint( $query_args['pageno'] ) : 1; |
|
| 2317 | - if ( ! $page ) {
|
|
| 2316 | + $page = !empty($query_args['pageno']) ? absint($query_args['pageno']) : 1; |
|
| 2317 | + if (!$page) {
|
|
| 2318 | 2318 | $page = 1; |
| 2319 | 2319 | } |
| 2320 | 2320 | |
| 2321 | - $limit = (int) $limit > 0 ? " LIMIT " . absint( ( $page - 1 ) * (int) $limit ) . ", " . (int) $limit : ""; |
|
| 2321 | + $limit = (int) $limit > 0 ? " LIMIT ".absint(($page - 1) * (int) $limit).", ".(int) $limit : ""; |
|
| 2322 | 2322 | |
| 2323 | - $sql = "SELECT SQL_CALC_FOUND_ROWS " . $fields . " FROM " . $wpdb->posts . " |
|
| 2324 | - " . $join . " |
|
| 2325 | - " . $where . " |
|
| 2326 | - " . $groupby . " |
|
| 2327 | - " . $orderby . " |
|
| 2323 | + $sql = "SELECT SQL_CALC_FOUND_ROWS ".$fields." FROM ".$wpdb->posts." |
|
| 2324 | + " . $join." |
|
| 2325 | + " . $where." |
|
| 2326 | + " . $groupby." |
|
| 2327 | + " . $orderby." |
|
| 2328 | 2328 | " . $limit; |
| 2329 | - $rows = $wpdb->get_results( $sql ); |
|
| 2329 | + $rows = $wpdb->get_results($sql); |
|
| 2330 | 2330 | } |
| 2331 | 2331 | |
| 2332 | - unset( $GLOBALS['gd_query_args_widgets'] ); |
|
| 2333 | - unset( $gd_query_args_widgets ); |
|
| 2332 | + unset($GLOBALS['gd_query_args_widgets']); |
|
| 2333 | + unset($gd_query_args_widgets); |
|
| 2334 | 2334 | |
| 2335 | 2335 | return $rows; |
| 2336 | 2336 | } |
@@ -2347,11 +2347,11 @@ discard block |
||
| 2347 | 2347 | * |
| 2348 | 2348 | * @return string Modified fields SQL. |
| 2349 | 2349 | */ |
| 2350 | -function geodir_function_widget_listings_fields( $fields ) {
|
|
| 2350 | +function geodir_function_widget_listings_fields($fields) {
|
|
| 2351 | 2351 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2352 | 2352 | |
| 2353 | 2353 | $query_args = $gd_query_args_widgets; |
| 2354 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2354 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2355 | 2355 | return $fields; |
| 2356 | 2356 | } |
| 2357 | 2357 | |
@@ -2370,24 +2370,24 @@ discard block |
||
| 2370 | 2370 | * |
| 2371 | 2371 | * @return string Modified join clause SQL. |
| 2372 | 2372 | */ |
| 2373 | -function geodir_function_widget_listings_join( $join ) {
|
|
| 2373 | +function geodir_function_widget_listings_join($join) {
|
|
| 2374 | 2374 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2375 | 2375 | |
| 2376 | 2376 | $query_args = $gd_query_args_widgets; |
| 2377 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2377 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2378 | 2378 | return $join; |
| 2379 | 2379 | } |
| 2380 | 2380 | |
| 2381 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
| 2382 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2381 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
| 2382 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2383 | 2383 | |
| 2384 | - if ( ! empty( $query_args['with_pics_only'] ) ) {
|
|
| 2385 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 2384 | + if (!empty($query_args['with_pics_only'])) {
|
|
| 2385 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
| 2386 | 2386 | } |
| 2387 | 2387 | |
| 2388 | - if ( ! empty( $query_args['tax_query'] ) ) {
|
|
| 2389 | - $tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' ); |
|
| 2390 | - if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
|
|
| 2388 | + if (!empty($query_args['tax_query'])) {
|
|
| 2389 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
| 2390 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
|
|
| 2391 | 2391 | $join .= $tax_queries['join']; |
| 2392 | 2392 | } |
| 2393 | 2393 | } |
@@ -2407,49 +2407,49 @@ discard block |
||
| 2407 | 2407 | * |
| 2408 | 2408 | * @return string Modified where clause SQL. |
| 2409 | 2409 | */ |
| 2410 | -function geodir_function_widget_listings_where( $where ) {
|
|
| 2410 | +function geodir_function_widget_listings_where($where) {
|
|
| 2411 | 2411 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2412 | 2412 | |
| 2413 | 2413 | $query_args = $gd_query_args_widgets; |
| 2414 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2414 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2415 | 2415 | return $where; |
| 2416 | 2416 | } |
| 2417 | - $post_type = empty( $query_args['post_type'] ) ? 'gd_place' : $query_args['post_type']; |
|
| 2418 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2417 | + $post_type = empty($query_args['post_type']) ? 'gd_place' : $query_args['post_type']; |
|
| 2418 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2419 | 2419 | |
| 2420 | - if ( ! empty( $query_args ) ) {
|
|
| 2421 | - if ( ! empty( $query_args['gd_location'] ) && function_exists( 'geodir_default_location_where' ) ) {
|
|
| 2422 | - $where = geodir_default_location_where( $where, $table ); |
|
| 2420 | + if (!empty($query_args)) {
|
|
| 2421 | + if (!empty($query_args['gd_location']) && function_exists('geodir_default_location_where')) {
|
|
| 2422 | + $where = geodir_default_location_where($where, $table); |
|
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | - if ( ! empty( $query_args['post_author'] ) ) {
|
|
| 2426 | - $where .= " AND " . $wpdb->posts . ".post_author = " . (int) $query_args['post_author']; |
|
| 2425 | + if (!empty($query_args['post_author'])) {
|
|
| 2426 | + $where .= " AND ".$wpdb->posts.".post_author = ".(int) $query_args['post_author']; |
|
| 2427 | 2427 | } |
| 2428 | 2428 | |
| 2429 | - if ( ! empty( $query_args['show_featured_only'] ) ) {
|
|
| 2430 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 2429 | + if (!empty($query_args['show_featured_only'])) {
|
|
| 2430 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | - if ( ! empty( $query_args['show_special_only'] ) ) {
|
|
| 2434 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 2433 | + if (!empty($query_args['show_special_only'])) {
|
|
| 2434 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | - if ( ! empty( $query_args['with_pics_only'] ) ) {
|
|
| 2438 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL "; |
|
| 2437 | + if (!empty($query_args['with_pics_only'])) {
|
|
| 2438 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL "; |
|
| 2439 | 2439 | } |
| 2440 | 2440 | |
| 2441 | - if ( ! empty( $query_args['featured_image_only'] ) ) {
|
|
| 2442 | - $where .= " AND " . $table . ".featured_image IS NOT NULL AND " . $table . ".featured_image!='' "; |
|
| 2441 | + if (!empty($query_args['featured_image_only'])) {
|
|
| 2442 | + $where .= " AND ".$table.".featured_image IS NOT NULL AND ".$table.".featured_image!='' "; |
|
| 2443 | 2443 | } |
| 2444 | 2444 | |
| 2445 | - if ( ! empty( $query_args['with_videos_only'] ) ) {
|
|
| 2446 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 2445 | + if (!empty($query_args['with_videos_only'])) {
|
|
| 2446 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
| 2447 | 2447 | } |
| 2448 | 2448 | |
| 2449 | - if ( ! empty( $query_args['tax_query'] ) ) {
|
|
| 2450 | - $tax_queries = get_tax_sql( $query_args['tax_query'], $wpdb->posts, 'ID' ); |
|
| 2449 | + if (!empty($query_args['tax_query'])) {
|
|
| 2450 | + $tax_queries = get_tax_sql($query_args['tax_query'], $wpdb->posts, 'ID'); |
|
| 2451 | 2451 | |
| 2452 | - if ( ! empty( $tax_queries['join'] ) && ! empty( $tax_queries['where'] ) ) {
|
|
| 2452 | + if (!empty($tax_queries['join']) && !empty($tax_queries['where'])) {
|
|
| 2453 | 2453 | $where .= $tax_queries['where']; |
| 2454 | 2454 | } |
| 2455 | 2455 | } |
@@ -2470,11 +2470,11 @@ discard block |
||
| 2470 | 2470 | * |
| 2471 | 2471 | * @return string Modified orderby clause SQL. |
| 2472 | 2472 | */ |
| 2473 | -function geodir_function_widget_listings_orderby( $orderby ) {
|
|
| 2473 | +function geodir_function_widget_listings_orderby($orderby) {
|
|
| 2474 | 2474 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2475 | 2475 | |
| 2476 | 2476 | $query_args = $gd_query_args_widgets; |
| 2477 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2477 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2478 | 2478 | return $orderby; |
| 2479 | 2479 | } |
| 2480 | 2480 | |
@@ -2493,15 +2493,15 @@ discard block |
||
| 2493 | 2493 | * |
| 2494 | 2494 | * @return int Query limit. |
| 2495 | 2495 | */ |
| 2496 | -function geodir_function_widget_listings_limit( $limit ) {
|
|
| 2496 | +function geodir_function_widget_listings_limit($limit) {
|
|
| 2497 | 2497 | global $wpdb, $plugin_prefix, $gd_query_args_widgets; |
| 2498 | 2498 | |
| 2499 | 2499 | $query_args = $gd_query_args_widgets; |
| 2500 | - if ( empty( $query_args ) || empty( $query_args['is_geodir_loop'] ) ) {
|
|
| 2500 | + if (empty($query_args) || empty($query_args['is_geodir_loop'])) {
|
|
| 2501 | 2501 | return $limit; |
| 2502 | 2502 | } |
| 2503 | 2503 | |
| 2504 | - if ( ! empty( $query_args ) && ! empty( $query_args['posts_per_page'] ) ) {
|
|
| 2504 | + if (!empty($query_args) && !empty($query_args['posts_per_page'])) {
|
|
| 2505 | 2505 | $limit = (int) $query_args['posts_per_page']; |
| 2506 | 2506 | } |
| 2507 | 2507 | |
@@ -2519,12 +2519,12 @@ discard block |
||
| 2519 | 2519 | * |
| 2520 | 2520 | * @return int Large size width. |
| 2521 | 2521 | */ |
| 2522 | -function geodir_media_image_large_width( $default = 800, $params = '' ) {
|
|
| 2523 | - $large_size_w = get_option( 'large_size_w' ); |
|
| 2522 | +function geodir_media_image_large_width($default = 800, $params = '') {
|
|
| 2523 | + $large_size_w = get_option('large_size_w');
|
|
| 2524 | 2524 | $large_size_w = $large_size_w > 0 ? $large_size_w : $default; |
| 2525 | - $large_size_w = absint( $large_size_w ); |
|
| 2525 | + $large_size_w = absint($large_size_w); |
|
| 2526 | 2526 | |
| 2527 | - if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
|
|
| 2527 | + if (!get_option('geodir_use_wp_media_large_size')) {
|
|
| 2528 | 2528 | $large_size_w = 800; |
| 2529 | 2529 | } |
| 2530 | 2530 | |
@@ -2537,7 +2537,7 @@ discard block |
||
| 2537 | 2537 | * @param int $default Default width. |
| 2538 | 2538 | * @param string|array $params Image parameters. |
| 2539 | 2539 | */ |
| 2540 | - $large_size_w = apply_filters( 'geodir_filter_media_image_large_width', $large_size_w, $default, $params ); |
|
| 2540 | + $large_size_w = apply_filters('geodir_filter_media_image_large_width', $large_size_w, $default, $params);
|
|
| 2541 | 2541 | |
| 2542 | 2542 | return $large_size_w; |
| 2543 | 2543 | } |
@@ -2553,12 +2553,12 @@ discard block |
||
| 2553 | 2553 | * |
| 2554 | 2554 | * @return int Large size height. |
| 2555 | 2555 | */ |
| 2556 | -function geodir_media_image_large_height( $default = 800, $params = '' ) {
|
|
| 2557 | - $large_size_h = get_option( 'large_size_h' ); |
|
| 2556 | +function geodir_media_image_large_height($default = 800, $params = '') {
|
|
| 2557 | + $large_size_h = get_option('large_size_h');
|
|
| 2558 | 2558 | $large_size_h = $large_size_h > 0 ? $large_size_h : $default; |
| 2559 | - $large_size_h = absint( $large_size_h ); |
|
| 2559 | + $large_size_h = absint($large_size_h); |
|
| 2560 | 2560 | |
| 2561 | - if ( ! get_option( 'geodir_use_wp_media_large_size' ) ) {
|
|
| 2561 | + if (!get_option('geodir_use_wp_media_large_size')) {
|
|
| 2562 | 2562 | $large_size_h = 800; |
| 2563 | 2563 | } |
| 2564 | 2564 | |
@@ -2571,7 +2571,7 @@ discard block |
||
| 2571 | 2571 | * @param int $default Default height. |
| 2572 | 2572 | * @param string|array $params Image parameters. |
| 2573 | 2573 | */ |
| 2574 | - $large_size_h = apply_filters( 'geodir_filter_media_image_large_height', $large_size_h, $default, $params ); |
|
| 2574 | + $large_size_h = apply_filters('geodir_filter_media_image_large_height', $large_size_h, $default, $params);
|
|
| 2575 | 2575 | |
| 2576 | 2576 | return $large_size_h; |
| 2577 | 2577 | } |
@@ -2588,8 +2588,8 @@ discard block |
||
| 2588 | 2588 | * |
| 2589 | 2589 | * @return string Sanitized name. |
| 2590 | 2590 | */ |
| 2591 | -function geodir_sanitize_location_name( $type, $name, $translate = true ) {
|
|
| 2592 | - if ( $name == '' ) {
|
|
| 2591 | +function geodir_sanitize_location_name($type, $name, $translate = true) {
|
|
| 2592 | + if ($name == '') {
|
|
| 2593 | 2593 | return null; |
| 2594 | 2594 | } |
| 2595 | 2595 | |
@@ -2598,13 +2598,13 @@ discard block |
||
| 2598 | 2598 | $type = $type == 'gd_city' ? 'city' : $type; |
| 2599 | 2599 | |
| 2600 | 2600 | $return = $name; |
| 2601 | - if ( function_exists( 'get_actual_location_name' ) ) {
|
|
| 2602 | - $return = get_actual_location_name( $type, $name, $translate ); |
|
| 2601 | + if (function_exists('get_actual_location_name')) {
|
|
| 2602 | + $return = get_actual_location_name($type, $name, $translate); |
|
| 2603 | 2603 | } else {
|
| 2604 | - $return = preg_replace( '/-(\d+)$/', '', $return ); |
|
| 2605 | - $return = preg_replace( '/[_-]/', ' ', $return ); |
|
| 2606 | - $return = geodir_ucwords( $return ); |
|
| 2607 | - $return = $translate ? __( $return, 'geodirectory' ) : $return; |
|
| 2604 | + $return = preg_replace('/-(\d+)$/', '', $return);
|
|
| 2605 | + $return = preg_replace('/[_-]/', ' ', $return);
|
|
| 2606 | + $return = geodir_ucwords($return); |
|
| 2607 | + $return = $translate ? __($return, 'geodirectory') : $return; |
|
| 2608 | 2608 | } |
| 2609 | 2609 | |
| 2610 | 2610 | return $return; |
@@ -2619,14 +2619,14 @@ discard block |
||
| 2619 | 2619 | * |
| 2620 | 2620 | * @param int $number Comments number. |
| 2621 | 2621 | */ |
| 2622 | -function geodir_comments_number( $number ) {
|
|
| 2622 | +function geodir_comments_number($number) {
|
|
| 2623 | 2623 | |
| 2624 | - if ( $number > 1 ) {
|
|
| 2625 | - $output = str_replace( '%', number_format_i18n( $number ), __( '% Reviews', 'geodirectory' ) ); |
|
| 2626 | - } elseif ( $number == 0 || $number == '' ) {
|
|
| 2627 | - $output = __( 'No Reviews', 'geodirectory' ); |
|
| 2624 | + if ($number > 1) {
|
|
| 2625 | + $output = str_replace('%', number_format_i18n($number), __('% Reviews', 'geodirectory'));
|
|
| 2626 | + } elseif ($number == 0 || $number == '') {
|
|
| 2627 | + $output = __('No Reviews', 'geodirectory');
|
|
| 2628 | 2628 | } else { // must be one
|
| 2629 | - $output = __( '1 Review', 'geodirectory' ); |
|
| 2629 | + $output = __('1 Review', 'geodirectory');
|
|
| 2630 | 2630 | } |
| 2631 | 2631 | echo $output; |
| 2632 | 2632 | } |
@@ -2641,18 +2641,18 @@ discard block |
||
| 2641 | 2641 | */ |
| 2642 | 2642 | function is_page_geodir_home() {
|
| 2643 | 2643 | global $wpdb; |
| 2644 | - $cur_url = str_replace( array( "https://", "http://", "www." ), array( '', '', '' ), geodir_curPageURL() ); |
|
| 2645 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 2646 | - remove_filter( 'home_url', 'geodir_location_geo_home_link', 100000 ); |
|
| 2644 | + $cur_url = str_replace(array("https://", "http://", "www."), array('', '', ''), geodir_curPageURL());
|
|
| 2645 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 2646 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 2647 | 2647 | } |
| 2648 | - $home_url = home_url( '', 'http' ); |
|
| 2649 | - if ( function_exists( 'geodir_location_geo_home_link' ) ) {
|
|
| 2650 | - add_filter( 'home_url', 'geodir_location_geo_home_link', 100000, 2 ); |
|
| 2648 | + $home_url = home_url('', 'http');
|
|
| 2649 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 2650 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 2651 | 2651 | } |
| 2652 | - $home_url = str_replace( "www.", "", $home_url ); |
|
| 2653 | - if ( ( strpos( $home_url, $cur_url ) !== false || strpos( $home_url . '/', $cur_url ) !== false ) && ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) ) {
|
|
| 2652 | + $home_url = str_replace("www.", "", $home_url);
|
|
| 2653 | + if ((strpos($home_url, $cur_url) !== false || strpos($home_url.'/', $cur_url) !== false) && ('page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page'))) {
|
|
| 2654 | 2654 | return true; |
| 2655 | - } elseif ( get_query_var( 'page_id' ) == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && get_option( 'page_on_front' ) == get_option( 'geodir_home_page' ) ) {
|
|
| 2655 | + } elseif (get_query_var('page_id') == get_option('page_on_front') && 'page' == get_option('show_on_front') && get_option('page_on_front') && get_option('page_on_front') == get_option('geodir_home_page')) {
|
|
| 2656 | 2656 | return true; |
| 2657 | 2657 | } else {
|
| 2658 | 2658 | return false; |
@@ -2672,18 +2672,18 @@ discard block |
||
| 2672 | 2672 | * |
| 2673 | 2673 | * @return string The canonical URL. |
| 2674 | 2674 | */ |
| 2675 | -function geodir_wpseo_homepage_canonical( $url ) {
|
|
| 2675 | +function geodir_wpseo_homepage_canonical($url) {
|
|
| 2676 | 2676 | global $post; |
| 2677 | 2677 | |
| 2678 | - if ( is_page_geodir_home() ) {
|
|
| 2678 | + if (is_page_geodir_home()) {
|
|
| 2679 | 2679 | return home_url(); |
| 2680 | 2680 | } |
| 2681 | 2681 | |
| 2682 | 2682 | return $url; |
| 2683 | 2683 | } |
| 2684 | 2684 | |
| 2685 | -add_filter( 'wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10 ); |
|
| 2686 | -add_filter( 'aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10 ); |
|
| 2685 | +add_filter('wpseo_canonical', 'geodir_wpseo_homepage_canonical', 10);
|
|
| 2686 | +add_filter('aioseop_canonical_url', 'geodir_wpseo_homepage_canonical', 10);
|
|
| 2687 | 2687 | |
| 2688 | 2688 | /** |
| 2689 | 2689 | * Add extra fields to google maps script call. |
@@ -2696,20 +2696,20 @@ discard block |
||
| 2696 | 2696 | * |
| 2697 | 2697 | * @return string Modified extra string. |
| 2698 | 2698 | */ |
| 2699 | -function geodir_googlemap_script_extra_details_page( $extra ) {
|
|
| 2699 | +function geodir_googlemap_script_extra_details_page($extra) {
|
|
| 2700 | 2700 | global $post; |
| 2701 | 2701 | $add_google_places_api = false; |
| 2702 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'gd_add_listing' ) ) {
|
|
| 2702 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
|
|
| 2703 | 2703 | $add_google_places_api = true; |
| 2704 | 2704 | } |
| 2705 | - if ( ! str_replace( 'libraries=places', '', $extra ) && ( geodir_is_page( 'detail' ) || $add_google_places_api ) ) {
|
|
| 2705 | + if (!str_replace('libraries=places', '', $extra) && (geodir_is_page('detail') || $add_google_places_api)) {
|
|
| 2706 | 2706 | $extra .= "&libraries=places"; |
| 2707 | 2707 | } |
| 2708 | 2708 | |
| 2709 | 2709 | return $extra; |
| 2710 | 2710 | } |
| 2711 | 2711 | |
| 2712 | -add_filter( 'geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1 ); |
|
| 2712 | +add_filter('geodir_googlemap_script_extra', 'geodir_googlemap_script_extra_details_page', 101, 1);
|
|
| 2713 | 2713 | |
| 2714 | 2714 | |
| 2715 | 2715 | /** |
@@ -2727,99 +2727,99 @@ discard block |
||
| 2727 | 2727 | * after_widget. |
| 2728 | 2728 | * @param array|string $instance The settings for the particular instance of the widget. |
| 2729 | 2729 | */ |
| 2730 | -function geodir_popular_post_category_output( $args = '', $instance = '' ) {
|
|
| 2730 | +function geodir_popular_post_category_output($args = '', $instance = '') {
|
|
| 2731 | 2731 | // prints the widget |
| 2732 | 2732 | global $wpdb, $plugin_prefix, $geodir_post_category_str; |
| 2733 | - extract( $args, EXTR_SKIP ); |
|
| 2733 | + extract($args, EXTR_SKIP); |
|
| 2734 | 2734 | |
| 2735 | 2735 | echo $before_widget; |
| 2736 | 2736 | |
| 2737 | 2737 | /** This filter is documented in geodirectory_widgets.php */ |
| 2738 | - $title = empty( $instance['title'] ) ? __( 'Popular Categories', 'geodirectory' ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
| 2738 | + $title = empty($instance['title']) ? __('Popular Categories', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 2739 | 2739 | |
| 2740 | 2740 | $gd_post_type = geodir_get_current_posttype(); |
| 2741 | 2741 | |
| 2742 | - $category_limit = isset( $instance['category_limit'] ) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
| 2743 | - if ( ! empty( $gd_post_type ) ) {
|
|
| 2742 | + $category_limit = isset($instance['category_limit']) && $instance['category_limit'] > 0 ? (int) $instance['category_limit'] : 15; |
|
| 2743 | + if (!empty($gd_post_type)) {
|
|
| 2744 | 2744 | $default_post_type = $gd_post_type; |
| 2745 | - } elseif ( isset( $instance['default_post_type'] ) && gdsc_is_post_type_valid( $instance['default_post_type'] ) ) {
|
|
| 2745 | + } elseif (isset($instance['default_post_type']) && gdsc_is_post_type_valid($instance['default_post_type'])) {
|
|
| 2746 | 2746 | $default_post_type = $instance['default_post_type']; |
| 2747 | 2747 | } else {
|
| 2748 | 2748 | $all_gd_post_type = geodir_get_posttypes(); |
| 2749 | - $default_post_type = ( isset( $all_gd_post_type[0] ) ) ? $all_gd_post_type[0] : ''; |
|
| 2749 | + $default_post_type = (isset($all_gd_post_type[0])) ? $all_gd_post_type[0] : ''; |
|
| 2750 | 2750 | } |
| 2751 | - $parent_only = !empty( $instance['parent_only'] ) ? true : false; |
|
| 2751 | + $parent_only = !empty($instance['parent_only']) ? true : false; |
|
| 2752 | 2752 | |
| 2753 | 2753 | $taxonomy = array(); |
| 2754 | - if ( ! empty( $gd_post_type ) ) {
|
|
| 2755 | - $taxonomy[] = $gd_post_type . "category"; |
|
| 2754 | + if (!empty($gd_post_type)) {
|
|
| 2755 | + $taxonomy[] = $gd_post_type."category"; |
|
| 2756 | 2756 | } else {
|
| 2757 | - $taxonomy = geodir_get_taxonomies( $gd_post_type ); |
|
| 2757 | + $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 2758 | 2758 | } |
| 2759 | 2759 | |
| 2760 | - $term_args = array( 'taxonomy' => $taxonomy ); |
|
| 2761 | - if ( $parent_only ) {
|
|
| 2760 | + $term_args = array('taxonomy' => $taxonomy);
|
|
| 2761 | + if ($parent_only) {
|
|
| 2762 | 2762 | $term_args['parent'] = 0; |
| 2763 | 2763 | } |
| 2764 | 2764 | |
| 2765 | - $terms = get_terms( $term_args ); |
|
| 2765 | + $terms = get_terms($term_args); |
|
| 2766 | 2766 | $a_terms = array(); |
| 2767 | 2767 | $b_terms = array(); |
| 2768 | 2768 | |
| 2769 | - foreach ( $terms as $term ) {
|
|
| 2770 | - if ( $term->count > 0 ) {
|
|
| 2771 | - $a_terms[ $term->taxonomy ][] = $term; |
|
| 2769 | + foreach ($terms as $term) {
|
|
| 2770 | + if ($term->count > 0) {
|
|
| 2771 | + $a_terms[$term->taxonomy][] = $term; |
|
| 2772 | 2772 | } |
| 2773 | 2773 | } |
| 2774 | 2774 | |
| 2775 | - if ( ! empty( $a_terms ) ) {
|
|
| 2776 | - foreach ( $a_terms as $b_key => $b_val ) {
|
|
| 2777 | - $b_terms[ $b_key ] = geodir_sort_terms( $b_val, 'count' ); |
|
| 2775 | + if (!empty($a_terms)) {
|
|
| 2776 | + foreach ($a_terms as $b_key => $b_val) {
|
|
| 2777 | + $b_terms[$b_key] = geodir_sort_terms($b_val, 'count'); |
|
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | - $default_taxonomy = $default_post_type != '' && isset( $b_terms[ $default_post_type . 'category' ] ) ? $default_post_type . 'category' : ''; |
|
| 2780 | + $default_taxonomy = $default_post_type != '' && isset($b_terms[$default_post_type.'category']) ? $default_post_type.'category' : ''; |
|
| 2781 | 2781 | |
| 2782 | 2782 | $tax_change_output = ''; |
| 2783 | - if ( count( $b_terms ) > 1 ) {
|
|
| 2784 | - $tax_change_output .= "<select data-limit='$category_limit' data-parent='" . (int)$parent_only . "' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
| 2785 | - foreach ( $b_terms as $key => $val ) {
|
|
| 2786 | - $ptype = get_post_type_object( str_replace( "category", "", $key ) ); |
|
| 2787 | - $cpt_name = __( $ptype->labels->singular_name, 'geodirectory' ); |
|
| 2788 | - $tax_change_output .= "<option value='$key' " . selected( $key, $default_taxonomy, false ) . ">" . sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ) . "</option>"; |
|
| 2783 | + if (count($b_terms) > 1) {
|
|
| 2784 | + $tax_change_output .= "<select data-limit='$category_limit' data-parent='".(int) $parent_only."' class='geodir-cat-list-tax' onchange='geodir_get_post_term(this);'>"; |
|
| 2785 | + foreach ($b_terms as $key => $val) {
|
|
| 2786 | + $ptype = get_post_type_object(str_replace("category", "", $key));
|
|
| 2787 | + $cpt_name = __($ptype->labels->singular_name, 'geodirectory'); |
|
| 2788 | + $tax_change_output .= "<option value='$key' ".selected($key, $default_taxonomy, false).">".sprintf(__('%s Categories', 'geodirectory'), $cpt_name)."</option>";
|
|
| 2789 | 2789 | } |
| 2790 | 2790 | $tax_change_output .= "</select>"; |
| 2791 | 2791 | } |
| 2792 | 2792 | |
| 2793 | - if ( ! empty( $b_terms ) ) {
|
|
| 2794 | - $terms = $default_taxonomy != '' && isset( $b_terms[ $default_taxonomy ] ) ? $b_terms[ $default_taxonomy ] : reset( $b_terms );// get the first array |
|
| 2795 | - global $cat_count;//make global so we can change via function |
|
| 2793 | + if (!empty($b_terms)) {
|
|
| 2794 | + $terms = $default_taxonomy != '' && isset($b_terms[$default_taxonomy]) ? $b_terms[$default_taxonomy] : reset($b_terms); // get the first array |
|
| 2795 | + global $cat_count; //make global so we can change via function |
|
| 2796 | 2796 | $cat_count = 0; |
| 2797 | 2797 | ?> |
| 2798 | 2798 | <div class="geodir-category-list-in clearfix"> |
| 2799 | 2799 | <div class="geodir-cat-list clearfix"> |
| 2800 | 2800 | <?php |
| 2801 | - echo $before_title . __( $title ) . $after_title; |
|
| 2801 | + echo $before_title.__($title).$after_title; |
|
| 2802 | 2802 | |
| 2803 | 2803 | echo $tax_change_output; |
| 2804 | 2804 | |
| 2805 | 2805 | echo '<ul class="geodir-popular-cat-list">'; |
| 2806 | 2806 | |
| 2807 | - geodir_helper_cat_list_output( $terms, $category_limit ); |
|
| 2807 | + geodir_helper_cat_list_output($terms, $category_limit); |
|
| 2808 | 2808 | |
| 2809 | 2809 | echo '</ul>'; |
| 2810 | 2810 | ?> |
| 2811 | 2811 | </div> |
| 2812 | 2812 | <?php |
| 2813 | 2813 | $hide = ''; |
| 2814 | - if ( $cat_count < $category_limit ) {
|
|
| 2814 | + if ($cat_count < $category_limit) {
|
|
| 2815 | 2815 | $hide = 'style="display:none;"'; |
| 2816 | 2816 | } |
| 2817 | 2817 | echo "<div class='geodir-cat-list-more' $hide >"; |
| 2818 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">' . __( 'More Categories', 'geodirectory' ) . '</a>'; |
|
| 2819 | - echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">' . __( 'Less Categories', 'geodirectory' ) . '</a>'; |
|
| 2818 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-showcat">'.__('More Categories', 'geodirectory').'</a>';
|
|
| 2819 | + echo '<a href="javascript:void(0)" class="geodir-morecat geodir-hidecat geodir-hide">'.__('Less Categories', 'geodirectory').'</a>';
|
|
| 2820 | 2820 | echo "</div>"; |
| 2821 | 2821 | /* add scripts */ |
| 2822 | - add_action( 'wp_footer', 'geodir_popular_category_add_scripts', 100 ); |
|
| 2822 | + add_action('wp_footer', 'geodir_popular_category_add_scripts', 100);
|
|
| 2823 | 2823 | ?> |
| 2824 | 2824 | </div> |
| 2825 | 2825 | <?php |
@@ -2838,25 +2838,25 @@ discard block |
||
| 2838 | 2838 | * @param array $terms An array of term objects. |
| 2839 | 2839 | * @param int $category_limit Number of categories to display by default. |
| 2840 | 2840 | */ |
| 2841 | -function geodir_helper_cat_list_output( $terms, $category_limit ) {
|
|
| 2841 | +function geodir_helper_cat_list_output($terms, $category_limit) {
|
|
| 2842 | 2842 | global $geodir_post_category_str, $cat_count; |
| 2843 | 2843 | $term_icons = geodir_get_term_icon(); |
| 2844 | 2844 | |
| 2845 | 2845 | $geodir_post_category_str = array(); |
| 2846 | 2846 | |
| 2847 | 2847 | |
| 2848 | - foreach ( $terms as $cat ) {
|
|
| 2849 | - $post_type = str_replace( "category", "", $cat->taxonomy ); |
|
| 2850 | - $term_icon_url = ! empty( $term_icons ) && isset( $term_icons[ $cat->term_id ] ) ? $term_icons[ $cat->term_id ] : ''; |
|
| 2848 | + foreach ($terms as $cat) {
|
|
| 2849 | + $post_type = str_replace("category", "", $cat->taxonomy);
|
|
| 2850 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$cat->term_id]) ? $term_icons[$cat->term_id] : ''; |
|
| 2851 | 2851 | |
| 2852 | - $cat_count ++; |
|
| 2852 | + $cat_count++; |
|
| 2853 | 2853 | |
| 2854 | - $geodir_post_category_str[] = array( 'posttype' => $post_type, 'termid' => $cat->term_id ); |
|
| 2854 | + $geodir_post_category_str[] = array('posttype' => $post_type, 'termid' => $cat->term_id);
|
|
| 2855 | 2855 | |
| 2856 | 2856 | $class_row = $cat_count > $category_limit ? 'geodir-pcat-hide geodir-hide' : 'geodir-pcat-show'; |
| 2857 | 2857 | $total_post = $cat->count; |
| 2858 | 2858 | |
| 2859 | - $term_link = get_term_link( $cat, $cat->taxonomy ); |
|
| 2859 | + $term_link = get_term_link($cat, $cat->taxonomy); |
|
| 2860 | 2860 | /** |
| 2861 | 2861 | * Filer the category term link. |
| 2862 | 2862 | * |
@@ -2866,11 +2866,11 @@ discard block |
||
| 2866 | 2866 | * @param int $cat ->term_id The term id. |
| 2867 | 2867 | * @param string $post_type Wordpress post type. |
| 2868 | 2868 | */ |
| 2869 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $cat->term_id, $post_type ); |
|
| 2869 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $cat->term_id, $post_type);
|
|
| 2870 | 2870 | |
| 2871 | - echo '<li class="' . $class_row . '"><a href="' . $term_link . '">'; |
|
| 2872 | - echo '<img alt="' . esc_attr( $cat->name ) . ' icon" style="height:20px;vertical-align:middle;" src="' . $term_icon_url . '"/> <span class="cat-link">'; |
|
| 2873 | - echo $cat->name . '</span> <span class="geodir_term_class geodir_link_span geodir_category_class_' . $post_type . '_' . $cat->term_id . '">(' . $total_post . ')</span> ';
|
|
| 2871 | + echo '<li class="'.$class_row.'"><a href="'.$term_link.'">'; |
|
| 2872 | + echo '<img alt="'.esc_attr($cat->name).' icon" style="height:20px;vertical-align:middle;" src="'.$term_icon_url.'"/> <span class="cat-link">'; |
|
| 2873 | + echo $cat->name.'</span> <span class="geodir_term_class geodir_link_span geodir_category_class_'.$post_type.'_'.$cat->term_id.'">('.$total_post.')</span> ';
|
|
| 2874 | 2874 | echo '</a></li>'; |
| 2875 | 2875 | } |
| 2876 | 2876 | } |
@@ -2885,14 +2885,14 @@ discard block |
||
| 2885 | 2885 | * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget. |
| 2886 | 2886 | * @param array|string $instance The settings for the particular instance of the widget. |
| 2887 | 2887 | */ |
| 2888 | -function geodir_listing_slider_widget_output( $args = '', $instance = '' ) {
|
|
| 2888 | +function geodir_listing_slider_widget_output($args = '', $instance = '') {
|
|
| 2889 | 2889 | // prints the widget |
| 2890 | - extract( $args, EXTR_SKIP ); |
|
| 2890 | + extract($args, EXTR_SKIP); |
|
| 2891 | 2891 | |
| 2892 | 2892 | echo $before_widget; |
| 2893 | 2893 | |
| 2894 | 2894 | /** This filter is documented in geodirectory_widgets.php */ |
| 2895 | - $title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
| 2895 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 2896 | 2896 | /** |
| 2897 | 2897 | * Filter the widget post type. |
| 2898 | 2898 | * |
@@ -2900,7 +2900,7 @@ discard block |
||
| 2900 | 2900 | * |
| 2901 | 2901 | * @param string $instance ['post_type'] Post type of listing. |
| 2902 | 2902 | */ |
| 2903 | - $post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] ); |
|
| 2903 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
|
|
| 2904 | 2904 | /** |
| 2905 | 2905 | * Filter the widget's term. |
| 2906 | 2906 | * |
@@ -2908,7 +2908,7 @@ discard block |
||
| 2908 | 2908 | * |
| 2909 | 2909 | * @param string $instance ['category'] Filter by term. Can be any valid term. |
| 2910 | 2910 | */ |
| 2911 | - $category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] ); |
|
| 2911 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
|
|
| 2912 | 2912 | /** |
| 2913 | 2913 | * Filter widget's "add_location_filter" value. |
| 2914 | 2914 | * |
@@ -2916,7 +2916,7 @@ discard block |
||
| 2916 | 2916 | * |
| 2917 | 2917 | * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0. |
| 2918 | 2918 | */ |
| 2919 | - $add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] ); |
|
| 2919 | + $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
|
|
| 2920 | 2920 | /** |
| 2921 | 2921 | * Filter the widget listings limit. |
| 2922 | 2922 | * |
@@ -2924,7 +2924,7 @@ discard block |
||
| 2924 | 2924 | * |
| 2925 | 2925 | * @param string $instance ['post_number'] Number of listings to display. |
| 2926 | 2926 | */ |
| 2927 | - $post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] ); |
|
| 2927 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
|
|
| 2928 | 2928 | /** |
| 2929 | 2929 | * Filter the widget listings limit shown at one time. |
| 2930 | 2930 | * |
@@ -2932,7 +2932,7 @@ discard block |
||
| 2932 | 2932 | * |
| 2933 | 2933 | * @param string $instance ['max_show'] Number of listings to display on screen. |
| 2934 | 2934 | */ |
| 2935 | - $max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] ); |
|
| 2935 | + $max_show = empty($instance['max_show']) ? '1' : apply_filters('widget_max_show', $instance['max_show']);
|
|
| 2936 | 2936 | /** |
| 2937 | 2937 | * Filter the widget slide width. |
| 2938 | 2938 | * |
@@ -2940,7 +2940,7 @@ discard block |
||
| 2940 | 2940 | * |
| 2941 | 2941 | * @param string $instance ['slide_width'] Width of the slides shown. |
| 2942 | 2942 | */ |
| 2943 | - $slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] ); |
|
| 2943 | + $slide_width = empty($instance['slide_width']) ? '' : apply_filters('widget_slide_width', $instance['slide_width']);
|
|
| 2944 | 2944 | /** |
| 2945 | 2945 | * Filter widget's "show title" value. |
| 2946 | 2946 | * |
@@ -2948,7 +2948,7 @@ discard block |
||
| 2948 | 2948 | * |
| 2949 | 2949 | * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0. |
| 2950 | 2950 | */ |
| 2951 | - $show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] ); |
|
| 2951 | + $show_title = empty($instance['show_title']) ? '' : apply_filters('widget_show_title', $instance['show_title']);
|
|
| 2952 | 2952 | /** |
| 2953 | 2953 | * Filter widget's "slideshow" value. |
| 2954 | 2954 | * |
@@ -2956,7 +2956,7 @@ discard block |
||
| 2956 | 2956 | * |
| 2957 | 2957 | * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically. |
| 2958 | 2958 | */ |
| 2959 | - $slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] ); |
|
| 2959 | + $slideshow = empty($instance['slideshow']) ? 0 : apply_filters('widget_slideshow', $instance['slideshow']);
|
|
| 2960 | 2960 | /** |
| 2961 | 2961 | * Filter widget's "animationLoop" value. |
| 2962 | 2962 | * |
@@ -2964,7 +2964,7 @@ discard block |
||
| 2964 | 2964 | * |
| 2965 | 2965 | * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop. |
| 2966 | 2966 | */ |
| 2967 | - $animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] ); |
|
| 2967 | + $animationLoop = empty($instance['animationLoop']) ? 0 : apply_filters('widget_animationLoop', $instance['animationLoop']);
|
|
| 2968 | 2968 | /** |
| 2969 | 2969 | * Filter widget's "directionNav" value. |
| 2970 | 2970 | * |
@@ -2972,7 +2972,7 @@ discard block |
||
| 2972 | 2972 | * |
| 2973 | 2973 | * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0. |
| 2974 | 2974 | */ |
| 2975 | - $directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] ); |
|
| 2975 | + $directionNav = empty($instance['directionNav']) ? 0 : apply_filters('widget_directionNav', $instance['directionNav']);
|
|
| 2976 | 2976 | /** |
| 2977 | 2977 | * Filter widget's "slideshowSpeed" value. |
| 2978 | 2978 | * |
@@ -2980,7 +2980,7 @@ discard block |
||
| 2980 | 2980 | * |
| 2981 | 2981 | * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds. |
| 2982 | 2982 | */ |
| 2983 | - $slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] ); |
|
| 2983 | + $slideshowSpeed = empty($instance['slideshowSpeed']) ? 5000 : apply_filters('widget_slideshowSpeed', $instance['slideshowSpeed']);
|
|
| 2984 | 2984 | /** |
| 2985 | 2985 | * Filter widget's "animationSpeed" value. |
| 2986 | 2986 | * |
@@ -2988,7 +2988,7 @@ discard block |
||
| 2988 | 2988 | * |
| 2989 | 2989 | * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds. |
| 2990 | 2990 | */ |
| 2991 | - $animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] ); |
|
| 2991 | + $animationSpeed = empty($instance['animationSpeed']) ? 600 : apply_filters('widget_animationSpeed', $instance['animationSpeed']);
|
|
| 2992 | 2992 | /** |
| 2993 | 2993 | * Filter widget's "animation" value. |
| 2994 | 2994 | * |
@@ -2996,7 +2996,7 @@ discard block |
||
| 2996 | 2996 | * |
| 2997 | 2997 | * @param string $instance ['animation'] Controls the animation type, "fade" or "slide". |
| 2998 | 2998 | */ |
| 2999 | - $animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] ); |
|
| 2999 | + $animation = empty($instance['animation']) ? 'slide' : apply_filters('widget_animation', $instance['animation']);
|
|
| 3000 | 3000 | /** |
| 3001 | 3001 | * Filter widget's "list_sort" type. |
| 3002 | 3002 | * |
@@ -3004,10 +3004,10 @@ discard block |
||
| 3004 | 3004 | * |
| 3005 | 3005 | * @param string $instance ['list_sort'] Listing sort by type. |
| 3006 | 3006 | */ |
| 3007 | - $list_sort = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] ); |
|
| 3008 | - $show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null; |
|
| 3007 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
|
|
| 3008 | + $show_featured_only = !empty($instance['show_featured_only']) ? 1 : null; |
|
| 3009 | 3009 | |
| 3010 | - wp_enqueue_script( 'geodirectory-jquery-flexslider-js' ); |
|
| 3010 | + wp_enqueue_script('geodirectory-jquery-flexslider-js');
|
|
| 3011 | 3011 | ?> |
| 3012 | 3012 | <script type="text/javascript"> |
| 3013 | 3013 | jQuery(window).load(function () {
|
@@ -3022,23 +3022,23 @@ discard block |
||
| 3022 | 3022 | itemWidth: 75, |
| 3023 | 3023 | itemMargin: 5, |
| 3024 | 3024 | asNavFor: '#geodir_widget_slider', |
| 3025 | - rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
| 3025 | + rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
| 3026 | 3026 | }); |
| 3027 | 3027 | |
| 3028 | 3028 | jQuery('#geodir_widget_slider').flexslider({
|
| 3029 | - animation: "<?php echo $animation;?>", |
|
| 3029 | + animation: "<?php echo $animation; ?>", |
|
| 3030 | 3030 | selector: ".geodir-slides > li", |
| 3031 | 3031 | namespace: "geodir-", |
| 3032 | 3032 | controlNav: true, |
| 3033 | - animationLoop: <?php echo $animationLoop;?>, |
|
| 3034 | - slideshow: <?php echo $slideshow;?>, |
|
| 3035 | - slideshowSpeed: <?php echo $slideshowSpeed;?>, |
|
| 3036 | - animationSpeed: <?php echo $animationSpeed;?>, |
|
| 3037 | - directionNav: <?php echo $directionNav;?>, |
|
| 3038 | - maxItems: <?php echo $max_show;?>, |
|
| 3033 | + animationLoop: <?php echo $animationLoop; ?>, |
|
| 3034 | + slideshow: <?php echo $slideshow; ?>, |
|
| 3035 | + slideshowSpeed: <?php echo $slideshowSpeed; ?>, |
|
| 3036 | + animationSpeed: <?php echo $animationSpeed; ?>, |
|
| 3037 | + directionNav: <?php echo $directionNav; ?>, |
|
| 3038 | + maxItems: <?php echo $max_show; ?>, |
|
| 3039 | 3039 | move: 1, |
| 3040 | - <?php if ( $slide_width ) {
|
|
| 3041 | - echo "itemWidth: " . $slide_width . ","; |
|
| 3040 | + <?php if ($slide_width) {
|
|
| 3041 | + echo "itemWidth: ".$slide_width.","; |
|
| 3042 | 3042 | }?> |
| 3043 | 3043 | sync: "#geodir_widget_carousel", |
| 3044 | 3044 | start: function (slider) {
|
@@ -3046,7 +3046,7 @@ discard block |
||
| 3046 | 3046 | jQuery('#geodir_widget_slider').css({'visibility': 'visible'});
|
| 3047 | 3047 | jQuery('#geodir_widget_carousel').css({'visibility': 'visible'});
|
| 3048 | 3048 | }, |
| 3049 | - rtl: <?php echo( is_rtl() ? 'true' : 'false' ); /* fix rtl issue */ ?> |
|
| 3049 | + rtl: <?php echo(is_rtl() ? 'true' : 'false'); /* fix rtl issue */ ?> |
|
| 3050 | 3050 | }); |
| 3051 | 3051 | }); |
| 3052 | 3052 | </script> |
@@ -3059,62 +3059,62 @@ discard block |
||
| 3059 | 3059 | 'order_by' => $list_sort |
| 3060 | 3060 | ); |
| 3061 | 3061 | |
| 3062 | - if ( $show_featured_only ) {
|
|
| 3062 | + if ($show_featured_only) {
|
|
| 3063 | 3063 | $query_args['show_featured_only'] = 1; |
| 3064 | 3064 | } |
| 3065 | 3065 | |
| 3066 | - if ( $category != 0 || $category != '' ) {
|
|
| 3067 | - $category_taxonomy = geodir_get_taxonomies( $post_type ); |
|
| 3066 | + if ($category != 0 || $category != '') {
|
|
| 3067 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 3068 | 3068 | $tax_query = array( |
| 3069 | 3069 | 'taxonomy' => $category_taxonomy[0], |
| 3070 | 3070 | 'field' => 'id', |
| 3071 | 3071 | 'terms' => $category |
| 3072 | 3072 | ); |
| 3073 | 3073 | |
| 3074 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 3074 | + $query_args['tax_query'] = array($tax_query); |
|
| 3075 | 3075 | } |
| 3076 | 3076 | |
| 3077 | 3077 | // we want listings with featured image only |
| 3078 | 3078 | $query_args['featured_image_only'] = 1; |
| 3079 | 3079 | |
| 3080 | - if ( $post_type == 'gd_event' ) {
|
|
| 3080 | + if ($post_type == 'gd_event') {
|
|
| 3081 | 3081 | $query_args['gedir_event_listing_filter'] = 'upcoming'; |
| 3082 | 3082 | }// show only upcoming events |
| 3083 | 3083 | |
| 3084 | - $widget_listings = geodir_get_widget_listings( $query_args ); |
|
| 3085 | - if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) {
|
|
| 3086 | - if ( $title ) {
|
|
| 3087 | - echo $before_title . $title . $after_title; |
|
| 3084 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
| 3085 | + if (!empty($widget_listings) || (isset($with_no_results) && $with_no_results)) {
|
|
| 3086 | + if ($title) {
|
|
| 3087 | + echo $before_title.$title.$after_title; |
|
| 3088 | 3088 | } |
| 3089 | 3089 | |
| 3090 | 3090 | global $post; |
| 3091 | 3091 | |
| 3092 | - $current_post = $post;// keep current post info |
|
| 3092 | + $current_post = $post; // keep current post info |
|
| 3093 | 3093 | |
| 3094 | 3094 | $widget_main_slides = ''; |
| 3095 | 3095 | $nav_slides = ''; |
| 3096 | 3096 | $widget_slides = 0; |
| 3097 | 3097 | |
| 3098 | - foreach ( $widget_listings as $widget_listing ) {
|
|
| 3098 | + foreach ($widget_listings as $widget_listing) {
|
|
| 3099 | 3099 | global $gd_widget_listing_type; |
| 3100 | 3100 | $post = $widget_listing; |
| 3101 | - $widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) ); |
|
| 3101 | + $widget_image = geodir_get_featured_image($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 3102 | 3102 | |
| 3103 | - if ( ! empty( $widget_image ) ) {
|
|
| 3104 | - if ( $widget_image->height >= 200 ) {
|
|
| 3103 | + if (!empty($widget_image)) {
|
|
| 3104 | + if ($widget_image->height >= 200) {
|
|
| 3105 | 3105 | $widget_spacer_height = 0; |
| 3106 | 3106 | } else {
|
| 3107 | - $widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 ); |
|
| 3107 | + $widget_spacer_height = ((200 - $widget_image->height) / 2); |
|
| 3108 | 3108 | } |
| 3109 | 3109 | |
| 3110 | - $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:' . $widget_spacer_height . 'px !important;margin:0 auto;" width="100" />'; |
|
| 3110 | + $widget_main_slides .= '<li class="geodir-listing-slider-widget"><img class="geodir-listing-slider-spacer" src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:'.$widget_spacer_height.'px !important;margin:0 auto;" width="100" />'; |
|
| 3111 | 3111 | |
| 3112 | 3112 | $title = ''; |
| 3113 | - if ( $show_title ) {
|
|
| 3114 | - $title_html = '<div class="geodir-slider-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a></div>'; |
|
| 3113 | + if ($show_title) {
|
|
| 3114 | + $title_html = '<div class="geodir-slider-title"><a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a></div>'; |
|
| 3115 | 3115 | $post_id = $post->ID; |
| 3116 | - $post_permalink = get_permalink( $post->ID ); |
|
| 3117 | - $post_title = get_the_title( $post->ID ); |
|
| 3116 | + $post_permalink = get_permalink($post->ID); |
|
| 3117 | + $post_title = get_the_title($post->ID); |
|
| 3118 | 3118 | /** |
| 3119 | 3119 | * Filter the listing slider widget title. |
| 3120 | 3120 | * |
@@ -3125,12 +3125,12 @@ discard block |
||
| 3125 | 3125 | * @param string $post_permalink The post permalink url. |
| 3126 | 3126 | * @param string $post_title The post title text. |
| 3127 | 3127 | */ |
| 3128 | - $title = apply_filters( 'geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title ); |
|
| 3128 | + $title = apply_filters('geodir_listing_slider_title', $title_html, $post_id, $post_permalink, $post_title);
|
|
| 3129 | 3129 | } |
| 3130 | 3130 | |
| 3131 | - $widget_main_slides .= $title . '<img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:200px;margin:0 auto;" /></li>'; |
|
| 3132 | - $nav_slides .= '<li><img src="' . $widget_image->src . '" alt="' . $widget_image->title . '" title="' . $widget_image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 3133 | - $widget_slides ++; |
|
| 3131 | + $widget_main_slides .= $title.'<img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:200px;margin:0 auto;" /></li>'; |
|
| 3132 | + $nav_slides .= '<li><img src="'.$widget_image->src.'" alt="'.$widget_image->title.'" title="'.$widget_image->title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 3133 | + $widget_slides++; |
|
| 3134 | 3134 | } |
| 3135 | 3135 | } |
| 3136 | 3136 | ?> |
@@ -3139,7 +3139,7 @@ discard block |
||
| 3139 | 3139 | <div id="geodir_widget_slider" class="geodir_flexslider"> |
| 3140 | 3140 | <ul class="geodir-slides clearfix"><?php echo $widget_main_slides; ?></ul> |
| 3141 | 3141 | </div> |
| 3142 | - <?php if ( $widget_slides > 1 ) { ?>
|
|
| 3142 | + <?php if ($widget_slides > 1) { ?>
|
|
| 3143 | 3143 | <div id="geodir_widget_carousel" class="geodir_flexslider"> |
| 3144 | 3144 | <ul class="geodir-slides clearfix"><?php echo $nav_slides; ?></ul> |
| 3145 | 3145 | </div> |
@@ -3147,7 +3147,7 @@ discard block |
||
| 3147 | 3147 | </div> |
| 3148 | 3148 | <?php |
| 3149 | 3149 | $GLOBALS['post'] = $current_post; |
| 3150 | - setup_postdata( $current_post ); |
|
| 3150 | + setup_postdata($current_post); |
|
| 3151 | 3151 | } |
| 3152 | 3152 | echo $after_widget; |
| 3153 | 3153 | } |
@@ -3163,46 +3163,46 @@ discard block |
||
| 3163 | 3163 | * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget. |
| 3164 | 3164 | * @param array|string $instance The settings for the particular instance of the widget. |
| 3165 | 3165 | */ |
| 3166 | -function geodir_loginwidget_output( $args = '', $instance = '' ) {
|
|
| 3166 | +function geodir_loginwidget_output($args = '', $instance = '') {
|
|
| 3167 | 3167 | //print_r($args); |
| 3168 | 3168 | //print_r($instance); |
| 3169 | 3169 | // prints the widget |
| 3170 | - extract( $args, EXTR_SKIP ); |
|
| 3170 | + extract($args, EXTR_SKIP); |
|
| 3171 | 3171 | |
| 3172 | 3172 | /** This filter is documented in geodirectory_widgets.php */ |
| 3173 | - $title = empty( $instance['title'] ) ? __( 'My Dashboard', 'geodirectory' ) : apply_filters( 'my_dashboard_widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
| 3173 | + $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('my_dashboard_widget_title', __($instance['title'], 'geodirectory'));
|
|
| 3174 | 3174 | |
| 3175 | 3175 | echo $before_widget; |
| 3176 | - echo $before_title . $title . $after_title; |
|
| 3176 | + echo $before_title.$title.$after_title; |
|
| 3177 | 3177 | |
| 3178 | - if ( is_user_logged_in() ) {
|
|
| 3178 | + if (is_user_logged_in()) {
|
|
| 3179 | 3179 | global $current_user; |
| 3180 | 3180 | |
| 3181 | - $author_link = get_author_posts_url( $current_user->data->ID ); |
|
| 3182 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 3181 | + $author_link = get_author_posts_url($current_user->data->ID); |
|
| 3182 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
|
|
| 3183 | 3183 | |
| 3184 | 3184 | echo '<ul class="geodir-loginbox-list">'; |
| 3185 | 3185 | ob_start(); |
| 3186 | 3186 | ?> |
| 3187 | 3187 | <li><a class="signin" |
| 3188 | - href="<?php echo wp_logout_url( home_url() ); ?>"><?php _e( 'Logout', 'geodirectory' ); ?></a></li> |
|
| 3188 | + href="<?php echo wp_logout_url(home_url()); ?>"><?php _e('Logout', 'geodirectory'); ?></a></li>
|
|
| 3189 | 3189 | <?php |
| 3190 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 3191 | - $show_add_listing_post_types_main_nav = get_option( 'geodir_add_listing_link_user_dashboard' ); |
|
| 3192 | - $geodir_allow_posttype_frontend = get_option( 'geodir_allow_posttype_frontend' ); |
|
| 3190 | + $post_types = geodir_get_posttypes('object');
|
|
| 3191 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
|
|
| 3192 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 3193 | 3193 | |
| 3194 | - if ( ! empty( $show_add_listing_post_types_main_nav ) ) {
|
|
| 3194 | + if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 3195 | 3195 | $addlisting_links = ''; |
| 3196 | - foreach ( $post_types as $key => $postobj ) {
|
|
| 3196 | + foreach ($post_types as $key => $postobj) {
|
|
| 3197 | 3197 | |
| 3198 | - if ( in_array( $key, $show_add_listing_post_types_main_nav ) ) {
|
|
| 3198 | + if (in_array($key, $show_add_listing_post_types_main_nav)) {
|
|
| 3199 | 3199 | |
| 3200 | - if ( $add_link = geodir_get_addlisting_link( $key ) ) {
|
|
| 3200 | + if ($add_link = geodir_get_addlisting_link($key)) {
|
|
| 3201 | 3201 | |
| 3202 | 3202 | $name = $postobj->labels->name; |
| 3203 | 3203 | |
| 3204 | 3204 | $selected = ''; |
| 3205 | - if ( geodir_get_current_posttype() == $key && geodir_is_page( 'add-listing' ) ) {
|
|
| 3205 | + if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
|
|
| 3206 | 3206 | $selected = 'selected="selected"'; |
| 3207 | 3207 | } |
| 3208 | 3208 | |
@@ -3215,22 +3215,22 @@ discard block |
||
| 3215 | 3215 | * @param string $key Add listing array key. |
| 3216 | 3216 | * @param int $current_user ->ID Current user ID. |
| 3217 | 3217 | */ |
| 3218 | - $add_link = apply_filters( 'geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID ); |
|
| 3218 | + $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
|
|
| 3219 | 3219 | |
| 3220 | - $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
| 3220 | + $addlisting_links .= '<option '.$selected.' value="'.$add_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 3221 | 3221 | |
| 3222 | 3222 | } |
| 3223 | 3223 | } |
| 3224 | 3224 | |
| 3225 | 3225 | } |
| 3226 | 3226 | |
| 3227 | - if ( $addlisting_links != '' ) { ?>
|
|
| 3227 | + if ($addlisting_links != '') { ?>
|
|
| 3228 | 3228 | |
| 3229 | 3229 | <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value" |
| 3230 | 3230 | option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false" |
| 3231 | - data-placeholder="<?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?>"> |
|
| 3231 | + data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?>">
|
|
| 3232 | 3232 | <option value="" disabled="disabled" selected="selected" |
| 3233 | - style='display:none;'><?php echo esc_attr( __( 'Add Listing', 'geodirectory' ) ); ?></option> |
|
| 3233 | + style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?></option>
|
|
| 3234 | 3234 | <?php echo $addlisting_links; ?> |
| 3235 | 3235 | </select></li> <?php |
| 3236 | 3236 | |
@@ -3238,23 +3238,23 @@ discard block |
||
| 3238 | 3238 | |
| 3239 | 3239 | } |
| 3240 | 3240 | // My Favourites in Dashboard |
| 3241 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
| 3241 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
|
|
| 3242 | 3242 | $user_favourite = geodir_user_favourite_listing_count(); |
| 3243 | 3243 | |
| 3244 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) {
|
|
| 3244 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
|
|
| 3245 | 3245 | $favourite_links = ''; |
| 3246 | 3246 | |
| 3247 | - foreach ( $post_types as $key => $postobj ) {
|
|
| 3248 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) {
|
|
| 3247 | + foreach ($post_types as $key => $postobj) {
|
|
| 3248 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
|
|
| 3249 | 3249 | $name = $postobj->labels->name; |
| 3250 | - $post_type_link = geodir_getlink( $author_link, array( |
|
| 3250 | + $post_type_link = geodir_getlink($author_link, array( |
|
| 3251 | 3251 | 'stype' => $key, |
| 3252 | 3252 | 'list' => 'favourite' |
| 3253 | - ), false ); |
|
| 3253 | + ), false); |
|
| 3254 | 3254 | |
| 3255 | 3255 | $selected = ''; |
| 3256 | 3256 | |
| 3257 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) {
|
|
| 3257 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
|
|
| 3258 | 3258 | $selected = 'selected="selected"'; |
| 3259 | 3259 | } |
| 3260 | 3260 | /** |
@@ -3266,20 +3266,20 @@ discard block |
||
| 3266 | 3266 | * @param string $key Favorite listing array key. |
| 3267 | 3267 | * @param int $current_user ->ID Current user ID. |
| 3268 | 3268 | */ |
| 3269 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID ); |
|
| 3269 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID);
|
|
| 3270 | 3270 | |
| 3271 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
| 3271 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 3272 | 3272 | } |
| 3273 | 3273 | } |
| 3274 | 3274 | |
| 3275 | - if ( $favourite_links != '' ) {
|
|
| 3275 | + if ($favourite_links != '') {
|
|
| 3276 | 3276 | ?> |
| 3277 | 3277 | <li> |
| 3278 | 3278 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" |
| 3279 | 3279 | option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" |
| 3280 | - data-placeholder="<?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?>"> |
|
| 3280 | + data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?>">
|
|
| 3281 | 3281 | <option value="" disabled="disabled" selected="selected" |
| 3282 | - style='display:none;'><?php echo esc_attr( __( 'My Favorites', 'geodirectory' ) ); ?></option> |
|
| 3282 | + style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?></option>
|
|
| 3283 | 3283 | <?php echo $favourite_links; ?> |
| 3284 | 3284 | </select> |
| 3285 | 3285 | </li> |
@@ -3288,19 +3288,19 @@ discard block |
||
| 3288 | 3288 | } |
| 3289 | 3289 | |
| 3290 | 3290 | |
| 3291 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
| 3291 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
|
|
| 3292 | 3292 | $user_listing = geodir_user_post_listing_count(); |
| 3293 | 3293 | |
| 3294 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) {
|
|
| 3294 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
|
|
| 3295 | 3295 | $listing_links = ''; |
| 3296 | 3296 | |
| 3297 | - foreach ( $post_types as $key => $postobj ) {
|
|
| 3298 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) {
|
|
| 3297 | + foreach ($post_types as $key => $postobj) {
|
|
| 3298 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
|
|
| 3299 | 3299 | $name = $postobj->labels->name; |
| 3300 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
| 3300 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
|
|
| 3301 | 3301 | |
| 3302 | 3302 | $selected = ''; |
| 3303 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) {
|
|
| 3303 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
|
|
| 3304 | 3304 | $selected = 'selected="selected"'; |
| 3305 | 3305 | } |
| 3306 | 3306 | |
@@ -3313,20 +3313,20 @@ discard block |
||
| 3313 | 3313 | * @param string $key My listing array key. |
| 3314 | 3314 | * @param int $current_user ->ID Current user ID. |
| 3315 | 3315 | */ |
| 3316 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID ); |
|
| 3316 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID);
|
|
| 3317 | 3317 | |
| 3318 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __( ucfirst( $name ), 'geodirectory' ) . '</option>'; |
|
| 3318 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(ucfirst($name), 'geodirectory').'</option>'; |
|
| 3319 | 3319 | } |
| 3320 | 3320 | } |
| 3321 | 3321 | |
| 3322 | - if ( $listing_links != '' ) {
|
|
| 3322 | + if ($listing_links != '') {
|
|
| 3323 | 3323 | ?> |
| 3324 | 3324 | <li> |
| 3325 | 3325 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" |
| 3326 | 3326 | option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" |
| 3327 | - data-placeholder="<?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?>"> |
|
| 3327 | + data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?>">
|
|
| 3328 | 3328 | <option value="" disabled="disabled" selected="selected" |
| 3329 | - style='display:none;'><?php echo esc_attr( __( 'My Listings', 'geodirectory' ) ); ?></option> |
|
| 3329 | + style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?></option>
|
|
| 3330 | 3330 | <?php echo $listing_links; ?> |
| 3331 | 3331 | </select> |
| 3332 | 3332 | </li> |
@@ -3342,7 +3342,7 @@ discard block |
||
| 3342 | 3342 | * |
| 3343 | 3343 | * @param string $dashboard_link Dashboard links HTML. |
| 3344 | 3344 | */ |
| 3345 | - echo apply_filters( 'geodir_dashboard_links', $dashboard_link ); |
|
| 3345 | + echo apply_filters('geodir_dashboard_links', $dashboard_link);
|
|
| 3346 | 3346 | echo '</ul>'; |
| 3347 | 3347 | |
| 3348 | 3348 | /** |
@@ -3350,7 +3350,7 @@ discard block |
||
| 3350 | 3350 | * |
| 3351 | 3351 | * @since 1.6.6 |
| 3352 | 3352 | */ |
| 3353 | - do_action( 'geodir_after_loginwidget_form_logged_in' ); |
|
| 3353 | + do_action('geodir_after_loginwidget_form_logged_in');
|
|
| 3354 | 3354 | |
| 3355 | 3355 | |
| 3356 | 3356 | } else {
|
@@ -3365,18 +3365,18 @@ discard block |
||
| 3365 | 3365 | <form name="loginform" class="loginform1" |
| 3366 | 3366 | action="<?php echo geodir_login_url(); ?>" |
| 3367 | 3367 | method="post"> |
| 3368 | - <div class="geodir_form_row"><input placeholder="<?php _e( 'Email', 'geodirectory' ); ?>" name="log" |
|
| 3368 | + <div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?>" name="log"
|
|
| 3369 | 3369 | type="text" class="textfield user_login1"/> <span |
| 3370 | 3370 | class="user_loginInfo"></span></div> |
| 3371 | - <div class="geodir_form_row"><input placeholder="<?php _e( 'Password', 'geodirectory' ); ?>" |
|
| 3371 | + <div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?>"
|
|
| 3372 | 3372 | name="pwd" type="password" |
| 3373 | 3373 | class="textfield user_pass1 input-text"/><span |
| 3374 | 3374 | class="user_passInfo"></span></div> |
| 3375 | 3375 | |
| 3376 | - <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars( geodir_curPageURL() ); ?>"/> |
|
| 3376 | + <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?>"/> |
|
| 3377 | 3377 | <input type="hidden" name="testcookie" value="1"/> |
| 3378 | 3378 | |
| 3379 | - <?php do_action( 'login_form' ); ?> |
|
| 3379 | + <?php do_action('login_form'); ?>
|
|
| 3380 | 3380 | |
| 3381 | 3381 | <div class="geodir_form_row clearfix"><input type="submit" name="submit" |
| 3382 | 3382 | value="<?php echo SIGN_IN_BUTTON; ?>" class="b_signin"/> |
@@ -3389,7 +3389,7 @@ discard block |
||
| 3389 | 3389 | * @since 1.0.0 |
| 3390 | 3390 | */ |
| 3391 | 3391 | ?> |
| 3392 | - <a href="<?php echo geodir_login_url( array( 'signup' => true ) ); ?>" |
|
| 3392 | + <a href="<?php echo geodir_login_url(array('signup' => true)); ?>"
|
|
| 3393 | 3393 | class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?></a> |
| 3394 | 3394 | |
| 3395 | 3395 | <?php |
@@ -3399,7 +3399,7 @@ discard block |
||
| 3399 | 3399 | * @since 1.0.0 |
| 3400 | 3400 | */ |
| 3401 | 3401 | ?> |
| 3402 | - <a href="<?php echo geodir_login_url( array( 'forgot' => true ) ); ?>" |
|
| 3402 | + <a href="<?php echo geodir_login_url(array('forgot' => true)); ?>"
|
|
| 3403 | 3403 | class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?></a></p></div> |
| 3404 | 3404 | </form> |
| 3405 | 3405 | <?php |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | * |
| 3409 | 3409 | * @since 1.6.6 |
| 3410 | 3410 | */ |
| 3411 | - do_action( 'geodir_after_loginwidget_form_logged_out' ); |
|
| 3411 | + do_action('geodir_after_loginwidget_form_logged_out');
|
|
| 3412 | 3412 | } |
| 3413 | 3413 | |
| 3414 | 3414 | echo $after_widget; |
@@ -3430,16 +3430,16 @@ discard block |
||
| 3430 | 3430 | * after_widget. |
| 3431 | 3431 | * @param array|string $instance The settings for the particular instance of the widget. |
| 3432 | 3432 | */ |
| 3433 | -function geodir_popular_postview_output( $args = '', $instance = '' ) {
|
|
| 3433 | +function geodir_popular_postview_output($args = '', $instance = '') {
|
|
| 3434 | 3434 | global $gd_session; |
| 3435 | 3435 | |
| 3436 | 3436 | // prints the widget |
| 3437 | - extract( $args, EXTR_SKIP ); |
|
| 3437 | + extract($args, EXTR_SKIP); |
|
| 3438 | 3438 | |
| 3439 | 3439 | echo $before_widget; |
| 3440 | 3440 | |
| 3441 | 3441 | /** This filter is documented in geodirectory_widgets.php */ |
| 3442 | - $title = empty( $instance['title'] ) ? geodir_ucwords( $instance['category_title'] ) : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); |
|
| 3442 | + $title = empty($instance['title']) ? geodir_ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 3443 | 3443 | /** |
| 3444 | 3444 | * Filter the widget post type. |
| 3445 | 3445 | * |
@@ -3447,7 +3447,7 @@ discard block |
||
| 3447 | 3447 | * |
| 3448 | 3448 | * @param string $instance ['post_type'] Post type of listing. |
| 3449 | 3449 | */ |
| 3450 | - $post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] ); |
|
| 3450 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']);
|
|
| 3451 | 3451 | /** |
| 3452 | 3452 | * Filter the widget's term. |
| 3453 | 3453 | * |
@@ -3455,7 +3455,7 @@ discard block |
||
| 3455 | 3455 | * |
| 3456 | 3456 | * @param string $instance ['category'] Filter by term. Can be any valid term. |
| 3457 | 3457 | */ |
| 3458 | - $category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] ); |
|
| 3458 | + $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']);
|
|
| 3459 | 3459 | /** |
| 3460 | 3460 | * Filter the widget listings limit. |
| 3461 | 3461 | * |
@@ -3463,7 +3463,7 @@ discard block |
||
| 3463 | 3463 | * |
| 3464 | 3464 | * @param string $instance ['post_number'] Number of listings to display. |
| 3465 | 3465 | */ |
| 3466 | - $post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] ); |
|
| 3466 | + $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
|
|
| 3467 | 3467 | /** |
| 3468 | 3468 | * Filter widget's "layout" type. |
| 3469 | 3469 | * |
@@ -3471,7 +3471,7 @@ discard block |
||
| 3471 | 3471 | * |
| 3472 | 3472 | * @param string $instance ['layout'] Widget layout type. |
| 3473 | 3473 | */ |
| 3474 | - $layout = empty( $instance['layout'] ) ? 'gridview_onehalf' : apply_filters( 'widget_layout', $instance['layout'] ); |
|
| 3474 | + $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
|
|
| 3475 | 3475 | /** |
| 3476 | 3476 | * Filter widget's "add_location_filter" value. |
| 3477 | 3477 | * |
@@ -3479,7 +3479,7 @@ discard block |
||
| 3479 | 3479 | * |
| 3480 | 3480 | * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0. |
| 3481 | 3481 | */ |
| 3482 | - $add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] ); |
|
| 3482 | + $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
|
|
| 3483 | 3483 | /** |
| 3484 | 3484 | * Filter widget's listing width. |
| 3485 | 3485 | * |
@@ -3487,7 +3487,7 @@ discard block |
||
| 3487 | 3487 | * |
| 3488 | 3488 | * @param string $instance ['listing_width'] Listing width. |
| 3489 | 3489 | */ |
| 3490 | - $listing_width = empty( $instance['listing_width'] ) ? '' : apply_filters( 'widget_listing_width', $instance['listing_width'] ); |
|
| 3490 | + $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
|
|
| 3491 | 3491 | /** |
| 3492 | 3492 | * Filter widget's "list_sort" type. |
| 3493 | 3493 | * |
@@ -3495,25 +3495,25 @@ discard block |
||
| 3495 | 3495 | * |
| 3496 | 3496 | * @param string $instance ['list_sort'] Listing sort by type. |
| 3497 | 3497 | */ |
| 3498 | - $list_sort = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] ); |
|
| 3499 | - $use_viewing_post_type = ! empty( $instance['use_viewing_post_type'] ) ? true : false; |
|
| 3498 | + $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
|
|
| 3499 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
| 3500 | 3500 | |
| 3501 | 3501 | // set post type to current viewing post type |
| 3502 | - if ( $use_viewing_post_type ) {
|
|
| 3502 | + if ($use_viewing_post_type) {
|
|
| 3503 | 3503 | $current_post_type = geodir_get_current_posttype(); |
| 3504 | - if ( $current_post_type != '' && $current_post_type != $post_type ) {
|
|
| 3504 | + if ($current_post_type != '' && $current_post_type != $post_type) {
|
|
| 3505 | 3505 | $post_type = $current_post_type; |
| 3506 | 3506 | $category = array(); // old post type category will not work for current changed post type |
| 3507 | 3507 | } |
| 3508 | 3508 | } |
| 3509 | 3509 | // replace widget title dynamically |
| 3510 | - $posttype_plural_label = __( get_post_type_plural_label( $post_type ), 'geodirectory' ); |
|
| 3511 | - $posttype_singular_label = __( get_post_type_singular_label( $post_type ), 'geodirectory' ); |
|
| 3510 | + $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory'); |
|
| 3511 | + $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory'); |
|
| 3512 | 3512 | |
| 3513 | - $title = str_replace( "%posttype_plural_label%", $posttype_plural_label, $title ); |
|
| 3514 | - $title = str_replace( "%posttype_singular_label%", $posttype_singular_label, $title ); |
|
| 3513 | + $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title);
|
|
| 3514 | + $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title);
|
|
| 3515 | 3515 | |
| 3516 | - if ( isset( $instance['character_count'] ) ) {
|
|
| 3516 | + if (isset($instance['character_count'])) {
|
|
| 3517 | 3517 | /** |
| 3518 | 3518 | * Filter the widget's excerpt character count. |
| 3519 | 3519 | * |
@@ -3521,37 +3521,37 @@ discard block |
||
| 3521 | 3521 | * |
| 3522 | 3522 | * @param int $instance ['character_count'] Excerpt character count. |
| 3523 | 3523 | */ |
| 3524 | - $character_count = apply_filters( 'widget_list_character_count', $instance['character_count'] ); |
|
| 3524 | + $character_count = apply_filters('widget_list_character_count', $instance['character_count']);
|
|
| 3525 | 3525 | } else {
|
| 3526 | 3526 | $character_count = ''; |
| 3527 | 3527 | } |
| 3528 | 3528 | |
| 3529 | - if ( empty( $title ) || $title == 'All' ) {
|
|
| 3530 | - $title .= ' ' . __( get_post_type_plural_label( $post_type ), 'geodirectory' ); |
|
| 3529 | + if (empty($title) || $title == 'All') {
|
|
| 3530 | + $title .= ' '.__(get_post_type_plural_label($post_type), 'geodirectory'); |
|
| 3531 | 3531 | } |
| 3532 | 3532 | |
| 3533 | 3533 | $location_url = array(); |
| 3534 | - $city = get_query_var( 'gd_city' ); |
|
| 3535 | - if ( ! empty( $city ) ) {
|
|
| 3536 | - $country = get_query_var( 'gd_country' ); |
|
| 3537 | - $region = get_query_var( 'gd_region' ); |
|
| 3534 | + $city = get_query_var('gd_city');
|
|
| 3535 | + if (!empty($city)) {
|
|
| 3536 | + $country = get_query_var('gd_country');
|
|
| 3537 | + $region = get_query_var('gd_region');
|
|
| 3538 | 3538 | |
| 3539 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
| 3539 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 3540 | 3540 | |
| 3541 | - if ( $geodir_show_location_url == 'all' ) {
|
|
| 3542 | - if ( $country != '' ) {
|
|
| 3541 | + if ($geodir_show_location_url == 'all') {
|
|
| 3542 | + if ($country != '') {
|
|
| 3543 | 3543 | $location_url[] = $country; |
| 3544 | 3544 | } |
| 3545 | 3545 | |
| 3546 | - if ( $region != '' ) {
|
|
| 3546 | + if ($region != '') {
|
|
| 3547 | 3547 | $location_url[] = $region; |
| 3548 | 3548 | } |
| 3549 | - } else if ( $geodir_show_location_url == 'country_city' ) {
|
|
| 3550 | - if ( $country != '' ) {
|
|
| 3549 | + } else if ($geodir_show_location_url == 'country_city') {
|
|
| 3550 | + if ($country != '') {
|
|
| 3551 | 3551 | $location_url[] = $country; |
| 3552 | 3552 | } |
| 3553 | - } else if ( $geodir_show_location_url == 'region_city' ) {
|
|
| 3554 | - if ( $region != '' ) {
|
|
| 3553 | + } else if ($geodir_show_location_url == 'region_city') {
|
|
| 3554 | + if ($region != '') {
|
|
| 3555 | 3555 | $location_url[] = $region; |
| 3556 | 3556 | } |
| 3557 | 3557 | } |
@@ -3559,37 +3559,37 @@ discard block |
||
| 3559 | 3559 | $location_url[] = $city; |
| 3560 | 3560 | } |
| 3561 | 3561 | |
| 3562 | - $location_url = implode( '/', $location_url ); |
|
| 3562 | + $location_url = implode('/', $location_url);
|
|
| 3563 | 3563 | $skip_location = false; |
| 3564 | - if ( ! $add_location_filter && $gd_session->get( 'gd_multi_location' ) ) {
|
|
| 3564 | + if (!$add_location_filter && $gd_session->get('gd_multi_location')) {
|
|
| 3565 | 3565 | $skip_location = true; |
| 3566 | - $gd_session->un_set( 'gd_multi_location' ); |
|
| 3566 | + $gd_session->un_set('gd_multi_location');
|
|
| 3567 | 3567 | } |
| 3568 | 3568 | |
| 3569 | - if ( get_option( 'permalink_structure' ) ) {
|
|
| 3570 | - $viewall_url = get_post_type_archive_link( $post_type ); |
|
| 3569 | + if (get_option('permalink_structure')) {
|
|
| 3570 | + $viewall_url = get_post_type_archive_link($post_type); |
|
| 3571 | 3571 | } else {
|
| 3572 | - $viewall_url = get_post_type_archive_link( $post_type ); |
|
| 3572 | + $viewall_url = get_post_type_archive_link($post_type); |
|
| 3573 | 3573 | } |
| 3574 | 3574 | |
| 3575 | - if ( ! empty( $category ) && $category[0] != '0' ) {
|
|
| 3575 | + if (!empty($category) && $category[0] != '0') {
|
|
| 3576 | 3576 | global $geodir_add_location_url; |
| 3577 | 3577 | |
| 3578 | 3578 | $geodir_add_location_url = '0'; |
| 3579 | 3579 | |
| 3580 | - if ( $add_location_filter != '0' ) {
|
|
| 3580 | + if ($add_location_filter != '0') {
|
|
| 3581 | 3581 | $geodir_add_location_url = '1'; |
| 3582 | 3582 | } |
| 3583 | 3583 | |
| 3584 | - $viewall_url = get_term_link( (int) $category[0], $post_type . 'category' ); |
|
| 3584 | + $viewall_url = get_term_link((int) $category[0], $post_type.'category'); |
|
| 3585 | 3585 | |
| 3586 | 3586 | $geodir_add_location_url = null; |
| 3587 | 3587 | } |
| 3588 | - if ( $skip_location ) {
|
|
| 3589 | - $gd_session->set( 'gd_multi_location', 1 ); |
|
| 3588 | + if ($skip_location) {
|
|
| 3589 | + $gd_session->set('gd_multi_location', 1);
|
|
| 3590 | 3590 | } |
| 3591 | 3591 | |
| 3592 | - if ( is_wp_error( $viewall_url ) ) {
|
|
| 3592 | + if (is_wp_error($viewall_url)) {
|
|
| 3593 | 3593 | $viewall_url = ''; |
| 3594 | 3594 | } |
| 3595 | 3595 | |
@@ -3601,34 +3601,34 @@ discard block |
||
| 3601 | 3601 | 'order_by' => $list_sort |
| 3602 | 3602 | ); |
| 3603 | 3603 | |
| 3604 | - if ( $character_count ) {
|
|
| 3604 | + if ($character_count) {
|
|
| 3605 | 3605 | $query_args['excerpt_length'] = $character_count; |
| 3606 | 3606 | } |
| 3607 | 3607 | |
| 3608 | - if ( ! empty( $instance['show_featured_only'] ) ) {
|
|
| 3608 | + if (!empty($instance['show_featured_only'])) {
|
|
| 3609 | 3609 | $query_args['show_featured_only'] = 1; |
| 3610 | 3610 | } |
| 3611 | 3611 | |
| 3612 | - if ( ! empty( $instance['show_special_only'] ) ) {
|
|
| 3612 | + if (!empty($instance['show_special_only'])) {
|
|
| 3613 | 3613 | $query_args['show_special_only'] = 1; |
| 3614 | 3614 | } |
| 3615 | 3615 | |
| 3616 | - if ( ! empty( $instance['with_pics_only'] ) ) {
|
|
| 3616 | + if (!empty($instance['with_pics_only'])) {
|
|
| 3617 | 3617 | $query_args['with_pics_only'] = 0; |
| 3618 | 3618 | $query_args['featured_image_only'] = 1; |
| 3619 | 3619 | } |
| 3620 | 3620 | |
| 3621 | - if ( ! empty( $instance['with_videos_only'] ) ) {
|
|
| 3621 | + if (!empty($instance['with_videos_only'])) {
|
|
| 3622 | 3622 | $query_args['with_videos_only'] = 1; |
| 3623 | 3623 | } |
| 3624 | - $with_no_results = ! empty( $instance['without_no_results'] ) ? false : true; |
|
| 3624 | + $with_no_results = !empty($instance['without_no_results']) ? false : true; |
|
| 3625 | 3625 | |
| 3626 | - if ( ! empty( $category ) && $category[0] != '0' ) {
|
|
| 3627 | - $category_taxonomy = geodir_get_taxonomies( $post_type ); |
|
| 3626 | + if (!empty($category) && $category[0] != '0') {
|
|
| 3627 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 3628 | 3628 | |
| 3629 | 3629 | ######### WPML ######### |
| 3630 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 3631 | - $category = gd_lang_object_ids( $category, $category_taxonomy[0] ); |
|
| 3630 | + if (function_exists('icl_object_id')) {
|
|
| 3631 | + $category = gd_lang_object_ids($category, $category_taxonomy[0]); |
|
| 3632 | 3632 | } |
| 3633 | 3633 | ######### WPML ######### |
| 3634 | 3634 | |
@@ -3638,14 +3638,14 @@ discard block |
||
| 3638 | 3638 | 'terms' => $category |
| 3639 | 3639 | ); |
| 3640 | 3640 | |
| 3641 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 3641 | + $query_args['tax_query'] = array($tax_query); |
|
| 3642 | 3642 | } |
| 3643 | 3643 | |
| 3644 | 3644 | global $gridview_columns_widget, $geodir_is_widget_listing; |
| 3645 | 3645 | |
| 3646 | - $widget_listings = geodir_get_widget_listings( $query_args ); |
|
| 3646 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
| 3647 | 3647 | |
| 3648 | - if ( ! empty( $widget_listings ) || $with_no_results ) {
|
|
| 3648 | + if (!empty($widget_listings) || $with_no_results) {
|
|
| 3649 | 3649 | ?> |
| 3650 | 3650 | <div class="geodir_locations geodir_location_listing"> |
| 3651 | 3651 | |
@@ -3655,11 +3655,11 @@ discard block |
||
| 3655 | 3655 | * |
| 3656 | 3656 | * @since 1.0.0 |
| 3657 | 3657 | */ |
| 3658 | - do_action( 'geodir_before_view_all_link_in_widget' ); ?> |
|
| 3658 | + do_action('geodir_before_view_all_link_in_widget'); ?>
|
|
| 3659 | 3659 | <div class="geodir_list_heading clearfix"> |
| 3660 | - <?php echo $before_title . $title . $after_title; ?> |
|
| 3660 | + <?php echo $before_title.$title.$after_title; ?> |
|
| 3661 | 3661 | <a href="<?php echo $viewall_url; ?>" |
| 3662 | - class="geodir-viewall"><?php _e( 'View all', 'geodirectory' ); ?></a> |
|
| 3662 | + class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?></a>
|
|
| 3663 | 3663 | </div> |
| 3664 | 3664 | <?php |
| 3665 | 3665 | /** |
@@ -3667,10 +3667,10 @@ discard block |
||
| 3667 | 3667 | * |
| 3668 | 3668 | * @since 1.0.0 |
| 3669 | 3669 | */ |
| 3670 | - do_action( 'geodir_after_view_all_link_in_widget' ); ?> |
|
| 3670 | + do_action('geodir_after_view_all_link_in_widget'); ?>
|
|
| 3671 | 3671 | <?php |
| 3672 | - if ( strstr( $layout, 'gridview' ) ) {
|
|
| 3673 | - $listing_view_exp = explode( '_', $layout ); |
|
| 3672 | + if (strstr($layout, 'gridview')) {
|
|
| 3673 | + $listing_view_exp = explode('_', $layout);
|
|
| 3674 | 3674 | $gridview_columns_widget = $layout; |
| 3675 | 3675 | $layout = $listing_view_exp[0]; |
| 3676 | 3676 | } else {
|
@@ -3682,8 +3682,8 @@ discard block |
||
| 3682 | 3682 | * |
| 3683 | 3683 | * @since 1.0.0 |
| 3684 | 3684 | */ |
| 3685 | - $template = apply_filters( "geodir_template_part-widget-listing-listview", geodir_locate_template( 'widget-listing-listview' ) ); |
|
| 3686 | - if ( ! isset( $character_count ) ) {
|
|
| 3685 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview'));
|
|
| 3686 | + if (!isset($character_count)) {
|
|
| 3687 | 3687 | /** |
| 3688 | 3688 | * Filter the widget's excerpt character count. |
| 3689 | 3689 | * |
@@ -3691,7 +3691,7 @@ discard block |
||
| 3691 | 3691 | * |
| 3692 | 3692 | * @param int $instance ['character_count'] Excerpt character count. |
| 3693 | 3693 | */ |
| 3694 | - $character_count = $character_count == '' ? 50 : apply_filters( 'widget_character_count', $character_count ); |
|
| 3694 | + $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count);
|
|
| 3695 | 3695 | } |
| 3696 | 3696 | |
| 3697 | 3697 | global $post, $map_jason, $map_canvas_arr; |
@@ -3706,13 +3706,13 @@ discard block |
||
| 3706 | 3706 | * |
| 3707 | 3707 | * @since 1.0.0 |
| 3708 | 3708 | */ |
| 3709 | - include( $template ); |
|
| 3709 | + include($template); |
|
| 3710 | 3710 | |
| 3711 | 3711 | $geodir_is_widget_listing = false; |
| 3712 | 3712 | |
| 3713 | 3713 | $GLOBALS['post'] = $current_post; |
| 3714 | - if ( ! empty( $current_post ) ) {
|
|
| 3715 | - setup_postdata( $current_post ); |
|
| 3714 | + if (!empty($current_post)) {
|
|
| 3715 | + setup_postdata($current_post); |
|
| 3716 | 3716 | } |
| 3717 | 3717 | $map_jason = $current_map_jason; |
| 3718 | 3718 | $map_canvas_arr = $current_map_canvas_arr; |
@@ -3743,12 +3743,12 @@ discard block |
||
| 3743 | 3743 | * |
| 3744 | 3744 | * @return int Reviews count. |
| 3745 | 3745 | */ |
| 3746 | -function geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ) {
|
|
| 3746 | +function geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type) {
|
|
| 3747 | 3747 | global $wpdb, $plugin_prefix; |
| 3748 | 3748 | |
| 3749 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 3749 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 3750 | 3750 | |
| 3751 | - $sql = "SELECT COALESCE(SUM(rating_count),0) FROM " . $detail_table . " WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(" . $term_id . ", " . $taxonomy . ")";
|
|
| 3751 | + $sql = "SELECT COALESCE(SUM(rating_count),0) FROM ".$detail_table." WHERE post_status = 'publish' AND rating_count > 0 AND FIND_IN_SET(".$term_id.", ".$taxonomy.")";
|
|
| 3752 | 3752 | |
| 3753 | 3753 | /** |
| 3754 | 3754 | * Filter count review sql query. |
@@ -3760,9 +3760,9 @@ discard block |
||
| 3760 | 3760 | * @param int $taxonomy The taxonomy Id. |
| 3761 | 3761 | * @param string $post_type The post type. |
| 3762 | 3762 | */ |
| 3763 | - $sql = apply_filters( 'geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type ); |
|
| 3763 | + $sql = apply_filters('geodir_count_reviews_by_term_sql', $sql, $term_id, $taxonomy, $post_type);
|
|
| 3764 | 3764 | |
| 3765 | - $count = $wpdb->get_var( $sql ); |
|
| 3765 | + $count = $wpdb->get_var($sql); |
|
| 3766 | 3766 | |
| 3767 | 3767 | return $count; |
| 3768 | 3768 | } |
@@ -3780,7 +3780,7 @@ discard block |
||
| 3780 | 3780 | * |
| 3781 | 3781 | * @return array Term array data. |
| 3782 | 3782 | */ |
| 3783 | -function geodir_count_reviews_by_terms( $force_update = false, $post_ID = 0 ) {
|
|
| 3783 | +function geodir_count_reviews_by_terms($force_update = false, $post_ID = 0) {
|
|
| 3784 | 3784 | /** |
| 3785 | 3785 | * Filter review count option data. |
| 3786 | 3786 | * |
@@ -3790,78 +3790,78 @@ discard block |
||
| 3790 | 3790 | * @param bool $force_update Force update option value?. Default.false. |
| 3791 | 3791 | * @param int $post_ID The post id to update if any. |
| 3792 | 3792 | */ |
| 3793 | - $option_data = apply_filters( 'geodir_count_reviews_by_terms_before', '', $force_update, $post_ID ); |
|
| 3794 | - if ( ! empty( $option_data ) ) {
|
|
| 3793 | + $option_data = apply_filters('geodir_count_reviews_by_terms_before', '', $force_update, $post_ID);
|
|
| 3794 | + if (!empty($option_data)) {
|
|
| 3795 | 3795 | return $option_data; |
| 3796 | 3796 | } |
| 3797 | 3797 | |
| 3798 | - $option_data = get_option( 'geodir_global_review_count' ); |
|
| 3798 | + $option_data = get_option('geodir_global_review_count');
|
|
| 3799 | 3799 | |
| 3800 | - if ( ! $option_data || $force_update ) {
|
|
| 3801 | - if ( (int) $post_ID > 0 ) { // Update reviews count for specific post categories only.
|
|
| 3800 | + if (!$option_data || $force_update) {
|
|
| 3801 | + if ((int) $post_ID > 0) { // Update reviews count for specific post categories only.
|
|
| 3802 | 3802 | global $gd_session; |
| 3803 | 3803 | $term_array = (array) $option_data; |
| 3804 | - $post_type = get_post_type( $post_ID ); |
|
| 3805 | - $taxonomy = $post_type . 'category'; |
|
| 3806 | - $terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) ); |
|
| 3807 | - |
|
| 3808 | - if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
|
| 3809 | - foreach ( $terms as $term_id ) {
|
|
| 3810 | - $count = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ); |
|
| 3811 | - $children = get_term_children( $term_id, $taxonomy ); |
|
| 3812 | - $term_array[ $term_id ] = $count; |
|
| 3804 | + $post_type = get_post_type($post_ID); |
|
| 3805 | + $taxonomy = $post_type.'category'; |
|
| 3806 | + $terms = wp_get_object_terms($post_ID, $taxonomy, array('fields' => 'ids'));
|
|
| 3807 | + |
|
| 3808 | + if (!empty($terms) && !is_wp_error($terms)) {
|
|
| 3809 | + foreach ($terms as $term_id) {
|
|
| 3810 | + $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type); |
|
| 3811 | + $children = get_term_children($term_id, $taxonomy); |
|
| 3812 | + $term_array[$term_id] = $count; |
|
| 3813 | 3813 | } |
| 3814 | 3814 | } |
| 3815 | 3815 | |
| 3816 | - $session_listing = $gd_session->get( 'listing' ); |
|
| 3816 | + $session_listing = $gd_session->get('listing');
|
|
| 3817 | 3817 | |
| 3818 | 3818 | $terms = array(); |
| 3819 | - if ( isset( $_POST['post_category'][ $taxonomy ] ) ) {
|
|
| 3820 | - $terms = (array) $_POST['post_category'][ $taxonomy ]; |
|
| 3821 | - } else if ( ! empty( $session_listing ) && isset( $session_listing['post_category'][ $taxonomy ] ) ) {
|
|
| 3822 | - $terms = (array) $session_listing['post_category'][ $taxonomy ]; |
|
| 3819 | + if (isset($_POST['post_category'][$taxonomy])) {
|
|
| 3820 | + $terms = (array) $_POST['post_category'][$taxonomy]; |
|
| 3821 | + } else if (!empty($session_listing) && isset($session_listing['post_category'][$taxonomy])) {
|
|
| 3822 | + $terms = (array) $session_listing['post_category'][$taxonomy]; |
|
| 3823 | 3823 | } |
| 3824 | 3824 | |
| 3825 | - if ( ! empty( $terms ) ) {
|
|
| 3826 | - foreach ( $terms as $term_id ) {
|
|
| 3827 | - if ( $term_id > 0 ) {
|
|
| 3828 | - $count = geodir_count_reviews_by_term_id( $term_id, $taxonomy, $post_type ); |
|
| 3829 | - $children = get_term_children( $term_id, $taxonomy ); |
|
| 3830 | - $term_array[ $term_id ] = $count; |
|
| 3825 | + if (!empty($terms)) {
|
|
| 3826 | + foreach ($terms as $term_id) {
|
|
| 3827 | + if ($term_id > 0) {
|
|
| 3828 | + $count = geodir_count_reviews_by_term_id($term_id, $taxonomy, $post_type); |
|
| 3829 | + $children = get_term_children($term_id, $taxonomy); |
|
| 3830 | + $term_array[$term_id] = $count; |
|
| 3831 | 3831 | } |
| 3832 | 3832 | } |
| 3833 | 3833 | } |
| 3834 | 3834 | } else { // Update reviews count for all post categories.
|
| 3835 | 3835 | $term_array = array(); |
| 3836 | 3836 | $post_types = geodir_get_posttypes(); |
| 3837 | - foreach ( $post_types as $post_type ) {
|
|
| 3837 | + foreach ($post_types as $post_type) {
|
|
| 3838 | 3838 | |
| 3839 | - $taxonomy = geodir_get_taxonomies( $post_type ); |
|
| 3839 | + $taxonomy = geodir_get_taxonomies($post_type); |
|
| 3840 | 3840 | $taxonomy = $taxonomy[0]; |
| 3841 | 3841 | |
| 3842 | 3842 | $args = array( |
| 3843 | 3843 | 'hide_empty' => false |
| 3844 | 3844 | ); |
| 3845 | 3845 | |
| 3846 | - $terms = get_terms( $taxonomy, $args ); |
|
| 3846 | + $terms = get_terms($taxonomy, $args); |
|
| 3847 | 3847 | |
| 3848 | - foreach ( $terms as $term ) {
|
|
| 3849 | - $count = geodir_count_reviews_by_term_id( $term->term_id, $taxonomy, $post_type ); |
|
| 3850 | - $children = get_term_children( $term->term_id, $taxonomy ); |
|
| 3848 | + foreach ($terms as $term) {
|
|
| 3849 | + $count = geodir_count_reviews_by_term_id($term->term_id, $taxonomy, $post_type); |
|
| 3850 | + $children = get_term_children($term->term_id, $taxonomy); |
|
| 3851 | 3851 | /*if ( is_array( $children ) ) {
|
| 3852 | 3852 | foreach ( $children as $child_id ) {
|
| 3853 | 3853 | $child_count = geodir_count_reviews_by_term_id($child_id, $taxonomy, $post_type); |
| 3854 | 3854 | $count = $count + $child_count; |
| 3855 | 3855 | } |
| 3856 | 3856 | }*/ |
| 3857 | - $term_array[ $term->term_id ] = $count; |
|
| 3857 | + $term_array[$term->term_id] = $count; |
|
| 3858 | 3858 | } |
| 3859 | 3859 | } |
| 3860 | 3860 | } |
| 3861 | 3861 | |
| 3862 | - update_option( 'geodir_global_review_count', $term_array ); |
|
| 3862 | + update_option('geodir_global_review_count', $term_array);
|
|
| 3863 | 3863 | //clear cache |
| 3864 | - wp_cache_delete( 'geodir_global_review_count' ); |
|
| 3864 | + wp_cache_delete('geodir_global_review_count');
|
|
| 3865 | 3865 | |
| 3866 | 3866 | return $term_array; |
| 3867 | 3867 | } else {
|
@@ -3877,39 +3877,39 @@ discard block |
||
| 3877 | 3877 | * @package GeoDirectory |
| 3878 | 3878 | * @return bool |
| 3879 | 3879 | */ |
| 3880 | -function geodir_term_review_count_force_update( $new_status, $old_status = '', $post = '' ) {
|
|
| 3881 | - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'geodir_import_export' ) {
|
|
| 3880 | +function geodir_term_review_count_force_update($new_status, $old_status = '', $post = '') {
|
|
| 3881 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
|
|
| 3882 | 3882 | return; // do not run if importing listings |
| 3883 | 3883 | } |
| 3884 | 3884 | |
| 3885 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
|
| 3885 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
|
| 3886 | 3886 | return; |
| 3887 | 3887 | } |
| 3888 | 3888 | |
| 3889 | 3889 | $post_ID = 0; |
| 3890 | - if ( ! empty( $post ) ) {
|
|
| 3891 | - if ( isset( $post->post_type ) && strpos( $post->post_type, 'gd_' ) !== 0 ) {
|
|
| 3890 | + if (!empty($post)) {
|
|
| 3891 | + if (isset($post->post_type) && strpos($post->post_type, 'gd_') !== 0) {
|
|
| 3892 | 3892 | return; |
| 3893 | 3893 | } |
| 3894 | 3894 | |
| 3895 | - if ( $new_status == 'auto-draft' && $old_status == 'new' ) {
|
|
| 3895 | + if ($new_status == 'auto-draft' && $old_status == 'new') {
|
|
| 3896 | 3896 | return; |
| 3897 | 3897 | } |
| 3898 | 3898 | |
| 3899 | - if ( ! empty( $post->ID ) ) {
|
|
| 3899 | + if (!empty($post->ID)) {
|
|
| 3900 | 3900 | $post_ID = $post->ID; |
| 3901 | 3901 | } |
| 3902 | 3902 | } |
| 3903 | 3903 | |
| 3904 | - if ( $new_status != $old_status ) {
|
|
| 3905 | - geodir_count_reviews_by_terms( true, $post_ID ); |
|
| 3904 | + if ($new_status != $old_status) {
|
|
| 3905 | + geodir_count_reviews_by_terms(true, $post_ID); |
|
| 3906 | 3906 | } |
| 3907 | 3907 | |
| 3908 | 3908 | return true; |
| 3909 | 3909 | } |
| 3910 | 3910 | |
| 3911 | -function geodir_term_review_count_force_update_single_post( $post_id ) {
|
|
| 3912 | - geodir_count_reviews_by_terms( true, $post_id ); |
|
| 3911 | +function geodir_term_review_count_force_update_single_post($post_id) {
|
|
| 3912 | + geodir_count_reviews_by_terms(true, $post_id); |
|
| 3913 | 3913 | } |
| 3914 | 3914 | |
| 3915 | 3915 | /*-----------------------------------------------------------------------------------*/ |
@@ -3926,11 +3926,11 @@ discard block |
||
| 3926 | 3926 | * |
| 3927 | 3927 | * @return int Post count. |
| 3928 | 3928 | */ |
| 3929 | -function geodir_count_posts_by_term( $data, $term ) {
|
|
| 3929 | +function geodir_count_posts_by_term($data, $term) {
|
|
| 3930 | 3930 | |
| 3931 | - if ( $data ) {
|
|
| 3932 | - if ( isset( $data[ $term->term_id ] ) ) {
|
|
| 3933 | - return $data[ $term->term_id ]; |
|
| 3931 | + if ($data) {
|
|
| 3932 | + if (isset($data[$term->term_id])) {
|
|
| 3933 | + return $data[$term->term_id]; |
|
| 3934 | 3934 | } else {
|
| 3935 | 3935 | return 0; |
| 3936 | 3936 | } |
@@ -3947,8 +3947,8 @@ discard block |
||
| 3947 | 3947 | * param array $terms An array of term objects. |
| 3948 | 3948 | * @return array Sorted terms array. |
| 3949 | 3949 | */ |
| 3950 | -function geodir_sort_terms_by_count( $terms ) {
|
|
| 3951 | - usort( $terms, "geodir_sort_by_count_obj" ); |
|
| 3950 | +function geodir_sort_terms_by_count($terms) {
|
|
| 3951 | + usort($terms, "geodir_sort_by_count_obj"); |
|
| 3952 | 3952 | |
| 3953 | 3953 | return $terms; |
| 3954 | 3954 | } |
@@ -3963,8 +3963,8 @@ discard block |
||
| 3963 | 3963 | * |
| 3964 | 3964 | * @return array Sorted terms array. |
| 3965 | 3965 | */ |
| 3966 | -function geodir_sort_terms_by_review_count( $terms ) {
|
|
| 3967 | - usort( $terms, "geodir_sort_by_review_count_obj" ); |
|
| 3966 | +function geodir_sort_terms_by_review_count($terms) {
|
|
| 3967 | + usort($terms, "geodir_sort_by_review_count_obj"); |
|
| 3968 | 3968 | |
| 3969 | 3969 | return $terms; |
| 3970 | 3970 | } |
@@ -3980,12 +3980,12 @@ discard block |
||
| 3980 | 3980 | * |
| 3981 | 3981 | * @return array Sorted terms array. |
| 3982 | 3982 | */ |
| 3983 | -function geodir_sort_terms( $terms, $sort = 'count' ) {
|
|
| 3984 | - if ( $sort == 'count' ) {
|
|
| 3985 | - return geodir_sort_terms_by_count( $terms ); |
|
| 3983 | +function geodir_sort_terms($terms, $sort = 'count') {
|
|
| 3984 | + if ($sort == 'count') {
|
|
| 3985 | + return geodir_sort_terms_by_count($terms); |
|
| 3986 | 3986 | } |
| 3987 | - if ( $sort == 'review_count' ) {
|
|
| 3988 | - return geodir_sort_terms_by_review_count( $terms ); |
|
| 3987 | + if ($sort == 'review_count') {
|
|
| 3988 | + return geodir_sort_terms_by_review_count($terms); |
|
| 3989 | 3989 | } |
| 3990 | 3990 | } |
| 3991 | 3991 | |
@@ -4003,7 +4003,7 @@ discard block |
||
| 4003 | 4003 | * |
| 4004 | 4004 | * @return bool |
| 4005 | 4005 | */ |
| 4006 | -function geodir_sort_by_count( $a, $b ) {
|
|
| 4006 | +function geodir_sort_by_count($a, $b) {
|
|
| 4007 | 4007 | return $a['count'] < $b['count']; |
| 4008 | 4008 | } |
| 4009 | 4009 | |
@@ -4018,7 +4018,7 @@ discard block |
||
| 4018 | 4018 | * |
| 4019 | 4019 | * @return bool |
| 4020 | 4020 | */ |
| 4021 | -function geodir_sort_by_count_obj( $a, $b ) {
|
|
| 4021 | +function geodir_sort_by_count_obj($a, $b) {
|
|
| 4022 | 4022 | return $a->count < $b->count; |
| 4023 | 4023 | } |
| 4024 | 4024 | |
@@ -4033,7 +4033,7 @@ discard block |
||
| 4033 | 4033 | * |
| 4034 | 4034 | * @return bool |
| 4035 | 4035 | */ |
| 4036 | -function geodir_sort_by_review_count_obj( $a, $b ) {
|
|
| 4036 | +function geodir_sort_by_review_count_obj($a, $b) {
|
|
| 4037 | 4037 | return $a->review_count < $b->review_count; |
| 4038 | 4038 | } |
| 4039 | 4039 | |
@@ -4050,35 +4050,35 @@ discard block |
||
| 4050 | 4050 | * @since 1.4.2 |
| 4051 | 4051 | * @package GeoDirectory |
| 4052 | 4052 | */ |
| 4053 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'geodirectory' ); |
|
| 4053 | + $locale = apply_filters('plugin_locale', get_locale(), 'geodirectory');
|
|
| 4054 | 4054 | |
| 4055 | - load_textdomain( 'geodirectory', WP_LANG_DIR . '/' . 'geodirectory' . '/' . 'geodirectory' . '-' . $locale . '.mo' ); |
|
| 4056 | - load_plugin_textdomain( 'geodirectory', false, plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/geodirectory-languages' ); |
|
| 4055 | + load_textdomain('geodirectory', WP_LANG_DIR.'/'.'geodirectory'.'/'.'geodirectory'.'-'.$locale.'.mo');
|
|
| 4056 | + load_plugin_textdomain('geodirectory', false, plugin_basename(dirname(dirname(__FILE__))).'/geodirectory-languages');
|
|
| 4057 | 4057 | |
| 4058 | 4058 | /** |
| 4059 | 4059 | * Define language constants. |
| 4060 | 4060 | * |
| 4061 | 4061 | * @since 1.0.0 |
| 4062 | 4062 | */ |
| 4063 | - require_once( geodir_plugin_path() . '/language.php' ); |
|
| 4063 | + require_once(geodir_plugin_path().'/language.php'); |
|
| 4064 | 4064 | |
| 4065 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
| 4065 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
| 4066 | 4066 | |
| 4067 | 4067 | // Load language string file if not created yet |
| 4068 | - if ( ! file_exists( $language_file ) ) {
|
|
| 4068 | + if (!file_exists($language_file)) {
|
|
| 4069 | 4069 | geodirectory_load_db_language(); |
| 4070 | 4070 | } |
| 4071 | 4071 | |
| 4072 | - if ( file_exists( $language_file ) ) {
|
|
| 4072 | + if (file_exists($language_file)) {
|
|
| 4073 | 4073 | /** |
| 4074 | 4074 | * Language strings from database. |
| 4075 | 4075 | * |
| 4076 | 4076 | * @since 1.4.2 |
| 4077 | 4077 | */ |
| 4078 | 4078 | try {
|
| 4079 | - require_once( $language_file ); |
|
| 4080 | - } catch ( Exception $e ) {
|
|
| 4081 | - error_log( 'Language Error: ' . $e->getMessage() ); |
|
| 4079 | + require_once($language_file); |
|
| 4080 | + } catch (Exception $e) {
|
|
| 4081 | + error_log('Language Error: '.$e->getMessage());
|
|
| 4082 | 4082 | } |
| 4083 | 4083 | } |
| 4084 | 4084 | } |
@@ -4095,19 +4095,19 @@ discard block |
||
| 4095 | 4095 | */ |
| 4096 | 4096 | function geodirectory_load_db_language() {
|
| 4097 | 4097 | global $wp_filesystem; |
| 4098 | - if ( empty( $wp_filesystem ) ) {
|
|
| 4099 | - require_once( ABSPATH . '/wp-admin/includes/file.php' ); |
|
| 4098 | + if (empty($wp_filesystem)) {
|
|
| 4099 | + require_once(ABSPATH.'/wp-admin/includes/file.php'); |
|
| 4100 | 4100 | WP_Filesystem(); |
| 4101 | 4101 | global $wp_filesystem; |
| 4102 | 4102 | } |
| 4103 | 4103 | |
| 4104 | - $language_file = geodir_plugin_path() . '/db-language.php'; |
|
| 4104 | + $language_file = geodir_plugin_path().'/db-language.php'; |
|
| 4105 | 4105 | |
| 4106 | - if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
|
|
| 4106 | + if (is_file($language_file) && !is_writable($language_file)) {
|
|
| 4107 | 4107 | return false; |
| 4108 | 4108 | } // Not possible to create. |
| 4109 | 4109 | |
| 4110 | - if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
|
|
| 4110 | + if (!is_file($language_file) && !is_writable(dirname($language_file))) {
|
|
| 4111 | 4111 | return false; |
| 4112 | 4112 | } // Not possible to create. |
| 4113 | 4113 | |
@@ -4120,9 +4120,9 @@ discard block |
||
| 4120 | 4120 | * |
| 4121 | 4121 | * @param array $contents_strings Array of strings. |
| 4122 | 4122 | */ |
| 4123 | - $contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings ); |
|
| 4123 | + $contents_strings = apply_filters('geodir_load_db_language', $contents_strings);
|
|
| 4124 | 4124 | |
| 4125 | - $contents_strings = array_unique( $contents_strings ); |
|
| 4125 | + $contents_strings = array_unique($contents_strings); |
|
| 4126 | 4126 | |
| 4127 | 4127 | $contents_head = array(); |
| 4128 | 4128 | $contents_head[] = "<?php"; |
@@ -4139,20 +4139,20 @@ discard block |
||
| 4139 | 4139 | $contents_foot[] = ""; |
| 4140 | 4140 | $contents_foot[] = ""; |
| 4141 | 4141 | |
| 4142 | - $contents = implode( PHP_EOL, $contents_head ); |
|
| 4142 | + $contents = implode(PHP_EOL, $contents_head); |
|
| 4143 | 4143 | |
| 4144 | - if ( ! empty( $contents_strings ) ) {
|
|
| 4145 | - foreach ( $contents_strings as $string ) {
|
|
| 4146 | - if ( is_scalar( $string ) && $string != '' ) {
|
|
| 4147 | - $string = str_replace( "'", "\'", $string ); |
|
| 4148 | - $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');";
|
|
| 4144 | + if (!empty($contents_strings)) {
|
|
| 4145 | + foreach ($contents_strings as $string) {
|
|
| 4146 | + if (is_scalar($string) && $string != '') {
|
|
| 4147 | + $string = str_replace("'", "\'", $string);
|
|
| 4148 | + $contents .= PHP_EOL."__('".$string."', 'geodirectory');";
|
|
| 4149 | 4149 | } |
| 4150 | 4150 | } |
| 4151 | 4151 | } |
| 4152 | 4152 | |
| 4153 | - $contents .= implode( PHP_EOL, $contents_foot ); |
|
| 4153 | + $contents .= implode(PHP_EOL, $contents_foot); |
|
| 4154 | 4154 | |
| 4155 | - if ( $wp_filesystem->put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
|
|
| 4155 | + if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) {
|
|
| 4156 | 4156 | return false; |
| 4157 | 4157 | } // Failure; could not write file. |
| 4158 | 4158 | |
@@ -4172,45 +4172,45 @@ discard block |
||
| 4172 | 4172 | * |
| 4173 | 4173 | * @return array Translation texts. |
| 4174 | 4174 | */ |
| 4175 | -function geodir_load_custom_field_translation( $translation_texts = array() ) {
|
|
| 4175 | +function geodir_load_custom_field_translation($translation_texts = array()) {
|
|
| 4176 | 4176 | global $wpdb; |
| 4177 | 4177 | |
| 4178 | 4178 | // Custom fields table |
| 4179 | - $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM " . GEODIR_CUSTOM_FIELDS_TABLE; |
|
| 4180 | - $rows = $wpdb->get_results( $sql ); |
|
| 4179 | + $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values FROM ".GEODIR_CUSTOM_FIELDS_TABLE; |
|
| 4180 | + $rows = $wpdb->get_results($sql); |
|
| 4181 | 4181 | |
| 4182 | - if ( ! empty( $rows ) ) {
|
|
| 4183 | - foreach ( $rows as $row ) {
|
|
| 4184 | - if ( ! empty( $row->admin_title ) ) {
|
|
| 4185 | - $translation_texts[] = stripslashes_deep( $row->admin_title ); |
|
| 4182 | + if (!empty($rows)) {
|
|
| 4183 | + foreach ($rows as $row) {
|
|
| 4184 | + if (!empty($row->admin_title)) {
|
|
| 4185 | + $translation_texts[] = stripslashes_deep($row->admin_title); |
|
| 4186 | 4186 | } |
| 4187 | 4187 | |
| 4188 | - if ( ! empty( $row->admin_desc ) ) {
|
|
| 4189 | - $translation_texts[] = stripslashes_deep( $row->admin_desc ); |
|
| 4188 | + if (!empty($row->admin_desc)) {
|
|
| 4189 | + $translation_texts[] = stripslashes_deep($row->admin_desc); |
|
| 4190 | 4190 | } |
| 4191 | 4191 | |
| 4192 | - if ( ! empty( $row->site_title ) ) {
|
|
| 4193 | - $translation_texts[] = stripslashes_deep( $row->site_title ); |
|
| 4192 | + if (!empty($row->site_title)) {
|
|
| 4193 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
| 4194 | 4194 | } |
| 4195 | 4195 | |
| 4196 | - if ( ! empty( $row->clabels ) ) {
|
|
| 4197 | - $translation_texts[] = stripslashes_deep( $row->clabels ); |
|
| 4196 | + if (!empty($row->clabels)) {
|
|
| 4197 | + $translation_texts[] = stripslashes_deep($row->clabels); |
|
| 4198 | 4198 | } |
| 4199 | 4199 | |
| 4200 | - if ( ! empty( $row->required_msg ) ) {
|
|
| 4201 | - $translation_texts[] = stripslashes_deep( $row->required_msg ); |
|
| 4200 | + if (!empty($row->required_msg)) {
|
|
| 4201 | + $translation_texts[] = stripslashes_deep($row->required_msg); |
|
| 4202 | 4202 | } |
| 4203 | 4203 | |
| 4204 | - if ( ! empty( $row->default_value ) ) {
|
|
| 4205 | - $translation_texts[] = stripslashes_deep( $row->default_value ); |
|
| 4204 | + if (!empty($row->default_value)) {
|
|
| 4205 | + $translation_texts[] = stripslashes_deep($row->default_value); |
|
| 4206 | 4206 | } |
| 4207 | 4207 | |
| 4208 | - if ( ! empty( $row->option_values ) ) {
|
|
| 4209 | - $option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) ); |
|
| 4208 | + if (!empty($row->option_values)) {
|
|
| 4209 | + $option_values = geodir_string_values_to_options(stripslashes_deep($row->option_values)); |
|
| 4210 | 4210 | |
| 4211 | - if ( ! empty( $option_values ) ) {
|
|
| 4212 | - foreach ( $option_values as $option_value ) {
|
|
| 4213 | - if ( ! empty( $option_value['label'] ) ) {
|
|
| 4211 | + if (!empty($option_values)) {
|
|
| 4212 | + foreach ($option_values as $option_value) {
|
|
| 4213 | + if (!empty($option_value['label'])) {
|
|
| 4214 | 4214 | $translation_texts[] = $option_value['label']; |
| 4215 | 4215 | } |
| 4216 | 4216 | } |
@@ -4220,48 +4220,48 @@ discard block |
||
| 4220 | 4220 | } |
| 4221 | 4221 | |
| 4222 | 4222 | // Custom sorting fields table |
| 4223 | - $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
| 4224 | - $rows = $wpdb->get_results( $sql ); |
|
| 4223 | + $sql = "SELECT site_title, asc_title, desc_title FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE; |
|
| 4224 | + $rows = $wpdb->get_results($sql); |
|
| 4225 | 4225 | |
| 4226 | - if ( ! empty( $rows ) ) {
|
|
| 4227 | - foreach ( $rows as $row ) {
|
|
| 4228 | - if ( ! empty( $row->site_title ) ) {
|
|
| 4229 | - $translation_texts[] = stripslashes_deep( $row->site_title ); |
|
| 4226 | + if (!empty($rows)) {
|
|
| 4227 | + foreach ($rows as $row) {
|
|
| 4228 | + if (!empty($row->site_title)) {
|
|
| 4229 | + $translation_texts[] = stripslashes_deep($row->site_title); |
|
| 4230 | 4230 | } |
| 4231 | 4231 | |
| 4232 | - if ( ! empty( $row->asc_title ) ) {
|
|
| 4233 | - $translation_texts[] = stripslashes_deep( $row->asc_title ); |
|
| 4232 | + if (!empty($row->asc_title)) {
|
|
| 4233 | + $translation_texts[] = stripslashes_deep($row->asc_title); |
|
| 4234 | 4234 | } |
| 4235 | 4235 | |
| 4236 | - if ( ! empty( $row->desc_title ) ) {
|
|
| 4237 | - $translation_texts[] = stripslashes_deep( $row->desc_title ); |
|
| 4236 | + if (!empty($row->desc_title)) {
|
|
| 4237 | + $translation_texts[] = stripslashes_deep($row->desc_title); |
|
| 4238 | 4238 | } |
| 4239 | 4239 | } |
| 4240 | 4240 | } |
| 4241 | 4241 | |
| 4242 | 4242 | // Advance search filter fields table |
| 4243 | - if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) {
|
|
| 4244 | - $sql = "SELECT field_site_name, front_search_title, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE; |
|
| 4245 | - $rows = $wpdb->get_results( $sql ); |
|
| 4246 | - |
|
| 4247 | - if ( ! empty( $rows ) ) {
|
|
| 4248 | - foreach ( $rows as $row ) {
|
|
| 4249 | - if ( ! empty( $row->field_site_name ) ) {
|
|
| 4250 | - $translation_texts[] = stripslashes_deep( $row->field_site_name ); |
|
| 4243 | + if (defined('GEODIR_ADVANCE_SEARCH_TABLE')) {
|
|
| 4244 | + $sql = "SELECT field_site_name, front_search_title, field_desc FROM ".GEODIR_ADVANCE_SEARCH_TABLE; |
|
| 4245 | + $rows = $wpdb->get_results($sql); |
|
| 4246 | + |
|
| 4247 | + if (!empty($rows)) {
|
|
| 4248 | + foreach ($rows as $row) {
|
|
| 4249 | + if (!empty($row->field_site_name)) {
|
|
| 4250 | + $translation_texts[] = stripslashes_deep($row->field_site_name); |
|
| 4251 | 4251 | } |
| 4252 | 4252 | |
| 4253 | - if ( ! empty( $row->front_search_title ) ) {
|
|
| 4254 | - $translation_texts[] = stripslashes_deep( $row->front_search_title ); |
|
| 4253 | + if (!empty($row->front_search_title)) {
|
|
| 4254 | + $translation_texts[] = stripslashes_deep($row->front_search_title); |
|
| 4255 | 4255 | } |
| 4256 | 4256 | |
| 4257 | - if ( ! empty( $row->field_desc ) ) {
|
|
| 4258 | - $translation_texts[] = stripslashes_deep( $row->field_desc ); |
|
| 4257 | + if (!empty($row->field_desc)) {
|
|
| 4258 | + $translation_texts[] = stripslashes_deep($row->field_desc); |
|
| 4259 | 4259 | } |
| 4260 | 4260 | } |
| 4261 | 4261 | } |
| 4262 | 4262 | } |
| 4263 | 4263 | |
| 4264 | - $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; |
|
| 4264 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
| 4265 | 4265 | |
| 4266 | 4266 | return $translation_texts; |
| 4267 | 4267 | } |
@@ -4283,7 +4283,7 @@ discard block |
||
| 4283 | 4283 | * |
| 4284 | 4284 | * @param array $geodir_allowed_mime_types and file extensions. |
| 4285 | 4285 | */ |
| 4286 | - return apply_filters( 'geodir_allowed_mime_types', array( |
|
| 4286 | + return apply_filters('geodir_allowed_mime_types', array(
|
|
| 4287 | 4287 | 'Image' => array( // Image formats. |
| 4288 | 4288 | 'jpg' => 'image/jpeg', |
| 4289 | 4289 | 'jpe' => 'image/jpeg', |
@@ -4351,18 +4351,18 @@ discard block |
||
| 4351 | 4351 | * |
| 4352 | 4352 | * @return string User display name. |
| 4353 | 4353 | */ |
| 4354 | -function geodir_get_client_name( $user_id ) {
|
|
| 4354 | +function geodir_get_client_name($user_id) {
|
|
| 4355 | 4355 | $client_name = ''; |
| 4356 | 4356 | |
| 4357 | - $user_data = get_userdata( $user_id ); |
|
| 4357 | + $user_data = get_userdata($user_id); |
|
| 4358 | 4358 | |
| 4359 | - if ( ! empty( $user_data ) ) {
|
|
| 4360 | - if ( isset( $user_data->display_name ) && trim( $user_data->display_name ) != '' ) {
|
|
| 4361 | - $client_name = trim( $user_data->display_name ); |
|
| 4362 | - } else if ( isset( $user_data->user_nicename ) && trim( $user_data->user_nicename ) != '' ) {
|
|
| 4363 | - $client_name = trim( $user_data->user_nicename ); |
|
| 4359 | + if (!empty($user_data)) {
|
|
| 4360 | + if (isset($user_data->display_name) && trim($user_data->display_name) != '') {
|
|
| 4361 | + $client_name = trim($user_data->display_name); |
|
| 4362 | + } else if (isset($user_data->user_nicename) && trim($user_data->user_nicename) != '') {
|
|
| 4363 | + $client_name = trim($user_data->user_nicename); |
|
| 4364 | 4364 | } else {
|
| 4365 | - $client_name = trim( $user_data->user_login ); |
|
| 4365 | + $client_name = trim($user_data->user_login); |
|
| 4366 | 4366 | } |
| 4367 | 4367 | } |
| 4368 | 4368 | |
@@ -4370,19 +4370,19 @@ discard block |
||
| 4370 | 4370 | } |
| 4371 | 4371 | |
| 4372 | 4372 | |
| 4373 | -add_filter( 'wpseo_replacements', 'geodir_wpseo_replacements', 10, 1 ); |
|
| 4373 | +add_filter('wpseo_replacements', 'geodir_wpseo_replacements', 10, 1);
|
|
| 4374 | 4374 | /* |
| 4375 | 4375 | * Add location variables to wpseo replacements. |
| 4376 | 4376 | * |
| 4377 | 4377 | * @since 1.5.4 |
| 4378 | 4378 | */ |
| 4379 | -function geodir_wpseo_replacements( $vars ) {
|
|
| 4379 | +function geodir_wpseo_replacements($vars) {
|
|
| 4380 | 4380 | |
| 4381 | 4381 | global $wp; |
| 4382 | 4382 | $title = ''; |
| 4383 | 4383 | // location variables |
| 4384 | 4384 | $gd_post_type = geodir_get_current_posttype(); |
| 4385 | - $location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
| 4385 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
|
|
| 4386 | 4386 | /** |
| 4387 | 4387 | * Filter the title variables location variables array |
| 4388 | 4388 | * |
@@ -4392,105 +4392,105 @@ discard block |
||
| 4392 | 4392 | * @param array $location_array The array of location variables. |
| 4393 | 4393 | * @param array $vars The page title variables. |
| 4394 | 4394 | */ |
| 4395 | - $location_array = apply_filters( 'geodir_filter_title_variables_location_arr_seo', $location_array, $vars ); |
|
| 4395 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr_seo', $location_array, $vars);
|
|
| 4396 | 4396 | $location_titles = array(); |
| 4397 | - if ( get_query_var( 'gd_country_full' ) ) {
|
|
| 4398 | - if ( get_query_var( 'gd_country_full' ) ) {
|
|
| 4399 | - $location_array['gd_country'] = get_query_var( 'gd_country_full' ); |
|
| 4397 | + if (get_query_var('gd_country_full')) {
|
|
| 4398 | + if (get_query_var('gd_country_full')) {
|
|
| 4399 | + $location_array['gd_country'] = get_query_var('gd_country_full');
|
|
| 4400 | 4400 | } |
| 4401 | - if ( get_query_var( 'gd_region_full' ) ) {
|
|
| 4402 | - $location_array['gd_region'] = get_query_var( 'gd_region_full' ); |
|
| 4401 | + if (get_query_var('gd_region_full')) {
|
|
| 4402 | + $location_array['gd_region'] = get_query_var('gd_region_full');
|
|
| 4403 | 4403 | } |
| 4404 | - if ( get_query_var( 'gd_city_full' ) ) {
|
|
| 4405 | - $location_array['gd_city'] = get_query_var( 'gd_city_full' ); |
|
| 4404 | + if (get_query_var('gd_city_full')) {
|
|
| 4405 | + $location_array['gd_city'] = get_query_var('gd_city_full');
|
|
| 4406 | 4406 | } |
| 4407 | 4407 | } |
| 4408 | 4408 | $location_single = ''; |
| 4409 | - $gd_country = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : ''; |
|
| 4410 | - $gd_region = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : ''; |
|
| 4411 | - $gd_city = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : ''; |
|
| 4409 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 4410 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 4411 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 4412 | 4412 | |
| 4413 | 4413 | $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
| 4414 | 4414 | |
| 4415 | - if ( function_exists( 'get_actual_location_name' ) ) {
|
|
| 4416 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country; |
|
| 4417 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region; |
|
| 4418 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city; |
|
| 4415 | + if (function_exists('get_actual_location_name')) {
|
|
| 4416 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 4417 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 4418 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 4419 | 4419 | } |
| 4420 | 4420 | |
| 4421 | - if ( $gd_city != '' ) {
|
|
| 4422 | - if ( $gd_city_actual != '' ) {
|
|
| 4421 | + if ($gd_city != '') {
|
|
| 4422 | + if ($gd_city_actual != '') {
|
|
| 4423 | 4423 | $gd_city = $gd_city_actual; |
| 4424 | 4424 | } else {
|
| 4425 | - $gd_city = preg_replace( '/-(\d+)$/', '', $gd_city ); |
|
| 4426 | - $gd_city = preg_replace( '/[_-]/', ' ', $gd_city ); |
|
| 4427 | - $gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' ); |
|
| 4425 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 4426 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 4427 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 4428 | 4428 | } |
| 4429 | 4429 | $location_single = $gd_city; |
| 4430 | 4430 | |
| 4431 | - } else if ( $gd_region != '' ) {
|
|
| 4432 | - if ( $gd_region_actual != '' ) {
|
|
| 4431 | + } else if ($gd_region != '') {
|
|
| 4432 | + if ($gd_region_actual != '') {
|
|
| 4433 | 4433 | $gd_region = $gd_region_actual; |
| 4434 | 4434 | } else {
|
| 4435 | - $gd_region = preg_replace( '/-(\d+)$/', '', $gd_region ); |
|
| 4436 | - $gd_region = preg_replace( '/[_-]/', ' ', $gd_region ); |
|
| 4437 | - $gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' ); |
|
| 4435 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 4436 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 4437 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 4438 | 4438 | } |
| 4439 | 4439 | |
| 4440 | 4440 | $location_single = $gd_region; |
| 4441 | - } else if ( $gd_country != '' ) {
|
|
| 4442 | - if ( $gd_country_actual != '' ) {
|
|
| 4441 | + } else if ($gd_country != '') {
|
|
| 4442 | + if ($gd_country_actual != '') {
|
|
| 4443 | 4443 | $gd_country = $gd_country_actual; |
| 4444 | 4444 | } else {
|
| 4445 | - $gd_country = preg_replace( '/-(\d+)$/', '', $gd_country ); |
|
| 4446 | - $gd_country = preg_replace( '/[_-]/', ' ', $gd_country ); |
|
| 4447 | - $gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' ); |
|
| 4445 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 4446 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 4447 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 4448 | 4448 | } |
| 4449 | 4449 | |
| 4450 | 4450 | $location_single = $gd_country; |
| 4451 | 4451 | } |
| 4452 | 4452 | |
| 4453 | - if ( ! empty( $location_array ) ) {
|
|
| 4453 | + if (!empty($location_array)) {
|
|
| 4454 | 4454 | |
| 4455 | - $actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false; |
|
| 4456 | - $location_array = array_reverse( $location_array ); |
|
| 4455 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false;
|
|
| 4456 | + $location_array = array_reverse($location_array); |
|
| 4457 | 4457 | |
| 4458 | - foreach ( $location_array as $location_type => $location ) {
|
|
| 4459 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location ); |
|
| 4460 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
| 4458 | + foreach ($location_array as $location_type => $location) {
|
|
| 4459 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
|
|
| 4460 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
|
|
| 4461 | 4461 | |
| 4462 | - $location_name = geodir_ucwords( $gd_location_link_text ); |
|
| 4463 | - $location_name = __( $location_name, 'geodirectory' ); |
|
| 4462 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
| 4463 | + $location_name = __($location_name, 'geodirectory'); |
|
| 4464 | 4464 | |
| 4465 | - if ( $actual_location_name ) {
|
|
| 4466 | - $location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type; |
|
| 4467 | - $location_name = get_actual_location_name( $location_type, $location, true ); |
|
| 4465 | + if ($actual_location_name) {
|
|
| 4466 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
| 4467 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 4468 | 4468 | } |
| 4469 | 4469 | |
| 4470 | 4470 | $location_titles[] = $location_name; |
| 4471 | 4471 | } |
| 4472 | - if ( ! empty( $location_titles ) ) {
|
|
| 4473 | - $location_titles = array_unique( $location_titles ); |
|
| 4472 | + if (!empty($location_titles)) {
|
|
| 4473 | + $location_titles = array_unique($location_titles); |
|
| 4474 | 4474 | } |
| 4475 | 4475 | } |
| 4476 | 4476 | |
| 4477 | 4477 | |
| 4478 | - if ( ! empty( $location_titles ) ) {
|
|
| 4479 | - $vars['%%location%%'] = implode( ", ", $location_titles ); |
|
| 4478 | + if (!empty($location_titles)) {
|
|
| 4479 | + $vars['%%location%%'] = implode(", ", $location_titles);
|
|
| 4480 | 4480 | } |
| 4481 | 4481 | |
| 4482 | 4482 | |
| 4483 | - if ( ! empty( $location_titles ) ) {
|
|
| 4484 | - $vars['%%in_location%%'] = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles ); |
|
| 4483 | + if (!empty($location_titles)) {
|
|
| 4484 | + $vars['%%in_location%%'] = __('in ', 'geodirectory').implode(", ", $location_titles);
|
|
| 4485 | 4485 | } |
| 4486 | 4486 | |
| 4487 | 4487 | |
| 4488 | - if ( $location_single ) {
|
|
| 4489 | - $vars['%%in_location_single%%'] = __( 'in', 'geodirectory' ) . ' ' . $location_single; |
|
| 4488 | + if ($location_single) {
|
|
| 4489 | + $vars['%%in_location_single%%'] = __('in', 'geodirectory').' '.$location_single;
|
|
| 4490 | 4490 | } |
| 4491 | 4491 | |
| 4492 | 4492 | |
| 4493 | - if ( $location_single ) {
|
|
| 4493 | + if ($location_single) {
|
|
| 4494 | 4494 | $vars['%%location_single%%'] = $location_single; |
| 4495 | 4495 | } |
| 4496 | 4496 | |
@@ -4503,13 +4503,13 @@ discard block |
||
| 4503 | 4503 | * @param string $vars The title with variables. |
| 4504 | 4504 | * @param array $location_array The array of location variables. |
| 4505 | 4505 | */ |
| 4506 | - return apply_filters( 'geodir_wpseo_replacements_vars', $vars, $location_array ); |
|
| 4506 | + return apply_filters('geodir_wpseo_replacements_vars', $vars, $location_array);
|
|
| 4507 | 4507 | } |
| 4508 | 4508 | |
| 4509 | 4509 | |
| 4510 | -add_filter( 'geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3 ); |
|
| 4511 | -add_filter( 'geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2 ); |
|
| 4512 | -add_filter( 'geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3 ); |
|
| 4510 | +add_filter('geodir_seo_meta_title', 'geodir_filter_title_variables', 10, 3);
|
|
| 4511 | +add_filter('geodir_seo_page_title', 'geodir_filter_title_variables', 10, 2);
|
|
| 4512 | +add_filter('geodir_seo_meta_description_pre', 'geodir_filter_title_variables', 10, 3);
|
|
| 4513 | 4513 | |
| 4514 | 4514 | /** |
| 4515 | 4515 | * Filter the title variables. |
@@ -4551,14 +4551,14 @@ discard block |
||
| 4551 | 4551 | * |
| 4552 | 4552 | * @return string Title after filtered variables. |
| 4553 | 4553 | */ |
| 4554 | -function geodir_filter_title_variables( $title, $gd_page, $sep = '' ) {
|
|
| 4554 | +function geodir_filter_title_variables($title, $gd_page, $sep = '') {
|
|
| 4555 | 4555 | global $wp, $post; |
| 4556 | 4556 | |
| 4557 | - if ( ! $gd_page || ! $title ) {
|
|
| 4557 | + if (!$gd_page || !$title) {
|
|
| 4558 | 4558 | return $title; // if no a GD page then bail. |
| 4559 | 4559 | } |
| 4560 | 4560 | |
| 4561 | - if ( $sep == '' ) {
|
|
| 4561 | + if ($sep == '') {
|
|
| 4562 | 4562 | /** |
| 4563 | 4563 | * Filter the page title separator. |
| 4564 | 4564 | * |
@@ -4567,100 +4567,100 @@ discard block |
||
| 4567 | 4567 | * |
| 4568 | 4568 | * @param string $sep The separator, default: `|`. |
| 4569 | 4569 | */ |
| 4570 | - $sep = apply_filters( 'geodir_page_title_separator', '|' ); |
|
| 4570 | + $sep = apply_filters('geodir_page_title_separator', '|');
|
|
| 4571 | 4571 | } |
| 4572 | 4572 | |
| 4573 | - if ( strpos( $title, '%%title%%' ) !== false ) {
|
|
| 4574 | - $title = str_replace( "%%title%%", $post->post_title, $title ); |
|
| 4573 | + if (strpos($title, '%%title%%') !== false) {
|
|
| 4574 | + $title = str_replace("%%title%%", $post->post_title, $title);
|
|
| 4575 | 4575 | } |
| 4576 | 4576 | |
| 4577 | - if ( strpos( $title, '%%sitename%%' ) !== false ) {
|
|
| 4578 | - $title = str_replace( "%%sitename%%", get_bloginfo( 'name' ), $title ); |
|
| 4577 | + if (strpos($title, '%%sitename%%') !== false) {
|
|
| 4578 | + $title = str_replace("%%sitename%%", get_bloginfo('name'), $title);
|
|
| 4579 | 4579 | } |
| 4580 | 4580 | |
| 4581 | - if ( strpos( $title, '%%sitedesc%%' ) !== false ) {
|
|
| 4582 | - $title = str_replace( "%%sitedesc%%", get_bloginfo( 'description' ), $title ); |
|
| 4581 | + if (strpos($title, '%%sitedesc%%') !== false) {
|
|
| 4582 | + $title = str_replace("%%sitedesc%%", get_bloginfo('description'), $title);
|
|
| 4583 | 4583 | } |
| 4584 | 4584 | |
| 4585 | - if ( strpos( $title, '%%excerpt%%' ) !== false ) {
|
|
| 4586 | - $title = str_replace( "%%excerpt%%", strip_tags( get_the_excerpt() ), $title ); |
|
| 4585 | + if (strpos($title, '%%excerpt%%') !== false) {
|
|
| 4586 | + $title = str_replace("%%excerpt%%", strip_tags(get_the_excerpt()), $title);
|
|
| 4587 | 4587 | } |
| 4588 | 4588 | |
| 4589 | - if ( $gd_page == 'search' || $gd_page == 'author' ) {
|
|
| 4590 | - $post_type = isset( $_REQUEST['stype'] ) ? sanitize_text_field( $_REQUEST['stype'] ) : ''; |
|
| 4591 | - } else if ( $gd_page == 'add-listing' ) {
|
|
| 4592 | - $post_type = ( isset( $_REQUEST['listing_type'] ) ) ? sanitize_text_field( $_REQUEST['listing_type'] ) : ''; |
|
| 4593 | - $post_type = ! $post_type && ! empty( $_REQUEST['pid'] ) ? get_post_type( (int) $_REQUEST['pid'] ) : $post_type; |
|
| 4594 | - } else if ( isset( $post->post_type ) && $post->post_type && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 4589 | + if ($gd_page == 'search' || $gd_page == 'author') {
|
|
| 4590 | + $post_type = isset($_REQUEST['stype']) ? sanitize_text_field($_REQUEST['stype']) : ''; |
|
| 4591 | + } else if ($gd_page == 'add-listing') {
|
|
| 4592 | + $post_type = (isset($_REQUEST['listing_type'])) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
| 4593 | + $post_type = !$post_type && !empty($_REQUEST['pid']) ? get_post_type((int) $_REQUEST['pid']) : $post_type; |
|
| 4594 | + } else if (isset($post->post_type) && $post->post_type && in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 4595 | 4595 | $post_type = $post->post_type; |
| 4596 | 4596 | } else {
|
| 4597 | - $post_type = get_query_var( 'post_type' ); |
|
| 4597 | + $post_type = get_query_var('post_type');
|
|
| 4598 | 4598 | } |
| 4599 | 4599 | |
| 4600 | - if ( strpos( $title, '%%pt_single%%' ) !== false ) {
|
|
| 4600 | + if (strpos($title, '%%pt_single%%') !== false) {
|
|
| 4601 | 4601 | $singular_name = ''; |
| 4602 | - if ( $post_type && $singular_name = get_post_type_singular_label( $post_type ) ) {
|
|
| 4603 | - $singular_name = __( $singular_name, 'geodirectory' ); |
|
| 4602 | + if ($post_type && $singular_name = get_post_type_singular_label($post_type)) {
|
|
| 4603 | + $singular_name = __($singular_name, 'geodirectory'); |
|
| 4604 | 4604 | } |
| 4605 | 4605 | |
| 4606 | - $title = str_replace( "%%pt_single%%", $singular_name, $title ); |
|
| 4606 | + $title = str_replace("%%pt_single%%", $singular_name, $title);
|
|
| 4607 | 4607 | } |
| 4608 | 4608 | |
| 4609 | - if ( strpos( $title, '%%pt_plural%%' ) !== false ) {
|
|
| 4609 | + if (strpos($title, '%%pt_plural%%') !== false) {
|
|
| 4610 | 4610 | $plural_name = ''; |
| 4611 | - if ( $post_type && $plural_name = get_post_type_plural_label( $post_type ) ) {
|
|
| 4612 | - $plural_name = __( $plural_name, 'geodirectory' ); |
|
| 4611 | + if ($post_type && $plural_name = get_post_type_plural_label($post_type)) {
|
|
| 4612 | + $plural_name = __($plural_name, 'geodirectory'); |
|
| 4613 | 4613 | } |
| 4614 | 4614 | |
| 4615 | - $title = str_replace( "%%pt_plural%%", $plural_name, $title ); |
|
| 4615 | + $title = str_replace("%%pt_plural%%", $plural_name, $title);
|
|
| 4616 | 4616 | } |
| 4617 | 4617 | |
| 4618 | - if ( strpos( $title, '%%category%%' ) !== false ) {
|
|
| 4618 | + if (strpos($title, '%%category%%') !== false) {
|
|
| 4619 | 4619 | $cat_name = ''; |
| 4620 | 4620 | |
| 4621 | - if ( $gd_page == 'detail' ) {
|
|
| 4622 | - if ( $post->default_category ) {
|
|
| 4623 | - $cat = get_term( $post->default_category, $post->post_type . 'category' ); |
|
| 4624 | - $cat_name = ( isset( $cat->name ) ) ? $cat->name : ''; |
|
| 4621 | + if ($gd_page == 'detail') {
|
|
| 4622 | + if ($post->default_category) {
|
|
| 4623 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
| 4624 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
| 4625 | 4625 | } |
| 4626 | - } else if ( $gd_page == 'listing' ) {
|
|
| 4626 | + } else if ($gd_page == 'listing') {
|
|
| 4627 | 4627 | $queried_object = get_queried_object(); |
| 4628 | - if ( isset( $queried_object->name ) ) {
|
|
| 4628 | + if (isset($queried_object->name)) {
|
|
| 4629 | 4629 | $cat_name = $queried_object->name; |
| 4630 | 4630 | } |
| 4631 | 4631 | } |
| 4632 | - $title = str_replace( "%%category%%", $cat_name, $title ); |
|
| 4632 | + $title = str_replace("%%category%%", $cat_name, $title);
|
|
| 4633 | 4633 | } |
| 4634 | 4634 | |
| 4635 | - if ( strpos( $title, '%%tag%%' ) !== false ) {
|
|
| 4635 | + if (strpos($title, '%%tag%%') !== false) {
|
|
| 4636 | 4636 | $cat_name = ''; |
| 4637 | 4637 | |
| 4638 | - if ( $gd_page == 'detail' ) {
|
|
| 4639 | - if ( $post->default_category ) {
|
|
| 4640 | - $cat = get_term( $post->default_category, $post->post_type . 'category' ); |
|
| 4641 | - $cat_name = ( isset( $cat->name ) ) ? $cat->name : ''; |
|
| 4638 | + if ($gd_page == 'detail') {
|
|
| 4639 | + if ($post->default_category) {
|
|
| 4640 | + $cat = get_term($post->default_category, $post->post_type.'category'); |
|
| 4641 | + $cat_name = (isset($cat->name)) ? $cat->name : ''; |
|
| 4642 | 4642 | } |
| 4643 | - } else if ( $gd_page == 'listing' ) {
|
|
| 4643 | + } else if ($gd_page == 'listing') {
|
|
| 4644 | 4644 | $queried_object = get_queried_object(); |
| 4645 | - if ( isset( $queried_object->name ) ) {
|
|
| 4645 | + if (isset($queried_object->name)) {
|
|
| 4646 | 4646 | $cat_name = $queried_object->name; |
| 4647 | 4647 | } |
| 4648 | 4648 | } |
| 4649 | - $title = str_replace( "%%tag%%", $cat_name, $title ); |
|
| 4649 | + $title = str_replace("%%tag%%", $cat_name, $title);
|
|
| 4650 | 4650 | } |
| 4651 | 4651 | |
| 4652 | - if ( strpos( $title, '%%id%%' ) !== false ) {
|
|
| 4653 | - $ID = ( isset( $post->ID ) ) ? $post->ID : ''; |
|
| 4654 | - $title = str_replace( "%%id%%", $ID, $title ); |
|
| 4652 | + if (strpos($title, '%%id%%') !== false) {
|
|
| 4653 | + $ID = (isset($post->ID)) ? $post->ID : ''; |
|
| 4654 | + $title = str_replace("%%id%%", $ID, $title);
|
|
| 4655 | 4655 | } |
| 4656 | 4656 | |
| 4657 | - if ( strpos( $title, '%%sep%%' ) !== false ) {
|
|
| 4658 | - $title = str_replace( "%%sep%%", $sep, $title ); |
|
| 4657 | + if (strpos($title, '%%sep%%') !== false) {
|
|
| 4658 | + $title = str_replace("%%sep%%", $sep, $title);
|
|
| 4659 | 4659 | } |
| 4660 | 4660 | |
| 4661 | 4661 | // location variables |
| 4662 | 4662 | $gd_post_type = geodir_get_current_posttype(); |
| 4663 | - $location_array = geodir_get_current_location_terms( 'query_vars', $gd_post_type ); |
|
| 4663 | + $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
|
|
| 4664 | 4664 | /** |
| 4665 | 4665 | * Filter the title variables location variables array |
| 4666 | 4666 | * |
@@ -4672,166 +4672,166 @@ discard block |
||
| 4672 | 4672 | * @param string $gd_page The page being filtered. |
| 4673 | 4673 | * @param string $sep The separator, default: `|`. |
| 4674 | 4674 | */ |
| 4675 | - $location_array = apply_filters( 'geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep ); |
|
| 4675 | + $location_array = apply_filters('geodir_filter_title_variables_location_arr', $location_array, $title, $gd_page, $sep);
|
|
| 4676 | 4676 | $location_titles = array(); |
| 4677 | - if ( $gd_page == 'location' && get_query_var( 'gd_country_full' ) ) {
|
|
| 4678 | - if ( get_query_var( 'gd_country_full' ) ) {
|
|
| 4679 | - $location_array['gd_country'] = get_query_var( 'gd_country_full' ); |
|
| 4677 | + if ($gd_page == 'location' && get_query_var('gd_country_full')) {
|
|
| 4678 | + if (get_query_var('gd_country_full')) {
|
|
| 4679 | + $location_array['gd_country'] = get_query_var('gd_country_full');
|
|
| 4680 | 4680 | } |
| 4681 | - if ( get_query_var( 'gd_region_full' ) ) {
|
|
| 4682 | - $location_array['gd_region'] = get_query_var( 'gd_region_full' ); |
|
| 4681 | + if (get_query_var('gd_region_full')) {
|
|
| 4682 | + $location_array['gd_region'] = get_query_var('gd_region_full');
|
|
| 4683 | 4683 | } |
| 4684 | - if ( get_query_var( 'gd_city_full' ) ) {
|
|
| 4685 | - $location_array['gd_city'] = get_query_var( 'gd_city_full' ); |
|
| 4684 | + if (get_query_var('gd_city_full')) {
|
|
| 4685 | + $location_array['gd_city'] = get_query_var('gd_city_full');
|
|
| 4686 | 4686 | } |
| 4687 | 4687 | } |
| 4688 | 4688 | $location_single = ''; |
| 4689 | - $gd_country = ( isset( $wp->query_vars['gd_country'] ) && $wp->query_vars['gd_country'] != '' ) ? $wp->query_vars['gd_country'] : ''; |
|
| 4690 | - $gd_region = ( isset( $wp->query_vars['gd_region'] ) && $wp->query_vars['gd_region'] != '' ) ? $wp->query_vars['gd_region'] : ''; |
|
| 4691 | - $gd_city = ( isset( $wp->query_vars['gd_city'] ) && $wp->query_vars['gd_city'] != '' ) ? $wp->query_vars['gd_city'] : ''; |
|
| 4689 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 4690 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 4691 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 4692 | 4692 | |
| 4693 | 4693 | $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
| 4694 | 4694 | |
| 4695 | - if ( function_exists( 'get_actual_location_name' ) ) {
|
|
| 4696 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name( 'country', $gd_country, true ) : $gd_country; |
|
| 4697 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name( 'region', $gd_region ) : $gd_region; |
|
| 4698 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name( 'city', $gd_city ) : $gd_city; |
|
| 4695 | + if (function_exists('get_actual_location_name')) {
|
|
| 4696 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 4697 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 4698 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 4699 | 4699 | } |
| 4700 | 4700 | |
| 4701 | - if ( $gd_city != '' ) {
|
|
| 4702 | - if ( $gd_city_actual != '' ) {
|
|
| 4701 | + if ($gd_city != '') {
|
|
| 4702 | + if ($gd_city_actual != '') {
|
|
| 4703 | 4703 | $gd_city = $gd_city_actual; |
| 4704 | 4704 | } else {
|
| 4705 | - $gd_city = preg_replace( '/-(\d+)$/', '', $gd_city ); |
|
| 4706 | - $gd_city = preg_replace( '/[_-]/', ' ', $gd_city ); |
|
| 4707 | - $gd_city = __( geodir_ucwords( $gd_city ), 'geodirectory' ); |
|
| 4705 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 4706 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 4707 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 4708 | 4708 | } |
| 4709 | 4709 | $location_single = $gd_city; |
| 4710 | 4710 | |
| 4711 | - } else if ( $gd_region != '' ) {
|
|
| 4712 | - if ( $gd_region_actual != '' ) {
|
|
| 4711 | + } else if ($gd_region != '') {
|
|
| 4712 | + if ($gd_region_actual != '') {
|
|
| 4713 | 4713 | $gd_region = $gd_region_actual; |
| 4714 | 4714 | } else {
|
| 4715 | - $gd_region = preg_replace( '/-(\d+)$/', '', $gd_region ); |
|
| 4716 | - $gd_region = preg_replace( '/[_-]/', ' ', $gd_region ); |
|
| 4717 | - $gd_region = __( geodir_ucwords( $gd_region ), 'geodirectory' ); |
|
| 4715 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 4716 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 4717 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 4718 | 4718 | } |
| 4719 | 4719 | |
| 4720 | 4720 | $location_single = $gd_region; |
| 4721 | - } else if ( $gd_country != '' ) {
|
|
| 4722 | - if ( $gd_country_actual != '' ) {
|
|
| 4721 | + } else if ($gd_country != '') {
|
|
| 4722 | + if ($gd_country_actual != '') {
|
|
| 4723 | 4723 | $gd_country = $gd_country_actual; |
| 4724 | 4724 | } else {
|
| 4725 | - $gd_country = preg_replace( '/-(\d+)$/', '', $gd_country ); |
|
| 4726 | - $gd_country = preg_replace( '/[_-]/', ' ', $gd_country ); |
|
| 4727 | - $gd_country = __( geodir_ucwords( $gd_country ), 'geodirectory' ); |
|
| 4725 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 4726 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 4727 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 4728 | 4728 | } |
| 4729 | 4729 | |
| 4730 | 4730 | $location_single = $gd_country; |
| 4731 | 4731 | } |
| 4732 | 4732 | |
| 4733 | - if ( ! empty( $location_array ) ) {
|
|
| 4733 | + if (!empty($location_array)) {
|
|
| 4734 | 4734 | |
| 4735 | - $actual_location_name = function_exists( 'get_actual_location_name' ) ? true : false; |
|
| 4736 | - $location_array = array_reverse( $location_array ); |
|
| 4735 | + $actual_location_name = function_exists('get_actual_location_name') ? true : false;
|
|
| 4736 | + $location_array = array_reverse($location_array); |
|
| 4737 | 4737 | |
| 4738 | - foreach ( $location_array as $location_type => $location ) {
|
|
| 4739 | - $gd_location_link_text = preg_replace( '/-(\d+)$/', '', $location ); |
|
| 4740 | - $gd_location_link_text = preg_replace( '/[_-]/', ' ', $gd_location_link_text ); |
|
| 4738 | + foreach ($location_array as $location_type => $location) {
|
|
| 4739 | + $gd_location_link_text = preg_replace('/-(\d+)$/', '', $location);
|
|
| 4740 | + $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
|
|
| 4741 | 4741 | |
| 4742 | - $location_name = geodir_ucwords( $gd_location_link_text ); |
|
| 4743 | - $location_name = __( $location_name, 'geodirectory' ); |
|
| 4742 | + $location_name = geodir_ucwords($gd_location_link_text); |
|
| 4743 | + $location_name = __($location_name, 'geodirectory'); |
|
| 4744 | 4744 | |
| 4745 | - if ( $actual_location_name ) {
|
|
| 4746 | - $location_type = strpos( $location_type, 'gd_' ) === 0 ? substr( $location_type, 3 ) : $location_type; |
|
| 4747 | - $location_name = get_actual_location_name( $location_type, $location, true ); |
|
| 4745 | + if ($actual_location_name) {
|
|
| 4746 | + $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type; |
|
| 4747 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 4748 | 4748 | } |
| 4749 | 4749 | |
| 4750 | 4750 | $location_titles[] = $location_name; |
| 4751 | 4751 | } |
| 4752 | - if ( ! empty( $location_titles ) ) {
|
|
| 4753 | - $location_titles = array_unique( $location_titles ); |
|
| 4752 | + if (!empty($location_titles)) {
|
|
| 4753 | + $location_titles = array_unique($location_titles); |
|
| 4754 | 4754 | } |
| 4755 | 4755 | } |
| 4756 | 4756 | |
| 4757 | 4757 | |
| 4758 | - if ( strpos( $title, '%%location%%' ) !== false ) {
|
|
| 4758 | + if (strpos($title, '%%location%%') !== false) {
|
|
| 4759 | 4759 | $location = ''; |
| 4760 | - if ( $location_titles ) {
|
|
| 4761 | - $location = implode( ", ", $location_titles ); |
|
| 4760 | + if ($location_titles) {
|
|
| 4761 | + $location = implode(", ", $location_titles);
|
|
| 4762 | 4762 | } |
| 4763 | - $title = str_replace( "%%location%%", $location, $title ); |
|
| 4763 | + $title = str_replace("%%location%%", $location, $title);
|
|
| 4764 | 4764 | } |
| 4765 | 4765 | |
| 4766 | - if ( strpos( $title, '%%in_location%%' ) !== false ) {
|
|
| 4766 | + if (strpos($title, '%%in_location%%') !== false) {
|
|
| 4767 | 4767 | $location = ''; |
| 4768 | - if ( $location_titles ) {
|
|
| 4769 | - $location = __( 'in ', 'geodirectory' ) . implode( ", ", $location_titles ); |
|
| 4768 | + if ($location_titles) {
|
|
| 4769 | + $location = __('in ', 'geodirectory').implode(", ", $location_titles);
|
|
| 4770 | 4770 | } |
| 4771 | - $title = str_replace( "%%in_location%%", $location, $title ); |
|
| 4771 | + $title = str_replace("%%in_location%%", $location, $title);
|
|
| 4772 | 4772 | } |
| 4773 | 4773 | |
| 4774 | - if ( strpos( $title, '%%in_location_single%%' ) !== false ) {
|
|
| 4775 | - if ( $location_single ) {
|
|
| 4776 | - $location_single = __( 'in', 'geodirectory' ) . ' ' . $location_single; |
|
| 4774 | + if (strpos($title, '%%in_location_single%%') !== false) {
|
|
| 4775 | + if ($location_single) {
|
|
| 4776 | + $location_single = __('in', 'geodirectory').' '.$location_single;
|
|
| 4777 | 4777 | } |
| 4778 | - $title = str_replace( "%%in_location_single%%", $location_single, $title ); |
|
| 4778 | + $title = str_replace("%%in_location_single%%", $location_single, $title);
|
|
| 4779 | 4779 | } |
| 4780 | 4780 | |
| 4781 | - if ( strpos( $title, '%%location_single%%' ) !== false ) {
|
|
| 4782 | - $title = str_replace( "%%location_single%%", $location_single, $title ); |
|
| 4781 | + if (strpos($title, '%%location_single%%') !== false) {
|
|
| 4782 | + $title = str_replace("%%location_single%%", $location_single, $title);
|
|
| 4783 | 4783 | } |
| 4784 | 4784 | |
| 4785 | 4785 | |
| 4786 | - if ( strpos( $title, '%%search_term%%' ) !== false ) {
|
|
| 4786 | + if (strpos($title, '%%search_term%%') !== false) {
|
|
| 4787 | 4787 | $search_term = ''; |
| 4788 | - if ( isset( $_REQUEST['s'] ) ) {
|
|
| 4789 | - $search_term = esc_attr( $_REQUEST['s'] ); |
|
| 4788 | + if (isset($_REQUEST['s'])) {
|
|
| 4789 | + $search_term = esc_attr($_REQUEST['s']); |
|
| 4790 | 4790 | } |
| 4791 | - $title = str_replace( "%%search_term%%", $search_term, $title ); |
|
| 4791 | + $title = str_replace("%%search_term%%", $search_term, $title);
|
|
| 4792 | 4792 | } |
| 4793 | 4793 | |
| 4794 | - if ( strpos( $title, '%%search_near%%' ) !== false ) {
|
|
| 4794 | + if (strpos($title, '%%search_near%%') !== false) {
|
|
| 4795 | 4795 | $search_term = ''; |
| 4796 | - if ( isset( $_REQUEST['snear'] ) ) {
|
|
| 4797 | - $search_term = esc_attr( $_REQUEST['snear'] ); |
|
| 4796 | + if (isset($_REQUEST['snear'])) {
|
|
| 4797 | + $search_term = esc_attr($_REQUEST['snear']); |
|
| 4798 | 4798 | } |
| 4799 | - $title = str_replace( "%%search_near%%", $search_term, $title ); |
|
| 4799 | + $title = str_replace("%%search_near%%", $search_term, $title);
|
|
| 4800 | 4800 | } |
| 4801 | 4801 | |
| 4802 | - if ( strpos( $title, '%%name%%' ) !== false ) {
|
|
| 4803 | - if ( is_author() ) {
|
|
| 4804 | - $curauth = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) ); |
|
| 4802 | + if (strpos($title, '%%name%%') !== false) {
|
|
| 4803 | + if (is_author()) {
|
|
| 4804 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 4805 | 4805 | $author_name = $curauth->display_name; |
| 4806 | 4806 | } else {
|
| 4807 | 4807 | $author_name = get_the_author(); |
| 4808 | 4808 | } |
| 4809 | - if ( ! $author_name || $author_name === '' ) {
|
|
| 4809 | + if (!$author_name || $author_name === '') {
|
|
| 4810 | 4810 | $queried_object = get_queried_object(); |
| 4811 | 4811 | |
| 4812 | - if ( isset( $queried_object->data->user_nicename ) ) {
|
|
| 4812 | + if (isset($queried_object->data->user_nicename)) {
|
|
| 4813 | 4813 | $author_name = $queried_object->data->display_name; |
| 4814 | 4814 | } |
| 4815 | 4815 | } |
| 4816 | - $title = str_replace( "%%name%%", $author_name, $title ); |
|
| 4816 | + $title = str_replace("%%name%%", $author_name, $title);
|
|
| 4817 | 4817 | } |
| 4818 | 4818 | |
| 4819 | - if ( strpos( $title, '%%page%%' ) !== false ) {
|
|
| 4820 | - $page = geodir_title_meta_page( $sep ); |
|
| 4821 | - $title = str_replace( "%%page%%", $page, $title ); |
|
| 4819 | + if (strpos($title, '%%page%%') !== false) {
|
|
| 4820 | + $page = geodir_title_meta_page($sep); |
|
| 4821 | + $title = str_replace("%%page%%", $page, $title);
|
|
| 4822 | 4822 | } |
| 4823 | - if ( strpos( $title, '%%pagenumber%%' ) !== false ) {
|
|
| 4823 | + if (strpos($title, '%%pagenumber%%') !== false) {
|
|
| 4824 | 4824 | $pagenumber = geodir_title_meta_pagenumber(); |
| 4825 | - $title = str_replace( "%%pagenumber%%", $pagenumber, $title ); |
|
| 4825 | + $title = str_replace("%%pagenumber%%", $pagenumber, $title);
|
|
| 4826 | 4826 | } |
| 4827 | - if ( strpos( $title, '%%pagetotal%%' ) !== false ) {
|
|
| 4827 | + if (strpos($title, '%%pagetotal%%') !== false) {
|
|
| 4828 | 4828 | $pagetotal = geodir_title_meta_pagetotal(); |
| 4829 | - $title = str_replace( "%%pagetotal%%", $pagetotal, $title ); |
|
| 4829 | + $title = str_replace("%%pagetotal%%", $pagetotal, $title);
|
|
| 4830 | 4830 | } |
| 4831 | 4831 | |
| 4832 | - $title = wptexturize( $title ); |
|
| 4833 | - $title = convert_chars( $title ); |
|
| 4834 | - $title = esc_html( $title ); |
|
| 4832 | + $title = wptexturize($title); |
|
| 4833 | + $title = convert_chars($title); |
|
| 4834 | + $title = esc_html($title); |
|
| 4835 | 4835 | |
| 4836 | 4836 | /** |
| 4837 | 4837 | * Filter the title variables after standard ones have been filtered. |
@@ -4845,7 +4845,7 @@ discard block |
||
| 4845 | 4845 | * @param string $sep The separator, default: `|`. |
| 4846 | 4846 | */ |
| 4847 | 4847 | |
| 4848 | - return apply_filters( 'geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep ); |
|
| 4848 | + return apply_filters('geodir_filter_title_variables_vars', $title, $location_array, $gd_page, $sep);
|
|
| 4849 | 4849 | } |
| 4850 | 4850 | |
| 4851 | 4851 | /** |
@@ -4858,82 +4858,82 @@ discard block |
||
| 4858 | 4858 | * |
| 4859 | 4859 | * @return array Translation texts. |
| 4860 | 4860 | */ |
| 4861 | -function geodir_load_cpt_text_translation( $translation_texts = array() ) {
|
|
| 4862 | - $gd_post_types = geodir_get_posttypes( 'array' ); |
|
| 4861 | +function geodir_load_cpt_text_translation($translation_texts = array()) {
|
|
| 4862 | + $gd_post_types = geodir_get_posttypes('array');
|
|
| 4863 | 4863 | |
| 4864 | - if ( ! empty( $gd_post_types ) ) {
|
|
| 4865 | - foreach ( $gd_post_types as $post_type => $cpt_info ) {
|
|
| 4866 | - $labels = isset( $cpt_info['labels'] ) ? $cpt_info['labels'] : ''; |
|
| 4867 | - $description = isset( $cpt_info['description'] ) ? $cpt_info['description'] : ''; |
|
| 4868 | - $seo = isset( $cpt_info['seo'] ) ? $cpt_info['seo'] : ''; |
|
| 4864 | + if (!empty($gd_post_types)) {
|
|
| 4865 | + foreach ($gd_post_types as $post_type => $cpt_info) {
|
|
| 4866 | + $labels = isset($cpt_info['labels']) ? $cpt_info['labels'] : ''; |
|
| 4867 | + $description = isset($cpt_info['description']) ? $cpt_info['description'] : ''; |
|
| 4868 | + $seo = isset($cpt_info['seo']) ? $cpt_info['seo'] : ''; |
|
| 4869 | 4869 | |
| 4870 | - if ( ! empty( $labels ) ) {
|
|
| 4871 | - if ( $labels['name'] != '' && ! in_array( $labels['name'], $translation_texts ) ) {
|
|
| 4870 | + if (!empty($labels)) {
|
|
| 4871 | + if ($labels['name'] != '' && !in_array($labels['name'], $translation_texts)) {
|
|
| 4872 | 4872 | $translation_texts[] = $labels['name']; |
| 4873 | 4873 | } |
| 4874 | - if ( $labels['singular_name'] != '' && ! in_array( $labels['singular_name'], $translation_texts ) ) {
|
|
| 4874 | + if ($labels['singular_name'] != '' && !in_array($labels['singular_name'], $translation_texts)) {
|
|
| 4875 | 4875 | $translation_texts[] = $labels['singular_name']; |
| 4876 | 4876 | } |
| 4877 | - if ( $labels['add_new'] != '' && ! in_array( $labels['add_new'], $translation_texts ) ) {
|
|
| 4877 | + if ($labels['add_new'] != '' && !in_array($labels['add_new'], $translation_texts)) {
|
|
| 4878 | 4878 | $translation_texts[] = $labels['add_new']; |
| 4879 | 4879 | } |
| 4880 | - if ( $labels['add_new_item'] != '' && ! in_array( $labels['add_new_item'], $translation_texts ) ) {
|
|
| 4880 | + if ($labels['add_new_item'] != '' && !in_array($labels['add_new_item'], $translation_texts)) {
|
|
| 4881 | 4881 | $translation_texts[] = $labels['add_new_item']; |
| 4882 | 4882 | } |
| 4883 | - if ( $labels['edit_item'] != '' && ! in_array( $labels['edit_item'], $translation_texts ) ) {
|
|
| 4883 | + if ($labels['edit_item'] != '' && !in_array($labels['edit_item'], $translation_texts)) {
|
|
| 4884 | 4884 | $translation_texts[] = $labels['edit_item']; |
| 4885 | 4885 | } |
| 4886 | - if ( $labels['new_item'] != '' && ! in_array( $labels['new_item'], $translation_texts ) ) {
|
|
| 4886 | + if ($labels['new_item'] != '' && !in_array($labels['new_item'], $translation_texts)) {
|
|
| 4887 | 4887 | $translation_texts[] = $labels['new_item']; |
| 4888 | 4888 | } |
| 4889 | - if ( $labels['view_item'] != '' && ! in_array( $labels['view_item'], $translation_texts ) ) {
|
|
| 4889 | + if ($labels['view_item'] != '' && !in_array($labels['view_item'], $translation_texts)) {
|
|
| 4890 | 4890 | $translation_texts[] = $labels['view_item']; |
| 4891 | 4891 | } |
| 4892 | - if ( $labels['search_items'] != '' && ! in_array( $labels['search_items'], $translation_texts ) ) {
|
|
| 4892 | + if ($labels['search_items'] != '' && !in_array($labels['search_items'], $translation_texts)) {
|
|
| 4893 | 4893 | $translation_texts[] = $labels['search_items']; |
| 4894 | 4894 | } |
| 4895 | - if ( $labels['not_found'] != '' && ! in_array( $labels['not_found'], $translation_texts ) ) {
|
|
| 4895 | + if ($labels['not_found'] != '' && !in_array($labels['not_found'], $translation_texts)) {
|
|
| 4896 | 4896 | $translation_texts[] = $labels['not_found']; |
| 4897 | 4897 | } |
| 4898 | - if ( $labels['not_found_in_trash'] != '' && ! in_array( $labels['not_found_in_trash'], $translation_texts ) ) {
|
|
| 4898 | + if ($labels['not_found_in_trash'] != '' && !in_array($labels['not_found_in_trash'], $translation_texts)) {
|
|
| 4899 | 4899 | $translation_texts[] = $labels['not_found_in_trash']; |
| 4900 | 4900 | } |
| 4901 | - if ( isset( $labels['label_post_profile'] ) && $labels['label_post_profile'] != '' && ! in_array( $labels['label_post_profile'], $translation_texts ) ) {
|
|
| 4901 | + if (isset($labels['label_post_profile']) && $labels['label_post_profile'] != '' && !in_array($labels['label_post_profile'], $translation_texts)) {
|
|
| 4902 | 4902 | $translation_texts[] = $labels['label_post_profile']; |
| 4903 | 4903 | } |
| 4904 | - if ( isset( $labels['label_post_info'] ) && $labels['label_post_info'] != '' && ! in_array( $labels['label_post_info'], $translation_texts ) ) {
|
|
| 4904 | + if (isset($labels['label_post_info']) && $labels['label_post_info'] != '' && !in_array($labels['label_post_info'], $translation_texts)) {
|
|
| 4905 | 4905 | $translation_texts[] = $labels['label_post_info']; |
| 4906 | 4906 | } |
| 4907 | - if ( isset( $labels['label_post_images'] ) && $labels['label_post_images'] != '' && ! in_array( $labels['label_post_images'], $translation_texts ) ) {
|
|
| 4907 | + if (isset($labels['label_post_images']) && $labels['label_post_images'] != '' && !in_array($labels['label_post_images'], $translation_texts)) {
|
|
| 4908 | 4908 | $translation_texts[] = $labels['label_post_images']; |
| 4909 | 4909 | } |
| 4910 | - if ( isset( $labels['label_post_map'] ) && $labels['label_post_map'] != '' && ! in_array( $labels['label_post_map'], $translation_texts ) ) {
|
|
| 4910 | + if (isset($labels['label_post_map']) && $labels['label_post_map'] != '' && !in_array($labels['label_post_map'], $translation_texts)) {
|
|
| 4911 | 4911 | $translation_texts[] = $labels['label_post_map']; |
| 4912 | 4912 | } |
| 4913 | - if ( isset( $labels['label_reviews'] ) && $labels['label_reviews'] != '' && ! in_array( $labels['label_reviews'], $translation_texts ) ) {
|
|
| 4913 | + if (isset($labels['label_reviews']) && $labels['label_reviews'] != '' && !in_array($labels['label_reviews'], $translation_texts)) {
|
|
| 4914 | 4914 | $translation_texts[] = $labels['label_reviews']; |
| 4915 | 4915 | } |
| 4916 | - if ( isset( $labels['label_related_listing'] ) && $labels['label_related_listing'] != '' && ! in_array( $labels['label_related_listing'], $translation_texts ) ) {
|
|
| 4916 | + if (isset($labels['label_related_listing']) && $labels['label_related_listing'] != '' && !in_array($labels['label_related_listing'], $translation_texts)) {
|
|
| 4917 | 4917 | $translation_texts[] = $labels['label_related_listing']; |
| 4918 | 4918 | } |
| 4919 | 4919 | } |
| 4920 | 4920 | |
| 4921 | - if ( $description != '' && ! in_array( $description, $translation_texts ) ) {
|
|
| 4922 | - $translation_texts[] = normalize_whitespace( $description ); |
|
| 4921 | + if ($description != '' && !in_array($description, $translation_texts)) {
|
|
| 4922 | + $translation_texts[] = normalize_whitespace($description); |
|
| 4923 | 4923 | } |
| 4924 | 4924 | |
| 4925 | - if ( ! empty( $seo ) ) {
|
|
| 4926 | - if ( isset( $seo['meta_keyword'] ) && $seo['meta_keyword'] != '' && ! in_array( $seo['meta_keyword'], $translation_texts ) ) {
|
|
| 4927 | - $translation_texts[] = normalize_whitespace( $seo['meta_keyword'] ); |
|
| 4925 | + if (!empty($seo)) {
|
|
| 4926 | + if (isset($seo['meta_keyword']) && $seo['meta_keyword'] != '' && !in_array($seo['meta_keyword'], $translation_texts)) {
|
|
| 4927 | + $translation_texts[] = normalize_whitespace($seo['meta_keyword']); |
|
| 4928 | 4928 | } |
| 4929 | 4929 | |
| 4930 | - if ( isset( $seo['meta_description'] ) && $seo['meta_description'] != '' && ! in_array( $seo['meta_description'], $translation_texts ) ) {
|
|
| 4931 | - $translation_texts[] = normalize_whitespace( $seo['meta_description'] ); |
|
| 4930 | + if (isset($seo['meta_description']) && $seo['meta_description'] != '' && !in_array($seo['meta_description'], $translation_texts)) {
|
|
| 4931 | + $translation_texts[] = normalize_whitespace($seo['meta_description']); |
|
| 4932 | 4932 | } |
| 4933 | 4933 | } |
| 4934 | 4934 | } |
| 4935 | 4935 | } |
| 4936 | - $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; |
|
| 4936 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
| 4937 | 4937 | |
| 4938 | 4938 | return $translation_texts; |
| 4939 | 4939 | } |
@@ -4948,27 +4948,27 @@ discard block |
||
| 4948 | 4948 | * |
| 4949 | 4949 | * @return array Location terms. |
| 4950 | 4950 | */ |
| 4951 | -function geodir_remove_location_terms( $location_terms = array() ) {
|
|
| 4952 | - $location_manager = defined( 'POST_LOCATION_TABLE' ) ? true : false; |
|
| 4951 | +function geodir_remove_location_terms($location_terms = array()) {
|
|
| 4952 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 4953 | 4953 | |
| 4954 | - if ( ! empty( $location_terms ) && $location_manager ) {
|
|
| 4955 | - $hide_country_part = get_option( 'geodir_location_hide_country_part' ); |
|
| 4956 | - $hide_region_part = get_option( 'geodir_location_hide_region_part' ); |
|
| 4954 | + if (!empty($location_terms) && $location_manager) {
|
|
| 4955 | + $hide_country_part = get_option('geodir_location_hide_country_part');
|
|
| 4956 | + $hide_region_part = get_option('geodir_location_hide_region_part');
|
|
| 4957 | 4957 | |
| 4958 | - if ( $hide_region_part && $hide_country_part ) {
|
|
| 4959 | - if ( isset( $location_terms['gd_country'] ) ) {
|
|
| 4960 | - unset( $location_terms['gd_country'] ); |
|
| 4958 | + if ($hide_region_part && $hide_country_part) {
|
|
| 4959 | + if (isset($location_terms['gd_country'])) {
|
|
| 4960 | + unset($location_terms['gd_country']); |
|
| 4961 | 4961 | } |
| 4962 | - if ( isset( $location_terms['gd_region'] ) ) {
|
|
| 4963 | - unset( $location_terms['gd_region'] ); |
|
| 4962 | + if (isset($location_terms['gd_region'])) {
|
|
| 4963 | + unset($location_terms['gd_region']); |
|
| 4964 | 4964 | } |
| 4965 | - } else if ( $hide_region_part && ! $hide_country_part ) {
|
|
| 4966 | - if ( isset( $location_terms['gd_region'] ) ) {
|
|
| 4967 | - unset( $location_terms['gd_region'] ); |
|
| 4965 | + } else if ($hide_region_part && !$hide_country_part) {
|
|
| 4966 | + if (isset($location_terms['gd_region'])) {
|
|
| 4967 | + unset($location_terms['gd_region']); |
|
| 4968 | 4968 | } |
| 4969 | - } else if ( ! $hide_region_part && $hide_country_part ) {
|
|
| 4970 | - if ( isset( $location_terms['gd_country'] ) ) {
|
|
| 4971 | - unset( $location_terms['gd_country'] ); |
|
| 4969 | + } else if (!$hide_region_part && $hide_country_part) {
|
|
| 4970 | + if (isset($location_terms['gd_country'])) {
|
|
| 4971 | + unset($location_terms['gd_country']); |
|
| 4972 | 4972 | } |
| 4973 | 4973 | } |
| 4974 | 4974 | } |
@@ -4986,33 +4986,33 @@ discard block |
||
| 4986 | 4986 | * @param WP_Post $post Post object. |
| 4987 | 4987 | * @param bool $update Whether this is an existing listing being updated or not. |
| 4988 | 4988 | */ |
| 4989 | -function geodir_on_wp_insert_post( $post_ID, $post, $update ) {
|
|
| 4990 | - if ( ! $update ) {
|
|
| 4989 | +function geodir_on_wp_insert_post($post_ID, $post, $update) {
|
|
| 4990 | + if (!$update) {
|
|
| 4991 | 4991 | return; |
| 4992 | 4992 | } |
| 4993 | 4993 | |
| 4994 | - $action = isset( $_REQUEST['action'] ) ? sanitize_text_field( $_REQUEST['action'] ) : ''; |
|
| 4995 | - $is_admin = is_admin() && ( ! defined( 'DOING_AJAX' ) || ( defined( 'DOING_AJAX' ) && ! DOING_AJAX ) ) ? true : false; |
|
| 4994 | + $action = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : ''; |
|
| 4995 | + $is_admin = is_admin() && (!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) ? true : false;
|
|
| 4996 | 4996 | $inline_save = $action == 'inline-save' ? true : false; |
| 4997 | 4997 | |
| 4998 | - if ( empty( $post->post_type ) || $is_admin || $inline_save || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
|
|
| 4998 | + if (empty($post->post_type) || $is_admin || $inline_save || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {
|
|
| 4999 | 4999 | return; |
| 5000 | 5000 | } |
| 5001 | 5001 | |
| 5002 | - if ( $action != '' && in_array( $action, array( 'geodir_import_export' ) ) ) {
|
|
| 5002 | + if ($action != '' && in_array($action, array('geodir_import_export'))) {
|
|
| 5003 | 5003 | return; |
| 5004 | 5004 | } |
| 5005 | 5005 | |
| 5006 | 5006 | $user_id = (int) get_current_user_id(); |
| 5007 | 5007 | |
| 5008 | - if ( $user_id > 0 && get_option( 'geodir_notify_post_edited' ) && ! wp_is_post_revision( $post_ID ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 5009 | - $author_id = ! empty( $post->post_author ) ? $post->post_author : 0; |
|
| 5008 | + if ($user_id > 0 && get_option('geodir_notify_post_edited') && !wp_is_post_revision($post_ID) && in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 5009 | + $author_id = !empty($post->post_author) ? $post->post_author : 0; |
|
| 5010 | 5010 | |
| 5011 | - if ( $user_id == $author_id && ! is_super_admin() ) {
|
|
| 5012 | - $from_email = get_option( 'site_email' ); |
|
| 5011 | + if ($user_id == $author_id && !is_super_admin()) {
|
|
| 5012 | + $from_email = get_option('site_email');
|
|
| 5013 | 5013 | $from_name = get_site_emailName(); |
| 5014 | - $to_email = get_option( 'admin_email' ); |
|
| 5015 | - $to_name = get_option( 'name' ); |
|
| 5014 | + $to_email = get_option('admin_email');
|
|
| 5015 | + $to_name = get_option('name');
|
|
| 5016 | 5016 | $message_type = 'listing_edited'; |
| 5017 | 5017 | |
| 5018 | 5018 | $notify_edited = true; |
@@ -5024,9 +5024,9 @@ discard block |
||
| 5024 | 5024 | * @param bool $notify_edited Notify on listing edited by author? |
| 5025 | 5025 | * @param object $post The current post object. |
| 5026 | 5026 | */ |
| 5027 | - $notify_edited = apply_filters( 'geodir_notify_on_listing_edited', $notify_edited, $post ); |
|
| 5027 | + $notify_edited = apply_filters('geodir_notify_on_listing_edited', $notify_edited, $post);
|
|
| 5028 | 5028 | |
| 5029 | - geodir_sendEmail( $from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID ); |
|
| 5029 | + geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID); |
|
| 5030 | 5030 | } |
| 5031 | 5031 | } |
| 5032 | 5032 | } |
@@ -5041,14 +5041,14 @@ discard block |
||
| 5041 | 5041 | * |
| 5042 | 5042 | * @return string|null The current page start & end numbering. |
| 5043 | 5043 | */ |
| 5044 | -function geodir_title_meta_page( $sep ) {
|
|
| 5044 | +function geodir_title_meta_page($sep) {
|
|
| 5045 | 5045 | $replacement = null; |
| 5046 | 5046 | |
| 5047 | - $max = geodir_title_meta_pagenumbering( 'max' ); |
|
| 5048 | - $nr = geodir_title_meta_pagenumbering( 'nr' ); |
|
| 5047 | + $max = geodir_title_meta_pagenumbering('max');
|
|
| 5048 | + $nr = geodir_title_meta_pagenumbering('nr');
|
|
| 5049 | 5049 | |
| 5050 | - if ( $max > 1 && $nr > 1 ) {
|
|
| 5051 | - $replacement = sprintf( $sep . ' ' . __( 'Page %1$d of %2$d', 'geodirectory' ), $nr, $max ); |
|
| 5050 | + if ($max > 1 && $nr > 1) {
|
|
| 5051 | + $replacement = sprintf($sep.' '.__('Page %1$d of %2$d', 'geodirectory'), $nr, $max);
|
|
| 5052 | 5052 | } |
| 5053 | 5053 | |
| 5054 | 5054 | return $replacement; |
@@ -5065,8 +5065,8 @@ discard block |
||
| 5065 | 5065 | function geodir_title_meta_pagenumber() {
|
| 5066 | 5066 | $replacement = null; |
| 5067 | 5067 | |
| 5068 | - $nr = geodir_title_meta_pagenumbering( 'nr' ); |
|
| 5069 | - if ( isset( $nr ) && $nr > 0 ) {
|
|
| 5068 | + $nr = geodir_title_meta_pagenumbering('nr');
|
|
| 5069 | + if (isset($nr) && $nr > 0) {
|
|
| 5070 | 5070 | $replacement = (string) $nr; |
| 5071 | 5071 | } |
| 5072 | 5072 | |
@@ -5084,8 +5084,8 @@ discard block |
||
| 5084 | 5084 | function geodir_title_meta_pagetotal() {
|
| 5085 | 5085 | $replacement = null; |
| 5086 | 5086 | |
| 5087 | - $max = geodir_title_meta_pagenumbering( 'max' ); |
|
| 5088 | - if ( isset( $max ) && $max > 0 ) {
|
|
| 5087 | + $max = geodir_title_meta_pagenumbering('max');
|
|
| 5088 | + if (isset($max) && $max > 0) {
|
|
| 5089 | 5089 | $replacement = (string) $max; |
| 5090 | 5090 | } |
| 5091 | 5091 | |
@@ -5105,36 +5105,36 @@ discard block |
||
| 5105 | 5105 | * |
| 5106 | 5106 | * @return int|null The current page numbering. |
| 5107 | 5107 | */ |
| 5108 | -function geodir_title_meta_pagenumbering( $request = 'nr' ) {
|
|
| 5108 | +function geodir_title_meta_pagenumbering($request = 'nr') {
|
|
| 5109 | 5109 | global $wp_query, $post; |
| 5110 | 5110 | $max_num_pages = null; |
| 5111 | 5111 | $page_number = null; |
| 5112 | 5112 | |
| 5113 | 5113 | $max_num_pages = 1; |
| 5114 | 5114 | |
| 5115 | - if ( ! is_singular() ) {
|
|
| 5116 | - $page_number = get_query_var( 'paged' ); |
|
| 5117 | - if ( $page_number === 0 || $page_number === '' ) {
|
|
| 5115 | + if (!is_singular()) {
|
|
| 5116 | + $page_number = get_query_var('paged');
|
|
| 5117 | + if ($page_number === 0 || $page_number === '') {
|
|
| 5118 | 5118 | $page_number = 1; |
| 5119 | 5119 | } |
| 5120 | 5120 | |
| 5121 | - if ( isset( $wp_query->max_num_pages ) && ( $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) ) {
|
|
| 5121 | + if (isset($wp_query->max_num_pages) && ($wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0)) {
|
|
| 5122 | 5122 | $max_num_pages = $wp_query->max_num_pages; |
| 5123 | 5123 | } |
| 5124 | 5124 | } else {
|
| 5125 | - $page_number = get_query_var( 'page' ); |
|
| 5126 | - if ( $page_number === 0 || $page_number === '' ) {
|
|
| 5125 | + $page_number = get_query_var('page');
|
|
| 5126 | + if ($page_number === 0 || $page_number === '') {
|
|
| 5127 | 5127 | $page_number = 1; |
| 5128 | 5128 | } |
| 5129 | 5129 | |
| 5130 | - if ( isset( $post->post_content ) ) {
|
|
| 5131 | - $max_num_pages = ( substr_count( $post->post_content, '<!--nextpage-->' ) + 1 ); |
|
| 5130 | + if (isset($post->post_content)) {
|
|
| 5131 | + $max_num_pages = (substr_count($post->post_content, '<!--nextpage-->') + 1); |
|
| 5132 | 5132 | } |
| 5133 | 5133 | } |
| 5134 | 5134 | |
| 5135 | 5135 | $return = null; |
| 5136 | 5136 | |
| 5137 | - switch ( $request ) {
|
|
| 5137 | + switch ($request) {
|
|
| 5138 | 5138 | case 'nr': |
| 5139 | 5139 | $return = $page_number; |
| 5140 | 5140 | break; |
@@ -5155,14 +5155,14 @@ discard block |
||
| 5155 | 5155 | * |
| 5156 | 5156 | * @return array Terms. |
| 5157 | 5157 | */ |
| 5158 | -function geodir_filter_empty_terms( $terms ) {
|
|
| 5159 | - if ( empty( $terms ) ) {
|
|
| 5158 | +function geodir_filter_empty_terms($terms) {
|
|
| 5159 | + if (empty($terms)) {
|
|
| 5160 | 5160 | return $terms; |
| 5161 | 5161 | } |
| 5162 | 5162 | |
| 5163 | 5163 | $return = array(); |
| 5164 | - foreach ( $terms as $term ) {
|
|
| 5165 | - if ( isset( $term->count ) && $term->count > 0 ) {
|
|
| 5164 | + foreach ($terms as $term) {
|
|
| 5165 | + if (isset($term->count) && $term->count > 0) {
|
|
| 5166 | 5166 | $return[] = $term; |
| 5167 | 5167 | } else {
|
| 5168 | 5168 | /** |
@@ -5173,7 +5173,7 @@ discard block |
||
| 5173 | 5173 | * @param array $return The array of terms to return. |
| 5174 | 5174 | * @param object $term The term object. |
| 5175 | 5175 | */ |
| 5176 | - $return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term ); |
|
| 5176 | + $return = apply_filters('geodir_filter_empty_terms_filter', $return, $term);
|
|
| 5177 | 5177 | } |
| 5178 | 5178 | } |
| 5179 | 5179 | |
@@ -5190,12 +5190,12 @@ discard block |
||
| 5190 | 5190 | * |
| 5191 | 5191 | * @return array |
| 5192 | 5192 | */ |
| 5193 | -function geodir_remove_hentry( $class ) {
|
|
| 5194 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 5195 | - $class = array_diff( $class, array( 'hentry' ) ); |
|
| 5193 | +function geodir_remove_hentry($class) {
|
|
| 5194 | + if (geodir_is_page('detail')) {
|
|
| 5195 | + $class = array_diff($class, array('hentry'));
|
|
| 5196 | 5196 | } |
| 5197 | 5197 | |
| 5198 | 5198 | return $class; |
| 5199 | 5199 | } |
| 5200 | 5200 | |
| 5201 | -add_filter( 'post_class', 'geodir_remove_hentry' ); |
|
| 5202 | 5201 | \ No newline at end of file |
| 5202 | +add_filter('post_class', 'geodir_remove_hentry'); |
|
| 5203 | 5203 | \ No newline at end of file |