@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | // Enable map cache if set |
| 10 | -if(get_option('geodir_enable_map_cache')){
|
|
| 11 | - add_filter('geodir_get_markers_cache','geodir_get_map_cache');
|
|
| 12 | - add_filter('geodir_markers_json','geodir_save_map_cache',10);
|
|
| 10 | +if (get_option('geodir_enable_map_cache')) {
|
|
| 11 | + add_filter('geodir_get_markers_cache', 'geodir_get_map_cache');
|
|
| 12 | + add_filter('geodir_markers_json', 'geodir_save_map_cache', 10);
|
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @since 1.6.22 |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | -function geodir_get_map_cache($cache){
|
|
| 24 | +function geodir_get_map_cache($cache) {
|
|
| 25 | 25 | |
| 26 | 26 | // if a search is going on then dont even try to check for cache. |
| 27 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 27 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 28 | 28 | return $cache; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 44 | 44 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 45 | 45 | |
| 46 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 46 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 47 | 47 | |
| 48 | 48 | $blog_id = get_current_blog_id(); |
| 49 | - if($blog_id>1){
|
|
| 49 | + if ($blog_id > 1) {
|
|
| 50 | 50 | $file_name = $blog_id."_".$file_name; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $file_path = realpath(dirname(__FILE__))."/map-cache/"; |
| 54 | - $file = $file_path . $file_name . ".json"; |
|
| 54 | + $file = $file_path.$file_name.".json"; |
|
| 55 | 55 | |
| 56 | - if(file_exists($file)){
|
|
| 56 | + if (file_exists($file)) {
|
|
| 57 | 57 | // do the cache delete stuff |
| 58 | 58 | $cache_time = get_option('geodir_map_cache');
|
| 59 | - if(!$cache_time){
|
|
| 59 | + if (!$cache_time) {
|
|
| 60 | 60 | $cache_time = time(); |
| 61 | 61 | update_option('geodir_map_cache', $cache_time);
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if((time() - $cache_time) > 86400){ // delete the cache every 24 hours
|
|
| 64 | + if ((time() - $cache_time) > 86400) { // delete the cache every 24 hours
|
|
| 65 | 65 | geodir_delete_map_cache(); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if(file_exists($file) && is_readable($file)){
|
|
| 68 | + if (file_exists($file) && is_readable($file)) {
|
|
| 69 | 69 | ob_start(); |
| 70 | 70 | readfile($file); // readfile is quicker then file get contents |
| 71 | 71 | return ob_get_clean(); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @since 1.6.22 |
| 84 | 84 | * @return mixed |
| 85 | 85 | */ |
| 86 | -function geodir_save_map_cache($map_json){
|
|
| 86 | +function geodir_save_map_cache($map_json) {
|
|
| 87 | 87 | |
| 88 | 88 | // if a search is going on then dont even try to check for cache. |
| 89 | - if(isset($_REQUEST['search']) && !empty($_REQUEST['search'])){
|
|
| 89 | + if (isset($_REQUEST['search']) && !empty($_REQUEST['search'])) {
|
|
| 90 | 90 | return $map_json; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | $url_params[] = isset($_REQUEST['gd_city']) ? $_REQUEST['gd_city'] : ''; |
| 106 | 106 | $url_params[] = isset($_REQUEST['gd_neighbourhood']) ? $_REQUEST['gd_neighbourhood'] : ''; |
| 107 | 107 | |
| 108 | - $file_name = sanitize_file_name( md5( implode("-",$url_params) ) );
|
|
| 108 | + $file_name = sanitize_file_name(md5(implode("-", $url_params)));
|
|
| 109 | 109 | |
| 110 | 110 | $blog_id = get_current_blog_id(); |
| 111 | - if($blog_id>1){
|
|
| 111 | + if ($blog_id > 1) {
|
|
| 112 | 112 | $file_name = $blog_id."_".$file_name; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | global $wp_filesystem; |
| 119 | 119 | if (empty($wp_filesystem)) {
|
| 120 | - require_once (ABSPATH . '/wp-admin/includes/file.php'); |
|
| 120 | + require_once (ABSPATH.'/wp-admin/includes/file.php'); |
|
| 121 | 121 | WP_Filesystem(); |
| 122 | 122 | } |
| 123 | 123 | $wp_filesystem->put_contents( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $gd_session->set('homemap_catlist_ptype', $gd_post_type);
|
| 139 | 139 | $post_taxonomy = geodir_get_taxonomies($gd_post_type); |
| 140 | 140 | $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']); |
| 141 | - $child_collapse = (bool)$_REQUEST['child_collapse']; |
|
| 141 | + $child_collapse = (bool) $_REQUEST['child_collapse']; |
|
| 142 | 142 | echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true); |
| 143 | 143 | die; |
| 144 | 144 | } |
@@ -158,21 +158,21 @@ discard block |
||
| 158 | 158 | global $wpdb, $plugin_prefix, $gd_session; |
| 159 | 159 | |
| 160 | 160 | if ($_REQUEST['m_id'] != '') {
|
| 161 | - $pid = (int)$_REQUEST['m_id']; |
|
| 161 | + $pid = (int) $_REQUEST['m_id']; |
|
| 162 | 162 | } else {
|
| 163 | 163 | echo __('No marker data found', 'geodirectory');
|
| 164 | 164 | exit; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
|
| 168 | - $post = (object)$gd_ses_listing; |
|
| 168 | + $post = (object) $gd_ses_listing; |
|
| 169 | 169 | echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']); |
| 170 | 170 | } else {
|
| 171 | 171 | $geodir_post_type = get_post_type($pid); |
| 172 | 172 | |
| 173 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 173 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 174 | 174 | |
| 175 | - $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
|
|
| 175 | + $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
|
|
| 176 | 176 | |
| 177 | 177 | $postinfo = $wpdb->get_results($sql); |
| 178 | 178 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function get_markers() {
|
| 208 | 208 | |
| 209 | - global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes,$gd_session; |
|
| 209 | + global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes, $gd_session; |
|
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * |
| 215 | 215 | * @since 1.6.22 |
| 216 | 216 | */ |
| 217 | - $map_cache = apply_filters('geodir_get_markers_cache','');
|
|
| 218 | - if($map_cache){
|
|
| 217 | + $map_cache = apply_filters('geodir_get_markers_cache', '');
|
|
| 218 | + if ($map_cache) {
|
|
| 219 | 219 | return $map_cache; |
| 220 | 220 | wp_die(); |
| 221 | 221 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place'; |
| 231 | 231 | |
| 232 | 232 | $map_cat_ids_array = array('0');
|
| 233 | - $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
|
|
| 233 | + $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
|
|
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | $field_default_cat = ''; |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | $map_cat_arr = trim($_REQUEST['cat_id'], ','); |
| 239 | 239 | |
| 240 | 240 | if (!empty($map_cat_arr)) {
|
| 241 | - $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
|
|
| 241 | + $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
|
|
| 242 | 242 | |
| 243 | 243 | $map_cat_ids_array = explode(',', $map_cat_arr);
|
| 244 | 244 | $cat_find_array = array(); |
| 245 | 245 | foreach ($map_cat_ids_array as $cat_id) {
|
| 246 | - $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id "; |
|
| 247 | - $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)"; |
|
| 246 | + $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id "; |
|
| 247 | + $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)"; |
|
| 248 | 248 | $main_query_array[] = $cat_id; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | $field_default_cat = ''; |
| 256 | 256 | |
| 257 | 257 | if (!empty($cat_find_array)) |
| 258 | - $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
|
|
| 258 | + $search .= "AND (".implode(' OR ', $cat_find_array).")";
|
|
| 259 | 259 | |
| 260 | 260 | $main_query_array = $map_cat_ids_array; |
| 261 | 261 | |
| 262 | 262 | if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
|
| 263 | 263 | $search .= " AND p.post_title LIKE %s"; |
| 264 | - $main_query_array[] = "%" . $_REQUEST['search'] . "%"; |
|
| 264 | + $main_query_array[] = "%".$_REQUEST['search']."%"; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $gd_posttype = ''; |
| 285 | 285 | if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
|
| 286 | - $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail'; |
|
| 286 | + $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail'; |
|
| 287 | 287 | $gd_posttype = " AND p.post_type = %s"; |
| 288 | 288 | $main_query_array[] = $_REQUEST['gd_posttype']; |
| 289 | 289 | |
| 290 | 290 | } else |
| 291 | - $table = $plugin_prefix . 'gd_place_detail'; |
|
| 291 | + $table = $plugin_prefix.'gd_place_detail'; |
|
| 292 | 292 | |
| 293 | - $join = ", " . $table . " AS pd "; |
|
| 293 | + $join = ", ".$table." AS pd "; |
|
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | 296 | * Filter the SQL JOIN clause for the markers data |
@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | $search = apply_filters('geodir_home_map_listing_where', $search);
|
| 312 | 312 | $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
|
| 313 | - $cat_type = $post_type . 'category'; |
|
| 313 | + $cat_type = $post_type.'category'; |
|
| 314 | 314 | if ($post_type == 'gd_event') {
|
| 315 | 315 | $event_select = ", pd.recurring_dates, pd.is_recurring"; |
| 316 | 316 | } else {
|
| 317 | 317 | $event_select = ""; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select; |
|
| 320 | + $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select; |
|
| 321 | 321 | /** |
| 322 | 322 | * Filter the SQL SELECT clause to retrive fields data |
| 323 | 323 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | $groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
|
| 339 | 339 | |
| 340 | - $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
|
|
| 340 | + $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
|
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Filter the SQL query to retrive markers data |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | global $geodir_date_time_format, $geodir_date_format, $geodir_time_format; |
| 388 | 388 | |
| 389 | 389 | $today = strtotime(date_i18n('Y-m-d'));
|
| 390 | - $show_dates = $post_type == 'gd_event' ? (int)get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 390 | + $show_dates = $post_type == 'gd_event' ? (int) get_option('geodir_event_infowindow_dates_count', 1) : 0;
|
|
| 391 | 391 | |
| 392 | 392 | foreach ($catinfo as $catinfo_obj) {
|
| 393 | 393 | $post_title = $catinfo_obj->post_title; |
@@ -403,29 +403,29 @@ discard block |
||
| 403 | 403 | $endtimes = ''; |
| 404 | 404 | $astarttimes = array(); |
| 405 | 405 | $aendtimes = array(); |
| 406 | - if ( !isset( $recurring_data['repeat_type'] ) ) {
|
|
| 406 | + if (!isset($recurring_data['repeat_type'])) {
|
|
| 407 | 407 | $recurring_data['repeat_type'] = 'custom'; |
| 408 | 408 | } |
| 409 | - $repeat_type = isset( $recurring_data['repeat_type'] ) && in_array( $recurring_data['repeat_type'], array( 'day', 'week', 'month', 'year', 'custom' ) ) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom |
|
| 410 | - $different_times = isset( $recurring_data['different_times'] ) && !empty( $recurring_data['different_times'] ) ? true : false; |
|
| 409 | + $repeat_type = isset($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'year'; // day, week, month, year, custom
|
|
| 410 | + $different_times = isset($recurring_data['different_times']) && !empty($recurring_data['different_times']) ? true : false; |
|
| 411 | 411 | |
| 412 | 412 | $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
| 413 | 413 | |
| 414 | - if ( !empty( $recurring_dates ) ) {
|
|
| 415 | - if ( empty( $recurring_data['all_day'] ) ) {
|
|
| 416 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 417 | - $astarttimes = isset( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 418 | - $aendtimes = isset( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 414 | + if (!empty($recurring_dates)) {
|
|
| 415 | + if (empty($recurring_data['all_day'])) {
|
|
| 416 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 417 | + $astarttimes = isset($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 418 | + $aendtimes = isset($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 419 | 419 | } else {
|
| 420 | - $starttimes = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 421 | - $endtimes = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 420 | + $starttimes = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 421 | + $endtimes = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | $e = 0; |
| 426 | - foreach( $recurring_dates as $key => $date ) {
|
|
| 427 | - if ( $repeat_type == 'custom' && $different_times ) {
|
|
| 428 | - if ( !empty( $astarttimes ) && isset( $astarttimes[$key] ) ) {
|
|
| 426 | + foreach ($recurring_dates as $key => $date) {
|
|
| 427 | + if ($repeat_type == 'custom' && $different_times) {
|
|
| 428 | + if (!empty($astarttimes) && isset($astarttimes[$key])) {
|
|
| 429 | 429 | $starttimes = $astarttimes[$key]; |
| 430 | 430 | $endtimes = $aendtimes[$key]; |
| 431 | 431 | } else {
|
@@ -434,50 +434,50 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | - $duration = isset( $recurring_data['duration_x'] ) && (int)$recurring_data['duration_x'] > 0 ? (int)$recurring_data['duration_x'] : 1; |
|
| 437 | + $duration = isset($recurring_data['duration_x']) && (int) $recurring_data['duration_x'] > 0 ? (int) $recurring_data['duration_x'] : 1; |
|
| 438 | 438 | $duration--; |
| 439 | - $enddate = date_i18n( 'Y-m-d', strtotime( $date . ' + ' . $duration . ' day' ) ); |
|
| 439 | + $enddate = date_i18n('Y-m-d', strtotime($date.' + '.$duration.' day'));
|
|
| 440 | 440 | |
| 441 | 441 | // Hide past dates |
| 442 | - if ( strtotime( $enddate ) < $today ) {
|
|
| 442 | + if (strtotime($enddate) < $today) {
|
|
| 443 | 443 | continue; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - $sdate = strtotime( $date . ' ' . $starttimes ); |
|
| 447 | - $edate = strtotime( $enddate . ' ' . $endtimes ); |
|
| 446 | + $sdate = strtotime($date.' '.$starttimes); |
|
| 447 | + $edate = strtotime($enddate.' '.$endtimes); |
|
| 448 | 448 | |
| 449 | - $start_date = date_i18n( $geodir_date_time_format, $sdate ); |
|
| 450 | - $end_date = date_i18n( $geodir_date_time_format, $edate ); |
|
| 449 | + $start_date = date_i18n($geodir_date_time_format, $sdate); |
|
| 450 | + $end_date = date_i18n($geodir_date_time_format, $edate); |
|
| 451 | 451 | |
| 452 | 452 | $same_day = false; |
| 453 | 453 | $full_day = false; |
| 454 | 454 | $same_datetime = false; |
| 455 | 455 | |
| 456 | - if ( $starttimes == $endtimes && ( $starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00' ) ) {
|
|
| 456 | + if ($starttimes == $endtimes && ($starttimes == '' || $starttimes == '00:00:00' || $starttimes == '00:00')) {
|
|
| 457 | 457 | $full_day = true; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if ( $start_date == $end_date && $full_day ) {
|
|
| 460 | + if ($start_date == $end_date && $full_day) {
|
|
| 461 | 461 | $same_datetime = true; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - $link_date = date_i18n( 'Y-m-d', $sdate ); |
|
| 465 | - $title_date = date_i18n( $geodir_date_format, $sdate ); |
|
| 466 | - if ( $full_day ) {
|
|
| 464 | + $link_date = date_i18n('Y-m-d', $sdate);
|
|
| 465 | + $title_date = date_i18n($geodir_date_format, $sdate); |
|
| 466 | + if ($full_day) {
|
|
| 467 | 467 | $start_date = $title_date; |
| 468 | - $end_date = date_i18n( $geodir_date_format, $edate ); |
|
| 468 | + $end_date = date_i18n($geodir_date_format, $edate); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if ( !$same_datetime && !$full_day && date_i18n( 'Y-m-d', $sdate ) == date_i18n( 'Y-m-d', $edate ) ) {
|
|
| 471 | + if (!$same_datetime && !$full_day && date_i18n('Y-m-d', $sdate) == date_i18n('Y-m-d', $edate)) {
|
|
| 472 | 472 | $same_day = true; |
| 473 | 473 | |
| 474 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $edate ); |
|
| 474 | + $start_date .= ' - '.date_i18n($geodir_time_format, $edate); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - $event_dates .= ' :: ' . $start_date; |
|
| 477 | + $event_dates .= ' :: '.$start_date; |
|
| 478 | 478 | |
| 479 | - if ( !$same_day && !$same_datetime ) {
|
|
| 480 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 479 | + if (!$same_day && !$same_datetime) {
|
|
| 480 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | $e++; |
@@ -488,67 +488,67 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } else {
|
| 491 | - $start_date = isset( $recurring_data['event_start'] ) ? $recurring_data['event_start'] : ''; |
|
| 492 | - $end_date = isset( $recurring_data['event_end'] ) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | - $all_day = isset( $recurring_data['all_day'] ) && !empty( $recurring_data['all_day'] ) ? true : false; |
|
| 494 | - $starttime = isset( $recurring_data['starttime'] ) ? $recurring_data['starttime'] : ''; |
|
| 495 | - $endtime = isset( $recurring_data['endtime'] ) ? $recurring_data['endtime'] : ''; |
|
| 491 | + $start_date = isset($recurring_data['event_start']) ? $recurring_data['event_start'] : ''; |
|
| 492 | + $end_date = isset($recurring_data['event_end']) ? $recurring_data['event_end'] : $start_date; |
|
| 493 | + $all_day = isset($recurring_data['all_day']) && !empty($recurring_data['all_day']) ? true : false; |
|
| 494 | + $starttime = isset($recurring_data['starttime']) ? $recurring_data['starttime'] : ''; |
|
| 495 | + $endtime = isset($recurring_data['endtime']) ? $recurring_data['endtime'] : ''; |
|
| 496 | 496 | |
| 497 | - $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] ); |
|
| 498 | - $starttimes = isset( $recurring_data['starttimes'] ) && !empty( $recurring_data['starttimes'] ) ? $recurring_data['starttimes'] : array(); |
|
| 499 | - $endtimes = isset( $recurring_data['endtimes'] ) && !empty( $recurring_data['endtimes'] ) ? $recurring_data['endtimes'] : array(); |
|
| 497 | + $event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
|
|
| 498 | + $starttimes = isset($recurring_data['starttimes']) && !empty($recurring_data['starttimes']) ? $recurring_data['starttimes'] : array(); |
|
| 499 | + $endtimes = isset($recurring_data['endtimes']) && !empty($recurring_data['endtimes']) ? $recurring_data['endtimes'] : array(); |
|
| 500 | 500 | |
| 501 | - if ( !geodir_event_is_date( $start_date ) && !empty( $event_recurring_dates ) ) {
|
|
| 501 | + if (!geodir_event_is_date($start_date) && !empty($event_recurring_dates)) {
|
|
| 502 | 502 | $start_date = $event_recurring_dates[0]; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if ( strtotime( $end_date ) < strtotime( $start_date ) ) {
|
|
| 505 | + if (strtotime($end_date) < strtotime($start_date)) {
|
|
| 506 | 506 | $end_date = $start_date; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if ($end_date != '' && strtotime($end_date) >= $today) {
|
| 510 | - if ( $starttime == '' && !empty( $starttimes ) ) {
|
|
| 510 | + if ($starttime == '' && !empty($starttimes)) {
|
|
| 511 | 511 | $starttime = $starttimes[0]; |
| 512 | 512 | $endtime = $endtimes[0]; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | $same_day = false; |
| 516 | 516 | $one_day = false; |
| 517 | - if ( $start_date == $end_date && $all_day ) {
|
|
| 517 | + if ($start_date == $end_date && $all_day) {
|
|
| 518 | 518 | $one_day = true; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - if ( $all_day ) {
|
|
| 522 | - $start_datetime = strtotime( $start_date ); |
|
| 523 | - $end_datetime = strtotime( $end_date ); |
|
| 521 | + if ($all_day) {
|
|
| 522 | + $start_datetime = strtotime($start_date); |
|
| 523 | + $end_datetime = strtotime($end_date); |
|
| 524 | 524 | |
| 525 | - $start_date = date_i18n( $geodir_date_format, $start_datetime ); |
|
| 526 | - $end_date = date_i18n( $geodir_date_format, $end_datetime ); |
|
| 527 | - if ( $start_date == $end_date ) {
|
|
| 525 | + $start_date = date_i18n($geodir_date_format, $start_datetime); |
|
| 526 | + $end_date = date_i18n($geodir_date_format, $end_datetime); |
|
| 527 | + if ($start_date == $end_date) {
|
|
| 528 | 528 | $one_day = true; |
| 529 | 529 | } |
| 530 | 530 | } else {
|
| 531 | - if ( $start_date == $end_date && $starttime == $endtime ) {
|
|
| 532 | - $end_date = date_i18n( 'Y-m-d', strtotime( $start_date . ' ' . $starttime . ' +1 day' ) ); |
|
| 531 | + if ($start_date == $end_date && $starttime == $endtime) {
|
|
| 532 | + $end_date = date_i18n('Y-m-d', strtotime($start_date.' '.$starttime.' +1 day'));
|
|
| 533 | 533 | $one_day = false; |
| 534 | 534 | } |
| 535 | - $start_datetime = strtotime( $start_date . ' ' . $starttime ); |
|
| 536 | - $end_datetime = strtotime( $end_date . ' ' . $endtime ); |
|
| 535 | + $start_datetime = strtotime($start_date.' '.$starttime); |
|
| 536 | + $end_datetime = strtotime($end_date.' '.$endtime); |
|
| 537 | 537 | |
| 538 | - $start_date = date_i18n( $geodir_date_time_format, $start_datetime ); |
|
| 539 | - $end_date = date_i18n( $geodir_date_time_format, $end_datetime ); |
|
| 538 | + $start_date = date_i18n($geodir_date_time_format, $start_datetime); |
|
| 539 | + $end_date = date_i18n($geodir_date_time_format, $end_datetime); |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if ( !$one_day && date_i18n( 'Y-m-d', $start_datetime ) == date_i18n( 'Y-m-d', $end_datetime ) ) {
|
|
| 542 | + if (!$one_day && date_i18n('Y-m-d', $start_datetime) == date_i18n('Y-m-d', $end_datetime)) {
|
|
| 543 | 543 | $same_day = true; |
| 544 | 544 | |
| 545 | - $start_date .= ' - ' . date_i18n( $geodir_time_format, $end_datetime ); |
|
| 545 | + $start_date .= ' - '.date_i18n($geodir_time_format, $end_datetime); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $event_dates .= ' :: ' . $start_date; |
|
| 548 | + $event_dates .= ' :: '.$start_date; |
|
| 549 | 549 | |
| 550 | - if ( !$same_day && !$one_day ) {
|
|
| 551 | - $event_dates .= ' ' . __( 'to', 'geodirectory' ) . ' ' . $end_date; |
|
| 550 | + if (!$same_day && !$one_day) {
|
|
| 551 | + $event_dates .= ' '.__('to', 'geodirectory').' '.$end_date;
|
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | $default_cat = isset($catinfo_obj->default_category) ? $catinfo_obj->default_category : ''; |
| 565 | 565 | |
| 566 | 566 | // if single cat lets just show that icon |
| 567 | - if(is_array($map_cat_ids_array) && count($map_cat_ids_array)==1){
|
|
| 568 | - $default_cat = (int)$map_cat_ids_array[0]; |
|
| 567 | + if (is_array($map_cat_ids_array) && count($map_cat_ids_array) == 1) {
|
|
| 568 | + $default_cat = (int) $map_cat_ids_array[0]; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$default_cat]) ? $geodir_cat_icons[$default_cat] : ''; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | $icon_size = array('w' => 36, 'h' => 45);
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $default_cat . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
|
|
| 588 | + $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$default_cat.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
|
|
| 589 | 589 | $post_ids[] = $catinfo_obj->post_id; |
| 590 | 590 | } |
| 591 | 591 | } |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | $totalcount = count(array_unique($post_ids)); |
| 610 | 610 | |
| 611 | 611 | if (!empty($cat_content_info)) {
|
| 612 | - $map_json = '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
|
|
| 612 | + $map_json = '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
|
|
| 613 | 613 | } |
| 614 | 614 | else {
|
| 615 | - $map_json = '[{"totalcount":"0"}]';
|
|
| 615 | + $map_json = '[{"totalcount":"0"}]';
|
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * @since 1.6.22 |
| 623 | 623 | * @param string $map_json The JSON string of the map markers results. |
| 624 | 624 | */ |
| 625 | - return apply_filters('geodir_markers_json',$map_json);
|
|
| 625 | + return apply_filters('geodir_markers_json', $map_json);
|
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | |
| 143 | 143 | if ($remove_class) { |
| 144 | 144 | $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
| 145 | - if ( $new_class == 'content' ) { |
|
| 145 | + if ($new_class == 'content') { |
|
| 146 | 146 | $new_class = 'content-no-sidebar'; |
| 147 | 147 | $classes[] = 'full-width-content'; |
| 148 | 148 | } |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 12 | 12 | * @return array User listing count for each post type. |
| 13 | 13 | */ |
| 14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
| 14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
| 15 | 15 | { |
| 16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
| 17 | 17 | |
| 18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | - if(!$user_id){return array();} |
|
| 18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
| 19 | + if (!$user_id) {return array(); } |
|
| 20 | 20 | |
| 21 | 21 | $site_id = ''; |
| 22 | - if ( is_multisite() ) { |
|
| 22 | + if (is_multisite()) { |
|
| 23 | 23 | $blog_id = get_current_blog_id(); |
| 24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $user_listing = array(); |
| 31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
| 32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
| 33 | 33 | |
| 34 | 34 | foreach ($all_posts as $ptype) { |
| 35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
| 36 | 36 | |
| 37 | 37 | if ($total_posts > 0) { |
| 38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -49,22 +49,22 @@ discard block |
||
| 49 | 49 | * @since 1.5.9 |
| 50 | 50 | * @package GeoDirectory |
| 51 | 51 | */ |
| 52 | -function geodir_user_show_favourites( $user_id = '', $output_type = 'select' ) { |
|
| 52 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
| 53 | 53 | // My Favourites in Dashboard |
| 54 | - $show_favorite_link_user_dashboard = get_option( 'geodir_favorite_link_user_dashboard' ); |
|
| 55 | - $user_favourite = geodir_user_favourite_listing_count( $user_id ); |
|
| 54 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
| 55 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
| 56 | 56 | |
| 57 | - if ( ! empty( $show_favorite_link_user_dashboard ) && ! empty( $user_favourite ) ) { |
|
| 57 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
| 58 | 58 | $favourite_links = $output_type == 'link' ? array() : ''; |
| 59 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 59 | + $post_types = geodir_get_posttypes('object'); |
|
| 60 | 60 | |
| 61 | - $author_link = get_author_posts_url( $user_id ); |
|
| 62 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 61 | + $author_link = get_author_posts_url($user_id); |
|
| 62 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 63 | 63 | |
| 64 | - foreach ( $post_types as $key => $postobj ) { |
|
| 65 | - if ( in_array( $key, $show_favorite_link_user_dashboard ) && array_key_exists( $key, $user_favourite ) ) { |
|
| 66 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 67 | - $post_type_link = geodir_getlink( $author_link, array( 'stype' => $key, 'list' => 'favourite' ), false ); |
|
| 64 | + foreach ($post_types as $key => $postobj) { |
|
| 65 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
| 66 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
| 67 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Filter favorite listing link. |
@@ -74,54 +74,54 @@ discard block |
||
| 74 | 74 | * @param string $key Favorite listing array key. |
| 75 | 75 | * @param int $current_user->ID Current user ID. |
| 76 | 76 | */ |
| 77 | - $post_type_link = apply_filters( 'geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id ); |
|
| 77 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
| 78 | 78 | |
| 79 | - if ( $output_type == 'select' ) { |
|
| 79 | + if ($output_type == 'select') { |
|
| 80 | 80 | $selected = ''; |
| 81 | - if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key && isset( $_REQUEST['geodir_dashbord'] ) ) { |
|
| 81 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
| 82 | 82 | $selected = 'selected="selected"'; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . $name . '</option>'; |
|
| 86 | - } elseif ( $output_type == 'link' ) { |
|
| 87 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . $name . '</a>'; |
|
| 85 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.$name.'</option>'; |
|
| 86 | + } elseif ($output_type == 'link') { |
|
| 87 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.$name.'</a>'; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if ( ! empty( $favourite_links ) ) { |
|
| 93 | - if ( $output_type == 'select' ) { |
|
| 92 | + if (!empty($favourite_links)) { |
|
| 93 | + if ($output_type == 'select') { |
|
| 94 | 94 | ?> |
| 95 | 95 | <li> |
| 96 | - <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Favorites', 'geodirectory' ); ?>"> |
|
| 97 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Favorites", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
| 96 | + <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Favorites', 'geodirectory'); ?>"> |
|
| 97 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Favorites", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
| 98 | 98 | <?php echo $favourite_links; ?> |
| 99 | 99 | </select> |
| 100 | 100 | </li> |
| 101 | 101 | <?php |
| 102 | - } elseif ( $output_type == 'link' ) { |
|
| 103 | - echo implode( " | ", $favourite_links ); |
|
| 102 | + } elseif ($output_type == 'link') { |
|
| 103 | + echo implode(" | ", $favourite_links); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -function geodir_user_show_listings( $user_id = '', $output_type = 'select' ) { |
|
| 110 | - $show_listing_link_user_dashboard = get_option( 'geodir_listing_link_user_dashboard' ); |
|
| 111 | - $user_listing = geodir_user_post_listing_count( $user_id ); |
|
| 109 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
| 110 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
| 111 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
| 112 | 112 | |
| 113 | - if ( ! empty( $show_listing_link_user_dashboard ) && ! empty( $user_listing ) ) { |
|
| 113 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
| 114 | 114 | $listing_links = $output_type == 'link' ? array() : ''; |
| 115 | 115 | |
| 116 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 116 | + $post_types = geodir_get_posttypes('object'); |
|
| 117 | 117 | |
| 118 | - $author_link = get_author_posts_url( $user_id ); |
|
| 119 | - $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); |
|
| 118 | + $author_link = get_author_posts_url($user_id); |
|
| 119 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 120 | 120 | |
| 121 | - foreach ( $post_types as $key => $postobj ) { |
|
| 122 | - if ( in_array( $key, $show_listing_link_user_dashboard ) && array_key_exists( $key, $user_listing ) ) { |
|
| 123 | - $name = __( $postobj->labels->name, 'geodirectory' ); |
|
| 124 | - $listing_link = geodir_getlink( $author_link, array( 'stype' => $key ), false ); |
|
| 121 | + foreach ($post_types as $key => $postobj) { |
|
| 122 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
| 123 | + $name = __($postobj->labels->name, 'geodirectory'); |
|
| 124 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Filter my listing link. |
@@ -131,32 +131,32 @@ discard block |
||
| 131 | 131 | * @param string $key My listing array key. |
| 132 | 132 | * @param int $current_user->ID Current user ID. |
| 133 | 133 | */ |
| 134 | - $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $key, $user_id ); |
|
| 135 | - if ( $output_type == 'select' ) { |
|
| 134 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
| 135 | + if ($output_type == 'select') { |
|
| 136 | 136 | $selected = ''; |
| 137 | - if ( ! isset( $_REQUEST['list'] ) && isset( $_REQUEST['geodir_dashbord'] ) && isset( $_REQUEST['stype'] ) && $_REQUEST['stype'] == $key ) { |
|
| 137 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
| 138 | 138 | $selected = 'selected="selected"'; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . $name . '</option>'; |
|
| 142 | - } elseif ( $output_type == 'link' ) { |
|
| 143 | - $listing_links[] = '<a href="' . $listing_link . '">' . $name . '</a>'; |
|
| 141 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.$name.'</option>'; |
|
| 142 | + } elseif ($output_type == 'link') { |
|
| 143 | + $listing_links[] = '<a href="'.$listing_link.'">'.$name.'</a>'; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( ! empty( $listing_links ) ) { |
|
| 149 | - if ( $output_type == 'select' ) { |
|
| 148 | + if (!empty($listing_links)) { |
|
| 149 | + if ($output_type == 'select') { |
|
| 150 | 150 | ?> |
| 151 | 151 | <li> |
| 152 | - <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__( 'My Listings', 'geodirectory' ); ?>"> |
|
| 153 | - <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr( wp_sprintf( __( "%s's Listings", 'geodirectory' ), geodir_get_client_name( $user_id ) ) ); ?></option> |
|
| 152 | + <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr__('My Listings', 'geodirectory'); ?>"> |
|
| 153 | + <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(wp_sprintf(__("%s's Listings", 'geodirectory'), geodir_get_client_name($user_id))); ?></option> |
|
| 154 | 154 | <?php echo $listing_links; ?> |
| 155 | 155 | </select> |
| 156 | 156 | </li> |
| 157 | 157 | <?php |
| 158 | - } elseif ( $output_type == 'link' ) { |
|
| 159 | - echo implode( " | ", $listing_links ); |
|
| 158 | + } elseif ($output_type == 'link') { |
|
| 159 | + echo implode(" | ", $listing_links); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | * @since 1.6.24 |
| 170 | 170 | * @return mixed |
| 171 | 171 | */ |
| 172 | -function geodir_get_user_favourites($user_id=''){ |
|
| 173 | - if(!$user_id){$user_id = get_current_user_id();} |
|
| 172 | +function geodir_get_user_favourites($user_id = '') { |
|
| 173 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
| 174 | 174 | $site_id = ''; |
| 175 | - if ( is_multisite() ) { |
|
| 175 | + if (is_multisite()) { |
|
| 176 | 176 | $blog_id = get_current_blog_id(); |
| 177 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 177 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
@@ -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 (geodir_is_wpml()) { |
| 20 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 20 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 37 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 37 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 54 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 54 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 71 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 71 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 88 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 88 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 105 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 105 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 122 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 122 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()) { |
| 140 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 140 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()){ |
|
| 147 | + if (geodir_is_wpml()) { |
|
| 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 (geodir_is_wpml()) { |
| 196 | - $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true); |
|
| 196 | + $gd_page_id = geodir_wpml_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 (geodir_is_wpml()){ |
|
| 203 | + if (geodir_is_wpml()) { |
|
| 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; |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | 'December', |
| 593 | 593 | ); |
| 594 | 594 | |
| 595 | - $non_english_long_months = array( |
|
| 595 | + $non_english_long_months = array( |
|
| 596 | 596 | __('January'), |
| 597 | 597 | __('February'), |
| 598 | 598 | __('March'), |
@@ -606,10 +606,10 @@ discard block |
||
| 606 | 606 | __('November'), |
| 607 | 607 | __('December'), |
| 608 | 608 | ); |
| 609 | - $date = str_replace($non_english_long_months,$english_long_months,$date,$count); |
|
| 609 | + $date = str_replace($non_english_long_months, $english_long_months, $date, $count); |
|
| 610 | 610 | |
| 611 | - if ( !empty( $wp_locale ) && empty($count) ) { |
|
| 612 | - $date = str_replace( array_values( $wp_locale->month_genitive ), $english_long_months, $date ); |
|
| 611 | + if (!empty($wp_locale) && empty($count)) { |
|
| 612 | + $date = str_replace(array_values($wp_locale->month_genitive), $english_long_months, $date); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | $english_short_months = array( |
@@ -628,21 +628,21 @@ discard block |
||
| 628 | 628 | ); |
| 629 | 629 | |
| 630 | 630 | $non_english_short_months = array( |
| 631 | - ' '._x( 'Jan', 'January abbreviation' ).' ', |
|
| 632 | - ' '._x( 'Feb', 'February abbreviation' ).' ', |
|
| 633 | - ' '._x( 'Mar', 'March abbreviation' ).' ', |
|
| 634 | - ' '._x( 'Apr', 'April abbreviation' ).' ', |
|
| 635 | - ' '._x( 'May', 'May abbreviation' ).' ', |
|
| 636 | - ' '._x( 'Jun', 'June abbreviation' ).' ', |
|
| 637 | - ' '._x( 'Jul', 'July abbreviation' ).' ', |
|
| 638 | - ' '._x( 'Aug', 'August abbreviation' ).' ', |
|
| 639 | - ' '._x( 'Sep', 'September abbreviation' ).' ', |
|
| 640 | - ' '._x( 'Oct', 'October abbreviation' ).' ', |
|
| 641 | - ' '._x( 'Nov', 'November abbreviation' ).' ', |
|
| 642 | - ' '._x( 'Dec', 'December abbreviation' ).' ', |
|
| 631 | + ' '._x('Jan', 'January abbreviation').' ', |
|
| 632 | + ' '._x('Feb', 'February abbreviation').' ', |
|
| 633 | + ' '._x('Mar', 'March abbreviation').' ', |
|
| 634 | + ' '._x('Apr', 'April abbreviation').' ', |
|
| 635 | + ' '._x('May', 'May abbreviation').' ', |
|
| 636 | + ' '._x('Jun', 'June abbreviation').' ', |
|
| 637 | + ' '._x('Jul', 'July abbreviation').' ', |
|
| 638 | + ' '._x('Aug', 'August abbreviation').' ', |
|
| 639 | + ' '._x('Sep', 'September abbreviation').' ', |
|
| 640 | + ' '._x('Oct', 'October abbreviation').' ', |
|
| 641 | + ' '._x('Nov', 'November abbreviation').' ', |
|
| 642 | + ' '._x('Dec', 'December abbreviation').' ', |
|
| 643 | 643 | ); |
| 644 | 644 | |
| 645 | - $date = str_replace($non_english_short_months,$english_short_months,$date); |
|
| 645 | + $date = str_replace($non_english_short_months, $english_short_months, $date); |
|
| 646 | 646 | |
| 647 | 647 | |
| 648 | 648 | return $date; |
@@ -660,30 +660,30 @@ discard block |
||
| 660 | 660 | * @param bool $locale True to retrieve the date in localized format. Default false. |
| 661 | 661 | * @return string The formatted date. |
| 662 | 662 | */ |
| 663 | -function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) { |
|
| 664 | - if ( empty( $date_input ) || empty( $date_to ) ) { |
|
| 663 | +function geodir_date($date_input, $date_to, $date_from = '', $locale = false) { |
|
| 664 | + if (empty($date_input) || empty($date_to)) { |
|
| 665 | 665 | return NULL; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - $date_input = geodir_maybe_untranslate_date( $date_input ); |
|
| 668 | + $date_input = geodir_maybe_untranslate_date($date_input); |
|
| 669 | 669 | |
| 670 | 670 | $timestamp = 0; |
| 671 | - if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) { |
|
| 672 | - $datetime = date_create_from_format( $date_from, $date_input ); |
|
| 673 | - if ( !empty( $datetime ) ) { |
|
| 671 | + if (!empty($date_from) && function_exists('date_create_from_format')) { |
|
| 672 | + $datetime = date_create_from_format($date_from, $date_input); |
|
| 673 | + if (!empty($datetime)) { |
|
| 674 | 674 | $timestamp = $datetime->getTimestamp(); |
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - if ( empty( $timestamp ) ) { |
|
| 679 | - $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input; |
|
| 680 | - $timestamp = strtotime( $date ); |
|
| 678 | + if (empty($timestamp)) { |
|
| 679 | + $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
| 680 | + $timestamp = strtotime($date); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $date = date_i18n( $date_to, $timestamp ); |
|
| 683 | + $date = date_i18n($date_to, $timestamp); |
|
| 684 | 684 | |
| 685 | - if ( !$locale ) { |
|
| 686 | - $date = geodir_maybe_untranslate_date( $date ); |
|
| 685 | + if (!$locale) { |
|
| 686 | + $date = geodir_maybe_untranslate_date($date); |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /** |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * @param string $date_from The source date format. |
| 699 | 699 | * @param bool $locale True to retrieve the date in localized format. |
| 700 | 700 | */ |
| 701 | - return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale ); |
|
| 701 | + return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from, $locale); |
|
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | /** |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | * @return string Trimmed string. |
| 724 | 724 | */ |
| 725 | 725 | function geodir_excerpt($text, $length = 100, $options = array()) { |
| 726 | - if (!(int)$length > 0) { |
|
| 726 | + if (!(int) $length > 0) { |
|
| 727 | 727 | return $text; |
| 728 | 728 | } |
| 729 | 729 | $default = array( |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | $length = $truncateLength; |
| 786 | 786 | |
| 787 | 787 | foreach ($openTags as $tag) { |
| 788 | - $suffix .= '</' . $tag . '>'; |
|
| 788 | + $suffix .= '</'.$tag.'>'; |
|
| 789 | 789 | } |
| 790 | 790 | } else { |
| 791 | 791 | if (geodir_strlen($text, $options) <= $length) { |
@@ -807,7 +807,7 @@ discard block |
||
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - return $prefix . $result . $suffix; |
|
| 810 | + return $prefix.$result.$suffix; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
| 845 | 845 | $replace = preg_replace_callback( |
| 846 | 846 | $pattern, |
| 847 | - function ($match) use ($strlen) { |
|
| 847 | + function($match) use ($strlen) { |
|
| 848 | 848 | $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
| 849 | 849 | |
| 850 | 850 | return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | if (empty($options['html'])) { |
| 908 | - return (string)$substr($text, $start, $length); |
|
| 908 | + return (string) $substr($text, $start, $length); |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | $totalOffset = 0; |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | |
| 931 | 931 | $len = geodir_strlen($part, $options); |
| 932 | 932 | if ($offset !== 0 || $totalLength + $len > $length) { |
| 933 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 933 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) { |
|
| 934 | 934 | // Entities cannot be passed substr. |
| 935 | 935 | continue; |
| 936 | 936 | } |
@@ -976,39 +976,39 @@ discard block |
||
| 976 | 976 | return ''; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | -function geodir_tool_restore_cpt_from_taxonomies(){ |
|
| 979 | +function geodir_tool_restore_cpt_from_taxonomies() { |
|
| 980 | 980 | |
| 981 | 981 | $cpts = get_option('geodir_post_types'); |
| 982 | 982 | |
| 983 | - if(!empty($cpts)){return;} |
|
| 983 | + if (!empty($cpts)) {return; } |
|
| 984 | 984 | |
| 985 | 985 | $taxonomies = get_option('geodir_taxonomies'); |
| 986 | 986 | |
| 987 | - if(empty($taxonomies)){return;} |
|
| 987 | + if (empty($taxonomies)) {return; } |
|
| 988 | 988 | |
| 989 | 989 | $cpts = array(); |
| 990 | 990 | |
| 991 | - foreach($taxonomies as $key => $val){ |
|
| 991 | + foreach ($taxonomies as $key => $val) { |
|
| 992 | 992 | |
| 993 | - if(strpos($val['listing_slug'], '/') === false) { |
|
| 994 | - $cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']); |
|
| 993 | + if (strpos($val['listing_slug'], '/') === false) { |
|
| 994 | + $cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']); |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | - if(empty($cpts)){return;} |
|
| 999 | + if (empty($cpts)) {return; } |
|
| 1000 | 1000 | |
| 1001 | 1001 | |
| 1002 | 1002 | $cpts_restore = $cpts; |
| 1003 | 1003 | |
| 1004 | - foreach($cpts as $cpt){ |
|
| 1004 | + foreach ($cpts as $cpt) { |
|
| 1005 | 1005 | |
| 1006 | 1006 | |
| 1007 | - $is_custom = $cpt['cpt']=='gd_place' ? 0 : 1; |
|
| 1007 | + $is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1; |
|
| 1008 | 1008 | |
| 1009 | - $cpts_restore[$cpt['cpt']] = array ( |
|
| 1009 | + $cpts_restore[$cpt['cpt']] = array( |
|
| 1010 | 1010 | 'labels' => |
| 1011 | - array ( |
|
| 1011 | + array( |
|
| 1012 | 1012 | 'name' => $cpt['slug'], |
| 1013 | 1013 | 'singular_name' => $cpt['slug'], |
| 1014 | 1014 | 'add_new' => 'Add New', |
@@ -1036,14 +1036,14 @@ discard block |
||
| 1036 | 1036 | 'public' => true, |
| 1037 | 1037 | 'query_var' => true, |
| 1038 | 1038 | 'rewrite' => |
| 1039 | - array ( |
|
| 1039 | + array( |
|
| 1040 | 1040 | 'slug' => $cpt['slug'], |
| 1041 | 1041 | 'with_front' => false, |
| 1042 | 1042 | 'hierarchical' => true, |
| 1043 | 1043 | 'feeds' => true, |
| 1044 | 1044 | ), |
| 1045 | 1045 | 'supports' => |
| 1046 | - array ( |
|
| 1046 | + array( |
|
| 1047 | 1047 | 0 => 'title', |
| 1048 | 1048 | 1 => 'editor', |
| 1049 | 1049 | 2 => 'author', |
@@ -1053,14 +1053,14 @@ discard block |
||
| 1053 | 1053 | 6 => 'comments', |
| 1054 | 1054 | ), |
| 1055 | 1055 | 'taxonomies' => |
| 1056 | - array ( |
|
| 1056 | + array( |
|
| 1057 | 1057 | 0 => $cpt['cpt'].'category', |
| 1058 | 1058 | 1 => $cpt['cpt'].'_tags', |
| 1059 | 1059 | ), |
| 1060 | 1060 | 'is_custom' => $is_custom, |
| 1061 | 1061 | 'listing_order' => '1', |
| 1062 | 1062 | 'seo' => |
| 1063 | - array ( |
|
| 1063 | + array( |
|
| 1064 | 1064 | 'meta_keyword' => '', |
| 1065 | 1065 | 'meta_description' => '', |
| 1066 | 1066 | ), |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | |
| 1075 | - update_option('geodir_post_types',$cpts_restore); |
|
| 1075 | + update_option('geodir_post_types', $cpts_restore); |
|
| 1076 | 1076 | |
| 1077 | 1077 | } |
| 1078 | 1078 | |
@@ -1090,12 +1090,12 @@ discard block |
||
| 1090 | 1090 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1091 | 1091 | * @return string |
| 1092 | 1092 | */ |
| 1093 | -function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) { |
|
| 1094 | - if ( function_exists( 'mb_strimwidth' ) ) { |
|
| 1095 | - return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding ); |
|
| 1093 | +function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') { |
|
| 1094 | + if (function_exists('mb_strimwidth')) { |
|
| 1095 | + return mb_strimwidth($str, $start, $width, $trimmaker, $encoding); |
|
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | - return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker; |
|
| 1098 | + return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker; |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | /** |
@@ -1108,12 +1108,12 @@ discard block |
||
| 1108 | 1108 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1109 | 1109 | * @return int Returns the number of characters in string. |
| 1110 | 1110 | */ |
| 1111 | -function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) { |
|
| 1112 | - if ( function_exists( 'mb_strlen' ) ) { |
|
| 1113 | - return mb_strlen( $str, $encoding ); |
|
| 1111 | +function geodir_utf8_strlen($str, $encoding = 'UTF-8') { |
|
| 1112 | + if (function_exists('mb_strlen')) { |
|
| 1113 | + return mb_strlen($str, $encoding); |
|
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - return strlen( $str ); |
|
| 1116 | + return strlen($str); |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | /** |
@@ -1128,12 +1128,12 @@ discard block |
||
| 1128 | 1128 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1129 | 1129 | * @return int Returns the position of the first occurrence of search in the string. |
| 1130 | 1130 | */ |
| 1131 | -function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) { |
|
| 1132 | - if ( function_exists( 'mb_strpos' ) ) { |
|
| 1133 | - return mb_strpos( $str, $find, $offset, $encoding ); |
|
| 1131 | +function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') { |
|
| 1132 | + if (function_exists('mb_strpos')) { |
|
| 1133 | + return mb_strpos($str, $find, $offset, $encoding); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | - return strpos( $str, $find, $offset ); |
|
| 1136 | + return strpos($str, $find, $offset); |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | /** |
@@ -1148,12 +1148,12 @@ discard block |
||
| 1148 | 1148 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1149 | 1149 | * @return int Returns the position of the last occurrence of search. |
| 1150 | 1150 | */ |
| 1151 | -function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) { |
|
| 1152 | - if ( function_exists( 'mb_strrpos' ) ) { |
|
| 1153 | - return mb_strrpos( $str, $find, $offset, $encoding ); |
|
| 1151 | +function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') { |
|
| 1152 | + if (function_exists('mb_strrpos')) { |
|
| 1153 | + return mb_strrpos($str, $find, $offset, $encoding); |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - return strrpos( $str, $find, $offset ); |
|
| 1156 | + return strrpos($str, $find, $offset); |
|
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | /** |
@@ -1169,16 +1169,16 @@ discard block |
||
| 1169 | 1169 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1170 | 1170 | * @return string |
| 1171 | 1171 | */ |
| 1172 | -function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) { |
|
| 1173 | - if ( function_exists( 'mb_substr' ) ) { |
|
| 1174 | - if ( $length === null ) { |
|
| 1175 | - return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding ); |
|
| 1172 | +function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') { |
|
| 1173 | + if (function_exists('mb_substr')) { |
|
| 1174 | + if ($length === null) { |
|
| 1175 | + return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding); |
|
| 1176 | 1176 | } else { |
| 1177 | - return mb_substr( $str, $start, $length, $encoding ); |
|
| 1177 | + return mb_substr($str, $start, $length, $encoding); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | - return substr( $str, $start, $length ); |
|
| 1181 | + return substr($str, $start, $length); |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | /** |
@@ -1191,12 +1191,12 @@ discard block |
||
| 1191 | 1191 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1192 | 1192 | * @return string The width of string. |
| 1193 | 1193 | */ |
| 1194 | -function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) { |
|
| 1195 | - if ( function_exists( 'mb_strwidth' ) ) { |
|
| 1196 | - return mb_strwidth( $str, $encoding ); |
|
| 1194 | +function geodir_utf8_strwidth($str, $encoding = 'UTF-8') { |
|
| 1195 | + if (function_exists('mb_strwidth')) { |
|
| 1196 | + return mb_strwidth($str, $encoding); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | - return geodir_utf8_strlen( $str, $encoding ); |
|
| 1199 | + return geodir_utf8_strlen($str, $encoding); |
|
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | /** |
@@ -1210,21 +1210,21 @@ discard block |
||
| 1210 | 1210 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 1211 | 1211 | * @return string The resulting string. |
| 1212 | 1212 | */ |
| 1213 | -function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) { |
|
| 1214 | - if ( function_exists( 'mb_strlen' ) ) { |
|
| 1215 | - $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding ); |
|
| 1213 | +function geodir_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') { |
|
| 1214 | + if (function_exists('mb_strlen')) { |
|
| 1215 | + $first_letter = geodir_strtoupper(geodir_utf8_substr($str, 0, 1, $encoding), $encoding); |
|
| 1216 | 1216 | $str_end = ""; |
| 1217 | 1217 | |
| 1218 | - if ( $lower_str_end ) { |
|
| 1219 | - $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding ); |
|
| 1218 | + if ($lower_str_end) { |
|
| 1219 | + $str_end = geodir_strtolower(geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding), $encoding); |
|
| 1220 | 1220 | } else { |
| 1221 | - $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ); |
|
| 1221 | + $str_end = geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - return $first_letter . $str_end; |
|
| 1224 | + return $first_letter.$str_end; |
|
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | - return ucfirst( $str ); |
|
| 1227 | + return ucfirst($str); |
|
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | 1230 | function geodir_total_listings_count($post_type = false) |
@@ -1234,13 +1234,13 @@ discard block |
||
| 1234 | 1234 | $count = 0; |
| 1235 | 1235 | |
| 1236 | 1236 | if ($post_type) { |
| 1237 | - $count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail"); |
|
| 1237 | + $count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail"); |
|
| 1238 | 1238 | } else { |
| 1239 | 1239 | $all_postypes = geodir_get_posttypes(); |
| 1240 | 1240 | |
| 1241 | 1241 | if (!empty($all_postypes)) { |
| 1242 | 1242 | foreach ($all_postypes as $key) { |
| 1243 | - $count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1243 | + $count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail"); |
|
| 1244 | 1244 | } |
| 1245 | 1245 | } |
| 1246 | 1246 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
|
|
| 42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
|
|
| 43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
| 44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
|
|
| 44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
|
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 48 | 48 | |
| 49 | 49 | $field_admin_title = ''; |
| 50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 72 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 72 | +}elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 73 | 73 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
| 74 | -}else{
|
|
| 74 | +} else {
|
|
| 75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -if(isset($cf['name']) && $cf['name']){
|
|
| 78 | +if (isset($cf['name']) && $cf['name']) {
|
|
| 79 | 79 | $field_type_name = $cf['name']; |
| 80 | -}else{
|
|
| 80 | +} else {
|
|
| 81 | 81 | $field_type_name = $field_type; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" >
|
| 93 | 93 | <?php |
| 94 | 94 | |
| 95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 95 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 96 | 96 | ?> |
| 97 | 97 | |
| 98 | 98 | <?php if (!$default): ?> |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 107 | 107 | <b style="cursor:pointer;" |
| 108 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
|
| 108 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
|
|
| 109 | 109 | <?php |
| 110 | 110 | } else {echo $field_icon;
|
| 111 | 111 | ?> |
| 112 | 112 | <b style="cursor:pointer;" |
| 113 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
|
| 113 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
|
|
| 114 | 114 | <?php |
| 115 | 115 | } |
| 116 | 116 | ?> |
@@ -133,43 +133,43 @@ discard block |
||
| 133 | 133 | } ?>"/> |
| 134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 135 | 135 | |
| 136 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
| 137 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 138 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 139 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
| 136 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
| 137 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 138 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 139 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
| 140 | 140 | |
| 141 | 141 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
| 142 | 142 | |
| 143 | 143 | <?php |
| 144 | 144 | |
| 145 | 145 | // data_type |
| 146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 146 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) {
|
|
| 147 | 147 | |
| 148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 149 | 149 | |
| 150 | - }else{
|
|
| 150 | + } else {
|
|
| 151 | 151 | $value = ''; |
| 152 | 152 | if (isset($field_info->data_type)) {
|
| 153 | 153 | $value = esc_attr($field_info->data_type); |
| 154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 154 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 155 | 155 | $value = $cf['defaults']['data_type']; |
| 156 | 156 | } |
| 157 | 157 | ?> |
| 158 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
| 158 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
| 159 | 159 | <?php |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | // admin_title |
| 164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 164 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
|
|
| 165 | 165 | |
| 166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 167 | 167 | |
| 168 | - }else{
|
|
| 168 | + } else {
|
|
| 169 | 169 | $value = ''; |
| 170 | 170 | if (isset($field_info->admin_title)) {
|
| 171 | 171 | $value = esc_attr($field_info->admin_title); |
| 172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 172 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
|
|
| 173 | 173 | $value = $cf['defaults']['admin_title']; |
| 174 | 174 | } |
| 175 | 175 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | </label> |
| 183 | 183 | <div class="gd-cf-input-wrap"> |
| 184 | 184 | <input type="text" name="admin_title" id="admin_title" |
| 185 | - value="<?php echo $value;?>"/> |
|
| 185 | + value="<?php echo $value; ?>"/> |
|
| 186 | 186 | </div> |
| 187 | 187 | </li> |
| 188 | 188 | <?php |
@@ -190,15 +190,15 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | // site_title |
| 193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 193 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) {
|
|
| 194 | 194 | |
| 195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 196 | 196 | |
| 197 | - }else{
|
|
| 197 | + } else {
|
|
| 198 | 198 | $value = ''; |
| 199 | 199 | if (isset($field_info->site_title)) {
|
| 200 | 200 | $value = esc_attr($field_info->site_title); |
| 201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 201 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
|
|
| 202 | 202 | $value = $cf['defaults']['site_title']; |
| 203 | 203 | } |
| 204 | 204 | ?> |
@@ -218,15 +218,15 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | // admin_desc |
| 221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 221 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
|
|
| 222 | 222 | |
| 223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 224 | 224 | |
| 225 | - }else{
|
|
| 225 | + } else {
|
|
| 226 | 226 | $value = ''; |
| 227 | 227 | if (isset($field_info->admin_desc)) {
|
| 228 | 228 | $value = esc_attr($field_info->admin_desc); |
| 229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 229 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
|
|
| 230 | 230 | $value = $cf['defaults']['admin_desc']; |
| 231 | 231 | } |
| 232 | 232 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | </div> |
| 238 | 238 | </label> |
| 239 | 239 | <div class="gd-cf-input-wrap"> |
| 240 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
| 240 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
| 241 | 241 | </div> |
| 242 | 242 | </li> |
| 243 | 243 | <?php |
@@ -246,26 +246,26 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | // htmlvar_name |
| 249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 249 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
|
|
| 250 | 250 | |
| 251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 252 | 252 | |
| 253 | - }else{
|
|
| 253 | + } else {
|
|
| 254 | 254 | $value = ''; |
| 255 | 255 | if (isset($field_info->htmlvar_name)) {
|
| 256 | 256 | $value = esc_attr($field_info->htmlvar_name); |
| 257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 257 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
|
|
| 258 | 258 | $value = $cf['defaults']['htmlvar_name']; |
| 259 | 259 | } |
| 260 | 260 | ?> |
| 261 | 261 | <li> |
| 262 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
|
|
| 262 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
|
|
| 263 | 263 | <div class="gdcf-tooltip"> |
| 264 | 264 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
|
| 265 | 265 | </div> |
| 266 | 266 | </label> |
| 267 | 267 | <div class="gd-cf-input-wrap"> |
| 268 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
|
|
| 268 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
|
|
| 269 | 269 | value="<?php if ($value) {
|
| 270 | 270 | echo preg_replace('/geodir_/', '', $value, 1);
|
| 271 | 271 | }?>" <?php if ($default) {
|
@@ -278,15 +278,15 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | |
| 280 | 280 | // is_active |
| 281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 281 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) {
|
|
| 282 | 282 | |
| 283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 284 | 284 | |
| 285 | - }else{
|
|
| 285 | + } else {
|
|
| 286 | 286 | $value = ''; |
| 287 | 287 | if (isset($field_info->is_active)) {
|
| 288 | 288 | $value = esc_attr($field_info->is_active); |
| 289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 289 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
|
|
| 290 | 290 | $value = $cf['defaults']['is_active']; |
| 291 | 291 | } |
| 292 | 292 | ?> |
@@ -298,17 +298,17 @@ discard block |
||
| 298 | 298 | </label> |
| 299 | 299 | <div class="gd-cf-input-wrap gd-switch"> |
| 300 | 300 | |
| 301 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 301 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 302 | 302 | <?php if ($value == '1') {
|
| 303 | 303 | echo 'checked'; |
| 304 | 304 | } ?>/> |
| 305 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 305 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 306 | 306 | |
| 307 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 307 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 308 | 308 | <?php if ($value == '0' || !$value) {
|
| 309 | 309 | echo 'checked'; |
| 310 | 310 | } ?>/> |
| 311 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 311 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 312 | 312 | |
| 313 | 313 | </div> |
| 314 | 314 | </li> |
@@ -317,15 +317,15 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | // for_admin_use |
| 320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 320 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
|
|
| 321 | 321 | |
| 322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 323 | 323 | |
| 324 | - }else{
|
|
| 324 | + } else {
|
|
| 325 | 325 | $value = ''; |
| 326 | 326 | if (isset($field_info->for_admin_use)) {
|
| 327 | 327 | $value = esc_attr($field_info->for_admin_use); |
| 328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 328 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
|
|
| 329 | 329 | $value = $cf['defaults']['for_admin_use']; |
| 330 | 330 | } |
| 331 | 331 | ?> |
@@ -337,17 +337,17 @@ discard block |
||
| 337 | 337 | </label> |
| 338 | 338 | <div class="gd-cf-input-wrap gd-switch"> |
| 339 | 339 | |
| 340 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 340 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 341 | 341 | <?php if ($value == '1') {
|
| 342 | 342 | echo 'checked'; |
| 343 | 343 | } ?>/> |
| 344 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 344 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 345 | 345 | |
| 346 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 346 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 347 | 347 | <?php if ($value == '0' || !$value) {
|
| 348 | 348 | echo 'checked'; |
| 349 | 349 | } ?>/> |
| 350 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 350 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 351 | 351 | |
| 352 | 352 | </div> |
| 353 | 353 | </li> |
@@ -356,20 +356,20 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | // default_value |
| 359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 359 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) {
|
|
| 360 | 360 | |
| 361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 362 | 362 | |
| 363 | - }else{
|
|
| 363 | + } else {
|
|
| 364 | 364 | $value = ''; |
| 365 | 365 | if (isset($field_info->default_value)) {
|
| 366 | 366 | $value = esc_attr($field_info->default_value); |
| 367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 367 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
|
|
| 368 | 368 | $value = $cf['defaults']['default_value']; |
| 369 | 369 | } |
| 370 | 370 | ?> |
| 371 | 371 | <li> |
| 372 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
|
| 372 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
|
|
| 373 | 373 | <div class="gdcf-tooltip"> |
| 374 | 374 | <?php |
| 375 | 375 | if ($field_type == 'checkbox') {
|
@@ -386,12 +386,12 @@ discard block |
||
| 386 | 386 | <?php if ($field_type == 'checkbox') { ?>
|
| 387 | 387 | <select name="default_value" id="default_value"> |
| 388 | 388 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
|
| 389 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 389 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 390 | 390 | </select> |
| 391 | 391 | <?php } else if ($field_type == 'email') { ?>
|
| 392 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
|
|
| 392 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
|
|
| 393 | 393 | <?php } else { ?>
|
| 394 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
| 394 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
| 395 | 395 | <?php } ?> |
| 396 | 396 | </div> |
| 397 | 397 | </li> |
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | |
| 402 | 402 | // show_in |
| 403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 403 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) {
|
|
| 404 | 404 | |
| 405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 406 | 406 | |
| 407 | - }else{
|
|
| 407 | + } else {
|
|
| 408 | 408 | $value = ''; |
| 409 | 409 | if (isset($field_info->show_in)) {
|
| 410 | 410 | $value = esc_attr($field_info->show_in); |
| 411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 411 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
|
|
| 412 | 412 | $value = esc_attr($cf['defaults']['show_in']); |
| 413 | 413 | } |
| 414 | 414 | ?> |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | * @param object $field_info The field being displayed info. |
| 442 | 442 | * @param string $field_info The type of field. |
| 443 | 443 | */ |
| 444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 444 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
|
|
| 445 | 445 | |
| 446 | 446 | |
| 447 | 447 | // remove some locations for some field types |
| 448 | 448 | |
| 449 | 449 | // don't show new tab option for some types |
| 450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 451 | - }else{
|
|
| 450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
|
|
| 451 | + } else {
|
|
| 452 | 452 | unset($show_in_locations['[owntab]']); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if(!$display_on_listing){
|
|
| 455 | + if (!$display_on_listing) {
|
|
| 456 | 456 | unset($show_in_locations['[listings]']); |
| 457 | 457 | } |
| 458 | 458 | |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | option-ajaxchosen="false"> |
| 467 | 467 | <?php |
| 468 | 468 | |
| 469 | - $show_in_values = explode(',',$value);
|
|
| 469 | + $show_in_values = explode(',', $value);
|
|
| 470 | 470 | |
| 471 | - foreach( $show_in_locations as $key => $val){
|
|
| 471 | + foreach ($show_in_locations as $key => $val) {
|
|
| 472 | 472 | $selected = ''; |
| 473 | 473 | |
| 474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 474 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) {
|
|
| 475 | 475 | $selected = 'selected'; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | ?> |
| 479 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
| 479 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
| 480 | 480 | <?php |
| 481 | 481 | } |
| 482 | 482 | ?> |
@@ -488,9 +488,9 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | |
| 490 | 490 | // advanced_editor |
| 491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 491 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
|
|
| 492 | 492 | |
| 493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 494 | 494 | |
| 495 | 495 | } |
| 496 | 496 | |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
| 504 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
|
|
| 504 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
|
|
| 505 | 505 | |
| 506 | 506 | <?php // we dont need to show the sort order ?> |
| 507 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
|
|
| 507 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
|
|
| 508 | 508 | |
| 509 | 509 | |
| 510 | 510 | |
@@ -557,15 +557,15 @@ discard block |
||
| 557 | 557 | <?php |
| 558 | 558 | |
| 559 | 559 | // is_required |
| 560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 560 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) {
|
|
| 561 | 561 | |
| 562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 563 | 563 | |
| 564 | - }else{
|
|
| 564 | + } else {
|
|
| 565 | 565 | $value = ''; |
| 566 | 566 | if (isset($field_info->is_required)) {
|
| 567 | 567 | $value = esc_attr($field_info->is_required); |
| 568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 568 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
|
|
| 569 | 569 | $value = $cf['defaults']['is_required']; |
| 570 | 570 | } |
| 571 | 571 | ?> |
@@ -578,17 +578,17 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | <div class="gd-cf-input-wrap gd-switch"> |
| 580 | 580 | |
| 581 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
| 581 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
| 582 | 582 | <?php if ($value == '1') {
|
| 583 | 583 | echo 'checked'; |
| 584 | 584 | } ?>/> |
| 585 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 585 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 586 | 586 | |
| 587 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
| 587 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
| 588 | 588 | <?php if ($value == '0' || !$value) {
|
| 589 | 589 | echo 'checked'; |
| 590 | 590 | } ?>/> |
| 591 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 591 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 592 | 592 | |
| 593 | 593 | </div> |
| 594 | 594 | |
@@ -598,19 +598,19 @@ discard block |
||
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | // required_msg |
| 601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 601 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
|
|
| 602 | 602 | |
| 603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 604 | 604 | |
| 605 | - }else{
|
|
| 605 | + } else {
|
|
| 606 | 606 | $value = ''; |
| 607 | 607 | if (isset($field_info->required_msg)) {
|
| 608 | 608 | $value = esc_attr($field_info->required_msg); |
| 609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 609 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
|
|
| 610 | 610 | $value = $cf['defaults']['required_msg']; |
| 611 | 611 | } |
| 612 | 612 | ?> |
| 613 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
|
|
| 613 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
|
|
| 614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
| 616 | 616 | <div class="gdcf-tooltip"> |
@@ -627,31 +627,31 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | |
| 629 | 629 | // required_msg |
| 630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 630 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
|
|
| 631 | 631 | |
| 632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 633 | 633 | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | // extra_fields |
| 638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 638 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
|
|
| 639 | 639 | |
| 640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 641 | 641 | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
| 645 | 645 | // field_icon |
| 646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 646 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
|
|
| 647 | 647 | |
| 648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 649 | 649 | |
| 650 | - }else{
|
|
| 650 | + } else {
|
|
| 651 | 651 | $value = ''; |
| 652 | 652 | if (isset($field_info->field_icon)) {
|
| 653 | 653 | $value = esc_attr($field_info->field_icon); |
| 654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 654 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
|
|
| 655 | 655 | $value = $cf['defaults']['field_icon']; |
| 656 | 656 | } |
| 657 | 657 | ?> |
@@ -662,12 +662,12 @@ discard block |
||
| 662 | 662 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
| 663 | 663 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
|
| 664 | 664 | <div class="gdcf-tooltip"> |
| 665 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
|
|
| 665 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
|
|
| 666 | 666 | </div> |
| 667 | 667 | </label> |
| 668 | 668 | <div class="gd-cf-input-wrap"> |
| 669 | 669 | <input type="text" name="field_icon" id="field_icon" |
| 670 | - value="<?php echo $value;?>"/> |
|
| 670 | + value="<?php echo $value; ?>"/> |
|
| 671 | 671 | </div> |
| 672 | 672 | |
| 673 | 673 | </li> |
@@ -676,15 +676,15 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | |
| 678 | 678 | // css_class |
| 679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 679 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) {
|
|
| 680 | 680 | |
| 681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 682 | 682 | |
| 683 | - }else{
|
|
| 683 | + } else {
|
|
| 684 | 684 | $value = ''; |
| 685 | 685 | if (isset($field_info->css_class)) {
|
| 686 | 686 | $value = esc_attr($field_info->css_class); |
| 687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 687 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
|
|
| 688 | 688 | $value = $cf['defaults']['css_class']; |
| 689 | 689 | } |
| 690 | 690 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
| 694 | 694 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
|
| 695 | 695 | <div class="gdcf-tooltip"> |
| 696 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
|
|
| 697 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
|
|
| 696 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
|
|
| 697 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
|
|
| 698 | 698 | </div> |
| 699 | 699 | </label> |
| 700 | 700 | <div class="gd-cf-input-wrap"> |
@@ -709,23 +709,23 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | |
| 711 | 711 | // cat_sort |
| 712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 712 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
|
|
| 713 | 713 | |
| 714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 715 | 715 | |
| 716 | - }else{
|
|
| 716 | + } else {
|
|
| 717 | 717 | $value = ''; |
| 718 | - $hide_cat_sort =''; |
|
| 718 | + $hide_cat_sort = ''; |
|
| 719 | 719 | if (isset($field_info->cat_sort)) {
|
| 720 | 720 | $value = esc_attr($field_info->cat_sort); |
| 721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 721 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
|
|
| 722 | 722 | $value = $cf['defaults']['cat_sort']; |
| 723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 723 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
| 727 | 727 | ?> |
| 728 | - <li <?php echo $hide_cat_sort ;?>> |
|
| 728 | + <li <?php echo $hide_cat_sort; ?>> |
|
| 729 | 729 | <h3><?php |
| 730 | 730 | /** |
| 731 | 731 | * Filter the section title. |
@@ -744,23 +744,23 @@ discard block |
||
| 744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 746 | 746 | <div class="gdcf-tooltip"> |
| 747 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
|
|
| 747 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
|
|
| 748 | 748 | </div> |
| 749 | 749 | </label> |
| 750 | 750 | |
| 751 | 751 | <div class="gd-cf-input-wrap gd-switch"> |
| 752 | 752 | |
| 753 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 753 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 754 | 754 | <?php if ($value == '1') {
|
| 755 | 755 | echo 'checked'; |
| 756 | 756 | } ?>/> |
| 757 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 757 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 758 | 758 | |
| 759 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 759 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 760 | 760 | <?php if (!$value) {
|
| 761 | 761 | echo 'checked'; |
| 762 | 762 | } ?>/> |
| 763 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 763 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 764 | 764 | |
| 765 | 765 | </div> |
| 766 | 766 | </li> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | * @param object $field_info The current fields info. |
| 788 | 788 | * @param array $cf The custom field settings |
| 789 | 789 | */ |
| 790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 790 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
|
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | 793 | <?php endswitch; ?> |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | <h3></h3> |
| 800 | 800 | </label> |
| 801 | 801 | <div class="gd-cf-input-wrap"> |
| 802 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 802 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 803 | 803 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 804 | 804 | <?php if (!$default): ?> |
| 805 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 805 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 806 | 806 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
|
| 807 | 807 | class="button"/></a> |
| 808 | 808 | <?php endif; ?> |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
| 50 | 50 | {
|
| 51 | 51 | global $wpdb; |
| 52 | - $result = 0;// no rows affected |
|
| 52 | + $result = 0; // no rows affected |
|
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | 54 | if (!empty($db) && !empty($column)) |
| 55 | 55 | $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | {
|
| 75 | 75 | global $wpdb, $geodir_post_custom_fields_cache; |
| 76 | 76 | |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 77 | + $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location; |
|
| 78 | 78 | |
| 79 | 79 | if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
| 80 | 80 | return $geodir_post_custom_fields_cache[$cache_stored]; |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $default_query .= " and is_admin = '0' "; |
| 89 | 89 | |
| 90 | 90 | if ($fields_location == 'none') {
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 91 | + } else {
|
|
| 92 | + $fields_location = esc_sql($fields_location); |
|
| 93 | 93 | $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $post_meta_info = $wpdb->get_results( |
| 97 | 97 | $wpdb->prepare( |
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 98 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | 99 | array($post_type) |
| 100 | 100 | ) |
| 101 | 101 | ); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | * @param string $field_ins_upd When set to "submit" displays form. |
| 163 | 163 | * @param string $field_type_key The key of the custom field. |
| 164 | 164 | */ |
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 166 | 166 | {
|
| 167 | 167 | global $wpdb; |
| 168 | 168 | $cf = $result_str; |
| 169 | 169 | if (!is_object($cf)) {
|
| 170 | 170 | |
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
|
|
| 172 | 172 | |
| 173 | 173 | } else {
|
| 174 | 174 | $field_info = $cf; |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | if ($field_id != '') {
|
| 203 | 203 | $cf = trim($field_id, '_'); |
| 204 | 204 | |
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 207 | 207 | |
| 208 | 208 | $post_type = $field->post_type; |
| 209 | 209 | $htmlvar_name = $field->htmlvar_name; |
| 210 | 210 | |
| 211 | 211 | if ($post_type != '' && $htmlvar_name != '') {
|
| 212 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 212 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
| 224 | 224 | |
| 225 | 225 | if ($field->field_type == 'address') {
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 226 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
|
|
| 235 | 235 | } else {
|
| 236 | 236 | if ($field->field_type != 'fieldset') {
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 237 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
|
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 306 | 306 | |
| 307 | 307 | // some servers fail if a POST value is VARCHAR so we change it. |
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 309 | 309 | $request_field['data_type'] = 'VARCHAR'; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | $post_type = $request_field['listing_type']; |
| 319 | 319 | |
| 320 | 320 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $check_html_variable = $wpdb->get_var( |
| 325 | 325 | $wpdb->prepare( |
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | 327 | array($cf, $cehhtmlvar_name, $post_type) |
| 328 | 328 | ) |
| 329 | 329 | ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $post_meta_info = $wpdb->get_row( |
| 337 | 337 | $wpdb->prepare( |
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 339 | 339 | array($cf) |
| 340 | 340 | ) |
| 341 | 341 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if ($post_type == '') $post_type = 'gd_place'; |
| 354 | 354 | |
| 355 | 355 | |
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 357 | 357 | |
| 358 | 358 | $admin_title = $request_field['admin_title']; |
| 359 | 359 | $site_title = $request_field['site_title']; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 384 | + if (is_array($show_in)) {
|
|
| 385 | 385 | $show_in = implode(",", $request_field['show_in']);
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $option_values = ''; |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if ($sort_order == '') {
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 432 | + $sort_order = (int) $last_order + 1; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $default_value_add = ''; |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | case 'address': |
| 442 | 442 | |
| 443 | 443 | if ($htmlvar_name != '') {
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 444 | + $prefix = $htmlvar_name.'_'; |
|
| 445 | 445 | } |
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 446 | + $old_prefix = $old_html_variable.'_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | 451 | if ($default_value != '') {
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $wpdb->query($meta_field_add); |
@@ -458,12 +458,12 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 462 | 462 | if ($is_column) {
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 463 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | 465 | if ($default_value != '') {
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | $wpdb->query($meta_field_add); |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 473 | 473 | if ($default_value != '') {
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 475 | 475 | } |
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | 478 | } |
| 479 | 479 | |
@@ -483,36 +483,36 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 487 | 487 | |
| 488 | 488 | if ($is_column) {
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 489 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | 491 | if ($default_value != '') {
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $wpdb->query($meta_field_add); |
| 496 | 496 | } else {
|
| 497 | 497 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 498 | 498 | if ($default_value != '') {
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | } |
| 506 | 506 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 509 | 509 | |
| 510 | 510 | if ($is_column) {
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | 514 | if ($default_value != '') {
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | $wpdb->query($meta_field_add); |
@@ -520,24 +520,24 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 522 | 522 | if ($default_value != '') {
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | } |
| 531 | 531 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 534 | 534 | |
| 535 | 535 | if ($is_column) {
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | 539 | if ($default_value != '') {
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $wpdb->query($meta_field_add); |
@@ -545,128 +545,128 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 547 | 547 | if ($default_value != '') {
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | } |
| 556 | 556 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 559 | 559 | if ($is_column) {
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | 563 | if ($default_value != '') {
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $wpdb->query($meta_field_add); |
| 568 | 568 | } else {
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | 571 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 572 | 572 | if ($default_value != '') {
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 582 | 582 | |
| 583 | 583 | if ($is_column) {
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | 586 | if ($default_value != '') {
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $wpdb->query($meta_field_add); |
| 591 | 591 | } else {
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | 594 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 595 | 595 | if ($default_value != '') {
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 606 | 606 | |
| 607 | 607 | if ($is_column) {
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | 610 | if ($default_value != '') {
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $wpdb->query($meta_field_add); |
| 615 | 615 | } else {
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | 619 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 620 | 620 | if ($default_value != '') {
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 632 | 632 | if ($is_column) {
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | 635 | if ($default_value != '') {
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $wpdb->query($meta_field_add); |
| 640 | 640 | |
| 641 | 641 | } else {
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | 645 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 646 | 646 | if ($default_value != '') {
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | // show lat lng |
| 655 | 655 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 657 | 657 | |
| 658 | 658 | if ($is_column) {
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | 660 | $meta_field_add .= " DEFAULT '1'"; |
| 661 | 661 | |
| 662 | 662 | $wpdb->query($meta_field_add); |
| 663 | 663 | } else {
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | 666 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 667 | 667 | $meta_field_add .= " DEFAULT '1'"; |
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | } |
@@ -675,13 +675,13 @@ discard block |
||
| 675 | 675 | break; |
| 676 | 676 | |
| 677 | 677 | case 'checkbox': |
| 678 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TINYINT(1) NOT NULL"; |
|
| 678 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TINYINT(1) NOT NULL"; |
|
| 679 | 679 | if ($default_value != '') {
|
| 680 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 680 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | $alter_result = $wpdb->query($default_value_add); |
| 684 | - if ( $alter_result === false) {
|
|
| 684 | + if ($alter_result === false) {
|
|
| 685 | 685 | return __('Column change failed, you may have too many columns.', 'geodirectory');
|
| 686 | 686 | } |
| 687 | 687 | break; |
@@ -692,30 +692,30 @@ discard block |
||
| 692 | 692 | $op_size = '500'; |
| 693 | 693 | |
| 694 | 694 | // only make the field as big as it needs to be. |
| 695 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 696 | - $option_values_arr = explode(',',$option_values);
|
|
| 697 | - if(is_array($option_values_arr)){
|
|
| 695 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 696 | + $option_values_arr = explode(',', $option_values);
|
|
| 697 | + if (is_array($option_values_arr)) {
|
|
| 698 | 698 | $op_max = 0; |
| 699 | - foreach($option_values_arr as $op_val){
|
|
| 700 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 699 | + foreach ($option_values_arr as $op_val) {
|
|
| 700 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 701 | 701 | } |
| 702 | - if($op_max){$op_size =$op_max; }
|
|
| 702 | + if ($op_max) {$op_size = $op_max; }
|
|
| 703 | 703 | } |
| 704 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 705 | - if(strlen($option_values)){
|
|
| 706 | - $op_size = strlen($option_values); |
|
| 704 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 705 | + if (strlen($option_values)) {
|
|
| 706 | + $op_size = strlen($option_values); |
|
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 710 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 711 | 711 | |
| 712 | 712 | if ($default_value != '') {
|
| 713 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 713 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | $alter_result = $wpdb->query($meta_field_add); |
| 717 | - if($alter_result===false){
|
|
| 718 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 717 | + if ($alter_result === false) {
|
|
| 718 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | if (isset($request_field['cat_display_type'])) |
@@ -732,9 +732,9 @@ discard block |
||
| 732 | 732 | case 'url': |
| 733 | 733 | case 'file': |
| 734 | 734 | |
| 735 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 736 | - if($alter_result===false){
|
|
| 737 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 735 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 736 | + if ($alter_result === false) {
|
|
| 737 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 738 | 738 | } |
| 739 | 739 | if (isset($request_field['advanced_editor'])) |
| 740 | 740 | $extra_fields = $request_field['advanced_editor']; |
@@ -748,24 +748,24 @@ discard block |
||
| 748 | 748 | default: |
| 749 | 749 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 750 | 750 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 751 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 751 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 752 | 752 | } else {
|
| 753 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 753 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | if (is_numeric($default_value) && $default_value != '') {
|
| 757 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 757 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 758 | 758 | } |
| 759 | 759 | } else {
|
| 760 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 760 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 761 | 761 | if ($default_value != '') {
|
| 762 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 762 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 763 | 763 | } |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | $alter_result = $wpdb->query($default_value_add); |
| 767 | - if($alter_result===false){
|
|
| 768 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 767 | + if ($alter_result === false) {
|
|
| 768 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 769 | 769 | } |
| 770 | 770 | break; |
| 771 | 771 | endswitch; |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | |
| 782 | 782 | $wpdb->prepare( |
| 783 | 783 | |
| 784 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 784 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 785 | 785 | post_type = %s, |
| 786 | 786 | admin_title = %s, |
| 787 | 787 | site_title = %s, |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | for_admin_use = %s |
| 816 | 816 | where id = %d", |
| 817 | 817 | |
| 818 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 818 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf) |
|
| 819 | 819 | ) |
| 820 | 820 | |
| 821 | 821 | ); |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | |
| 826 | 826 | $wpdb->query( |
| 827 | 827 | $wpdb->prepare( |
| 828 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 828 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 829 | 829 | site_title=%s |
| 830 | 830 | where post_type = %s and htmlvar_name = %s", |
| 831 | 831 | array($site_title, $post_type, $htmlvar_name) |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | if ($cat_sort == '') |
| 837 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 837 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 838 | 838 | |
| 839 | 839 | |
| 840 | 840 | /** |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | $data_type = ''; |
| 855 | 855 | |
| 856 | 856 | if ($htmlvar_name != '') {
|
| 857 | - $prefix = $htmlvar_name . '_'; |
|
| 857 | + $prefix = $htmlvar_name.'_'; |
|
| 858 | 858 | } |
| 859 | 859 | $old_prefix = $old_html_variable; |
| 860 | 860 | |
@@ -862,109 +862,109 @@ discard block |
||
| 862 | 862 | |
| 863 | 863 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 864 | 864 | if ($default_value != '') {
|
| 865 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 865 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 868 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 869 | 869 | //$wpdb->query($meta_field_add); |
| 870 | 870 | |
| 871 | 871 | |
| 872 | 872 | if (!empty($extra_fields)) {
|
| 873 | 873 | |
| 874 | 874 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 875 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 876 | 876 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 877 | 877 | if ($default_value != '') {
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 882 | 882 | //$wpdb->query($meta_field_add); |
| 883 | 883 | } |
| 884 | 884 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 885 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 886 | 886 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 887 | 887 | if ($default_value != '') {
|
| 888 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 888 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 891 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 892 | 892 | //$wpdb->query($meta_field_add); |
| 893 | 893 | } |
| 894 | 894 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 895 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 895 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 896 | 896 | |
| 897 | 897 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 898 | 898 | if ($default_value != '') {
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 903 | 903 | //$wpdb->query($meta_field_add); |
| 904 | 904 | } |
| 905 | 905 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 906 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 907 | 907 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 908 | 908 | if ($default_value != '') {
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 913 | 913 | //$wpdb->query($meta_field_add); |
| 914 | 914 | } |
| 915 | 915 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 916 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 916 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 917 | 917 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 918 | 918 | if ($default_value != '') {
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 923 | 923 | //$wpdb->query($meta_field_add); |
| 924 | 924 | |
| 925 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 925 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 926 | 926 | |
| 927 | 927 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 928 | 928 | if ($default_value != '') {
|
| 929 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 929 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 932 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 933 | 933 | |
| 934 | 934 | //$wpdb->query($meta_field_add); |
| 935 | 935 | } |
| 936 | 936 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 937 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 937 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 938 | 938 | |
| 939 | 939 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 940 | 940 | if ($default_value != '') {
|
| 941 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 941 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 944 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 945 | 945 | |
| 946 | 946 | //$wpdb->query($meta_field_add); |
| 947 | 947 | } |
| 948 | 948 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 949 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 949 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 950 | 950 | |
| 951 | 951 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 952 | 952 | if ($default_value != '') {
|
| 953 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 953 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 954 | 954 | } |
| 955 | 955 | |
| 956 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 956 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 957 | 957 | |
| 958 | 958 | //$wpdb->query($meta_field_add); |
| 959 | 959 | } |
| 960 | 960 | // show lat lng |
| 961 | 961 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 962 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 962 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 963 | 963 | |
| 964 | 964 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 965 | 965 | $meta_field_add .= " DEFAULT '1'"; |
| 966 | 966 | |
| 967 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 967 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 968 | 968 | //$wpdb->query($meta_field_add); |
| 969 | 969 | } |
| 970 | 970 | } |
@@ -974,8 +974,8 @@ discard block |
||
| 974 | 974 | case 'checkbox': |
| 975 | 975 | $data_type = 'TINYINT'; |
| 976 | 976 | |
| 977 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 978 | - if ((int)$default_value === 1) {
|
|
| 977 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 978 | + if ((int) $default_value === 1) {
|
|
| 979 | 979 | $meta_field_add .= " DEFAULT '1'"; |
| 980 | 980 | } |
| 981 | 981 | |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | } |
| 1009 | 1009 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 1010 | 1010 | if (strlen($option_values)) {
|
| 1011 | - $op_size = strlen($option_values); |
|
| 1011 | + $op_size = strlen($option_values); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | if (isset($request_field['multi_display_type'])) {
|
@@ -1016,9 +1016,9 @@ discard block |
||
| 1016 | 1016 | } |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1019 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1020 | 1020 | if ($default_value != '') {
|
| 1021 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1021 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1033,9 +1033,9 @@ discard block |
||
| 1033 | 1033 | |
| 1034 | 1034 | $data_type = 'TEXT'; |
| 1035 | 1035 | |
| 1036 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1036 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1037 | 1037 | |
| 1038 | - $meta_field_add = $data_type . " NULL "; |
|
| 1038 | + $meta_field_add = $data_type." NULL "; |
|
| 1039 | 1039 | /*if($default_value != '') |
| 1040 | 1040 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1041 | 1041 | |
@@ -1050,9 +1050,9 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | $data_type = 'DATE'; |
| 1052 | 1052 | |
| 1053 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1053 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1054 | 1054 | |
| 1055 | - $meta_field_add = $data_type . " NULL "; |
|
| 1055 | + $meta_field_add = $data_type." NULL "; |
|
| 1056 | 1056 | |
| 1057 | 1057 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1058 | 1058 | if ($add_result === false) {
|
@@ -1065,9 +1065,9 @@ discard block |
||
| 1065 | 1065 | |
| 1066 | 1066 | $data_type = 'TIME'; |
| 1067 | 1067 | |
| 1068 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1068 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1069 | 1069 | |
| 1070 | - $meta_field_add = $data_type . " NULL "; |
|
| 1070 | + $meta_field_add = $data_type." NULL "; |
|
| 1071 | 1071 | |
| 1072 | 1072 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1073 | 1073 | if ($add_result === false) {
|
@@ -1079,22 +1079,22 @@ discard block |
||
| 1079 | 1079 | default: |
| 1080 | 1080 | |
| 1081 | 1081 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1082 | - $meta_field_add = $data_type . " NULL "; |
|
| 1082 | + $meta_field_add = $data_type." NULL "; |
|
| 1083 | 1083 | |
| 1084 | 1084 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1085 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1085 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | if (is_numeric($default_value) && $default_value != '') {
|
| 1089 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1090 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1089 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1090 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1091 | 1091 | } |
| 1092 | 1092 | } else {
|
| 1093 | 1093 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1094 | 1094 | |
| 1095 | 1095 | if ($default_value != '') {
|
| 1096 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1097 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1096 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1097 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | } |
| 1100 | 1100 | |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | |
| 1117 | 1117 | $wpdb->prepare( |
| 1118 | 1118 | |
| 1119 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1119 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1120 | 1120 | post_type = %s, |
| 1121 | 1121 | admin_title = %s, |
| 1122 | 1122 | site_title = %s, |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | validation_msg = %s, |
| 1150 | 1150 | for_admin_use = %s ", |
| 1151 | 1151 | |
| 1152 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1152 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use) |
|
| 1153 | 1153 | |
| 1154 | 1154 | ) |
| 1155 | 1155 | |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | - return (int)$lastid; |
|
| 1164 | + return (int) $lastid; |
|
| 1165 | 1165 | |
| 1166 | 1166 | |
| 1167 | 1167 | } else {
|
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | |
| 1195 | 1195 | $post_meta_info = $wpdb->query( |
| 1196 | 1196 | $wpdb->prepare( |
| 1197 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1197 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1198 | 1198 | sort_order=%d |
| 1199 | 1199 | where id= %d", |
| 1200 | 1200 | array($count, $cf) |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | global $post; |
| 1217 | 1217 | |
| 1218 | 1218 | if (isset($_REQUEST['post'])) {
|
| 1219 | - $_REQUEST['pid'] = (int)$_REQUEST['post']; |
|
| 1219 | + $_REQUEST['pid'] = (int) $_REQUEST['post']; |
|
| 1220 | 1220 | } |
| 1221 | 1221 | } |
| 1222 | 1222 | |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | * @param mixed $value Custom field value. |
| 1240 | 1240 | * @param array $cf Custom field info. |
| 1241 | 1241 | */ |
| 1242 | - return apply_filters( 'geodir_get_cf_value', $value, $cf ); |
|
| 1242 | + return apply_filters('geodir_get_cf_value', $value, $cf);
|
|
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | /** |
@@ -1265,16 +1265,16 @@ discard block |
||
| 1265 | 1265 | $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
| 1266 | 1266 | |
| 1267 | 1267 | foreach ($custom_fields as $key => $val) {
|
| 1268 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1268 | + if (isset($val['extra_fields'])) {$extra_fields = $val['extra_fields']; }
|
|
| 1269 | 1269 | $val = stripslashes_deep($val); // strip slashes from labels |
| 1270 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1270 | + if (isset($val['extra_fields'])) {$val['extra_fields'] = $extra_fields; }
|
|
| 1271 | 1271 | |
| 1272 | 1272 | $name = $val['name']; |
| 1273 | 1273 | $type = $val['type']; |
| 1274 | 1274 | $is_default = $val['is_default']; |
| 1275 | 1275 | |
| 1276 | 1276 | /* field available to site admin only for edit */ |
| 1277 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1277 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1278 | 1278 | if ($for_admin_use && !is_super_admin()) {
|
| 1279 | 1279 | continue; |
| 1280 | 1280 | } |
@@ -1299,11 +1299,11 @@ discard block |
||
| 1299 | 1299 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1300 | 1300 | * @see 'geodir_after_custom_form_field_$name' |
| 1301 | 1301 | */ |
| 1302 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1302 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1303 | 1303 | |
| 1304 | 1304 | |
| 1305 | 1305 | $custom_field = $val; |
| 1306 | - $html =''; |
|
| 1306 | + $html = ''; |
|
| 1307 | 1307 | /** |
| 1308 | 1308 | * Filter the output for custom fields. |
| 1309 | 1309 | * |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | * @param string $html The html to be filtered (blank). |
| 1313 | 1313 | * @param array $custom_field The custom field array values. |
| 1314 | 1314 | */ |
| 1315 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1315 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1316 | 1316 | |
| 1317 | 1317 | |
| 1318 | 1318 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1328 | 1328 | * @see 'geodir_before_custom_form_field_$name' |
| 1329 | 1329 | */ |
| 1330 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1330 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1331 | 1331 | |
| 1332 | 1332 | } |
| 1333 | 1333 | |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | |
| 1354 | 1354 | $filter = $wpdb->get_row( |
| 1355 | 1355 | $wpdb->prepare( |
| 1356 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1356 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1357 | 1357 | array($geodir_post_type) |
| 1358 | 1358 | ) |
| 1359 | 1359 | ); |
@@ -1368,14 +1368,14 @@ discard block |
||
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | |
| 1371 | -function geodir_field_icon_proccess($cf){
|
|
| 1371 | +function geodir_field_icon_proccess($cf) {
|
|
| 1372 | 1372 | |
| 1373 | 1373 | |
| 1374 | 1374 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1375 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1375 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1376 | 1376 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1377 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1378 | - }else{
|
|
| 1377 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1378 | + } else {
|
|
| 1379 | 1379 | $field_icon = $cf['field_icon']; |
| 1380 | 1380 | } |
| 1381 | 1381 | |
@@ -1420,14 +1420,14 @@ discard block |
||
| 1420 | 1420 | |
| 1421 | 1421 | |
| 1422 | 1422 | foreach ($fields_info as $type) {
|
| 1423 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1423 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
|
|
| 1424 | 1424 | $type = stripslashes_deep($type); // strip slashes |
| 1425 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1425 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
|
|
| 1426 | 1426 | $html = ''; |
| 1427 | 1427 | $field_icon = geodir_field_icon_proccess($type); |
| 1428 | 1428 | $filed_type = $type['type']; |
| 1429 | 1429 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 1430 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1430 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 1431 | 1431 | |
| 1432 | 1432 | /** |
| 1433 | 1433 | * Filter the output for custom fields. |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | * @param string $fields_location The location the field is to be show. |
| 1439 | 1439 | * @param array $type The array of field values. |
| 1440 | 1440 | */ |
| 1441 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1441 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1442 | 1442 | |
| 1443 | 1443 | $variables_array = array(); |
| 1444 | 1444 | |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | * @param string $fields_location The location the fields are being output. |
| 1499 | 1499 | * @since 1.6.9 |
| 1500 | 1500 | */ |
| 1501 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1501 | + return apply_filters('geodir_show_listing_info', $html, $fields_location);
|
|
| 1502 | 1502 | |
| 1503 | 1503 | } |
| 1504 | 1504 | } |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | |
| 1574 | 1574 | $post_type = get_post_type($post_id); |
| 1575 | 1575 | //echo $field_id; exit; |
| 1576 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1576 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1577 | 1577 | |
| 1578 | 1578 | $postcurr_images = array(); |
| 1579 | 1579 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1592,13 +1592,13 @@ discard block |
||
| 1592 | 1592 | $geodir_uploadurl = $uploads['url']; |
| 1593 | 1593 | $sub_dir = $uploads['subdir']; |
| 1594 | 1594 | |
| 1595 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1595 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
|
|
| 1596 | 1596 | |
| 1597 | 1597 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1598 | 1598 | |
| 1599 | 1599 | /* --------- start ------- */ |
| 1600 | 1600 | |
| 1601 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1601 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1602 | 1602 | |
| 1603 | 1603 | |
| 1604 | 1604 | $curr_img_url = $post_image[$m]; |
@@ -1624,24 +1624,24 @@ discard block |
||
| 1624 | 1624 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 1625 | 1625 | |
| 1626 | 1626 | if (!function_exists('wp_handle_upload'))
|
| 1627 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1627 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1628 | 1628 | |
| 1629 | 1629 | if (!is_dir($geodir_uploadpath)) |
| 1630 | 1630 | mkdir($geodir_uploadpath); |
| 1631 | 1631 | |
| 1632 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1632 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1633 | 1633 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1634 | 1634 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1635 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1636 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1635 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1636 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1637 | 1637 | } else {
|
| 1638 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1639 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1638 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1639 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | $uploaded_file = ''; |
| 1643 | 1643 | if (file_exists($img_path)) |
| 1644 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1644 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1645 | 1645 | |
| 1646 | 1646 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1647 | 1647 | if (file_exists($img_path)) |
@@ -1649,7 +1649,7 @@ discard block |
||
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | 1651 | if (!empty($uploaded_file)) |
| 1652 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1652 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1653 | 1653 | |
| 1654 | 1654 | } else {
|
| 1655 | 1655 | $file_urls = $post_image[$m]; |
@@ -1663,8 +1663,8 @@ discard block |
||
| 1663 | 1663 | if (!empty($postcurr_images)) {
|
| 1664 | 1664 | |
| 1665 | 1665 | if ($file_urls != $postcurr_images) {
|
| 1666 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1667 | - $invalid_files = (object)$invalid_files; |
|
| 1666 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1667 | + $invalid_files = (object) $invalid_files; |
|
| 1668 | 1668 | } |
| 1669 | 1669 | } |
| 1670 | 1670 | |
@@ -1716,9 +1716,9 @@ discard block |
||
| 1716 | 1716 | function geodir_upload_dir($upload) |
| 1717 | 1717 | {
|
| 1718 | 1718 | global $current_user; |
| 1719 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1720 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1721 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1719 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1720 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1721 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1722 | 1722 | return $upload; |
| 1723 | 1723 | } |
| 1724 | 1724 | |
@@ -1733,20 +1733,20 @@ discard block |
||
| 1733 | 1733 | // check ajax nonce |
| 1734 | 1734 | $imgid = $_POST["imgid"]; |
| 1735 | 1735 | |
| 1736 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1736 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1737 | 1737 | |
| 1738 | 1738 | // handle custom file uploaddir |
| 1739 | 1739 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1740 | 1740 | |
| 1741 | 1741 | // change file orientation if needed |
| 1742 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1742 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1743 | 1743 | |
| 1744 | 1744 | // handle file upload |
| 1745 | 1745 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1746 | 1746 | // remove handle custom file uploaddir |
| 1747 | 1747 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1748 | 1748 | |
| 1749 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1749 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1750 | 1750 | print_r($status); |
| 1751 | 1751 | } |
| 1752 | 1752 | |
@@ -1776,9 +1776,9 @@ discard block |
||
| 1776 | 1776 | |
| 1777 | 1777 | $post_type = get_post_type($post_id); |
| 1778 | 1778 | |
| 1779 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1779 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1780 | 1780 | |
| 1781 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1781 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1782 | 1782 | |
| 1783 | 1783 | if ($results) {
|
| 1784 | 1784 | return $results[0]->geodir_video; |
@@ -1802,9 +1802,9 @@ discard block |
||
| 1802 | 1802 | |
| 1803 | 1803 | $post_type = get_post_type($post_id); |
| 1804 | 1804 | |
| 1805 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1805 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1806 | 1806 | |
| 1807 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1807 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1808 | 1808 | |
| 1809 | 1809 | if ($results) {
|
| 1810 | 1810 | return $results[0]->geodir_special_offers; |
@@ -1822,12 +1822,12 @@ discard block |
||
| 1822 | 1822 | */ |
| 1823 | 1823 | function geodir_max_upload_size() |
| 1824 | 1824 | {
|
| 1825 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1825 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1826 | 1826 | |
| 1827 | 1827 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1828 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1828 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1829 | 1829 | } else {
|
| 1830 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1830 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1833 | 1833 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1859,7 +1859,7 @@ discard block |
||
| 1859 | 1859 | |
| 1860 | 1860 | $custom_fields = $wpdb->get_results( |
| 1861 | 1861 | $wpdb->prepare( |
| 1862 | - "select post_type,data_type,field_type,site_title,admin_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1862 | + "select post_type,data_type,field_type,site_title,admin_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1863 | 1863 | array($post_type) |
| 1864 | 1864 | ), 'ARRAY_A' |
| 1865 | 1865 | ); |
@@ -1986,7 +1986,7 @@ discard block |
||
| 1986 | 1986 | |
| 1987 | 1987 | $post_meta_info = $wpdb->query( |
| 1988 | 1988 | $wpdb->prepare( |
| 1989 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1989 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1990 | 1990 | sort_order=%d |
| 1991 | 1991 | where id= %d", |
| 1992 | 1992 | array($count, $cf) |
@@ -2068,14 +2068,14 @@ discard block |
||
| 2068 | 2068 | |
| 2069 | 2069 | $check_html_variable = $wpdb->get_var( |
| 2070 | 2070 | $wpdb->prepare( |
| 2071 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2071 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2072 | 2072 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2073 | 2073 | ) |
| 2074 | 2074 | ); |
| 2075 | 2075 | |
| 2076 | 2076 | if ($is_default == 1) {
|
| 2077 | 2077 | |
| 2078 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2078 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2079 | 2079 | |
| 2080 | 2080 | } |
| 2081 | 2081 | |
@@ -2086,7 +2086,7 @@ discard block |
||
| 2086 | 2086 | |
| 2087 | 2087 | $wpdb->prepare( |
| 2088 | 2088 | |
| 2089 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2089 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2090 | 2090 | post_type = %s, |
| 2091 | 2091 | data_type = %s, |
| 2092 | 2092 | field_type = %s, |
@@ -2117,7 +2117,7 @@ discard block |
||
| 2117 | 2117 | |
| 2118 | 2118 | $wpdb->prepare( |
| 2119 | 2119 | |
| 2120 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2120 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2121 | 2121 | post_type = %s, |
| 2122 | 2122 | data_type = %s, |
| 2123 | 2123 | field_type = %s, |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | } |
| 2144 | 2144 | |
| 2145 | 2145 | |
| 2146 | - return (int)$lastid; |
|
| 2146 | + return (int) $lastid; |
|
| 2147 | 2147 | |
| 2148 | 2148 | } |
| 2149 | 2149 | } |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | if ($field_id != '') {
|
| 2167 | 2167 | $cf = trim($field_id, '_'); |
| 2168 | 2168 | |
| 2169 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2169 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2170 | 2170 | |
| 2171 | 2171 | return $field_id; |
| 2172 | 2172 | |
@@ -2189,12 +2189,12 @@ discard block |
||
| 2189 | 2189 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2190 | 2190 | * @param bool $default when set to true field will be for admin use only. |
| 2191 | 2191 | */ |
| 2192 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2192 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 2193 | 2193 | {
|
| 2194 | 2194 | global $wpdb; |
| 2195 | 2195 | $cf = $result_str; |
| 2196 | 2196 | if (!is_object($cf)) {
|
| 2197 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2197 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2198 | 2198 | } else {
|
| 2199 | 2199 | $field_info = $cf; |
| 2200 | 2200 | $result_str = $cf->id; |
@@ -2230,18 +2230,18 @@ discard block |
||
| 2230 | 2230 | if ($htmlvar_name == '') |
| 2231 | 2231 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2232 | 2232 | |
| 2233 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2233 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2234 | 2234 | |
| 2235 | 2235 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 2236 | 2236 | $cso_arr = geodir_get_custom_sort_options($post_type); |
| 2237 | 2237 | |
| 2238 | 2238 | $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
| 2239 | - foreach($cso_arr as $cso){
|
|
| 2240 | - if($cur_field_type==$cso['field_type']){
|
|
| 2239 | + foreach ($cso_arr as $cso) {
|
|
| 2240 | + if ($cur_field_type == $cso['field_type']) {
|
|
| 2241 | 2241 | |
| 2242 | 2242 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2243 | 2243 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2244 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2244 | + }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
|
|
| 2245 | 2245 | $field_icon = '<b class="gd-cf-icon" style="background-image: url(\''.$cso['field_icon'].'\')"></b>'; |
| 2246 | 2246 | } |
| 2247 | 2247 | |
@@ -2251,40 +2251,40 @@ discard block |
||
| 2251 | 2251 | $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
| 2252 | 2252 | ?> |
| 2253 | 2253 | |
| 2254 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2254 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2255 | 2255 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
| 2256 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2257 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2258 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2256 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2257 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2258 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2259 | 2259 | <?php |
| 2260 | 2260 | |
| 2261 | 2261 | ?> |
| 2262 | 2262 | |
| 2263 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2264 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2263 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2264 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2265 | 2265 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 2266 | 2266 | |
| 2267 | 2267 | |
| 2268 | - <?php echo $field_icon;?> |
|
| 2268 | + <?php echo $field_icon; ?> |
|
| 2269 | 2269 | <b style="cursor:pointer;" |
| 2270 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2270 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2271 | 2271 | |
| 2272 | 2272 | </div> |
| 2273 | 2273 | |
| 2274 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2274 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2275 | 2275 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2276 | 2276 | echo 'block;'; |
| 2277 | 2277 | } else {
|
| 2278 | 2278 | echo 'none;'; |
| 2279 | 2279 | } ?>"> |
| 2280 | 2280 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2281 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2282 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2283 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2281 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2282 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2283 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2284 | 2284 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2285 | 2285 | echo $field_info->data_type; |
| 2286 | 2286 | }?>"/> |
| 2287 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2287 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2288 | 2288 | |
| 2289 | 2289 | |
| 2290 | 2290 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2294,7 +2294,7 @@ discard block |
||
| 2294 | 2294 | <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/> |
| 2295 | 2295 | |
| 2296 | 2296 | <li> |
| 2297 | - <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?> |
|
| 2297 | + <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?> |
|
| 2298 | 2298 | |
| 2299 | 2299 | <label for="asc" class="gd-cf-tooltip-wrap"> |
| 2300 | 2300 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
|
@@ -2304,24 +2304,24 @@ discard block |
||
| 2304 | 2304 | </label> |
| 2305 | 2305 | <div class="gd-cf-input-wrap gd-switch"> |
| 2306 | 2306 | |
| 2307 | - <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
|
| 2307 | + <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled" value="1" |
|
| 2308 | 2308 | <?php if ($value == '1') {
|
| 2309 | 2309 | echo 'checked'; |
| 2310 | 2310 | } ?>/> |
| 2311 | - <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2311 | + <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2312 | 2312 | |
| 2313 | - <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
|
| 2313 | + <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0" |
|
| 2314 | 2314 | <?php if ($value == '0' || !$value) {
|
| 2315 | 2315 | echo 'checked'; |
| 2316 | 2316 | } ?>/> |
| 2317 | - <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2317 | + <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2318 | 2318 | |
| 2319 | 2319 | </div> |
| 2320 | 2320 | |
| 2321 | 2321 | </li> |
| 2322 | 2322 | |
| 2323 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2324 | - <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?> |
|
| 2323 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2324 | + <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?> |
|
| 2325 | 2325 | |
| 2326 | 2326 | <label for="asc_title" class="gd-cf-tooltip-wrap"> |
| 2327 | 2327 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
|
@@ -2331,14 +2331,14 @@ discard block |
||
| 2331 | 2331 | </label> |
| 2332 | 2332 | <div class="gd-cf-input-wrap"> |
| 2333 | 2333 | |
| 2334 | - <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" /> |
|
| 2334 | + <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" /> |
|
| 2335 | 2335 | </div> |
| 2336 | 2336 | |
| 2337 | 2337 | |
| 2338 | 2338 | </li> |
| 2339 | 2339 | |
| 2340 | 2340 | |
| 2341 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2341 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2342 | 2342 | |
| 2343 | 2343 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2344 | 2344 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2349,7 +2349,7 @@ discard block |
||
| 2349 | 2349 | <div class="gd-cf-input-wrap"> |
| 2350 | 2350 | |
| 2351 | 2351 | <input type="radio" name="is_default" |
| 2352 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2352 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2353 | 2353 | echo 'checked="checked"'; |
| 2354 | 2354 | } ?>/> |
| 2355 | 2355 | </div> |
@@ -2359,7 +2359,7 @@ discard block |
||
| 2359 | 2359 | |
| 2360 | 2360 | |
| 2361 | 2361 | <li> |
| 2362 | - <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?> |
|
| 2362 | + <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?> |
|
| 2363 | 2363 | |
| 2364 | 2364 | <label for="desc" class="gd-cf-tooltip-wrap"> |
| 2365 | 2365 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
|
@@ -2369,24 +2369,24 @@ discard block |
||
| 2369 | 2369 | </label> |
| 2370 | 2370 | <div class="gd-cf-input-wrap gd-switch"> |
| 2371 | 2371 | |
| 2372 | - <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
|
| 2372 | + <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled" value="1" |
|
| 2373 | 2373 | <?php if ($value == '1') {
|
| 2374 | 2374 | echo 'checked'; |
| 2375 | 2375 | } ?>/> |
| 2376 | - <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2376 | + <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2377 | 2377 | |
| 2378 | - <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
|
| 2378 | + <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0" |
|
| 2379 | 2379 | <?php if ($value == '0' || !$value) {
|
| 2380 | 2380 | echo 'checked'; |
| 2381 | 2381 | } ?>/> |
| 2382 | - <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2382 | + <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2383 | 2383 | |
| 2384 | 2384 | </div> |
| 2385 | 2385 | |
| 2386 | 2386 | </li> |
| 2387 | 2387 | |
| 2388 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2389 | - <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?> |
|
| 2388 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2389 | + <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?> |
|
| 2390 | 2390 | |
| 2391 | 2391 | <label for="desc_title" class="gd-cf-tooltip-wrap"> |
| 2392 | 2392 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
|
@@ -2396,13 +2396,13 @@ discard block |
||
| 2396 | 2396 | </label> |
| 2397 | 2397 | <div class="gd-cf-input-wrap"> |
| 2398 | 2398 | |
| 2399 | - <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" /> |
|
| 2399 | + <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" /> |
|
| 2400 | 2400 | </div> |
| 2401 | 2401 | |
| 2402 | 2402 | |
| 2403 | 2403 | </li> |
| 2404 | 2404 | |
| 2405 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2405 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2406 | 2406 | |
| 2407 | 2407 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2408 | 2408 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | <div class="gd-cf-input-wrap"> |
| 2414 | 2414 | |
| 2415 | 2415 | <input type="radio" name="is_default" |
| 2416 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2416 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2417 | 2417 | echo 'checked="checked"'; |
| 2418 | 2418 | } ?>/> |
| 2419 | 2419 | </div> |
@@ -2438,14 +2438,14 @@ discard block |
||
| 2438 | 2438 | </label> |
| 2439 | 2439 | <div class="gd-cf-input-wrap"> |
| 2440 | 2440 | |
| 2441 | - <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" /> |
|
| 2441 | + <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" /> |
|
| 2442 | 2442 | </div> |
| 2443 | 2443 | |
| 2444 | 2444 | |
| 2445 | 2445 | </li> |
| 2446 | 2446 | |
| 2447 | 2447 | <li> |
| 2448 | - <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?> |
|
| 2448 | + <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?> |
|
| 2449 | 2449 | |
| 2450 | 2450 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2451 | 2451 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2469,7 +2469,7 @@ discard block |
||
| 2469 | 2469 | |
| 2470 | 2470 | |
| 2471 | 2471 | <li> |
| 2472 | - <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?> |
|
| 2472 | + <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?> |
|
| 2473 | 2473 | |
| 2474 | 2474 | <label for="is_active" class="gd-cf-tooltip-wrap"> |
| 2475 | 2475 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
|
@@ -2479,17 +2479,17 @@ discard block |
||
| 2479 | 2479 | </label> |
| 2480 | 2480 | <div class="gd-cf-input-wrap gd-switch"> |
| 2481 | 2481 | |
| 2482 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2482 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2483 | 2483 | <?php if ($value == '1') {
|
| 2484 | 2484 | echo 'checked'; |
| 2485 | 2485 | } ?>/> |
| 2486 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2486 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2487 | 2487 | |
| 2488 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2488 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2489 | 2489 | <?php if ($value == '0' || !$value) {
|
| 2490 | 2490 | echo 'checked'; |
| 2491 | 2491 | } ?>/> |
| 2492 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2492 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2493 | 2493 | |
| 2494 | 2494 | </div> |
| 2495 | 2495 | |
@@ -2510,10 +2510,10 @@ discard block |
||
| 2510 | 2510 | <h3></h3> |
| 2511 | 2511 | </label> |
| 2512 | 2512 | <div class="gd-cf-input-wrap"> |
| 2513 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 2513 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 2514 | 2514 | onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 2515 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 2516 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2515 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 2516 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2517 | 2517 | class="button"/></a> |
| 2518 | 2518 | </div> |
| 2519 | 2519 | </li> |
@@ -2548,7 +2548,7 @@ discard block |
||
| 2548 | 2548 | if (!$package_id || !$field_name || !$post_type) {
|
| 2549 | 2549 | return true; |
| 2550 | 2550 | } |
| 2551 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2551 | + $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
|
|
| 2552 | 2552 | |
| 2553 | 2553 | if ($wpdb->get_var($sql)) {
|
| 2554 | 2554 | return true; |
@@ -2671,13 +2671,13 @@ discard block |
||
| 2671 | 2671 | } |
| 2672 | 2672 | |
| 2673 | 2673 | |
| 2674 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2674 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2675 | 2675 | ob_start(); |
| 2676 | 2676 | |
| 2677 | 2677 | $dt_value = ''; |
| 2678 | 2678 | if (isset($field_info->data_type)) {
|
| 2679 | 2679 | $dt_value = esc_attr($field_info->data_type); |
| 2680 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2680 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 2681 | 2681 | $dt_value = $cf['defaults']['data_type']; |
| 2682 | 2682 | } |
| 2683 | 2683 | ?> |
@@ -2688,15 +2688,15 @@ discard block |
||
| 2688 | 2688 | <select name="data_type" id="data_type" |
| 2689 | 2689 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2690 | 2690 | <option |
| 2691 | - value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2691 | + value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2692 | 2692 | echo 'selected="selected"'; |
| 2693 | 2693 | } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
| 2694 | 2694 | <option |
| 2695 | - value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2695 | + value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2696 | 2696 | echo 'selected="selected"'; |
| 2697 | 2697 | } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
| 2698 | 2698 | <option |
| 2699 | - value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2699 | + value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2700 | 2700 | echo 'selected="selected"'; |
| 2701 | 2701 | } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
| 2702 | 2702 | </select> |
@@ -2709,13 +2709,13 @@ discard block |
||
| 2709 | 2709 | $value = ''; |
| 2710 | 2710 | if (isset($field_info->decimal_point)) {
|
| 2711 | 2711 | $value = esc_attr($field_info->decimal_point); |
| 2712 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2712 | + }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
|
|
| 2713 | 2713 | $value = $cf['defaults']['decimal_point']; |
| 2714 | 2714 | } |
| 2715 | 2715 | ?> |
| 2716 | 2716 | |
| 2717 | 2717 | <li class="decimal-point-wrapper" |
| 2718 | - style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2718 | + style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2719 | 2719 | <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
|
| 2720 | 2720 | <div class="gd-cf-input-wrap"> |
| 2721 | 2721 | <select name="decimal_point" id="decimal_point"> |
@@ -2733,41 +2733,41 @@ discard block |
||
| 2733 | 2733 | $output = ob_get_clean(); |
| 2734 | 2734 | return $output; |
| 2735 | 2735 | } |
| 2736 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2736 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2737 | 2737 | |
| 2738 | 2738 | // htmlvar not needed for fieldset and taxonomy |
| 2739 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2740 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2739 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2740 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2741 | 2741 | |
| 2742 | 2742 | |
| 2743 | 2743 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2744 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2745 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2746 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2747 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2744 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2745 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2746 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2747 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2748 | 2748 | |
| 2749 | 2749 | // is_required not needed for fieldset |
| 2750 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2751 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2750 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2751 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2752 | 2752 | |
| 2753 | 2753 | // field_icon not needed for fieldset |
| 2754 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2755 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2754 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2755 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2756 | 2756 | |
| 2757 | 2757 | // cat_sort not needed for some fields |
| 2758 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2759 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2760 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2761 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2762 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2763 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2764 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2765 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2758 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2759 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2760 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2761 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2762 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2763 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2764 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2765 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2766 | 2766 | |
| 2767 | 2767 | |
| 2768 | 2768 | |
| 2769 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2770 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2769 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2770 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2771 | 2771 | ob_start(); |
| 2772 | 2772 | ?> |
| 2773 | 2773 | <li> |
@@ -2798,16 +2798,16 @@ discard block |
||
| 2798 | 2798 | $output = ob_get_clean(); |
| 2799 | 2799 | return $output; |
| 2800 | 2800 | } |
| 2801 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2801 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2802 | 2802 | |
| 2803 | 2803 | |
| 2804 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2804 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2805 | 2805 | ob_start(); |
| 2806 | 2806 | |
| 2807 | 2807 | $value = ''; |
| 2808 | 2808 | if (isset($field_info->validation_pattern)) {
|
| 2809 | 2809 | $value = esc_attr($field_info->validation_pattern); |
| 2810 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2810 | + }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
|
|
| 2811 | 2811 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2812 | 2812 | } |
| 2813 | 2813 | ?> |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | $value = ''; |
| 2828 | 2828 | if (isset($field_info->validation_msg)) {
|
| 2829 | 2829 | $value = esc_attr($field_info->validation_msg); |
| 2830 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2830 | + }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
|
|
| 2831 | 2831 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2832 | 2832 | } |
| 2833 | 2833 | ?> |
@@ -2848,10 +2848,10 @@ discard block |
||
| 2848 | 2848 | $output = ob_get_clean(); |
| 2849 | 2849 | return $output; |
| 2850 | 2850 | } |
| 2851 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2851 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2852 | 2852 | |
| 2853 | 2853 | |
| 2854 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2854 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2855 | 2855 | ob_start(); |
| 2856 | 2856 | global $post_type; |
| 2857 | 2857 | |
@@ -2876,7 +2876,7 @@ discard block |
||
| 2876 | 2876 | ?> |
| 2877 | 2877 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2878 | 2878 | echo 'selected="selected"'; |
| 2879 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2879 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2880 | 2880 | } |
| 2881 | 2881 | ?> |
| 2882 | 2882 | </select> |
@@ -2887,7 +2887,7 @@ discard block |
||
| 2887 | 2887 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2888 | 2888 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2889 | 2889 | <div class="gdcf-tooltip"> |
| 2890 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2890 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2891 | 2891 | </div> |
| 2892 | 2892 | </label> |
| 2893 | 2893 | <div class="gd-cf-input-wrap"> |
@@ -2895,19 +2895,19 @@ discard block |
||
| 2895 | 2895 | <select name="cat_display_type" id="cat_display_type"> |
| 2896 | 2896 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2897 | 2897 | echo 'selected="selected"'; |
| 2898 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2898 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2899 | 2899 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2900 | 2900 | echo 'selected="selected"'; |
| 2901 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2901 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2902 | 2902 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2903 | 2903 | echo 'selected="selected"'; |
| 2904 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2904 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2905 | 2905 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2906 | 2906 | echo 'selected="selected"'; |
| 2907 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2907 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2908 | 2908 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2909 | 2909 | echo 'selected="selected"'; |
| 2910 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2910 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2911 | 2911 | </select> |
| 2912 | 2912 | </div> |
| 2913 | 2913 | </li> |
@@ -2916,10 +2916,10 @@ discard block |
||
| 2916 | 2916 | $output = ob_get_clean(); |
| 2917 | 2917 | return $output; |
| 2918 | 2918 | } |
| 2919 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2919 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2920 | 2920 | |
| 2921 | 2921 | |
| 2922 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2922 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2923 | 2923 | |
| 2924 | 2924 | ob_start(); |
| 2925 | 2925 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2942,32 +2942,32 @@ discard block |
||
| 2942 | 2942 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2943 | 2943 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2944 | 2944 | <div class="gdcf-tooltip"> |
| 2945 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2945 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2946 | 2946 | </div> |
| 2947 | 2947 | </label> |
| 2948 | 2948 | <div class="gd-cf-input-wrap gd-switch"> |
| 2949 | 2949 | |
| 2950 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2950 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2951 | 2951 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2952 | 2952 | echo 'checked'; |
| 2953 | 2953 | } ?>/> |
| 2954 | - <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2954 | + <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2955 | 2955 | |
| 2956 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2956 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2957 | 2957 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2958 | 2958 | echo 'checked'; |
| 2959 | 2959 | } ?>/> |
| 2960 | - <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2960 | + <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2961 | 2961 | |
| 2962 | 2962 | |
| 2963 | 2963 | </div> |
| 2964 | 2964 | </li> |
| 2965 | 2965 | |
| 2966 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2966 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2967 | 2967 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2968 | 2968 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2969 | 2969 | <div class="gdcf-tooltip"> |
| 2970 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2970 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2971 | 2971 | </div> |
| 2972 | 2972 | </label> |
| 2973 | 2973 | <div class="gd-cf-input-wrap"> |
@@ -2985,7 +2985,7 @@ discard block |
||
| 2985 | 2985 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2986 | 2986 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2987 | 2987 | <div class="gdcf-tooltip"> |
| 2988 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2988 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2989 | 2989 | </div> |
| 2990 | 2990 | </label> |
| 2991 | 2991 | <div class="gd-cf-input-wrap"> |
@@ -3000,22 +3000,22 @@ discard block |
||
| 3000 | 3000 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 3001 | 3001 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 3002 | 3002 | <div class="gdcf-tooltip"> |
| 3003 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 3003 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 3004 | 3004 | </div> |
| 3005 | 3005 | </label> |
| 3006 | 3006 | <div class="gd-cf-input-wrap gd-switch"> |
| 3007 | 3007 | |
| 3008 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 3008 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 3009 | 3009 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 3010 | 3010 | echo 'checked'; |
| 3011 | 3011 | } ?>/> |
| 3012 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3012 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3013 | 3013 | |
| 3014 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 3014 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 3015 | 3015 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 3016 | 3016 | echo 'checked'; |
| 3017 | 3017 | } ?>/> |
| 3018 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3018 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3019 | 3019 | |
| 3020 | 3020 | </div> |
| 3021 | 3021 | </li> |
@@ -3024,22 +3024,22 @@ discard block |
||
| 3024 | 3024 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 3025 | 3025 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 3026 | 3026 | <div class="gdcf-tooltip"> |
| 3027 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 3027 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 3028 | 3028 | </div> |
| 3029 | 3029 | </label> |
| 3030 | 3030 | <div class="gd-cf-input-wrap gd-switch"> |
| 3031 | 3031 | |
| 3032 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3032 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3033 | 3033 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3034 | 3034 | echo 'checked'; |
| 3035 | 3035 | } ?>/> |
| 3036 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3036 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3037 | 3037 | |
| 3038 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3038 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3039 | 3039 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3040 | 3040 | echo 'checked'; |
| 3041 | 3041 | } ?>/> |
| 3042 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3042 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3043 | 3043 | |
| 3044 | 3044 | </div> |
| 3045 | 3045 | </li> |
@@ -3049,7 +3049,7 @@ discard block |
||
| 3049 | 3049 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 3050 | 3050 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 3051 | 3051 | <div class="gdcf-tooltip"> |
| 3052 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 3052 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 3053 | 3053 | </div> |
| 3054 | 3054 | </label> |
| 3055 | 3055 | <div class="gd-cf-input-wrap"> |
@@ -3063,22 +3063,22 @@ discard block |
||
| 3063 | 3063 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 3064 | 3064 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 3065 | 3065 | <div class="gdcf-tooltip"> |
| 3066 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 3066 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 3067 | 3067 | </div> |
| 3068 | 3068 | </label> |
| 3069 | 3069 | <div class="gd-cf-input-wrap gd-switch"> |
| 3070 | 3070 | |
| 3071 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3071 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3072 | 3072 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3073 | 3073 | echo 'checked'; |
| 3074 | 3074 | } ?>/> |
| 3075 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3075 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3076 | 3076 | |
| 3077 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3077 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3078 | 3078 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3079 | 3079 | echo 'checked'; |
| 3080 | 3080 | } ?>/> |
| 3081 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3081 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3082 | 3082 | |
| 3083 | 3083 | </div> |
| 3084 | 3084 | </li> |
@@ -3087,17 +3087,17 @@ discard block |
||
| 3087 | 3087 | $html = ob_get_clean(); |
| 3088 | 3088 | return $output.$html; |
| 3089 | 3089 | } |
| 3090 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 3090 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 3091 | 3091 | |
| 3092 | 3092 | |
| 3093 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 3093 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 3094 | 3094 | ob_start(); |
| 3095 | 3095 | ?> |
| 3096 | 3096 | <li> |
| 3097 | 3097 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3098 | 3098 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 3099 | 3099 | <div class="gdcf-tooltip"> |
| 3100 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 3100 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 3101 | 3101 | </div> |
| 3102 | 3102 | </label> |
| 3103 | 3103 | <div class="gd-cf-input-wrap"> |
@@ -3105,13 +3105,13 @@ discard block |
||
| 3105 | 3105 | <select name="multi_display_type" id="multi_display_type"> |
| 3106 | 3106 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3107 | 3107 | echo 'selected="selected"'; |
| 3108 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3108 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 3109 | 3109 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3110 | 3110 | echo 'selected="selected"'; |
| 3111 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3111 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 3112 | 3112 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3113 | 3113 | echo 'selected="selected"'; |
| 3114 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3114 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 3115 | 3115 | </select> |
| 3116 | 3116 | |
| 3117 | 3117 | <br/> |
@@ -3122,17 +3122,17 @@ discard block |
||
| 3122 | 3122 | $html = ob_get_clean(); |
| 3123 | 3123 | return $output.$html; |
| 3124 | 3124 | } |
| 3125 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 3125 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 3126 | 3126 | |
| 3127 | 3127 | |
| 3128 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 3128 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 3129 | 3129 | |
| 3130 | 3130 | ob_start(); |
| 3131 | 3131 | |
| 3132 | 3132 | $value = ''; |
| 3133 | 3133 | if (isset($field_info->option_values)) {
|
| 3134 | 3134 | $value = esc_attr($field_info->option_values); |
| 3135 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3135 | + }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
|
|
| 3136 | 3136 | $value = esc_attr($cf['defaults']['option_values']); |
| 3137 | 3137 | } |
| 3138 | 3138 | |
@@ -3142,11 +3142,11 @@ discard block |
||
| 3142 | 3142 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3143 | 3143 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 3144 | 3144 | <div class="gdcf-tooltip"> |
| 3145 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 3145 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 3146 | 3146 | <br/> |
| 3147 | - <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
|
|
| 3147 | + <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
|
|
| 3148 | 3148 | <br/> |
| 3149 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 3149 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 3150 | 3150 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 3151 | 3151 | <br/> |
| 3152 | 3152 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -3157,7 +3157,7 @@ discard block |
||
| 3157 | 3157 | </label> |
| 3158 | 3158 | <div class="gd-cf-input-wrap"> |
| 3159 | 3159 | <input type="text" name="option_values" id="option_values" |
| 3160 | - value="<?php echo $value;?>"/> |
|
| 3160 | + value="<?php echo $value; ?>"/> |
|
| 3161 | 3161 | <br/> |
| 3162 | 3162 | |
| 3163 | 3163 | </div> |
@@ -3167,12 +3167,12 @@ discard block |
||
| 3167 | 3167 | $html = ob_get_clean(); |
| 3168 | 3168 | return $output.$html; |
| 3169 | 3169 | } |
| 3170 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3171 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3172 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3170 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3171 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3172 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3173 | 3173 | |
| 3174 | 3174 | |
| 3175 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 3175 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 3176 | 3176 | ob_start(); |
| 3177 | 3177 | $extra = array(); |
| 3178 | 3178 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -3183,7 +3183,7 @@ discard block |
||
| 3183 | 3183 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3184 | 3184 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 3185 | 3185 | <div class="gdcf-tooltip"> |
| 3186 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 3186 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 3187 | 3187 | </div> |
| 3188 | 3188 | </label> |
| 3189 | 3189 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -3203,16 +3203,16 @@ discard block |
||
| 3203 | 3203 | * @since 1.6.5 |
| 3204 | 3204 | * @param array $date_formats The PHP date format array. |
| 3205 | 3205 | */ |
| 3206 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3206 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 3207 | 3207 | ?> |
| 3208 | 3208 | <select name="extra[date_format]" id="date_format"> |
| 3209 | 3209 | <?php |
| 3210 | - foreach($date_formats as $format){
|
|
| 3210 | + foreach ($date_formats as $format) {
|
|
| 3211 | 3211 | $selected = ''; |
| 3212 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3212 | + if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
|
|
| 3213 | 3213 | $selected = "selected='selected'"; |
| 3214 | 3214 | } |
| 3215 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3215 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3216 | 3216 | } |
| 3217 | 3217 | ?> |
| 3218 | 3218 | </select> |
@@ -3224,10 +3224,10 @@ discard block |
||
| 3224 | 3224 | $html = ob_get_clean(); |
| 3225 | 3225 | return $output.$html; |
| 3226 | 3226 | } |
| 3227 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3227 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3228 | 3228 | |
| 3229 | 3229 | |
| 3230 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3230 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3231 | 3231 | ob_start(); |
| 3232 | 3232 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3233 | 3233 | |
@@ -3238,16 +3238,16 @@ discard block |
||
| 3238 | 3238 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3239 | 3239 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3240 | 3240 | <div class="gdcf-tooltip"> |
| 3241 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3241 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3242 | 3242 | </div> |
| 3243 | 3243 | </label> |
| 3244 | 3244 | <div class="gd-cf-input-wrap"> |
| 3245 | 3245 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3246 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3247 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3248 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3249 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3250 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3246 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3247 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3248 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3249 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3250 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3251 | 3251 | <?php } ?> |
| 3252 | 3252 | </optgroup> |
| 3253 | 3253 | <?php } ?> |
@@ -3259,9 +3259,9 @@ discard block |
||
| 3259 | 3259 | $html = ob_get_clean(); |
| 3260 | 3260 | return $output.$html; |
| 3261 | 3261 | } |
| 3262 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
|
| 3262 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
|
|
| 3263 | 3263 | |
| 3264 | -function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
|
| 3264 | +function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
|
|
| 3265 | 3265 | ob_start(); |
| 3266 | 3266 | |
| 3267 | 3267 | $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
@@ -3275,15 +3275,15 @@ discard block |
||
| 3275 | 3275 | $value = ''; |
| 3276 | 3276 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3277 | 3277 | $value = esc_attr($extra_fields['is_price']); |
| 3278 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3278 | + }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
|
|
| 3279 | 3279 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3280 | 3280 | } |
| 3281 | 3281 | |
| 3282 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3282 | + $show_price_extra = ($value == 1) ? 1 : 0; |
|
| 3283 | 3283 | |
| 3284 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3284 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0; |
|
| 3285 | 3285 | ?> |
| 3286 | - <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
|
| 3286 | + <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
|
|
| 3287 | 3287 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3288 | 3288 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
| 3289 | 3289 | <div class="gdcf-tooltip"> |
@@ -3292,17 +3292,17 @@ discard block |
||
| 3292 | 3292 | </label> |
| 3293 | 3293 | <div class="gd-cf-input-wrap gd-switch"> |
| 3294 | 3294 | |
| 3295 | - <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3295 | + <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3296 | 3296 | <?php if ($value == '1') {
|
| 3297 | 3297 | echo 'checked'; |
| 3298 | 3298 | } ?>/> |
| 3299 | - <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3299 | + <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3300 | 3300 | |
| 3301 | - <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3301 | + <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3302 | 3302 | <?php if ($value == '0' || !$value) {
|
| 3303 | 3303 | echo 'checked'; |
| 3304 | 3304 | } ?>/> |
| 3305 | - <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3305 | + <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3306 | 3306 | |
| 3307 | 3307 | </div> |
| 3308 | 3308 | </li> |
@@ -3312,23 +3312,23 @@ discard block |
||
| 3312 | 3312 | $value = ''; |
| 3313 | 3313 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3314 | 3314 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3315 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3315 | + }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
|
|
| 3316 | 3316 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3317 | 3317 | } |
| 3318 | 3318 | ?> |
| 3319 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3320 | - <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
|
| 3319 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3320 | + <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
|
|
| 3321 | 3321 | <div class="gdcf-tooltip"> |
| 3322 | 3322 | <?php _e('Select the thousand separator.', 'geodirectory'); ?>
|
| 3323 | 3323 | </div> |
| 3324 | 3324 | </label> |
| 3325 | 3325 | <div class="gd-cf-input-wrap"> |
| 3326 | 3326 | <select name="extra[thousand_separator]" id="thousand_separator"> |
| 3327 | - <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3328 | - <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3329 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3330 | - <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3331 | - <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3327 | + <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3328 | + <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3329 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3330 | + <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3331 | + <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3332 | 3332 | </select> |
| 3333 | 3333 | </div> |
| 3334 | 3334 | </li> |
@@ -3339,20 +3339,20 @@ discard block |
||
| 3339 | 3339 | $value = ''; |
| 3340 | 3340 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3341 | 3341 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3342 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3342 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
|
|
| 3343 | 3343 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3344 | 3344 | } |
| 3345 | 3345 | ?> |
| 3346 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3347 | - <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
|
| 3346 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3347 | + <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
|
|
| 3348 | 3348 | <div class="gdcf-tooltip"> |
| 3349 | 3349 | <?php _e('Select the decimal separator.', 'geodirectory'); ?>
|
| 3350 | 3350 | </div> |
| 3351 | 3351 | </label> |
| 3352 | 3352 | <div class="gd-cf-input-wrap"> |
| 3353 | 3353 | <select name="extra[decimal_separator]" id="decimal_separator"> |
| 3354 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3355 | - <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3354 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3355 | + <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3356 | 3356 | </select> |
| 3357 | 3357 | </div> |
| 3358 | 3358 | </li> |
@@ -3362,20 +3362,20 @@ discard block |
||
| 3362 | 3362 | $value = ''; |
| 3363 | 3363 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3364 | 3364 | $value = esc_attr($extra_fields['decimal_display']); |
| 3365 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3365 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
|
|
| 3366 | 3366 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3367 | 3367 | } |
| 3368 | 3368 | ?> |
| 3369 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3370 | - <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
|
| 3369 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3370 | + <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
|
|
| 3371 | 3371 | <div class="gdcf-tooltip"> |
| 3372 | 3372 | <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
|
| 3373 | 3373 | </div> |
| 3374 | 3374 | </label> |
| 3375 | 3375 | <div class="gd-cf-input-wrap"> |
| 3376 | 3376 | <select name="extra[decimal_display]" id="decimal_display"> |
| 3377 | - <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3378 | - <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3377 | + <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3378 | + <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3379 | 3379 | </select> |
| 3380 | 3380 | </div> |
| 3381 | 3381 | </li> |
@@ -3385,12 +3385,12 @@ discard block |
||
| 3385 | 3385 | $value = ''; |
| 3386 | 3386 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3387 | 3387 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3388 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3388 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
|
|
| 3389 | 3389 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3390 | 3390 | } |
| 3391 | 3391 | ?> |
| 3392 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3393 | - <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
|
| 3392 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3393 | + <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
|
|
| 3394 | 3394 | <div class="gdcf-tooltip"> |
| 3395 | 3395 | <?php _e('Select the currency symbol.', 'geodirectory'); ?>
|
| 3396 | 3396 | </div> |
@@ -3406,20 +3406,20 @@ discard block |
||
| 3406 | 3406 | $value = ''; |
| 3407 | 3407 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3408 | 3408 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3409 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3409 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
|
|
| 3410 | 3410 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3411 | 3411 | } |
| 3412 | 3412 | ?> |
| 3413 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3414 | - <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
|
| 3413 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3414 | + <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
|
|
| 3415 | 3415 | <div class="gdcf-tooltip"> |
| 3416 | 3416 | <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
|
| 3417 | 3417 | </div> |
| 3418 | 3418 | </label> |
| 3419 | 3419 | <div class="gd-cf-input-wrap"> |
| 3420 | 3420 | <select name="extra[currency_symbol_placement]" id="currency_symbol_placement"> |
| 3421 | - <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3422 | - <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3421 | + <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3422 | + <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3423 | 3423 | </select> |
| 3424 | 3424 | </div> |
| 3425 | 3425 | </li> |
@@ -3430,11 +3430,11 @@ discard block |
||
| 3430 | 3430 | $html = ob_get_clean(); |
| 3431 | 3431 | return $output.$html; |
| 3432 | 3432 | } |
| 3433 | -add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
|
| 3433 | +add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
|
|
| 3434 | 3434 | |
| 3435 | -function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
|
| 3435 | +function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
|
|
| 3436 | 3436 | $fields = array(); |
| 3437 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3437 | + $package = ($package_id == '') ? '' : array($package_id); |
|
| 3438 | 3438 | |
| 3439 | 3439 | $fields[] = array('listing_type' => $post_type,
|
| 3440 | 3440 | 'data_type' => 'VARCHAR', |
@@ -3607,7 +3607,7 @@ discard block |
||
| 3607 | 3607 | return $fields; |
| 3608 | 3608 | } |
| 3609 | 3609 | |
| 3610 | -function geodir_currency_format_number($number='',$cf=''){
|
|
| 3610 | +function geodir_currency_format_number($number = '', $cf = '') {
|
|
| 3611 | 3611 | |
| 3612 | 3612 | $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
| 3613 | 3613 | |
@@ -3616,35 +3616,35 @@ discard block |
||
| 3616 | 3616 | $decimal_display = !empty($cf['decimal_display']) ? $cf['decimal_display'] : (!empty($cs['decimal_display']) ? $cs['decimal_display'] : 'if'); |
| 3617 | 3617 | $decimalpoint = '.'; |
| 3618 | 3618 | |
| 3619 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3619 | + if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
|
|
| 3620 | 3620 | $decimalpoint = ','; |
| 3621 | 3621 | } |
| 3622 | 3622 | |
| 3623 | 3623 | $separator = ','; |
| 3624 | 3624 | |
| 3625 | - if(isset($cs['thousand_separator'])){
|
|
| 3626 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3627 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3628 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3629 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3630 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3625 | + if (isset($cs['thousand_separator'])) {
|
|
| 3626 | + if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
|
|
| 3627 | + if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
|
|
| 3628 | + if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
|
|
| 3629 | + if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
|
|
| 3630 | + if ($cs['thousand_separator'] == 'none') {$separator = ''; }
|
|
| 3631 | 3631 | } |
| 3632 | 3632 | |
| 3633 | 3633 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3634 | 3634 | |
| 3635 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3636 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3635 | + if ($decimals > 0 && $decimal_display == 'if') {
|
|
| 3636 | + if (is_int($number) || floor($number) == $number) |
|
| 3637 | 3637 | $decimals = 0; |
| 3638 | 3638 | } |
| 3639 | 3639 | |
| 3640 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3640 | + $number = number_format($number, $decimals, $decimalpoint, $separator); |
|
| 3641 | 3641 | |
| 3642 | 3642 | |
| 3643 | 3643 | |
| 3644 | - if($currency_symbol_placement=='left'){
|
|
| 3645 | - $number = $symbol . $number; |
|
| 3646 | - }else{
|
|
| 3647 | - $number = $number . $symbol; |
|
| 3644 | + if ($currency_symbol_placement == 'left') {
|
|
| 3645 | + $number = $symbol.$number; |
|
| 3646 | + } else {
|
|
| 3647 | + $number = $number.$symbol; |
|
| 3648 | 3648 | } |
| 3649 | 3649 | |
| 3650 | 3650 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | function geodir_get_admin_option_form($current_tab) |
| 64 | 64 | {
|
| 65 | - geodir_admin_option_form($current_tab);// defined in admin template tags.php |
|
| 65 | + geodir_admin_option_form($current_tab); // defined in admin template tags.php |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | add_action('geodir_update_options_compatibility_settings', 'geodir_update_options_compatibility_settings');
|
| 71 | 71 | add_action('geodir_update_options_default_location_settings', 'geodir_location_form_submit');
|
| 72 | 72 | add_action('geodir_before_admin_panel', 'geodir_before_admin_panel'); // this function is in admin_functions.php
|
| 73 | -add_action('geodir_before_update_options', 'geodir_before_update_options',10,2);
|
|
| 73 | +add_action('geodir_before_update_options', 'geodir_before_update_options', 10, 2);
|
|
| 74 | 74 | |
| 75 | 75 | //add_action('geodir_before_admin_panel', 'geodir_autoinstall_admin_header');
|
| 76 | 76 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Disable VC editor for GD post types. |
| 101 | 101 | if (class_exists('Vc_Role_Access_Controller')) {
|
| 102 | - add_filter( 'vc_role_access_with_post_types_can', '__return_false', 100 ); |
|
| 102 | + add_filter('vc_role_access_with_post_types_can', '__return_false', 100);
|
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | add_action('admin_panel_init', 'geodir_admin_list_columns', 2);
|
| 127 | 127 | |
| 128 | 128 | /* --- insert dummy post action ---*/ |
| 129 | -add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1,3);
|
|
| 130 | -add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1,3);
|
|
| 129 | +add_action('geodir_insert_dummy_posts', 'geodir_insert_dummy_posts', 1, 3);
|
|
| 130 | +add_action('geodir_delete_dummy_posts', 'geodir_delete_dummy_posts', 1, 3);
|
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | // Filter-Payment-Manager |
| 242 | 242 | |
| 243 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 243 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 244 | 244 | |
| 245 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 245 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 246 | 246 | |
| 247 | 247 | // no need of this box as all fields moved to main information box |
| 248 | 248 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | -add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 254 | +add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 255 | 255 | |
| 256 | 256 | |
| 257 | 257 | |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
| 280 | 280 | |
| 281 | - if(!empty($gd_taxonomy)) {
|
|
| 281 | + if (!empty($gd_taxonomy)) {
|
|
| 282 | 282 | foreach ($gd_taxonomy as $tax) {
|
| 283 | 283 | |
| 284 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 284 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -367,14 +367,14 @@ discard block |
||
| 367 | 367 | add_action('geodir_manage_available_fields_predefined', 'geodir_manage_available_fields_predefined');
|
| 368 | 368 | add_action('geodir_manage_available_fields_custom', 'geodir_manage_available_fields_custom');
|
| 369 | 369 | |
| 370 | -function geodir_manage_available_fields_predefined($sub_tab){
|
|
| 371 | - if($sub_tab=='custom_fields'){
|
|
| 370 | +function geodir_manage_available_fields_predefined($sub_tab) {
|
|
| 371 | + if ($sub_tab == 'custom_fields') {
|
|
| 372 | 372 | geodir_custom_available_fields('predefined');
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -function geodir_manage_available_fields_custom($sub_tab){
|
|
| 377 | - if($sub_tab=='custom_fields'){
|
|
| 376 | +function geodir_manage_available_fields_custom($sub_tab) {
|
|
| 377 | + if ($sub_tab == 'custom_fields') {
|
|
| 378 | 378 | geodir_custom_available_fields('custom');
|
| 379 | 379 | } |
| 380 | 380 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | global $wpdb; |
| 445 | 445 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 446 | 446 | ?> |
| 447 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 447 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 448 | 448 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 449 | 449 | <ul> |
| 450 | 450 | <?php |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | $check_html_variable = $wpdb->get_var( |
| 457 | 457 | $wpdb->prepare( |
| 458 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 458 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 459 | 459 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
| 460 | 460 | ) |
| 461 | 461 | ); |
@@ -463,23 +463,23 @@ discard block |
||
| 463 | 463 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
| 464 | 464 | ?> |
| 465 | 465 | |
| 466 | - <li class="gd-cf-tooltip-wrap" <?php echo $display;?>> |
|
| 466 | + <li class="gd-cf-tooltip-wrap" <?php echo $display; ?>> |
|
| 467 | 467 | <?php |
| 468 | - if(isset($val['description']) && $val['description']){
|
|
| 468 | + if (isset($val['description']) && $val['description']) {
|
|
| 469 | 469 | echo '<div class="gdcf-tooltip">'.$val['description'].'</div>'; |
| 470 | 470 | }?> |
| 471 | 471 | |
| 472 | - <a id="gd-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" data-field-type-key="<?php echo $val['htmlvar_name'];?>" data-field-type="<?php echo $val['field_type'];?>" |
|
| 473 | - title="<?php echo $val['site_title'];?>" |
|
| 474 | - class="gd-draggable-form-items gd-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" href="javascript:void(0);"> |
|
| 472 | + <a id="gd-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" data-field-type-key="<?php echo $val['htmlvar_name']; ?>" data-field-type="<?php echo $val['field_type']; ?>" |
|
| 473 | + title="<?php echo $val['site_title']; ?>" |
|
| 474 | + class="gd-draggable-form-items gd-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" href="javascript:void(0);"> |
|
| 475 | 475 | <?php if (isset($val['field_icon']) && strpos($val['field_icon'], 'fa fa-') !== false) {
|
| 476 | 476 | echo '<i class="'.$val['field_icon'].'" aria-hidden="true"></i>'; |
| 477 | - }elseif(isset($val['field_icon']) && $val['field_icon'] ){
|
|
| 477 | + }elseif (isset($val['field_icon']) && $val['field_icon']) {
|
|
| 478 | 478 | echo '<b class="gd-cf-icon" style="background-image: url(\''.$val['field_icon'].'\')"></b>'; |
| 479 | - }else{
|
|
| 479 | + } else {
|
|
| 480 | 480 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 481 | 481 | }?> |
| 482 | - <?php echo (! empty( $val['admin_title'] ) ? $val['admin_title'] : $val['site_title'] );?> |
|
| 482 | + <?php echo (!empty($val['admin_title']) ? $val['admin_title'] : $val['site_title']); ?> |
|
| 483 | 483 | </a> |
| 484 | 484 | </li> |
| 485 | 485 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | <?php |
| 508 | 508 | global $wpdb; |
| 509 | 509 | |
| 510 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 510 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type = %s AND field_type != 'address' ORDER BY sort_order ASC", array($listing_type)));
|
|
| 511 | 511 | |
| 512 | 512 | if (!empty($fields)) {
|
| 513 | 513 | foreach ($fields as $field) {
|
@@ -532,14 +532,14 @@ discard block |
||
| 532 | 532 | * @since 1.6.9 |
| 533 | 533 | * @package GeoDirectory |
| 534 | 534 | */ |
| 535 | -function geodir_custom_fields_custom($post_type=''){
|
|
| 535 | +function geodir_custom_fields_custom($post_type = '') {
|
|
| 536 | 536 | |
| 537 | 537 | $custom_fields = array(); |
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | 540 | * @see `geodir_custom_fields` |
| 541 | 541 | */ |
| 542 | - return apply_filters('geodir_custom_fields_custom',$custom_fields,$post_type);
|
|
| 542 | + return apply_filters('geodir_custom_fields_custom', $custom_fields, $post_type);
|
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @since 1.6.6 |
| 551 | 551 | * @package GeoDirectory |
| 552 | 552 | */ |
| 553 | -function geodir_custom_fields($post_type=''){
|
|
| 553 | +function geodir_custom_fields($post_type = '') {
|
|
| 554 | 554 | |
| 555 | 555 | $custom_fields = array( |
| 556 | 556 | 'text' => array( |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * } |
| 686 | 686 | * @param string $post_type The post type requested. |
| 687 | 687 | */ |
| 688 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 688 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
|
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /** |
@@ -696,25 +696,25 @@ discard block |
||
| 696 | 696 | * @param string $type The custom field type, predefined, custom or blank for default |
| 697 | 697 | * @package GeoDirectory |
| 698 | 698 | */ |
| 699 | -function geodir_custom_available_fields($type='') |
|
| 699 | +function geodir_custom_available_fields($type = '') |
|
| 700 | 700 | {
|
| 701 | 701 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 702 | 702 | ?> |
| 703 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 703 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 704 | 704 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>" /> |
| 705 | 705 | |
| 706 | 706 | <?php |
| 707 | - if($type=='predefined'){
|
|
| 707 | + if ($type == 'predefined') {
|
|
| 708 | 708 | $cfs = geodir_custom_fields_predefined($listing_type); |
| 709 | - }elseif($type=='custom'){
|
|
| 709 | + }elseif ($type == 'custom') {
|
|
| 710 | 710 | $cfs = geodir_custom_fields_custom($listing_type); |
| 711 | - }else{
|
|
| 711 | + } else {
|
|
| 712 | 712 | $cfs = geodir_custom_fields($listing_type); |
| 713 | 713 | ?> |
| 714 | 714 | <ul class="full gd-cf-tooltip-wrap"> |
| 715 | 715 | <li> |
| 716 | 716 | <div class="gdcf-tooltip"> |
| 717 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?>
|
|
| 717 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
|
|
| 718 | 718 | </div> |
| 719 | 719 | <a id="gt-fieldset" |
| 720 | 720 | class="gd-draggable-form-items gt-fieldset" |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 727 | 727 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 728 | - <?php _e('Fieldset (section separator)', 'geodirectory');?>
|
|
| 728 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
|
|
| 729 | 729 | </a> |
| 730 | 730 | </li> |
| 731 | 731 | </ul> |
@@ -733,15 +733,15 @@ discard block |
||
| 733 | 733 | <?php |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - if(!empty($cfs)) {
|
|
| 736 | + if (!empty($cfs)) {
|
|
| 737 | 737 | echo '<ul>'; |
| 738 | - foreach ( $cfs as $id => $cf ) {
|
|
| 738 | + foreach ($cfs as $id => $cf) {
|
|
| 739 | 739 | ?> |
| 740 | 740 | |
| 741 | 741 | <li class="gd-cf-tooltip-wrap"> |
| 742 | 742 | <?php |
| 743 | - if ( isset( $cf['description'] ) && $cf['description'] ) {
|
|
| 744 | - echo '<div class="gdcf-tooltip">' . $cf['description'] . '</div>'; |
|
| 743 | + if (isset($cf['description']) && $cf['description']) {
|
|
| 744 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 745 | 745 | } ?> |
| 746 | 746 | |
| 747 | 747 | <a id="gd-<?php echo $id; ?>" |
@@ -751,10 +751,10 @@ discard block |
||
| 751 | 751 | class="gd-draggable-form-items <?php echo $cf['class']; ?>" |
| 752 | 752 | href="javascript:void(0);"> |
| 753 | 753 | |
| 754 | - <?php if ( isset( $cf['icon'] ) && strpos( $cf['icon'], 'fa fa-' ) !== false ) {
|
|
| 755 | - echo '<i class="' . $cf['icon'] . '" aria-hidden="true"></i>'; |
|
| 756 | - } elseif ( isset( $cf['icon'] ) && $cf['icon'] ) {
|
|
| 757 | - echo '<b class="gd-cf-icon" style="background-image: url(\'' . $cf['icon'] . '\')"></b>'; |
|
| 754 | + <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
|
| 755 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 756 | + } elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 757 | + echo '<b class="gd-cf-icon" style="background-image: url(\''.$cf['icon'].'\')"></b>'; |
|
| 758 | 758 | } else {
|
| 759 | 759 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 760 | 760 | } ?> |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | </li> |
| 764 | 764 | <?php |
| 765 | 765 | } |
| 766 | - }else{
|
|
| 766 | + } else {
|
|
| 767 | 767 | _e('There are no custom fields here yet.', 'geodirectory');
|
| 768 | 768 | } |
| 769 | 769 | ?> |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | <ul class="core"> |
| 792 | 792 | <?php |
| 793 | 793 | global $wpdb; |
| 794 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 794 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 795 | 795 | |
| 796 | 796 | if (!empty($fields)) {
|
| 797 | 797 | foreach ($fields as $field) {
|
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $field_type_key = $field->field_type_key; |
| 802 | 802 | $field_ins_upd = 'display'; |
| 803 | 803 | |
| 804 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 804 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | ?></ul> |
@@ -960,8 +960,8 @@ discard block |
||
| 960 | 960 | |
| 961 | 961 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 962 | 962 | |
| 963 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 964 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 963 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
|
|
| 964 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
|
|
| 965 | 965 | |
| 966 | 966 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 967 | 967 | |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | case 'diagnosis' : |
| 991 | 991 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
|
| 992 | 992 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 993 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 993 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 994 | 994 | |
| 995 | 995 | } |
| 996 | 996 | exit(); |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | case 'diagnosis-fix' : |
| 1000 | 1000 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 1001 | 1001 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 1002 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 1002 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 1003 | 1003 | exit(); |
| 1004 | 1004 | break; |
| 1005 | 1005 | } |
@@ -1024,50 +1024,50 @@ discard block |
||
| 1024 | 1024 | {
|
| 1025 | 1025 | global $wpdb; |
| 1026 | 1026 | //$filter_arr['output_str'] .='###'.$table.'###'; |
| 1027 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 1028 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 1027 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
| 1028 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
| 1029 | 1029 | $filter_arr['is_error_during_diagnose'] = true; |
| 1030 | 1030 | |
| 1031 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1032 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1031 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1032 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1033 | 1033 | $filter_arr['is_error_during_diagnose'] = true; |
| 1034 | - $filter_arr['output_str'] .= "<li>" . __('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory') . "</li>";
|
|
| 1034 | + $filter_arr['output_str'] .= "<li>".__('IMPORTANT: This can be caused by out of date core or addons, please update core + addons before trying the fix OR YOU WILL HAVE A BAD TIME!', 'geodirectory')."</li>";
|
|
| 1035 | 1035 | $filter_arr['is_error_during_diagnose'] = true; |
| 1036 | 1036 | |
| 1037 | 1037 | if ($fix) {
|
| 1038 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 1039 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 1038 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
| 1039 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
| 1040 | 1040 | |
| 1041 | 1041 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
| 1042 | 1042 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
| 1043 | 1043 | |
| 1044 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 1044 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
| 1045 | 1045 | |
| 1046 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1047 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 1046 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1047 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
|
|
| 1048 | 1048 | } else {
|
| 1049 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1049 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
| 1053 | 1053 | |
| 1054 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 1055 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 1054 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
| 1055 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
| 1056 | 1056 | |
| 1057 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1058 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1057 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1058 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
| 1059 | 1059 | } else {
|
| 1060 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1060 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
| 1064 | 1064 | |
| 1065 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 1065 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
| 1066 | 1066 | |
| 1067 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 1068 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 1067 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 1068 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
| 1069 | 1069 | } else {
|
| 1070 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 1070 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | } |
@@ -1075,54 +1075,54 @@ discard block |
||
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | |
| 1078 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 1079 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1078 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 1079 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1080 | 1080 | $filter_arr['is_error_during_diagnose'] = true; |
| 1081 | 1081 | |
| 1082 | 1082 | if ($fix) {
|
| 1083 | 1083 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
| 1084 | 1084 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
| 1085 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1085 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
| 1086 | 1086 | } else {
|
| 1087 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1087 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | - } elseif ($wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1091 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1092 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1090 | + } elseif ($wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table") == 0) {// if main table is empty but original is not, delete main and rename original
|
|
| 1091 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
| 1092 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1093 | 1093 | } else {
|
| 1094 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1094 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1095 | 1095 | } |
| 1096 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1097 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1096 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1097 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1098 | 1098 | } else {
|
| 1099 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1099 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1100 | 1100 | } |
| 1101 | 1101 | } else {// else rename the original table to _ms_bak
|
| 1102 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1103 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1102 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1103 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table contained info so we renamed %s to %s incase it is needed in future', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1104 | 1104 | } else {
|
| 1105 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table . "_ms_bak") . "</li>";
|
|
| 1105 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Table %s could not be renamed to %s, this table has info so may need to be reviewed manually in the DB', 'geodirectory'), $table, $table."_ms_bak")."</li>";
|
|
| 1106 | 1106 | } |
| 1107 | 1107 | } |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1111 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1110 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1111 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1112 | 1112 | $filter_arr['is_error_during_diagnose'] = true; |
| 1113 | 1113 | |
| 1114 | 1114 | if ($fix) {
|
| 1115 | 1115 | // if original table exists but new does not, rename |
| 1116 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1117 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1116 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1117 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1118 | 1118 | } else {
|
| 1119 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1119 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Failed to rename table %s to %s, please try manually from DB', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1125 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1124 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1125 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1126 | 1126 | $filter_arr['is_error_during_diagnose'] = true; |
| 1127 | 1127 | |
| 1128 | 1128 | if ($fix) {
|
@@ -1136,11 +1136,11 @@ discard block |
||
| 1136 | 1136 | delete_option('geodir_custom_posts_db_version');
|
| 1137 | 1137 | delete_option('geodir_reviewratings_db_version');
|
| 1138 | 1138 | delete_option('geodiradvancesearch_db_version');
|
| 1139 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1139 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | } else {
|
| 1143 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1143 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1144 | 1144 | } |
| 1145 | 1145 | return $filter_arr; |
| 1146 | 1146 | } |
@@ -1181,21 +1181,21 @@ discard block |
||
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | if ($stepped_process) {
|
| 1184 | - $sql = $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $ptype . "_detail LIMIT %d OFFSET %d", $step_max_items, $offset ); |
|
| 1185 | - $posts = $wpdb->get_results( $sql ); |
|
| 1184 | + $sql = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."geodir_".$ptype."_detail LIMIT %d OFFSET %d", $step_max_items, $offset);
|
|
| 1185 | + $posts = $wpdb->get_results($sql); |
|
| 1186 | 1186 | |
| 1187 | 1187 | if (!empty($posts)) {
|
| 1188 | 1188 | |
| 1189 | 1189 | foreach ($posts as $p) {
|
| 1190 | 1190 | $p->post_type = $ptype; |
| 1191 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1191 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1192 | 1192 | if (empty($raw_tags)) {
|
| 1193 | 1193 | $post_tags = ''; |
| 1194 | 1194 | } else {
|
| 1195 | 1195 | $post_tags = implode(",", $raw_tags);
|
| 1196 | 1196 | } |
| 1197 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1198 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1197 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1198 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1199 | 1199 | |
| 1200 | 1200 | } |
| 1201 | 1201 | if ($step >= $max_step) {
|
@@ -1211,23 +1211,23 @@ discard block |
||
| 1211 | 1211 | if (!empty($all_postypes)) {
|
| 1212 | 1212 | foreach ($all_postypes as $key) {
|
| 1213 | 1213 | // update each GD CPT |
| 1214 | - $posts = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail"); |
|
| 1214 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail");
|
|
| 1215 | 1215 | |
| 1216 | 1216 | if (!empty($posts)) {
|
| 1217 | 1217 | |
| 1218 | 1218 | foreach ($posts as $p) {
|
| 1219 | 1219 | $p->post_type = $key; |
| 1220 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1220 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1221 | 1221 | if (empty($raw_tags)) {
|
| 1222 | 1222 | $post_tags = ''; |
| 1223 | 1223 | } else {
|
| 1224 | 1224 | $post_tags = implode(",", $raw_tags);
|
| 1225 | 1225 | } |
| 1226 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1227 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1226 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1227 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1228 | 1228 | |
| 1229 | 1229 | } |
| 1230 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1230 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | } |
@@ -1238,14 +1238,14 @@ discard block |
||
| 1238 | 1238 | |
| 1239 | 1239 | if ($is_error_during_diagnose) {
|
| 1240 | 1240 | $info_div_class = "geodir_problem_info"; |
| 1241 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1241 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1242 | 1242 | } else {
|
| 1243 | 1243 | $info_div_class = "geodir_noproblem_info"; |
| 1244 | 1244 | $fix_button_txt = ''; |
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | if ($stepped_process) {
|
| 1248 | - $percent = ($step/$max_step) * 100; |
|
| 1248 | + $percent = ($step / $max_step) * 100; |
|
| 1249 | 1249 | if ($output_str == 'done') {
|
| 1250 | 1250 | echo $output_str; |
| 1251 | 1251 | } else {
|
@@ -1288,29 +1288,29 @@ discard block |
||
| 1288 | 1288 | if (!empty($all_postypes)) {
|
| 1289 | 1289 | foreach ($all_postypes as $key) {
|
| 1290 | 1290 | // update each GD CTP |
| 1291 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1291 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
| 1292 | 1292 | |
| 1293 | 1293 | if (!empty($posts)) {
|
| 1294 | 1294 | |
| 1295 | 1295 | foreach ($posts as $p) {
|
| 1296 | 1296 | $p->post_type = $key; |
| 1297 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1297 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
| 1298 | 1298 | |
| 1299 | 1299 | if (empty($raw_cats)) {
|
| 1300 | 1300 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
| 1301 | 1301 | |
| 1302 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1303 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1304 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1302 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
| 1303 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
| 1304 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
| 1305 | 1305 | if (is_numeric($cat_part)) {
|
| 1306 | - $raw_cats[] = (int)$cat_part; |
|
| 1306 | + $raw_cats[] = (int) $cat_part; |
|
| 1307 | 1307 | } |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | if (!empty($raw_cats)) {
|
| 1313 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1313 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
| 1314 | 1314 | |
| 1315 | 1315 | } |
| 1316 | 1316 | |
@@ -1320,14 +1320,14 @@ discard block |
||
| 1320 | 1320 | if (empty($raw_cats)) {
|
| 1321 | 1321 | $post_cats = ''; |
| 1322 | 1322 | } else {
|
| 1323 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1323 | + $post_cats = ','.implode(",", $raw_cats).',';
|
|
| 1324 | 1324 | } |
| 1325 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1326 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1325 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1326 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | } |
| 1330 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1330 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1331 | 1331 | |
| 1332 | 1332 | } |
| 1333 | 1333 | |
@@ -1335,7 +1335,7 @@ discard block |
||
| 1335 | 1335 | |
| 1336 | 1336 | if ($is_error_during_diagnose) {
|
| 1337 | 1337 | $info_div_class = "geodir_problem_info"; |
| 1338 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1338 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1339 | 1339 | } else {
|
| 1340 | 1340 | $info_div_class = "geodir_noproblem_info"; |
| 1341 | 1341 | $fix_button_txt = ''; |
@@ -1388,15 +1388,15 @@ discard block |
||
| 1388 | 1388 | if (!empty($ver_arr)) {
|
| 1389 | 1389 | foreach ($ver_arr as $key => $val) {
|
| 1390 | 1390 | if (delete_option($val)) {
|
| 1391 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1391 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
| 1392 | 1392 | } else {
|
| 1393 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1393 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | if ($output_str) {
|
| 1399 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1399 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | 1402 | } |
@@ -1433,43 +1433,43 @@ discard block |
||
| 1433 | 1433 | $output_str = ''; |
| 1434 | 1434 | |
| 1435 | 1435 | // check review locations |
| 1436 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1437 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1436 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE post_city='' OR post_city IS NULL OR post_latitude='' OR post_latitude IS NULL")) {
|
|
| 1437 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
| 1438 | 1438 | $is_error_during_diagnose = true; |
| 1439 | 1439 | |
| 1440 | 1440 | if ($fix) {
|
| 1441 | 1441 | if (geodir_fix_review_location()) {
|
| 1442 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1442 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
| 1443 | 1443 | } else {
|
| 1444 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1444 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
| 1445 | 1445 | } |
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | } else {
|
| 1449 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1449 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | // check review content |
| 1453 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1454 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1453 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
| 1454 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
| 1455 | 1455 | $is_error_during_diagnose = true; |
| 1456 | 1456 | |
| 1457 | 1457 | if ($fix) {
|
| 1458 | 1458 | if (geodir_fix_review_content()) {
|
| 1459 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1459 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
| 1460 | 1460 | } else {
|
| 1461 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1461 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
| 1462 | 1462 | } |
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | } else {
|
| 1466 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1466 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | |
| 1470 | 1470 | if ($is_error_during_diagnose) {
|
| 1471 | 1471 | $info_div_class = "geodir_problem_info"; |
| 1472 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1472 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1473 | 1473 | } else {
|
| 1474 | 1474 | $info_div_class = "geodir_noproblem_info"; |
| 1475 | 1475 | $fix_button_txt = ''; |
@@ -1533,7 +1533,7 @@ discard block |
||
| 1533 | 1533 | |
| 1534 | 1534 | if ($is_error_during_diagnose) {
|
| 1535 | 1535 | $info_div_class = "geodir_problem_info"; |
| 1536 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1536 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1537 | 1537 | } else {
|
| 1538 | 1538 | $info_div_class = "geodir_noproblem_info"; |
| 1539 | 1539 | $fix_button_txt = ''; |
@@ -1567,7 +1567,7 @@ discard block |
||
| 1567 | 1567 | else {
|
| 1568 | 1568 | $page_found = $wpdb->get_var( |
| 1569 | 1569 | $wpdb->prepare( |
| 1570 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1570 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 1571 | 1571 | array($slug) |
| 1572 | 1572 | ) |
| 1573 | 1573 | ); |
@@ -1613,18 +1613,18 @@ discard block |
||
| 1613 | 1613 | ////////////////////////////////// |
| 1614 | 1614 | $option_value = get_option('geodir_home_page');
|
| 1615 | 1615 | $page = get_post($option_value); |
| 1616 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1616 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1617 | 1617 | |
| 1618 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1619 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1618 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1619 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1620 | 1620 | else {
|
| 1621 | 1621 | $is_error_during_diagnose = true; |
| 1622 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1622 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1623 | 1623 | if ($fix) {
|
| 1624 | 1624 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
| 1625 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1625 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
| 1626 | 1626 | } else {
|
| 1627 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1627 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1628 | 1628 | } |
| 1629 | 1629 | } |
| 1630 | 1630 | } |
@@ -1638,18 +1638,18 @@ discard block |
||
| 1638 | 1638 | ////////////////////////////////// |
| 1639 | 1639 | $option_value = get_option('geodir_add_listing_page');
|
| 1640 | 1640 | $page = get_post($option_value); |
| 1641 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1641 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1642 | 1642 | |
| 1643 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1644 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1643 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1644 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1645 | 1645 | else {
|
| 1646 | 1646 | $is_error_during_diagnose = true; |
| 1647 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1647 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1648 | 1648 | if ($fix) {
|
| 1649 | 1649 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
| 1650 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1650 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
| 1651 | 1651 | } else {
|
| 1652 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1652 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1653 | 1653 | } |
| 1654 | 1654 | } |
| 1655 | 1655 | } |
@@ -1664,18 +1664,18 @@ discard block |
||
| 1664 | 1664 | ////////////////////////////////// |
| 1665 | 1665 | $option_value = get_option('geodir_preview_page');
|
| 1666 | 1666 | $page = get_post($option_value); |
| 1667 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1667 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1668 | 1668 | |
| 1669 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1670 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1669 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1670 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1671 | 1671 | else {
|
| 1672 | 1672 | $is_error_during_diagnose = true; |
| 1673 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1673 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1674 | 1674 | if ($fix) {
|
| 1675 | 1675 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
| 1676 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1676 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
| 1677 | 1677 | } else {
|
| 1678 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1678 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1679 | 1679 | } |
| 1680 | 1680 | } |
| 1681 | 1681 | } |
@@ -1689,18 +1689,18 @@ discard block |
||
| 1689 | 1689 | ////////////////////////////////// |
| 1690 | 1690 | $option_value = get_option('geodir_success_page');
|
| 1691 | 1691 | $page = get_post($option_value); |
| 1692 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1692 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1693 | 1693 | |
| 1694 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1695 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1694 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1695 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1696 | 1696 | else {
|
| 1697 | 1697 | $is_error_during_diagnose = true; |
| 1698 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1698 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1699 | 1699 | if ($fix) {
|
| 1700 | 1700 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
| 1701 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1701 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
| 1702 | 1702 | } else {
|
| 1703 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1703 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1704 | 1704 | } |
| 1705 | 1705 | } |
| 1706 | 1706 | } |
@@ -1714,18 +1714,18 @@ discard block |
||
| 1714 | 1714 | ////////////////////////////////// |
| 1715 | 1715 | $option_value = get_option('geodir_info_page');
|
| 1716 | 1716 | $page = get_post($option_value); |
| 1717 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1717 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1718 | 1718 | |
| 1719 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1720 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1719 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1720 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1721 | 1721 | else {
|
| 1722 | 1722 | $is_error_during_diagnose = true; |
| 1723 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1723 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1724 | 1724 | if ($fix) {
|
| 1725 | 1725 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
| 1726 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1726 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
| 1727 | 1727 | } else {
|
| 1728 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1728 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1729 | 1729 | } |
| 1730 | 1730 | } |
| 1731 | 1731 | } |
@@ -1739,18 +1739,18 @@ discard block |
||
| 1739 | 1739 | ////////////////////////////////// |
| 1740 | 1740 | $option_value = get_option('geodir_login_page');
|
| 1741 | 1741 | $page = get_post($option_value); |
| 1742 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1742 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1743 | 1743 | |
| 1744 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1745 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1744 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1745 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1746 | 1746 | else {
|
| 1747 | 1747 | $is_error_during_diagnose = true; |
| 1748 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1748 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1749 | 1749 | if ($fix) {
|
| 1750 | 1750 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
| 1751 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1751 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
| 1752 | 1752 | } else {
|
| 1753 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1753 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1754 | 1754 | } |
| 1755 | 1755 | } |
| 1756 | 1756 | } |
@@ -1764,18 +1764,18 @@ discard block |
||
| 1764 | 1764 | ////////////////////////////////// |
| 1765 | 1765 | $option_value = get_option('geodir_location_page');
|
| 1766 | 1766 | $page = get_post($option_value); |
| 1767 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1767 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1768 | 1768 | |
| 1769 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1770 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1769 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1770 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1771 | 1771 | else {
|
| 1772 | 1772 | $is_error_during_diagnose = true; |
| 1773 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1773 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1774 | 1774 | if ($fix) {
|
| 1775 | 1775 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
| 1776 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1776 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
| 1777 | 1777 | } else {
|
| 1778 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1778 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1779 | 1779 | } |
| 1780 | 1780 | } |
| 1781 | 1781 | } |
@@ -1784,13 +1784,13 @@ discard block |
||
| 1784 | 1784 | /* Diagnose Location Page Ends */ |
| 1785 | 1785 | //////////////////////////////// |
| 1786 | 1786 | |
| 1787 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1787 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
| 1788 | 1788 | /** |
| 1789 | 1789 | * This action is called at the end of the GD Tools page check function. |
| 1790 | 1790 | * |
| 1791 | 1791 | * @since 1.5.2 |
| 1792 | 1792 | */ |
| 1793 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1793 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
| 1794 | 1794 | |
| 1795 | 1795 | $output_str = $page_chk_arr['output_str']; |
| 1796 | 1796 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | flush_rewrite_rules(); |
| 1801 | 1801 | } |
| 1802 | 1802 | $info_div_class = "geodir_problem_info"; |
| 1803 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1803 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1804 | 1804 | } else {
|
| 1805 | 1805 | $info_div_class = "geodir_noproblem_info"; |
| 1806 | 1806 | $fix_button_txt = ''; |
@@ -1828,10 +1828,10 @@ discard block |
||
| 1828 | 1828 | $fix_button_txt = ''; |
| 1829 | 1829 | |
| 1830 | 1830 | if ($is_error_during_diagnose) {
|
| 1831 | - $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>";
|
|
| 1831 | + $output_str .= "<li>".__('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory').' '.geodir_plugin_path().'/db-language.php'."</li>";
|
|
| 1832 | 1832 | $info_div_class = "geodir_problem_info"; |
| 1833 | 1833 | } else {
|
| 1834 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1834 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
| 1835 | 1835 | $info_div_class = "geodir_noproblem_info"; |
| 1836 | 1836 | $fix_button_txt = ''; |
| 1837 | 1837 | } |
@@ -1873,17 +1873,17 @@ discard block |
||
| 1873 | 1873 | global $wpdb, $wp_query, $plugin_prefix; |
| 1874 | 1874 | |
| 1875 | 1875 | if (is_admin() && !empty($wp_query->query_vars) && !empty($wp_query->query_vars['is_geodir_loop']) && !empty($wp_query->query_vars['orderby']) && $wp_query->query_vars['orderby'] == 'expire' && !empty($wp_query->query_vars['post_type']) && in_array($wp_query->query_vars['post_type'], geodir_get_posttypes()) && !empty($wp_query->query_vars['orderby']) && isset($clauses['join']) && isset($clauses['orderby']) && isset($clauses['fields'])) {
|
| 1876 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1876 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
| 1877 | 1877 | |
| 1878 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1878 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
| 1879 | 1879 | $clauses['join'] = $join; |
| 1880 | 1880 | |
| 1881 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1881 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
| 1882 | 1882 | $fields .= 'IF(UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), UNIX_TIMESTAMP(DATE_FORMAT(gd_posts.expire_date, "%Y-%m-%d")), 253402300799) AS gd_expire'; |
| 1883 | 1883 | $clauses['fields'] = $fields; |
| 1884 | 1884 | |
| 1885 | 1885 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
| 1886 | - $orderby = 'gd_expire ' . $order; |
|
| 1886 | + $orderby = 'gd_expire '.$order; |
|
| 1887 | 1887 | $clauses['orderby'] = $orderby; |
| 1888 | 1888 | } |
| 1889 | 1889 | return $clauses; |
@@ -1926,7 +1926,7 @@ discard block |
||
| 1926 | 1926 | global $current_user; |
| 1927 | 1927 | $upload_dir = wp_upload_dir(); |
| 1928 | 1928 | |
| 1929 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1929 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
| 1930 | 1930 | $handle = fopen($file, 'w'); |
| 1931 | 1931 | |
| 1932 | 1932 | fwrite($handle, $input); |
@@ -1971,7 +1971,7 @@ discard block |
||
| 1971 | 1971 | $uploads_dir = $uploads['path']; |
| 1972 | 1972 | $image_name_arr = explode('/', $filename);
|
| 1973 | 1973 | $filename = end($image_name_arr); |
| 1974 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1974 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1975 | 1975 | $return = array(); |
| 1976 | 1976 | $return['file'] = $uploadedFile; |
| 1977 | 1977 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
@@ -1988,8 +1988,8 @@ discard block |
||
| 1988 | 1988 | |
| 1989 | 1989 | if (($handle = fopen($target_path, "r")) !== FALSE) {
|
| 1990 | 1990 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 1991 | - if(is_array($data) && !empty($data)) {
|
|
| 1992 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1991 | + if (is_array($data) && !empty($data)) {
|
|
| 1992 | + $file[] = '"'.implode('","', $data).'"';
|
|
| 1993 | 1993 | } |
| 1994 | 1994 | } |
| 1995 | 1995 | fclose($handle); |
@@ -2106,10 +2106,10 @@ discard block |
||
| 2106 | 2106 | $tag_arr = explode(',', $post_tags);
|
| 2107 | 2107 | } |
| 2108 | 2108 | |
| 2109 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 2109 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
| 2110 | 2110 | |
| 2111 | 2111 | $error = ''; |
| 2112 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 2112 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
| 2113 | 2113 | $invalid_post_type++; |
| 2114 | 2114 | continue; |
| 2115 | 2115 | } |
@@ -2135,7 +2135,7 @@ discard block |
||
| 2135 | 2135 | if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
| 2136 | 2136 | $submitdata = date('Y-m-d');
|
| 2137 | 2137 | |
| 2138 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 2138 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
| 2139 | 2139 | } else {
|
| 2140 | 2140 | $gd_post_info['expire_date'] = 'Never'; |
| 2141 | 2141 | } |
@@ -2163,7 +2163,7 @@ discard block |
||
| 2163 | 2163 | |
| 2164 | 2164 | // Post status |
| 2165 | 2165 | if ($customKeyarray[$c] == 'post_status') {
|
| 2166 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2166 | + $post_status = sanitize_key($buffer[$c]); |
|
| 2167 | 2167 | } |
| 2168 | 2168 | } |
| 2169 | 2169 | |
@@ -2181,8 +2181,8 @@ discard block |
||
| 2181 | 2181 | |
| 2182 | 2182 | // Default post status |
| 2183 | 2183 | $default_status = 'publish'; |
| 2184 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 2185 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 2184 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 2185 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 2186 | 2186 | |
| 2187 | 2187 | $my_post['post_title'] = $post_title; |
| 2188 | 2188 | $my_post['post_content'] = $post_desc; |
@@ -2226,7 +2226,7 @@ discard block |
||
| 2226 | 2226 | $payment_info = array(); |
| 2227 | 2227 | $package_info = array(); |
| 2228 | 2228 | |
| 2229 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2229 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2230 | 2230 | $package_id = ''; |
| 2231 | 2231 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
| 2232 | 2232 | $package_id = $gd_post_info['package_id']; |
@@ -2236,7 +2236,7 @@ discard block |
||
| 2236 | 2236 | $payment_info['package_id'] = $package_info['pid']; |
| 2237 | 2237 | |
| 2238 | 2238 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
| 2239 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2239 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
| 2240 | 2240 | } else {
|
| 2241 | 2241 | $payment_info['expire_date'] = 'Never'; |
| 2242 | 2242 | } |
@@ -2248,7 +2248,7 @@ discard block |
||
| 2248 | 2248 | |
| 2249 | 2249 | $post_type = get_post_type($last_postid); |
| 2250 | 2250 | |
| 2251 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2251 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2252 | 2252 | |
| 2253 | 2253 | geodir_save_post_info($last_postid, $gd_post_info); |
| 2254 | 2254 | |
@@ -2269,7 +2269,7 @@ discard block |
||
| 2269 | 2269 | $attachment['post_id'] = $last_postid; |
| 2270 | 2270 | $attachment['title'] = $img_name_arr[0]; |
| 2271 | 2271 | $attachment['content'] = ''; |
| 2272 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2272 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
| 2273 | 2273 | $attachment['mime_type'] = $uploaded_file_type; |
| 2274 | 2274 | $attachment['menu_order'] = $menu_order; |
| 2275 | 2275 | $attachment['is_featured'] = 0; |
@@ -2278,15 +2278,15 @@ discard block |
||
| 2278 | 2278 | |
| 2279 | 2279 | foreach ($attachment as $key => $val) {
|
| 2280 | 2280 | if ($val != '') |
| 2281 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2281 | + $attachment_set .= $key." = '".$val."', "; |
|
| 2282 | 2282 | } |
| 2283 | 2283 | $attachment_set = trim($attachment_set, ", "); |
| 2284 | 2284 | |
| 2285 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2285 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 2286 | 2286 | |
| 2287 | 2287 | if ($menu_order == 1) {
|
| 2288 | 2288 | $post_type = get_post_type($last_postid); |
| 2289 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2289 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
| 2290 | 2290 | } |
| 2291 | 2291 | $menu_order++; |
| 2292 | 2292 | } |
@@ -2327,11 +2327,11 @@ discard block |
||
| 2327 | 2327 | } |
| 2328 | 2328 | |
| 2329 | 2329 | // Add the tab in left sidebar menu fro import & export page. |
| 2330 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
| 2330 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
| 2331 | 2331 | |
| 2332 | 2332 | // Handle ajax request for import/export. |
| 2333 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
| 2334 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
| 2333 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
| 2334 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
| 2335 | 2335 | |
| 2336 | 2336 | |
| 2337 | 2337 | /** |
@@ -2342,40 +2342,40 @@ discard block |
||
| 2342 | 2342 | * @param $post_id int $post_id The post ID of the post being saved. |
| 2343 | 2343 | * @param $post object $post The post object of the post being saved. |
| 2344 | 2344 | */ |
| 2345 | -function geodir_update_location_prefix($post_id,$post){
|
|
| 2346 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2347 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2345 | +function geodir_update_location_prefix($post_id, $post) {
|
|
| 2346 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
| 2347 | + update_option('geodir_location_prefix', $post->post_name);
|
|
| 2348 | 2348 | } |
| 2349 | 2349 | |
| 2350 | 2350 | } |
| 2351 | 2351 | |
| 2352 | -add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
| 2352 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
| 2353 | 2353 | |
| 2354 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
| 2354 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
| 2355 | 2355 | |
| 2356 | -function geodir_ga_callback(){
|
|
| 2356 | +function geodir_ga_callback() {
|
|
| 2357 | 2357 | |
| 2358 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2358 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2359 | 2359 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
| 2360 | 2360 | $code = "code=".$_REQUEST['code']; |
| 2361 | 2361 | $grant_type = "&grant_type=authorization_code"; |
| 2362 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2362 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 2363 | 2363 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 2364 | 2364 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
| 2365 | 2365 | |
| 2366 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2366 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
| 2367 | 2367 | |
| 2368 | 2368 | $response = wp_remote_post($auth_url, array('timeout' => 15));
|
| 2369 | 2369 | |
| 2370 | 2370 | //print_r($response); |
| 2371 | 2371 | |
| 2372 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2373 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2372 | + $error_msg = __('Something went wrong', 'geodirectory');
|
|
| 2373 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
| 2374 | 2374 | |
| 2375 | 2375 | $parts = json_decode($response['body']); |
| 2376 | 2376 | //print_r($parts); |
| 2377 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2378 | - else{
|
|
| 2377 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
| 2378 | + else {
|
|
| 2379 | 2379 | |
| 2380 | 2380 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2381 | 2381 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2384,18 +2384,18 @@ discard block |
||
| 2384 | 2384 | |
| 2385 | 2385 | |
| 2386 | 2386 | } |
| 2387 | - elseif(!empty($response['response']['code'])) {
|
|
| 2387 | + elseif (!empty($response['response']['code'])) {
|
|
| 2388 | 2388 | $parts = json_decode($response['body']); |
| 2389 | 2389 | |
| 2390 | - if(isset($parts->error)){
|
|
| 2391 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2392 | - }else{
|
|
| 2393 | - echo $error_msg." - #2";exit; |
|
| 2390 | + if (isset($parts->error)) {
|
|
| 2391 | + echo $parts->error.": ".$parts->error_description; exit; |
|
| 2392 | + } else {
|
|
| 2393 | + echo $error_msg." - #2"; exit; |
|
| 2394 | 2394 | } |
| 2395 | 2395 | |
| 2396 | - }else{
|
|
| 2396 | + } else {
|
|
| 2397 | 2397 | |
| 2398 | - echo $error_msg." - #3";exit; |
|
| 2398 | + echo $error_msg." - #3"; exit; |
|
| 2399 | 2399 | |
| 2400 | 2400 | } |
| 2401 | 2401 | } |
@@ -2417,7 +2417,7 @@ discard block |
||
| 2417 | 2417 | function geodir_uninstall_settings($general_settings) {
|
| 2418 | 2418 | $settings = array(); |
| 2419 | 2419 | $settings[] = array('type' => 'title', 'id' => 'uninstall_settings', 'name' => __('Uninstall Settings', 'geodirectory'));
|
| 2420 | - $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory' ));
|
|
| 2420 | + $settings[] = array('type' => 'sectionstart', 'id' => 'uninstall_settings_main', 'name' => __('Remove Data on Uninstall?', 'geodirectory'));
|
|
| 2421 | 2421 | |
| 2422 | 2422 | $plugins = get_plugins(); |
| 2423 | 2423 | $un_plugins = apply_filters('geodir_plugins_uninstall_settings', array());
|
@@ -2429,7 +2429,7 @@ discard block |
||
| 2429 | 2429 | if (in_array($plugin_name, $un_plugins)) {
|
| 2430 | 2430 | $settings[] = array( |
| 2431 | 2431 | 'type' => 'checkbox', |
| 2432 | - 'id' => 'geodir_un_' . $plugin_name, |
|
| 2432 | + 'id' => 'geodir_un_'.$plugin_name, |
|
| 2433 | 2433 | 'name' => $data['Name'], |
| 2434 | 2434 | 'desc' => __('Remove all data when deleted?', 'geodirectory'),
|
| 2435 | 2435 | 'std' => '0' |
@@ -2463,7 +2463,7 @@ discard block |
||
| 2463 | 2463 | * @since 1.6.9 |
| 2464 | 2464 | */ |
| 2465 | 2465 | function geodir_uninstall_settings_desc() {
|
| 2466 | - echo '<p class="gd-un-settings-desc">' . __('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory') . '</p>';
|
|
| 2466 | + echo '<p class="gd-un-settings-desc">'.__('Select the plugin(s) for which all data should be completely removed when the plugin is deleted.', 'geodirectory').'</p>';
|
|
| 2467 | 2467 | } |
| 2468 | 2468 | add_action('geodir_settings_uninstall_settings_main_start', 'geodir_uninstall_settings_desc');
|
| 2469 | 2469 | |
@@ -2527,12 +2527,12 @@ discard block |
||
| 2527 | 2527 | |
| 2528 | 2528 | |
| 2529 | 2529 | if ($delete) {
|
| 2530 | - $output_str .= "<li><strong>" . __('Table dropped, refresh page to reinstall.', 'geodirectory') . "</strong></li>";
|
|
| 2530 | + $output_str .= "<li><strong>".__('Table dropped, refresh page to reinstall.', 'geodirectory')."</strong></li>";
|
|
| 2531 | 2531 | ob_start(); |
| 2532 | 2532 | geodir_diagnose_version_clear(); |
| 2533 | 2533 | ob_end_clean(); |
| 2534 | - }else{
|
|
| 2535 | - $output_str .= "<li><strong>" . __('Something went wrong.', 'geodirectory') . "</strong></li>";
|
|
| 2534 | + } else {
|
|
| 2535 | + $output_str .= "<li><strong>".__('Something went wrong.', 'geodirectory')."</strong></li>";
|
|
| 2536 | 2536 | } |
| 2537 | 2537 | |
| 2538 | 2538 | if ($is_error_during_diagnose) {
|
@@ -2557,9 +2557,9 @@ discard block |
||
| 2557 | 2557 | * @param object $row The post|taxonomy object. |
| 2558 | 2558 | * @return array Filtered actions. |
| 2559 | 2559 | */ |
| 2560 | -function geodir_disable_quick_edit( $actions = array(), $row = null ) {
|
|
| 2561 | - if ( isset( $actions['inline hide-if-no-js'] ) ) {
|
|
| 2562 | - unset( $actions['inline hide-if-no-js'] ); |
|
| 2560 | +function geodir_disable_quick_edit($actions = array(), $row = null) {
|
|
| 2561 | + if (isset($actions['inline hide-if-no-js'])) {
|
|
| 2562 | + unset($actions['inline hide-if-no-js']); |
|
| 2563 | 2563 | } |
| 2564 | 2564 | |
| 2565 | 2565 | return $actions; |
@@ -2578,26 +2578,26 @@ discard block |
||
| 2578 | 2578 | function geodir_check_quick_edit() {
|
| 2579 | 2579 | global $pagenow, $current_screen, $gd_cpt_screen; |
| 2580 | 2580 | |
| 2581 | - if ( ( $pagenow == 'edit.php' || $pagenow == 'edit-tags.php' ) && !empty( $current_screen->post_type ) ) {
|
|
| 2582 | - if ( empty( $gd_cpt_screen ) ) {
|
|
| 2583 | - if ( in_array( $current_screen->post_type, geodir_get_posttypes() ) ) {
|
|
| 2581 | + if (($pagenow == 'edit.php' || $pagenow == 'edit-tags.php') && !empty($current_screen->post_type)) {
|
|
| 2582 | + if (empty($gd_cpt_screen)) {
|
|
| 2583 | + if (in_array($current_screen->post_type, geodir_get_posttypes())) {
|
|
| 2584 | 2584 | $gd_cpt_screen = 'y'; |
| 2585 | 2585 | } else {
|
| 2586 | 2586 | $gd_cpt_screen = 'n'; |
| 2587 | 2587 | } |
| 2588 | 2588 | } |
| 2589 | 2589 | |
| 2590 | - if ( $gd_cpt_screen == 'y' ) {
|
|
| 2591 | - if ( $pagenow == 'edit.php' ) {
|
|
| 2592 | - add_filter( 'post_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2593 | - add_filter( 'page_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2594 | - } elseif ( $pagenow == 'edit-tags.php' && !empty( $current_screen->taxonomy ) ) {
|
|
| 2595 | - add_filter( $current_screen->taxonomy . '_row_actions', 'geodir_disable_quick_edit', 10, 2 ); |
|
| 2590 | + if ($gd_cpt_screen == 'y') {
|
|
| 2591 | + if ($pagenow == 'edit.php') {
|
|
| 2592 | + add_filter('post_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2593 | + add_filter('page_row_actions', 'geodir_disable_quick_edit', 10, 2);
|
|
| 2594 | + } elseif ($pagenow == 'edit-tags.php' && !empty($current_screen->taxonomy)) {
|
|
| 2595 | + add_filter($current_screen->taxonomy.'_row_actions', 'geodir_disable_quick_edit', 10, 2); |
|
| 2596 | 2596 | } |
| 2597 | 2597 | } |
| 2598 | 2598 | } |
| 2599 | 2599 | } |
| 2600 | -add_action( 'admin_head', 'geodir_check_quick_edit', 10 ); |
|
| 2600 | +add_action('admin_head', 'geodir_check_quick_edit', 10);
|
|
| 2601 | 2601 | |
| 2602 | 2602 | /** |
| 2603 | 2603 | * Filter the bulk actions for GD CPT. |
@@ -2608,9 +2608,9 @@ discard block |
||
| 2608 | 2608 | * @param array $actions An array of the available bulk actions. |
| 2609 | 2609 | * @return array Filtered bulk actions. |
| 2610 | 2610 | */ |
| 2611 | -function geodir_filter_bulk_actions( $actions ) {
|
|
| 2612 | - if ( isset( $actions['edit'] ) ) {
|
|
| 2613 | - unset( $actions['edit'] ); |
|
| 2611 | +function geodir_filter_bulk_actions($actions) {
|
|
| 2612 | + if (isset($actions['edit'])) {
|
|
| 2613 | + unset($actions['edit']); |
|
| 2614 | 2614 | } |
| 2615 | 2615 | |
| 2616 | 2616 | return $actions; |