@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | * @since 1.4.6 |
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | -function geodir_add_listing_page_id(){ |
|
| 16 | +function geodir_add_listing_page_id() { |
|
| 17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
| 18 | 18 | |
| 19 | 19 | if (function_exists('icl_object_id')) { |
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @since 1.4.6 |
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | -function geodir_preview_page_id(){ |
|
| 33 | +function geodir_preview_page_id() { |
|
| 34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
| 35 | 35 | |
| 36 | 36 | if (function_exists('icl_object_id')) { |
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @since 1.4.6 |
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | -function geodir_success_page_id(){ |
|
| 50 | +function geodir_success_page_id() { |
|
| 51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
| 52 | 52 | |
| 53 | 53 | if (function_exists('icl_object_id')) { |
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * @since 1.4.6 |
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | -function geodir_location_page_id(){ |
|
| 67 | +function geodir_location_page_id() { |
|
| 68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
| 69 | 69 | |
| 70 | 70 | if (function_exists('icl_object_id')) { |
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * @since 1.5.4 |
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | -function geodir_home_page_id(){ |
|
| 84 | +function geodir_home_page_id() { |
|
| 85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
| 86 | 86 | |
| 87 | 87 | if (function_exists('icl_object_id')) { |
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @since 1.5.3 |
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | -function geodir_info_page_id(){ |
|
| 101 | +function geodir_info_page_id() { |
|
| 102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
| 103 | 103 | |
| 104 | 104 | if (function_exists('icl_object_id')) { |
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @since 1.5.3 |
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | -function geodir_login_page_id(){ |
|
| 118 | +function geodir_login_page_id() { |
|
| 119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
| 120 | 120 | |
| 121 | 121 | if (function_exists('icl_object_id')) { |
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $gd_page_id; |
@@ -133,20 +133,20 @@ discard block |
||
| 133 | 133 | * @since 1.5.3 |
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | -function geodir_login_url($args=array()){ |
|
| 136 | +function geodir_login_url($args = array()) { |
|
| 137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
| 138 | 138 | |
| 139 | 139 | if (function_exists('icl_object_id')) { |
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
| 144 | 144 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (defined('ICL_LANGUAGE_CODE')){ |
|
| 147 | + if (defined('ICL_LANGUAGE_CODE')) { |
|
| 148 | 148 | $home_url = icl_get_home_url(); |
| 149 | - }else{ |
|
| 149 | + } else { |
|
| 150 | 150 | $home_url = home_url(); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -154,17 +154,17 @@ discard block |
||
| 154 | 154 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if($gd_page_id){ |
|
| 157 | + if ($gd_page_id) { |
|
| 158 | 158 | $post = get_post($gd_page_id); |
| 159 | 159 | $slug = $post->post_name; |
| 160 | 160 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 161 | 161 | $login_url = trailingslashit($home_url)."$slug/"; |
| 162 | - }else{ |
|
| 162 | + } else { |
|
| 163 | 163 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if($args){ |
|
| 167 | - $login_url = add_query_arg($args,$login_url ); |
|
| 166 | + if ($args) { |
|
| 167 | + $login_url = add_query_arg($args, $login_url); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param array $args The array of query args used. |
| 179 | 179 | * @param int $gd_page_id The page id of the GD login page. |
| 180 | 180 | */ |
| 181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 181 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -189,20 +189,20 @@ discard block |
||
| 189 | 189 | * @since 1.5.16 Added WPML lang code to url. |
| 190 | 190 | * @return string Info page url. |
| 191 | 191 | */ |
| 192 | -function geodir_info_url($args=array()){ |
|
| 192 | +function geodir_info_url($args = array()) { |
|
| 193 | 193 | $gd_page_id = get_option('geodir_info_page'); |
| 194 | 194 | |
| 195 | 195 | if (function_exists('icl_object_id')) { |
| 196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (function_exists('geodir_location_geo_home_link')) { |
| 200 | 200 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if (defined('ICL_LANGUAGE_CODE')){ |
|
| 203 | + if (defined('ICL_LANGUAGE_CODE')) { |
|
| 204 | 204 | $home_url = icl_get_home_url(); |
| 205 | - }else{ |
|
| 205 | + } else { |
|
| 206 | 206 | $home_url = home_url(); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -210,17 +210,17 @@ discard block |
||
| 210 | 210 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if($gd_page_id){ |
|
| 213 | + if ($gd_page_id) { |
|
| 214 | 214 | $post = get_post($gd_page_id); |
| 215 | 215 | $slug = $post->post_name; |
| 216 | 216 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 217 | 217 | $info_url = trailingslashit($home_url)."$slug/"; |
| 218 | - }else{ |
|
| 218 | + } else { |
|
| 219 | 219 | $info_url = trailingslashit($home_url); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if($args){ |
|
| 223 | - $info_url = add_query_arg($args,$info_url ); |
|
| 222 | + if ($args) { |
|
| 223 | + $info_url = add_query_arg($args, $info_url); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | return $info_url; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param string $charset Character set to use for conversion. |
| 239 | 239 | * @return string Returns converted string. |
| 240 | 240 | */ |
| 241 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
| 241 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
| 242 | 242 | if (function_exists('mb_convert_case')) { |
| 243 | 243 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
| 244 | 244 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param string $charset Character set to use for conversion. |
| 259 | 259 | * @return string Returns converted string. |
| 260 | 260 | */ |
| 261 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
| 261 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
| 262 | 262 | if (function_exists('mb_convert_case')) { |
| 263 | 263 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
| 264 | 264 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @param string $charset Character set to use for conversion. |
| 279 | 279 | * @return string Returns converted string. |
| 280 | 280 | */ |
| 281 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
| 281 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
| 282 | 282 | if (function_exists('mb_convert_case')) { |
| 283 | 283 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
| 284 | 284 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $url = trim($parts[0]); |
| 311 | 311 | if ($formatted && $url != '') { |
| 312 | - $url = str_replace( ' ', '%20', $url ); |
|
| 312 | + $url = str_replace(' ', '%20', $url); |
|
| 313 | 313 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
| 314 | 314 | |
| 315 | 315 | if (0 !== stripos($url, 'mailto:')) { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $url = str_replace(';//', '://', $url); |
| 321 | 321 | |
| 322 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 323 | - $url = 'http://' . $url; |
|
| 322 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 323 | + $url = 'http://'.$url; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | $url = wp_kses_normalize_entities($url); |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | * @package GeoDirectory |
| 463 | 463 | */ |
| 464 | 464 | function _gd_die_handler() { |
| 465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 465 | + if (defined('GD_TESTING_MODE')) { |
|
| 466 | 466 | return '_gd_die_handler'; |
| 467 | 467 | } else { |
| 468 | 468 | die(); |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | * @param string $title Optional. Error title. |
| 481 | 481 | * @param int $status Optional. Status code. |
| 482 | 482 | */ |
| 483 | -function gd_die( $message = '', $title = '', $status = 400 ) { |
|
| 484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 483 | +function gd_die($message = '', $title = '', $status = 400) { |
|
| 484 | + add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); |
|
| 485 | + add_filter('wp_die_handler', '_gd_die_handler', 10, 3); |
|
| 486 | + wp_die($message, $title, array('response' => $status)); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /* |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param string $php_format The PHP date format. |
| 494 | 494 | * @return string The jQuery format date string. |
| 495 | 495 | */ |
| 496 | -function geodir_date_format_php_to_jqueryui( $php_format ) { |
|
| 496 | +function geodir_date_format_php_to_jqueryui($php_format) { |
|
| 497 | 497 | $symbols = array( |
| 498 | 498 | // Day |
| 499 | 499 | 'd' => 'dd', |
@@ -533,27 +533,27 @@ discard block |
||
| 533 | 533 | $jqueryui_format = ""; |
| 534 | 534 | $escaping = false; |
| 535 | 535 | |
| 536 | - for ( $i = 0; $i < strlen( $php_format ); $i++ ) { |
|
| 536 | + for ($i = 0; $i < strlen($php_format); $i++) { |
|
| 537 | 537 | $char = $php_format[$i]; |
| 538 | 538 | |
| 539 | 539 | // PHP date format escaping character |
| 540 | - if ( $char === '\\' ) { |
|
| 540 | + if ($char === '\\') { |
|
| 541 | 541 | $i++; |
| 542 | 542 | |
| 543 | - if ( $escaping ) { |
|
| 543 | + if ($escaping) { |
|
| 544 | 544 | $jqueryui_format .= $php_format[$i]; |
| 545 | 545 | } else { |
| 546 | - $jqueryui_format .= '\'' . $php_format[$i]; |
|
| 546 | + $jqueryui_format .= '\''.$php_format[$i]; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $escaping = true; |
| 550 | 550 | } else { |
| 551 | - if ( $escaping ) { |
|
| 551 | + if ($escaping) { |
|
| 552 | 552 | $jqueryui_format .= "'"; |
| 553 | 553 | $escaping = false; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - if ( isset( $symbols[$char] ) ) { |
|
| 556 | + if (isset($symbols[$char])) { |
|
| 557 | 557 | $jqueryui_format .= $symbols[$char]; |
| 558 | 558 | } else { |
| 559 | 559 | $jqueryui_format .= $char; |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * @return string The untranslated date string. |
| 573 | 573 | * @since 1.6.5 |
| 574 | 574 | */ |
| 575 | -function geodir_maybe_untranslate_date($date){ |
|
| 575 | +function geodir_maybe_untranslate_date($date) { |
|
| 576 | 576 | $english_long_months = array( |
| 577 | 577 | 'January', |
| 578 | 578 | 'February', |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | 'December', |
| 589 | 589 | ); |
| 590 | 590 | |
| 591 | - $non_english_long_months = array( |
|
| 591 | + $non_english_long_months = array( |
|
| 592 | 592 | __('January'), |
| 593 | 593 | __('February'), |
| 594 | 594 | __('March'), |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | __('November'), |
| 603 | 603 | __('December'), |
| 604 | 604 | ); |
| 605 | - $date = str_replace($non_english_long_months,$english_long_months,$date); |
|
| 605 | + $date = str_replace($non_english_long_months, $english_long_months, $date); |
|
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | $english_short_months = array( |
@@ -621,21 +621,21 @@ discard block |
||
| 621 | 621 | ); |
| 622 | 622 | |
| 623 | 623 | $non_english_short_months = array( |
| 624 | - ' '._x( 'Jan', 'January abbreviation' ).' ', |
|
| 625 | - ' '._x( 'Feb', 'February abbreviation' ).' ', |
|
| 626 | - ' '._x( 'Mar', 'March abbreviation' ).' ', |
|
| 627 | - ' '._x( 'Apr', 'April abbreviation' ).' ', |
|
| 628 | - ' '._x( 'May', 'May abbreviation' ).' ', |
|
| 629 | - ' '._x( 'Jun', 'June abbreviation' ).' ', |
|
| 630 | - ' '._x( 'Jul', 'July abbreviation' ).' ', |
|
| 631 | - ' '._x( 'Aug', 'August abbreviation' ).' ', |
|
| 632 | - ' '._x( 'Sep', 'September abbreviation' ).' ', |
|
| 633 | - ' '._x( 'Oct', 'October abbreviation' ).' ', |
|
| 634 | - ' '._x( 'Nov', 'November abbreviation' ).' ', |
|
| 635 | - ' '._x( 'Dec', 'December abbreviation' ).' ', |
|
| 624 | + ' '._x('Jan', 'January abbreviation').' ', |
|
| 625 | + ' '._x('Feb', 'February abbreviation').' ', |
|
| 626 | + ' '._x('Mar', 'March abbreviation').' ', |
|
| 627 | + ' '._x('Apr', 'April abbreviation').' ', |
|
| 628 | + ' '._x('May', 'May abbreviation').' ', |
|
| 629 | + ' '._x('Jun', 'June abbreviation').' ', |
|
| 630 | + ' '._x('Jul', 'July abbreviation').' ', |
|
| 631 | + ' '._x('Aug', 'August abbreviation').' ', |
|
| 632 | + ' '._x('Sep', 'September abbreviation').' ', |
|
| 633 | + ' '._x('Oct', 'October abbreviation').' ', |
|
| 634 | + ' '._x('Nov', 'November abbreviation').' ', |
|
| 635 | + ' '._x('Dec', 'December abbreviation').' ', |
|
| 636 | 636 | ); |
| 637 | 637 | |
| 638 | - $date = str_replace($non_english_short_months,$english_short_months,$date); |
|
| 638 | + $date = str_replace($non_english_short_months, $english_short_months, $date); |
|
| 639 | 639 | |
| 640 | 640 | |
| 641 | 641 | return $date; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @return string Trimmed string. |
| 708 | 708 | */ |
| 709 | 709 | function geodir_excerpt($text, $length = 100, array $options = []) { |
| 710 | - if (!(int)$length > 0) { |
|
| 710 | + if (!(int) $length > 0) { |
|
| 711 | 711 | return $text; |
| 712 | 712 | } |
| 713 | 713 | $default = [ |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | $length = $truncateLength; |
| 770 | 770 | |
| 771 | 771 | foreach ($openTags as $tag) { |
| 772 | - $suffix .= '</' . $tag . '>'; |
|
| 772 | + $suffix .= '</'.$tag.'>'; |
|
| 773 | 773 | } |
| 774 | 774 | } else { |
| 775 | 775 | if (geodir_strlen($text, $options) <= $length) { |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - return $prefix . $result . $suffix; |
|
| 794 | + return $prefix.$result.$suffix; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
| 829 | 829 | $replace = preg_replace_callback( |
| 830 | 830 | $pattern, |
| 831 | - function ($match) use ($strlen) { |
|
| 831 | + function($match) use ($strlen) { |
|
| 832 | 832 | $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
| 833 | 833 | |
| 834 | 834 | return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | if (empty($options['html'])) { |
| 892 | - return (string)$substr($text, $start, $length); |
|
| 892 | + return (string) $substr($text, $start, $length); |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | $totalOffset = 0; |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | |
| 915 | 915 | $len = geodir_strlen($part, $options); |
| 916 | 916 | if ($offset !== 0 || $totalLength + $len > $length) { |
| 917 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 917 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) { |
|
| 918 | 918 | // Entities cannot be passed substr. |
| 919 | 919 | continue; |
| 920 | 920 | } |
@@ -960,39 +960,39 @@ discard block |
||
| 960 | 960 | return ''; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | -function geodir_tool_restore_cpt_from_taxonomies(){ |
|
| 963 | +function geodir_tool_restore_cpt_from_taxonomies() { |
|
| 964 | 964 | |
| 965 | 965 | $cpts = get_option('geodir_post_types'); |
| 966 | 966 | |
| 967 | - if(!empty($cpts)){return;} |
|
| 967 | + if (!empty($cpts)) {return; } |
|
| 968 | 968 | |
| 969 | 969 | $taxonomies = get_option('geodir_taxonomies'); |
| 970 | 970 | |
| 971 | - if(empty($taxonomies)){return;} |
|
| 971 | + if (empty($taxonomies)) {return; } |
|
| 972 | 972 | |
| 973 | 973 | $cpts = array(); |
| 974 | 974 | |
| 975 | - foreach($taxonomies as $key => $val){ |
|
| 975 | + foreach ($taxonomies as $key => $val) { |
|
| 976 | 976 | |
| 977 | - if(strpos($val['listing_slug'], '/') === false) { |
|
| 978 | - $cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']); |
|
| 977 | + if (strpos($val['listing_slug'], '/') === false) { |
|
| 978 | + $cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | } |
| 982 | 982 | |
| 983 | - if(empty($cpts)){return;} |
|
| 983 | + if (empty($cpts)) {return; } |
|
| 984 | 984 | |
| 985 | 985 | |
| 986 | 986 | $cpts_restore = $cpts; |
| 987 | 987 | |
| 988 | - foreach($cpts as $cpt){ |
|
| 988 | + foreach ($cpts as $cpt) { |
|
| 989 | 989 | |
| 990 | 990 | |
| 991 | - $is_custom = $cpt['cpt']=='gd_place' ? 0 : 1; |
|
| 991 | + $is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1; |
|
| 992 | 992 | |
| 993 | - $cpts_restore[$cpt['cpt']] = array ( |
|
| 993 | + $cpts_restore[$cpt['cpt']] = array( |
|
| 994 | 994 | 'labels' => |
| 995 | - array ( |
|
| 995 | + array( |
|
| 996 | 996 | 'name' => $cpt['slug'], |
| 997 | 997 | 'singular_name' => $cpt['slug'], |
| 998 | 998 | 'add_new' => 'Add New', |
@@ -1020,14 +1020,14 @@ discard block |
||
| 1020 | 1020 | 'public' => true, |
| 1021 | 1021 | 'query_var' => true, |
| 1022 | 1022 | 'rewrite' => |
| 1023 | - array ( |
|
| 1023 | + array( |
|
| 1024 | 1024 | 'slug' => $cpt['slug'], |
| 1025 | 1025 | 'with_front' => false, |
| 1026 | 1026 | 'hierarchical' => true, |
| 1027 | 1027 | 'feeds' => true, |
| 1028 | 1028 | ), |
| 1029 | 1029 | 'supports' => |
| 1030 | - array ( |
|
| 1030 | + array( |
|
| 1031 | 1031 | 0 => 'title', |
| 1032 | 1032 | 1 => 'editor', |
| 1033 | 1033 | 2 => 'author', |
@@ -1037,14 +1037,14 @@ discard block |
||
| 1037 | 1037 | 6 => 'comments', |
| 1038 | 1038 | ), |
| 1039 | 1039 | 'taxonomies' => |
| 1040 | - array ( |
|
| 1040 | + array( |
|
| 1041 | 1041 | 0 => $cpt['cpt'].'category', |
| 1042 | 1042 | 1 => $cpt['cpt'].'_tags', |
| 1043 | 1043 | ), |
| 1044 | 1044 | 'is_custom' => $is_custom, |
| 1045 | 1045 | 'listing_order' => '1', |
| 1046 | 1046 | 'seo' => |
| 1047 | - array ( |
|
| 1047 | + array( |
|
| 1048 | 1048 | 'meta_keyword' => '', |
| 1049 | 1049 | 'meta_description' => '', |
| 1050 | 1050 | ), |
@@ -1056,6 +1056,6 @@ discard block |
||
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | - update_option('geodir_post_types',$cpts_restore); |
|
| 1059 | + update_option('geodir_post_types', $cpts_restore); |
|
| 1060 | 1060 | |
| 1061 | 1061 | } |