@@ -10,50 +10,50 @@ discard block |
||
| 10 | 10 | global $wpdb; |
| 11 | 11 | |
| 12 | 12 | if (get_option('geodirectory' . '_db_version') != GEODIRECTORY_VERSION) {
|
| 13 | - /** |
|
| 14 | - * Include custom database table related functions. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - */ |
|
| 19 | - include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | - add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | - if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | - add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | - } |
|
| 13 | + /** |
|
| 14 | + * Include custom database table related functions. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + */ |
|
| 19 | + include_once('geodirectory-admin/admin_db_install.php');
|
|
| 20 | + add_action('plugins_loaded', 'geodirectory_upgrade_all', 10);
|
|
| 21 | + if (GEODIRECTORY_VERSION <= '1.3.6') {
|
|
| 22 | + add_action('plugins_loaded', 'geodir_upgrade_136', 11);
|
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | - add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | - } |
|
| 25 | + if (GEODIRECTORY_VERSION <= '1.4.6') {
|
|
| 26 | + add_action('init', 'geodir_upgrade_146', 11);
|
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | - add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | - } |
|
| 29 | + if (GEODIRECTORY_VERSION <= '1.4.8') {
|
|
| 30 | + add_action('init', 'geodir_upgrade_148', 11);
|
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | - add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | - } |
|
| 33 | + if (GEODIRECTORY_VERSION <= '1.5.0') {
|
|
| 34 | + add_action('init', 'geodir_upgrade_150', 11);
|
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | - add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | - } |
|
| 37 | + if (GEODIRECTORY_VERSION <= '1.5.2') {
|
|
| 38 | + add_action('init', 'geodir_upgrade_152', 11);
|
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | - add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | - } |
|
| 41 | + if (GEODIRECTORY_VERSION <= '1.5.3') {
|
|
| 42 | + add_action('init', 'geodir_upgrade_153', 11);
|
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | - add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | - } |
|
| 45 | + if (GEODIRECTORY_VERSION <= '1.5.4') {
|
|
| 46 | + add_action('init', 'geodir_upgrade_154', 11);
|
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - if (GEODIRECTORY_VERSION <= '1.6.6') {
|
|
| 50 | - add_action('init', 'geodir_upgrade_166', 11);
|
|
| 51 | - } |
|
| 49 | + if (GEODIRECTORY_VERSION <= '1.6.6') {
|
|
| 50 | + add_action('init', 'geodir_upgrade_166', 11);
|
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | - add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 54 | + add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
|
|
| 55 | 55 | |
| 56 | - update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 56 | + update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
|
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | function geodirectory_upgrade_all() |
| 68 | 68 | {
|
| 69 | - geodir_create_tables(); |
|
| 70 | - geodir_update_review_db(); |
|
| 71 | - gd_install_theme_compat(); |
|
| 69 | + geodir_create_tables(); |
|
| 70 | + geodir_update_review_db(); |
|
| 71 | + gd_install_theme_compat(); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | function geodir_upgrade_136() |
| 81 | 81 | {
|
| 82 | - geodir_fix_review_overall_rating(); |
|
| 82 | + geodir_fix_review_overall_rating(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @package GeoDirectory |
| 90 | 90 | */ |
| 91 | 91 | function geodir_upgrade_146(){
|
| 92 | - gd_convert_virtual_pages(); |
|
| 92 | + gd_convert_virtual_pages(); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @package GeoDirectory |
| 100 | 100 | */ |
| 101 | 101 | function geodir_upgrade_150(){
|
| 102 | - gd_fix_cpt_rewrite_slug(); |
|
| 102 | + gd_fix_cpt_rewrite_slug(); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | * @package GeoDirectory |
| 112 | 112 | */ |
| 113 | 113 | function geodir_upgrade_148(){
|
| 114 | - /* |
|
| 114 | + /* |
|
| 115 | 115 | * Blank the users google password if present as we now use oAuth 2.0 |
| 116 | 116 | */ |
| 117 | - update_option('geodir_ga_pass','');
|
|
| 118 | - update_option('geodir_ga_user','');
|
|
| 117 | + update_option('geodir_ga_pass','');
|
|
| 118 | + update_option('geodir_ga_user','');
|
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * @package GeoDirectory |
| 128 | 128 | */ |
| 129 | 129 | function geodir_upgrade_153(){
|
| 130 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 131 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 130 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 131 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @package GeoDirectory |
| 139 | 139 | */ |
| 140 | 140 | function geodir_upgrade_154(){
|
| 141 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 141 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @package GeoDirectory |
| 149 | 149 | */ |
| 150 | 150 | function geodir_upgrade_152(){
|
| 151 | - gd_fix_address_detail_table_limit(); |
|
| 151 | + gd_fix_address_detail_table_limit(); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @package GeoDirectory |
| 159 | 159 | */ |
| 160 | 160 | function geodir_upgrade_166(){
|
| 161 | - gd_convert_custom_field_display(); |
|
| 161 | + gd_convert_custom_field_display(); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | function geodir_update_review_db() |
| 174 | 174 | {
|
| 175 | - global $wpdb, $plugin_prefix; |
|
| 175 | + global $wpdb, $plugin_prefix; |
|
| 176 | 176 | |
| 177 | - geodir_fix_review_date(); |
|
| 178 | - geodir_fix_review_post_status(); |
|
| 179 | - geodir_fix_review_content(); |
|
| 180 | - geodir_fix_review_location(); |
|
| 177 | + geodir_fix_review_date(); |
|
| 178 | + geodir_fix_review_post_status(); |
|
| 179 | + geodir_fix_review_content(); |
|
| 180 | + geodir_fix_review_location(); |
|
| 181 | 181 | |
| 182 | 182 | } |
| 183 | 183 | |
@@ -190,8 +190,8 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | function geodir_fix_review_date() |
| 192 | 192 | {
|
| 193 | - global $wpdb; |
|
| 194 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 193 | + global $wpdb; |
|
| 194 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.post_date = c.comment_date WHERE gdr.post_date='0000-00-00 00:00:00'");
|
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | function geodir_fix_review_post_status() |
| 205 | 205 | {
|
| 206 | - global $wpdb; |
|
| 207 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 206 | + global $wpdb; |
|
| 207 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->posts p ON gdr.post_id=p.ID SET gdr.post_status = 1 WHERE gdr.post_status IS NULL AND p.post_status='publish'");
|
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | function geodir_fix_review_content() |
| 219 | 219 | {
|
| 220 | - global $wpdb; |
|
| 221 | - if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 222 | - return true; |
|
| 223 | - } else {
|
|
| 224 | - return false; |
|
| 225 | - } |
|
| 220 | + global $wpdb; |
|
| 221 | + if ($wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN $wpdb->comments c ON gdr.comment_id=c.comment_ID SET gdr.comment_content = c.comment_content WHERE gdr.comment_content IS NULL")) {
|
|
| 222 | + return true; |
|
| 223 | + } else {
|
|
| 224 | + return false; |
|
| 225 | + } |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -235,20 +235,20 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | function geodir_fix_review_location() |
| 237 | 237 | {
|
| 238 | - global $wpdb; |
|
| 238 | + global $wpdb; |
|
| 239 | 239 | |
| 240 | - $all_postypes = geodir_get_posttypes(); |
|
| 240 | + $all_postypes = geodir_get_posttypes(); |
|
| 241 | 241 | |
| 242 | - if (!empty($all_postypes)) {
|
|
| 243 | - foreach ($all_postypes as $key) {
|
|
| 244 | - // update each GD CTP |
|
| 242 | + if (!empty($all_postypes)) {
|
|
| 243 | + foreach ($all_postypes as $key) {
|
|
| 244 | + // update each GD CTP |
|
| 245 | 245 | |
| 246 | - $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 246 | + $wpdb->query("UPDATE " . GEODIR_REVIEW_TABLE . " gdr JOIN " . $wpdb->prefix . "geodir_" . $key . "_detail d ON gdr.post_id=d.post_id SET gdr.post_latitude = d.post_latitude, gdr.post_longitude = d.post_longitude, gdr.post_city = d.post_city, gdr.post_region=d.post_region, gdr.post_country=d.post_country WHERE gdr.post_latitude IS NULL OR gdr.post_city IS NULL");
|
|
| 247 | 247 | |
| 248 | - } |
|
| 249 | - return true; |
|
| 250 | - } |
|
| 251 | - return false; |
|
| 248 | + } |
|
| 249 | + return true; |
|
| 250 | + } |
|
| 251 | + return false; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -260,82 +260,82 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | function geodir_fix_review_overall_rating() |
| 262 | 262 | {
|
| 263 | - global $wpdb; |
|
| 263 | + global $wpdb; |
|
| 264 | 264 | |
| 265 | - $all_postypes = geodir_get_posttypes(); |
|
| 265 | + $all_postypes = geodir_get_posttypes(); |
|
| 266 | 266 | |
| 267 | - if (!empty($all_postypes)) {
|
|
| 268 | - foreach ($all_postypes as $key) {
|
|
| 269 | - // update each GD CTP |
|
| 270 | - $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 267 | + if (!empty($all_postypes)) {
|
|
| 268 | + foreach ($all_postypes as $key) {
|
|
| 269 | + // update each GD CTP |
|
| 270 | + $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 271 | 271 | |
| 272 | - if (!empty($reviews)) {
|
|
| 273 | - foreach ($reviews as $post_id) {
|
|
| 274 | - geodir_update_postrating($post_id->post_id, $key); |
|
| 275 | - } |
|
| 272 | + if (!empty($reviews)) {
|
|
| 273 | + foreach ($reviews as $post_id) {
|
|
| 274 | + geodir_update_postrating($post_id->post_id, $key); |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - } |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - } |
|
| 281 | + } |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | function gd_convert_custom_field_display(){
|
| 286 | - global $wpdb; |
|
| 286 | + global $wpdb; |
|
| 287 | 287 | |
| 288 | - $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 288 | + $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 289 | 289 | |
| 290 | - $has_run = get_option('gd_convert_custom_field_display');
|
|
| 291 | - if($has_run){return;}
|
|
| 290 | + $has_run = get_option('gd_convert_custom_field_display');
|
|
| 291 | + if($has_run){return;}
|
|
| 292 | 292 | |
| 293 | - // set the field_type_key for standard fields |
|
| 294 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 293 | + // set the field_type_key for standard fields |
|
| 294 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
|
|
| 295 | 295 | |
| 296 | 296 | |
| 297 | - if(is_array( $field_info)){
|
|
| 297 | + if(is_array( $field_info)){
|
|
| 298 | 298 | |
| 299 | - foreach( $field_info as $cf){
|
|
| 299 | + foreach( $field_info as $cf){
|
|
| 300 | 300 | |
| 301 | - $id = $cf->id; |
|
| 301 | + $id = $cf->id; |
|
| 302 | 302 | |
| 303 | - if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 303 | + if(!property_exists($cf,'show_in') || !$id){return;}
|
|
| 304 | 304 | |
| 305 | - $show_in_arr = array(); |
|
| 305 | + $show_in_arr = array(); |
|
| 306 | 306 | |
| 307 | - if($cf->is_default){
|
|
| 308 | - $show_in_arr[] = "[detail]"; |
|
| 309 | - } |
|
| 307 | + if($cf->is_default){
|
|
| 308 | + $show_in_arr[] = "[detail]"; |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | - if($cf->show_on_detail){
|
|
| 312 | - $show_in_arr[] = "[moreinfo]"; |
|
| 313 | - } |
|
| 311 | + if($cf->show_on_detail){
|
|
| 312 | + $show_in_arr[] = "[moreinfo]"; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - if($cf->show_on_listing){
|
|
| 316 | - $show_in_arr[] = "[listing]"; |
|
| 317 | - } |
|
| 315 | + if($cf->show_on_listing){
|
|
| 316 | + $show_in_arr[] = "[listing]"; |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | - if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 320 | - $show_in_arr[] = "[owntab]"; |
|
| 321 | - } |
|
| 319 | + if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
|
|
| 320 | + $show_in_arr[] = "[owntab]"; |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 324 | - $show_in_arr[] = "[mapbubble]"; |
|
| 325 | - } |
|
| 323 | + if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
|
|
| 324 | + $show_in_arr[] = "[mapbubble]"; |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - if(!empty($show_in_arr )){
|
|
| 328 | - $show_in_arr = implode(',',$show_in_arr);
|
|
| 329 | - }else{
|
|
| 330 | - $show_in_arr = ''; |
|
| 331 | - } |
|
| 327 | + if(!empty($show_in_arr )){
|
|
| 328 | + $show_in_arr = implode(',',$show_in_arr);
|
|
| 329 | + }else{
|
|
| 330 | + $show_in_arr = ''; |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 333 | + $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
|
|
| 334 | 334 | |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - update_option('gd_convert_custom_field_display',1);
|
|
| 338 | - } |
|
| 337 | + update_option('gd_convert_custom_field_display',1);
|
|
| 338 | + } |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | ############################################ |
@@ -351,367 +351,367 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | function gd_install_theme_compat() |
| 353 | 353 | {
|
| 354 | - global $wpdb; |
|
| 354 | + global $wpdb; |
|
| 355 | 355 | |
| 356 | - $theme_compat = array(); |
|
| 357 | - $theme_compat = get_option('gd_theme_compats');
|
|
| 356 | + $theme_compat = array(); |
|
| 357 | + $theme_compat = get_option('gd_theme_compats');
|
|
| 358 | 358 | //GDF |
| 359 | - $theme_compat['GeoDirectory_Framework'] = array( |
|
| 360 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 361 | - 'geodir_wrapper_open_class' => '', |
|
| 362 | - 'geodir_wrapper_open_replace' => '', |
|
| 363 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 364 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 365 | - 'geodir_wrapper_content_open_class' => '', |
|
| 366 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 367 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 368 | - 'geodir_article_open_id' => '', |
|
| 369 | - 'geodir_article_open_class' => '', |
|
| 370 | - 'geodir_article_open_replace' => '', |
|
| 371 | - 'geodir_article_close_replace' => '', |
|
| 372 | - 'geodir_sidebar_right_open_id' => '', |
|
| 373 | - 'geodir_sidebar_right_open_class' => '', |
|
| 374 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 375 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 376 | - 'geodir_sidebar_left_open_id' => '', |
|
| 377 | - 'geodir_sidebar_left_open_class' => '', |
|
| 378 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 379 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 380 | - 'geodir_main_content_open_id' => '', |
|
| 381 | - 'geodir_main_content_open_class' => '', |
|
| 382 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 383 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 384 | - 'geodir_top_content_add' => '', |
|
| 385 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 386 | - 'geodir_before_widget_filter' => '', |
|
| 387 | - 'geodir_after_widget_filter' => '', |
|
| 388 | - 'geodir_theme_compat_css' => '', |
|
| 389 | - 'geodir_theme_compat_js' => '', |
|
| 390 | - 'geodir_theme_compat_default_options' => '', |
|
| 391 | - 'geodir_theme_compat_code' => '' |
|
| 392 | - ); |
|
| 359 | + $theme_compat['GeoDirectory_Framework'] = array( |
|
| 360 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 361 | + 'geodir_wrapper_open_class' => '', |
|
| 362 | + 'geodir_wrapper_open_replace' => '', |
|
| 363 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 364 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 365 | + 'geodir_wrapper_content_open_class' => '', |
|
| 366 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 367 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 368 | + 'geodir_article_open_id' => '', |
|
| 369 | + 'geodir_article_open_class' => '', |
|
| 370 | + 'geodir_article_open_replace' => '', |
|
| 371 | + 'geodir_article_close_replace' => '', |
|
| 372 | + 'geodir_sidebar_right_open_id' => '', |
|
| 373 | + 'geodir_sidebar_right_open_class' => '', |
|
| 374 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 375 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 376 | + 'geodir_sidebar_left_open_id' => '', |
|
| 377 | + 'geodir_sidebar_left_open_class' => '', |
|
| 378 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 379 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 380 | + 'geodir_main_content_open_id' => '', |
|
| 381 | + 'geodir_main_content_open_class' => '', |
|
| 382 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 383 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 384 | + 'geodir_top_content_add' => '', |
|
| 385 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 386 | + 'geodir_before_widget_filter' => '', |
|
| 387 | + 'geodir_after_widget_filter' => '', |
|
| 388 | + 'geodir_theme_compat_css' => '', |
|
| 389 | + 'geodir_theme_compat_js' => '', |
|
| 390 | + 'geodir_theme_compat_default_options' => '', |
|
| 391 | + 'geodir_theme_compat_code' => '' |
|
| 392 | + ); |
|
| 393 | 393 | |
| 394 | 394 | //Directory Theme |
| 395 | - $theme_compat['Directory_Starter'] = array( |
|
| 396 | - 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 397 | - 'geodir_wrapper_open_class' => '', |
|
| 398 | - 'geodir_wrapper_open_replace' => '', |
|
| 399 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 400 | - 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 401 | - 'geodir_wrapper_content_open_class' => '', |
|
| 402 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 403 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 404 | - 'geodir_article_open_id' => '', |
|
| 405 | - 'geodir_article_open_class' => '', |
|
| 406 | - 'geodir_article_open_replace' => '', |
|
| 407 | - 'geodir_article_close_replace' => '', |
|
| 408 | - 'geodir_sidebar_right_open_id' => '', |
|
| 409 | - 'geodir_sidebar_right_open_class' => '', |
|
| 410 | - 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 411 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 412 | - 'geodir_sidebar_left_open_id' => '', |
|
| 413 | - 'geodir_sidebar_left_open_class' => '', |
|
| 414 | - 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 415 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 416 | - 'geodir_main_content_open_id' => '', |
|
| 417 | - 'geodir_main_content_open_class' => '', |
|
| 418 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 419 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 420 | - 'geodir_top_content_add' => '', |
|
| 421 | - 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 422 | - 'geodir_before_widget_filter' => '', |
|
| 423 | - 'geodir_after_widget_filter' => '', |
|
| 424 | - 'geodir_theme_compat_css' => '', |
|
| 425 | - 'geodir_theme_compat_js' => '', |
|
| 426 | - 'geodir_theme_compat_default_options' => '', |
|
| 427 | - 'geodir_theme_compat_code' => '' |
|
| 428 | - ); |
|
| 395 | + $theme_compat['Directory_Starter'] = array( |
|
| 396 | + 'geodir_wrapper_open_id' => 'geodir_wrapper', |
|
| 397 | + 'geodir_wrapper_open_class' => '', |
|
| 398 | + 'geodir_wrapper_open_replace' => '', |
|
| 399 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 400 | + 'geodir_wrapper_content_open_id' => 'geodir_content', |
|
| 401 | + 'geodir_wrapper_content_open_class' => '', |
|
| 402 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 403 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 404 | + 'geodir_article_open_id' => '', |
|
| 405 | + 'geodir_article_open_class' => '', |
|
| 406 | + 'geodir_article_open_replace' => '', |
|
| 407 | + 'geodir_article_close_replace' => '', |
|
| 408 | + 'geodir_sidebar_right_open_id' => '', |
|
| 409 | + 'geodir_sidebar_right_open_class' => '', |
|
| 410 | + 'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 411 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 412 | + 'geodir_sidebar_left_open_id' => '', |
|
| 413 | + 'geodir_sidebar_left_open_class' => '', |
|
| 414 | + 'geodir_sidebar_left_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 415 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 416 | + 'geodir_main_content_open_id' => '', |
|
| 417 | + 'geodir_main_content_open_class' => '', |
|
| 418 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 419 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 420 | + 'geodir_top_content_add' => '', |
|
| 421 | + 'geodir_before_main_content_add' => '<div class="clearfix geodir-common">', |
|
| 422 | + 'geodir_before_widget_filter' => '', |
|
| 423 | + 'geodir_after_widget_filter' => '', |
|
| 424 | + 'geodir_theme_compat_css' => '', |
|
| 425 | + 'geodir_theme_compat_js' => '', |
|
| 426 | + 'geodir_theme_compat_default_options' => '', |
|
| 427 | + 'geodir_theme_compat_code' => '' |
|
| 428 | + ); |
|
| 429 | 429 | |
| 430 | 430 | //Jobby |
| 431 | - $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 431 | + $theme_compat['Jobby'] = $theme_compat['Directory_Starter']; |
|
| 432 | 432 | |
| 433 | 433 | //GeoProperty |
| 434 | - $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 434 | + $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter']; |
|
| 435 | 435 | |
| 436 | 436 | //Avada |
| 437 | - $theme_compat['Avada'] = array( |
|
| 438 | - 'geodir_wrapper_open_id' => '', |
|
| 439 | - 'geodir_wrapper_open_class' => '', |
|
| 440 | - 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 441 | - 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 442 | - 'geodir_wrapper_content_open_id' => 'content', |
|
| 443 | - 'geodir_wrapper_content_open_class' => '', |
|
| 444 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 445 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 446 | - 'geodir_article_open_id' => '', |
|
| 447 | - 'geodir_article_open_class' => '', |
|
| 448 | - 'geodir_article_open_replace' => '', |
|
| 449 | - 'geodir_article_close_replace' => '', |
|
| 450 | - 'geodir_sidebar_right_open_id' => '', |
|
| 451 | - 'geodir_sidebar_right_open_class' => '', |
|
| 452 | - 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 453 | - 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 454 | - 'geodir_sidebar_left_open_id' => '', |
|
| 455 | - 'geodir_sidebar_left_open_class' => '', |
|
| 456 | - 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 457 | - 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 458 | - 'geodir_main_content_open_id' => '', |
|
| 459 | - 'geodir_main_content_open_class' => '', |
|
| 460 | - 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 461 | - 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 462 | - 'geodir_top_content_add' => '', |
|
| 463 | - 'geodir_before_main_content_add' => '', |
|
| 464 | - 'geodir_before_widget_filter' => '', |
|
| 465 | - 'geodir_after_widget_filter' => '', |
|
| 466 | - 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 467 | - 'geodir_theme_compat_js' => '', |
|
| 468 | - 'geodir_theme_compat_default_options' => '', |
|
| 469 | - 'geodir_theme_compat_code' => 'Avada' |
|
| 470 | - ); |
|
| 437 | + $theme_compat['Avada'] = array( |
|
| 438 | + 'geodir_wrapper_open_id' => '', |
|
| 439 | + 'geodir_wrapper_open_class' => '', |
|
| 440 | + 'geodir_wrapper_open_replace' => '<!-- removed -->', |
|
| 441 | + 'geodir_wrapper_close_replace' => '<!-- removed -->', |
|
| 442 | + 'geodir_wrapper_content_open_id' => 'content', |
|
| 443 | + 'geodir_wrapper_content_open_class' => '', |
|
| 444 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 445 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 446 | + 'geodir_article_open_id' => '', |
|
| 447 | + 'geodir_article_open_class' => '', |
|
| 448 | + 'geodir_article_open_replace' => '', |
|
| 449 | + 'geodir_article_close_replace' => '', |
|
| 450 | + 'geodir_sidebar_right_open_id' => '', |
|
| 451 | + 'geodir_sidebar_right_open_class' => '', |
|
| 452 | + 'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 453 | + 'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->', |
|
| 454 | + 'geodir_sidebar_left_open_id' => '', |
|
| 455 | + 'geodir_sidebar_left_open_class' => '', |
|
| 456 | + 'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>', |
|
| 457 | + 'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->', |
|
| 458 | + 'geodir_main_content_open_id' => '', |
|
| 459 | + 'geodir_main_content_open_class' => '', |
|
| 460 | + 'geodir_main_content_open_replace' => '<!-- removed -->', |
|
| 461 | + 'geodir_main_content_close_replace' => '<!-- removed -->', |
|
| 462 | + 'geodir_top_content_add' => '', |
|
| 463 | + 'geodir_before_main_content_add' => '', |
|
| 464 | + 'geodir_before_widget_filter' => '', |
|
| 465 | + 'geodir_after_widget_filter' => '', |
|
| 466 | + 'geodir_theme_compat_css' => stripslashes('.geodir-sidebar-left{float:left}select,textarea{border-style:solid;border-width:1px}.top-menu li > div{visibility:visible}.geodir-chosen-container-single .chosen-single{height:auto}ul li#menu-item-gd-location-switcher ul{width:222px}ul li#menu-item-gd-location-switcher ul li{padding-right:0!important}#mobile-nav li#mobile-menu-item-gd-location-switcher li a{padding-left:10px;padding-right:10px}#menu-item-gd-location-switcher dd,#mobile-menu-item-gd-location-switcher{margin-left:0}#menu-item-gd-location-switcher dd a{display:block}.geodir-chosen-container .chosen-results li.highlighted{background-color:#eee;background-image:none;color:#444}#mobile-nav li.mobile-nav-item li a:before{content:\'\';margin:0}#mobile-nav li.mobile-nav-item li a{padding:10px;width:auto}.geodir-listing-search{text-align:center}.geodir-search{float:none;margin:0}.geodir-search select,.geodir-search .search_by_post,.geodir-search input[type="text"],.geodir-search button[type="button"], .geodir-search input[type="button"],.geodir-search input[type="submit"]{display:inline-block;float:none}.geodir-cat-list ul li,.map_category ul li{list-style-type:none}.wpgeo-avada .page-title ul li:after{content:\'\'}.top_banner_section{margin-bottom:0}.geodir-category-list-in{margin:0;padding:15px}.geodir_full_page .geodir-cat-list .widget-title{margin-top:0}.geodir_full_page .geodir-cat-list ul li{padding-left:0}.geodir-loc-bar{border:none;margin:0;padding:0}.geodir-loc-bar-in{padding:15px 0}.geodir_full_page section.widget{margin-bottom:20px}.sidebar .geodir-loginbox-list li{margin-bottom:10px;padding-bottom:10px}.sidebar .geodir-loginbox-list li a{display:block}.sidebar .geodir-chosen-container .chosen-results li{margin:0;padding:5px 6px}.sidebar .geodir-chosen-container .chosen-results li.highlighted{background:#eee;background-image:none;color:#000}.sidebar .geodir_category_list_view li.geodir-gridview{display:inline-block;margin-bottom:15px}.wpgeo-avada.double-sidebars #main #sidebar{margin-left:3%}.wpgeo-avada.double-sidebars #main #sidebar-2{margin-left:-100%}.wpgeo-avada.double-sidebars #content{float:left;margin-left:0}.geodir_full_page section.widget{margin-bottom: 0px;} .sidebar .widget .geodir-hide {display: none;}li.fusion-mobile-nav-item .geodir_location_tab_container a:before{content: "" !important; margin-right: auto !important;}li.fusion-mobile-nav-item .geodir_location_tab_container a{padding-left:5px !important;}'),
|
|
| 467 | + 'geodir_theme_compat_js' => '', |
|
| 468 | + 'geodir_theme_compat_default_options' => '', |
|
| 469 | + 'geodir_theme_compat_code' => 'Avada' |
|
| 470 | + ); |
|
| 471 | 471 | |
| 472 | 472 | //Enfold |
| 473 | - $theme_compat['Enfold'] = array( |
|
| 474 | - 'geodir_wrapper_open_id' => '', |
|
| 475 | - 'geodir_wrapper_open_class' => '', |
|
| 476 | - 'geodir_wrapper_open_replace' => '', |
|
| 477 | - 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 478 | - 'geodir_wrapper_content_open_id' => '', |
|
| 479 | - 'geodir_wrapper_content_open_class' => '', |
|
| 480 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 481 | - 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 482 | - 'geodir_article_open_id' => '', |
|
| 483 | - 'geodir_article_open_class' => '', |
|
| 484 | - 'geodir_article_open_replace' => '', |
|
| 485 | - 'geodir_article_close_replace' => '', |
|
| 486 | - 'geodir_sidebar_right_open_id' => '', |
|
| 487 | - 'geodir_sidebar_right_open_class' => '', |
|
| 488 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 489 | - 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 490 | - 'geodir_sidebar_left_open_id' => '', |
|
| 491 | - 'geodir_sidebar_left_open_class' => '', |
|
| 492 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 493 | - 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 494 | - 'geodir_main_content_open_id' => '', |
|
| 495 | - 'geodir_main_content_open_class' => '', |
|
| 496 | - 'geodir_main_content_open_replace' => '', |
|
| 497 | - 'geodir_main_content_close_replace' => '', |
|
| 498 | - 'geodir_top_content_add' => '', |
|
| 499 | - 'geodir_before_main_content_add' => '', |
|
| 500 | - 'geodir_before_widget_filter' => '', |
|
| 501 | - 'geodir_after_widget_filter' => '', |
|
| 502 | - 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 503 | - 'geodir_theme_compat_js' => '', |
|
| 504 | - 'geodir_theme_compat_default_options' => '', |
|
| 505 | - 'geodir_theme_compat_code' => 'Enfold' |
|
| 506 | - ); |
|
| 473 | + $theme_compat['Enfold'] = array( |
|
| 474 | + 'geodir_wrapper_open_id' => '', |
|
| 475 | + 'geodir_wrapper_open_class' => '', |
|
| 476 | + 'geodir_wrapper_open_replace' => '', |
|
| 477 | + 'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->', |
|
| 478 | + 'geodir_wrapper_content_open_id' => '', |
|
| 479 | + 'geodir_wrapper_content_open_class' => '', |
|
| 480 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 481 | + 'geodir_wrapper_content_close_replace' => '</div></main>', |
|
| 482 | + 'geodir_article_open_id' => '', |
|
| 483 | + 'geodir_article_open_class' => '', |
|
| 484 | + 'geodir_article_open_replace' => '', |
|
| 485 | + 'geodir_article_close_replace' => '', |
|
| 486 | + 'geodir_sidebar_right_open_id' => '', |
|
| 487 | + 'geodir_sidebar_right_open_class' => '', |
|
| 488 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 489 | + 'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 490 | + 'geodir_sidebar_left_open_id' => '', |
|
| 491 | + 'geodir_sidebar_left_open_class' => '', |
|
| 492 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 493 | + 'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->', |
|
| 494 | + 'geodir_main_content_open_id' => '', |
|
| 495 | + 'geodir_main_content_open_class' => '', |
|
| 496 | + 'geodir_main_content_open_replace' => '', |
|
| 497 | + 'geodir_main_content_close_replace' => '', |
|
| 498 | + 'geodir_top_content_add' => '', |
|
| 499 | + 'geodir_before_main_content_add' => '', |
|
| 500 | + 'geodir_before_widget_filter' => '', |
|
| 501 | + 'geodir_after_widget_filter' => '', |
|
| 502 | + 'geodir_theme_compat_css' => stripslashes('.geodir_full_page .top_banner_section{margin-bottom:0}.widget .geodir-cat-list ul li{clear:none}.wpgeo-enfold .av-main-nav ul{width:222px}.geodir-listing-search .geodir-loc-bar{border-top:none;padding:0}#main .geodir-listing-search,.geodir-listing-search .geodir-loc-bar{margin-bottom:0}#main .geodir-loc-bar-in,#main .geodir-category-list-in{background-color:#fcfcfc;margin:20px 0;padding:20px}#main .geodir_full_page .geodir-loc-bar-in,#main .geodir_full_page .geodir-loc-bar,#main .geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}#main .geodir-loc-bar-in{padding:20px}#main .geodir-search{margin:0;width:100%}#main .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#main .geodir-search input[type="text"]{margin:0 3% 0 0;padding:10px;width:32.4%}#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"]{font-size:inherit;line-height:2.25;margin:0;padding:7px;width:13%}.enfold-home-top section.widget{margin:0;padding:0}.enfold-home-top .top_banner_section{margin-bottom:0}.enfold-home-top .geodir-loc-bar{background:#fcfcfc;border:none;margin:0;padding:0}#main .enfold-home-top .geodir-loc-bar-in{background:none;border:none;margin:0 auto;padding:20px 0}#main .geodir-breadcrumb{border-bottom-style:solid;border-bottom-width:1px}#gd-tabs dt{clear:none}#geodir_slider ul li{list-style-type:none;margin:0;padding:0}#respond{clear:both}#comments .comments-title span{display:inline;font-size:inherit;font-weight:700}#reviewsTab .comments-area .bypostauthor cite span{display:inline}#top #comments .commentlist .comment,#top #comments .commentlist .comment > div{min-height:0}.commentlist .commenttext{padding-top:15px}#comment_imagesdropbox{margin-bottom:20px}.wpgeo-enfold .geodir_category_list_view li{margin-left:0;padding:0}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_category_list_view li .geodir-post-img{display:block}.wpgeo-enfold .geodir_event_listing_calendar tr.title{background:#ccc}@media only screen and (max-width:480px){.geodir_category_list_view li .geodir-content,.geodir_category_list_view li .geodir-post-img,.geodir_category_list_view li .geodir-addinfo{float:none;width:100%;margin:10px 0}#main .geodir-search input[type="text"],#main .geodir-search input[type="button"],#main .geodir-search input[type="submit"],#main .geodir-search select{margin:10px 0;width:100%}}#main .geodir_full_page section:last-child .geodir-loc-bar{margin-bottom: -1px;border-bottom: none;}'),
|
|
| 503 | + 'geodir_theme_compat_js' => '', |
|
| 504 | + 'geodir_theme_compat_default_options' => '', |
|
| 505 | + 'geodir_theme_compat_code' => 'Enfold' |
|
| 506 | + ); |
|
| 507 | 507 | |
| 508 | 508 | // X |
| 509 | - $theme_compat['X'] = array( |
|
| 510 | - 'geodir_wrapper_open_id' => '', |
|
| 511 | - 'geodir_wrapper_open_class' => '', |
|
| 512 | - 'geodir_wrapper_open_replace' => '', |
|
| 513 | - 'geodir_wrapper_close_replace' => '', |
|
| 514 | - 'geodir_wrapper_content_open_id' => '', |
|
| 515 | - 'geodir_wrapper_content_open_class' => '', |
|
| 516 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 517 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 518 | - 'geodir_article_open_id' => '', |
|
| 519 | - 'geodir_article_open_class' => '', |
|
| 520 | - 'geodir_article_open_replace' => '', |
|
| 521 | - 'geodir_article_close_replace' => '', |
|
| 522 | - 'geodir_sidebar_right_open_id' => '', |
|
| 523 | - 'geodir_sidebar_right_open_class' => '', |
|
| 524 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 525 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 526 | - 'geodir_sidebar_left_open_id' => '', |
|
| 527 | - 'geodir_sidebar_left_open_class' => '', |
|
| 528 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 529 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 530 | - 'geodir_main_content_open_id' => '', |
|
| 531 | - 'geodir_main_content_open_class' => '', |
|
| 532 | - 'geodir_main_content_open_replace' => '', |
|
| 533 | - 'geodir_main_content_close_replace' => '', |
|
| 534 | - 'geodir_top_content_add' => '', |
|
| 535 | - 'geodir_before_main_content_add' => '', |
|
| 536 | - 'geodir_before_widget_filter' => '', |
|
| 537 | - 'geodir_after_widget_filter' => '', |
|
| 538 | - 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 539 | - 'geodir_theme_compat_js' => '', |
|
| 540 | - 'geodir_theme_compat_default_options' => '', |
|
| 541 | - 'geodir_theme_compat_code' => 'X' |
|
| 542 | - ); |
|
| 509 | + $theme_compat['X'] = array( |
|
| 510 | + 'geodir_wrapper_open_id' => '', |
|
| 511 | + 'geodir_wrapper_open_class' => '', |
|
| 512 | + 'geodir_wrapper_open_replace' => '', |
|
| 513 | + 'geodir_wrapper_close_replace' => '', |
|
| 514 | + 'geodir_wrapper_content_open_id' => '', |
|
| 515 | + 'geodir_wrapper_content_open_class' => '', |
|
| 516 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 517 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 518 | + 'geodir_article_open_id' => '', |
|
| 519 | + 'geodir_article_open_class' => '', |
|
| 520 | + 'geodir_article_open_replace' => '', |
|
| 521 | + 'geodir_article_close_replace' => '', |
|
| 522 | + 'geodir_sidebar_right_open_id' => '', |
|
| 523 | + 'geodir_sidebar_right_open_class' => '', |
|
| 524 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 525 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 526 | + 'geodir_sidebar_left_open_id' => '', |
|
| 527 | + 'geodir_sidebar_left_open_class' => '', |
|
| 528 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 529 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 530 | + 'geodir_main_content_open_id' => '', |
|
| 531 | + 'geodir_main_content_open_class' => '', |
|
| 532 | + 'geodir_main_content_open_replace' => '', |
|
| 533 | + 'geodir_main_content_close_replace' => '', |
|
| 534 | + 'geodir_top_content_add' => '', |
|
| 535 | + 'geodir_before_main_content_add' => '', |
|
| 536 | + 'geodir_before_widget_filter' => '', |
|
| 537 | + 'geodir_after_widget_filter' => '', |
|
| 538 | + 'geodir_theme_compat_css' => stripslashes('.x-colophon.bottom{clear:both}#geodir-main-content,.geodir_flex-container{margin-top:16px}.geodir-x ul{list-style:none}.widget ul.geodir_category_list_view{border:none}.geodir_category_list_view li.geodir-gridview:last-child{border-bottom:1px solid #e1e1e1}.home .x-header-landmark{display:none}.geodir-x .x-main .geodir_advance_search_widget{margin:0}.geodir-x .top_banner_section{margin-bottom:0}.geodir-loc-bar{background:rgba(0,0,0,0.05);margin:0;padding:0}.geodir-loc-bar-in{background:none;border:none;padding:10px}.geodir-search{margin:0;width:100%}.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{border:1px solid #ccc;box-shadow:none;height:auto;line-height:21px;margin:0 1% 0 0;padding:5px 10px}.widget .geodir-search select,.geodir-search input[type="text"]{width:28%}.geodir-search input[type="submit"],.geodir-search input[type="button"]{line-height:19px;margin-right:0;width:11%}.geodir-search input:hover[type="submit"],.geodir-search input:hover[type="button"]{background:#333;color:#fff}.geodir-cat-list .widget-title{margin-top:0}.geodir-x .geodir-category-list-in{background:rgba(0,0,0,0.05);border:none}.widget .geodir-cat-list ul.geodir-popular-cat-list{border:none;border-radius:0;box-shadow:none}.geodir_full_page .geodir-cat-list ul li{border:none}.geodir_full_page .geodir-cat-list ul li a{border:none}.post-type-archive .geodir-loc-bar{border:none;margin-top:20px}#menu-item-gd-location-switcher dd{margin-left:0}.geodir-chosen-container-single .chosen-single{height:auto}.widget ul.geodir-loginbox-list{overflow:visible}.geodir_full_page section.widget{clear:both}.x-ethos .entry-title{margin-bottom:20px}.x-ethos .geodir-chosen-container-single .chosen-single{padding:0 0 0 8px}.x-ethos .widget ul li a,.x-ethos .geodir_category_list_view li{color:#333}@media only screen and (max-width:767px){.widget .geodir-search select,.geodir-search input[type="text"],.geodir-search input[type="button"],.geodir-search input[type="submit"]{margin:0 0 10px;width:100%}}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-loc-bar,.geodir_full_page .geodir-category-list-in{margin-top:0;margin-bottom:0}.geodir_full_page .geodir-loc-bar-in,.geodir_full_page .geodir-category-list-in{border-bottom:1px solid rgba(0,0,0,0.1)}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 539 | + 'geodir_theme_compat_js' => '', |
|
| 540 | + 'geodir_theme_compat_default_options' => '', |
|
| 541 | + 'geodir_theme_compat_code' => 'X' |
|
| 542 | + ); |
|
| 543 | 543 | |
| 544 | 544 | // Divi |
| 545 | - $theme_compat['Divi'] = array( |
|
| 546 | - 'geodir_wrapper_open_id' => 'main-content', |
|
| 547 | - 'geodir_wrapper_open_class' => '', |
|
| 548 | - 'geodir_wrapper_open_replace' => '', |
|
| 549 | - 'geodir_wrapper_close_replace' => '', |
|
| 550 | - 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 551 | - 'geodir_wrapper_content_open_class' => '', |
|
| 552 | - 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 553 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 554 | - 'geodir_article_open_id' => '', |
|
| 555 | - 'geodir_article_open_class' => '', |
|
| 556 | - 'geodir_article_open_replace' => '', |
|
| 557 | - 'geodir_article_close_replace' => '', |
|
| 558 | - 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 559 | - 'geodir_sidebar_right_open_class' => '', |
|
| 560 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 561 | - 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 562 | - 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 563 | - 'geodir_sidebar_left_open_class' => '', |
|
| 564 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 565 | - 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 566 | - 'geodir_main_content_open_id' => '', |
|
| 567 | - 'geodir_main_content_open_class' => '', |
|
| 568 | - 'geodir_main_content_open_replace' => '', |
|
| 569 | - 'geodir_main_content_close_replace' => '', |
|
| 570 | - 'geodir_top_content_add' => '', |
|
| 571 | - 'geodir_before_main_content_add' => '', |
|
| 572 | - 'geodir_before_widget_filter' => '', |
|
| 573 | - 'geodir_after_widget_filter' => '', |
|
| 574 | - 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 575 | - 'geodir_theme_compat_js' => '', |
|
| 576 | - 'geodir_theme_compat_default_options' => '', |
|
| 577 | - 'geodir_theme_compat_code' => 'Divi' |
|
| 578 | - ); |
|
| 545 | + $theme_compat['Divi'] = array( |
|
| 546 | + 'geodir_wrapper_open_id' => 'main-content', |
|
| 547 | + 'geodir_wrapper_open_class' => '', |
|
| 548 | + 'geodir_wrapper_open_replace' => '', |
|
| 549 | + 'geodir_wrapper_close_replace' => '', |
|
| 550 | + 'geodir_wrapper_content_open_id' => 'left-area', |
|
| 551 | + 'geodir_wrapper_content_open_class' => '', |
|
| 552 | + 'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >', |
|
| 553 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 554 | + 'geodir_article_open_id' => '', |
|
| 555 | + 'geodir_article_open_class' => '', |
|
| 556 | + 'geodir_article_open_replace' => '', |
|
| 557 | + 'geodir_article_close_replace' => '', |
|
| 558 | + 'geodir_sidebar_right_open_id' => 'sidebar', |
|
| 559 | + 'geodir_sidebar_right_open_class' => '', |
|
| 560 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 561 | + 'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 562 | + 'geodir_sidebar_left_open_id' => 'sidebar', |
|
| 563 | + 'geodir_sidebar_left_open_class' => '', |
|
| 564 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 565 | + 'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>', |
|
| 566 | + 'geodir_main_content_open_id' => '', |
|
| 567 | + 'geodir_main_content_open_class' => '', |
|
| 568 | + 'geodir_main_content_open_replace' => '', |
|
| 569 | + 'geodir_main_content_close_replace' => '', |
|
| 570 | + 'geodir_top_content_add' => '', |
|
| 571 | + 'geodir_before_main_content_add' => '', |
|
| 572 | + 'geodir_before_widget_filter' => '', |
|
| 573 | + 'geodir_after_widget_filter' => '', |
|
| 574 | + 'geodir_theme_compat_css' => stripslashes('#left-area ul.geodir-direction-nav{list-style-type:none}#sidebar .geodir-company_info{margin-left:30px}#sidebar .geodir-widget{float:none;margin:0 0 30px 30px}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.archive .entry-header,.geodir-breadcrumb{border-bottom:1px solid #e2e2e2}.archive .entry-header h1,ul#breadcrumbs{margin:0 auto;width:1080px}#left-area ul.geodir_category_list_view{padding:10px 0}.nav li#menu-item-gd-location-switcher ul{width:222px}#menu-item-gd-location-switcher li.gd-location-switcher-menu-item{padding-right:0}#menu-item-gd-location-switcher dd{margin-left:0}#menu-item-gd-location-switcher .geodir_location_tab_container dd a{padding:5px;width:auto}@media only screen and ( max-width: 980px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:690px}}@media only screen and ( max-width: 767px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:400px}}@media only screen and ( max-width: 479px ){.geodir-loc-bar-in,.geodir-cat-list,ul#breadcrumbs{width:280px}}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 575 | + 'geodir_theme_compat_js' => '', |
|
| 576 | + 'geodir_theme_compat_default_options' => '', |
|
| 577 | + 'geodir_theme_compat_code' => 'Divi' |
|
| 578 | + ); |
|
| 579 | 579 | |
| 580 | 580 | // Genesis |
| 581 | - $theme_compat['Genesis'] = array( |
|
| 582 | - 'geodir_wrapper_open_id' => '', |
|
| 583 | - 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 584 | - 'geodir_wrapper_open_replace' => '', |
|
| 585 | - 'geodir_wrapper_close_replace' => '', |
|
| 586 | - 'geodir_wrapper_content_open_id' => '', |
|
| 587 | - 'geodir_wrapper_content_open_class' => 'content', |
|
| 588 | - 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 589 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 590 | - 'geodir_article_open_id' => '', |
|
| 591 | - 'geodir_article_open_class' => '', |
|
| 592 | - 'geodir_article_open_replace' => '', |
|
| 593 | - 'geodir_article_close_replace' => '', |
|
| 594 | - 'geodir_sidebar_right_open_id' => '', |
|
| 595 | - 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 596 | - 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 597 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 598 | - 'geodir_sidebar_left_open_id' => '', |
|
| 599 | - 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 600 | - 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 601 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 602 | - 'geodir_main_content_open_id' => '', |
|
| 603 | - 'geodir_main_content_open_class' => '', |
|
| 604 | - 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 605 | - 'geodir_main_content_close_replace' => '', |
|
| 606 | - 'geodir_top_content_add' => '', |
|
| 607 | - 'geodir_before_main_content_add' => '', |
|
| 608 | - 'geodir_before_widget_filter' => '', |
|
| 609 | - 'geodir_after_widget_filter' => '', |
|
| 610 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 611 | - 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 612 | - 'geodir_theme_compat_js' => '', |
|
| 613 | - 'geodir_theme_compat_default_options' => '', |
|
| 614 | - 'geodir_theme_compat_code' => 'Genesis' |
|
| 615 | - ); |
|
| 581 | + $theme_compat['Genesis'] = array( |
|
| 582 | + 'geodir_wrapper_open_id' => '', |
|
| 583 | + 'geodir_wrapper_open_class' => 'content-sidebar-wrap', |
|
| 584 | + 'geodir_wrapper_open_replace' => '', |
|
| 585 | + 'geodir_wrapper_close_replace' => '', |
|
| 586 | + 'geodir_wrapper_content_open_id' => '', |
|
| 587 | + 'geodir_wrapper_content_open_class' => 'content', |
|
| 588 | + 'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >', |
|
| 589 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 590 | + 'geodir_article_open_id' => '', |
|
| 591 | + 'geodir_article_open_class' => '', |
|
| 592 | + 'geodir_article_open_replace' => '', |
|
| 593 | + 'geodir_article_close_replace' => '', |
|
| 594 | + 'geodir_sidebar_right_open_id' => '', |
|
| 595 | + 'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area', |
|
| 596 | + 'geodir_sidebar_right_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 597 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 598 | + 'geodir_sidebar_left_open_id' => '', |
|
| 599 | + 'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area', |
|
| 600 | + 'geodir_sidebar_left_open_replace' => '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">', |
|
| 601 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 602 | + 'geodir_main_content_open_id' => '', |
|
| 603 | + 'geodir_main_content_open_class' => '', |
|
| 604 | + 'geodir_main_content_open_replace' => '<main id="[id]" class="entry [class]" role="main">', |
|
| 605 | + 'geodir_main_content_close_replace' => '', |
|
| 606 | + 'geodir_top_content_add' => '', |
|
| 607 | + 'geodir_before_main_content_add' => '', |
|
| 608 | + 'geodir_before_widget_filter' => '', |
|
| 609 | + 'geodir_after_widget_filter' => '', |
|
| 610 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher', |
|
| 611 | + 'geodir_theme_compat_css' => stripslashes('.full-width-content #geodir-wrapper-content{width:100%}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}.content{float:left}.sidebar-content .content,.sidebar-content #geodir-wrapper-content{float:right}.sidebar .geodir-company_info{background-color:#fff;border:none}.geodir_full_page .geodir-loc-bar{padding:0;margin:0;border:none}.geodir_full_page .geodir-category-list-in{margin-top:0}.geodir_full_page .top_banner_section{margin-bottom:0}.geodir-breadcrumb-bar{margin-bottom:-35px} .search-page .entry-title,.listings-page .entry-title{font-size: 20px;}.site-inner .geodir-breadcrumb-bar{margin-bottom:0px}'),
|
|
| 612 | + 'geodir_theme_compat_js' => '', |
|
| 613 | + 'geodir_theme_compat_default_options' => '', |
|
| 614 | + 'geodir_theme_compat_code' => 'Genesis' |
|
| 615 | + ); |
|
| 616 | 616 | |
| 617 | 617 | // Jupiter |
| 618 | - $theme_compat['Jupiter'] = array( |
|
| 619 | - 'geodir_wrapper_open_id' => '', |
|
| 620 | - 'geodir_wrapper_open_class' => '', |
|
| 621 | - 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 622 | - 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 623 | - 'geodir_wrapper_content_open_id' => '', |
|
| 624 | - 'geodir_wrapper_content_open_class' => '', |
|
| 625 | - 'geodir_wrapper_content_open_replace' => '', |
|
| 626 | - 'geodir_wrapper_content_close_replace' => '', |
|
| 627 | - 'geodir_article_open_id' => '', |
|
| 628 | - 'geodir_article_open_class' => '', |
|
| 629 | - 'geodir_article_open_replace' => '', |
|
| 630 | - 'geodir_article_close_replace' => '', |
|
| 631 | - 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 632 | - 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 633 | - 'geodir_sidebar_right_open_replace' => '', |
|
| 634 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 635 | - 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 636 | - 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 637 | - 'geodir_sidebar_left_open_replace' => '', |
|
| 638 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 639 | - 'geodir_main_content_open_id' => '', |
|
| 640 | - 'geodir_main_content_open_class' => '', |
|
| 641 | - 'geodir_main_content_open_replace' => '', |
|
| 642 | - 'geodir_main_content_close_replace' => '', |
|
| 643 | - 'geodir_top_content_add' => '', |
|
| 644 | - 'geodir_before_main_content_add' => '', |
|
| 645 | - 'geodir_before_widget_filter' => '', |
|
| 646 | - 'geodir_after_widget_filter' => '', |
|
| 647 | - 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 648 | - 'geodir_after_title_filter' => '', |
|
| 649 | - 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 650 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 651 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 652 | - 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 653 | - 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 654 | - 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 655 | - 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 656 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 657 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 658 | - 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 659 | - 'geodir_theme_compat_js' => '', |
|
| 660 | - 'geodir_theme_compat_default_options' => '', |
|
| 661 | - 'geodir_theme_compat_code' => 'Jupiter' |
|
| 662 | - ); |
|
| 618 | + $theme_compat['Jupiter'] = array( |
|
| 619 | + 'geodir_wrapper_open_id' => '', |
|
| 620 | + 'geodir_wrapper_open_class' => '', |
|
| 621 | + 'geodir_wrapper_open_replace' => '<div id="theme-page"><div class="mk-main-wrapper-holder"><div class="theme-page-wrapper mk-main-wrapper mk-grid vc_row-fluid">', |
|
| 622 | + 'geodir_wrapper_close_replace' => '</div></div></div>', |
|
| 623 | + 'geodir_wrapper_content_open_id' => '', |
|
| 624 | + 'geodir_wrapper_content_open_class' => '', |
|
| 625 | + 'geodir_wrapper_content_open_replace' => '', |
|
| 626 | + 'geodir_wrapper_content_close_replace' => '', |
|
| 627 | + 'geodir_article_open_id' => '', |
|
| 628 | + 'geodir_article_open_class' => '', |
|
| 629 | + 'geodir_article_open_replace' => '', |
|
| 630 | + 'geodir_article_close_replace' => '', |
|
| 631 | + 'geodir_sidebar_right_open_id' => 'mk-sidebar', |
|
| 632 | + 'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 633 | + 'geodir_sidebar_right_open_replace' => '', |
|
| 634 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 635 | + 'geodir_sidebar_left_open_id' => 'mk-sidebar', |
|
| 636 | + 'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right', |
|
| 637 | + 'geodir_sidebar_left_open_replace' => '', |
|
| 638 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 639 | + 'geodir_main_content_open_id' => '', |
|
| 640 | + 'geodir_main_content_open_class' => '', |
|
| 641 | + 'geodir_main_content_open_replace' => '', |
|
| 642 | + 'geodir_main_content_close_replace' => '', |
|
| 643 | + 'geodir_top_content_add' => '', |
|
| 644 | + 'geodir_before_main_content_add' => '', |
|
| 645 | + 'geodir_before_widget_filter' => '', |
|
| 646 | + 'geodir_after_widget_filter' => '', |
|
| 647 | + 'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">', |
|
| 648 | + 'geodir_after_title_filter' => '', |
|
| 649 | + 'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu', |
|
| 650 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 651 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 652 | + 'geodir_menu_a_class_filter' => 'menu-item-link', |
|
| 653 | + 'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item', |
|
| 654 | + 'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-type-social menu-item-type-social gd-location-switcher menu-item-has-children no-mega-menu', |
|
| 655 | + 'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link', |
|
| 656 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 657 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 658 | + 'geodir_theme_compat_css' => stripslashes('.geodir-widget li,.geodir_category_list_view li{margin:0}#theme-page h3.geodir-entry-title{font-size:14px}#menu-item-gd-location-switcher dd{line-height:44px}#menu-item-gd-location-switcher .geodir_location_sugestion{line-height:20px}.geodir_loginbox{overflow:visible}.geodir_full_page .geodir-listing-search{text-align:center}.geodir_full_page .geodir-search{float:none;margin:0}.geodir_full_page .geodir-search select,.geodir_full_page .geodir-search .search_by_post,.geodir_full_page .geodir-search input[type="text"],.geodir_full_page .geodir-search input[type="button"],.geodir_full_page .geodir-search input[type="submit"]{display:inline-block;float:none}'),
|
|
| 659 | + 'geodir_theme_compat_js' => '', |
|
| 660 | + 'geodir_theme_compat_default_options' => '', |
|
| 661 | + 'geodir_theme_compat_code' => 'Jupiter' |
|
| 662 | + ); |
|
| 663 | 663 | |
| 664 | 664 | // Multi News |
| 665 | - $theme_compat['Multi_News'] = array( |
|
| 666 | - 'geodir_wrapper_open_id' => '', |
|
| 667 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 668 | - 'geodir_wrapper_open_replace' => '', |
|
| 669 | - 'geodir_wrapper_close_replace' => '', |
|
| 670 | - 'geodir_wrapper_content_open_id' => '', |
|
| 671 | - 'geodir_wrapper_content_open_class' => '', |
|
| 672 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 673 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 674 | - 'geodir_article_open_id' => '', |
|
| 675 | - 'geodir_article_open_class' => '', |
|
| 676 | - 'geodir_article_open_replace' => '', |
|
| 677 | - 'geodir_article_close_replace' => '', |
|
| 678 | - 'geodir_sidebar_right_open_id' => '', |
|
| 679 | - 'geodir_sidebar_right_open_class' => '', |
|
| 680 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 681 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 682 | - 'geodir_sidebar_left_open_id' => '', |
|
| 683 | - 'geodir_sidebar_left_open_class' => '', |
|
| 684 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 685 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 686 | - 'geodir_main_content_open_id' => '', |
|
| 687 | - 'geodir_main_content_open_class' => '', |
|
| 688 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 689 | - 'geodir_main_content_close_replace' => '</div>', |
|
| 690 | - 'geodir_top_content_add' => '', |
|
| 691 | - 'geodir_before_main_content_add' => '', |
|
| 692 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 693 | - 'geodir_before_widget_filter' => '', |
|
| 694 | - 'geodir_after_widget_filter' => '', |
|
| 695 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 696 | - 'geodir_after_title_filter' => '</h2></div>', |
|
| 697 | - 'geodir_menu_li_class_filter' => '', |
|
| 698 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 699 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 700 | - 'geodir_menu_a_class_filter' => '', |
|
| 701 | - 'geodir_sub_menu_a_class_filter' => '', |
|
| 702 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 703 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 704 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 705 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 706 | - 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 707 | - 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 708 | - 'geodir_theme_compat_default_options' => '', |
|
| 709 | - 'geodir_theme_compat_code' => 'Multi_News' |
|
| 710 | - ); |
|
| 711 | - |
|
| 712 | - update_option('gd_theme_compats', $theme_compat);
|
|
| 713 | - |
|
| 714 | - gd_set_theme_compat();// set the compat pack if avail |
|
| 665 | + $theme_compat['Multi_News'] = array( |
|
| 666 | + 'geodir_wrapper_open_id' => '', |
|
| 667 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 668 | + 'geodir_wrapper_open_replace' => '', |
|
| 669 | + 'geodir_wrapper_close_replace' => '', |
|
| 670 | + 'geodir_wrapper_content_open_id' => '', |
|
| 671 | + 'geodir_wrapper_content_open_class' => '', |
|
| 672 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 673 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 674 | + 'geodir_article_open_id' => '', |
|
| 675 | + 'geodir_article_open_class' => '', |
|
| 676 | + 'geodir_article_open_replace' => '', |
|
| 677 | + 'geodir_article_close_replace' => '', |
|
| 678 | + 'geodir_sidebar_right_open_id' => '', |
|
| 679 | + 'geodir_sidebar_right_open_class' => '', |
|
| 680 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 681 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 682 | + 'geodir_sidebar_left_open_id' => '', |
|
| 683 | + 'geodir_sidebar_left_open_class' => '', |
|
| 684 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 685 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 686 | + 'geodir_main_content_open_id' => '', |
|
| 687 | + 'geodir_main_content_open_class' => '', |
|
| 688 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 689 | + 'geodir_main_content_close_replace' => '</div>', |
|
| 690 | + 'geodir_top_content_add' => '', |
|
| 691 | + 'geodir_before_main_content_add' => '', |
|
| 692 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 693 | + 'geodir_before_widget_filter' => '', |
|
| 694 | + 'geodir_after_widget_filter' => '', |
|
| 695 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 696 | + 'geodir_after_title_filter' => '</h2></div>', |
|
| 697 | + 'geodir_menu_li_class_filter' => '', |
|
| 698 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 699 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 700 | + 'geodir_menu_a_class_filter' => '', |
|
| 701 | + 'geodir_sub_menu_a_class_filter' => '', |
|
| 702 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 703 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 704 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 705 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 706 | + 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'),
|
|
| 707 | + 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});',
|
|
| 708 | + 'geodir_theme_compat_default_options' => '', |
|
| 709 | + 'geodir_theme_compat_code' => 'Multi_News' |
|
| 710 | + ); |
|
| 711 | + |
|
| 712 | + update_option('gd_theme_compats', $theme_compat);
|
|
| 713 | + |
|
| 714 | + gd_set_theme_compat();// set the compat pack if avail |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | |
@@ -723,61 +723,61 @@ discard block |
||
| 723 | 723 | * @global object $wpdb WordPress Database object. |
| 724 | 724 | */ |
| 725 | 725 | function gd_convert_virtual_pages(){
|
| 726 | - global $wpdb; |
|
| 727 | - |
|
| 728 | - // Update the add listing page settings |
|
| 729 | - $add_listing_page = $wpdb->get_var( |
|
| 730 | - $wpdb->prepare( |
|
| 731 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 732 | - array('add-listing')
|
|
| 733 | - ) |
|
| 734 | - ); |
|
| 735 | - |
|
| 736 | - if($add_listing_page){
|
|
| 737 | - wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 738 | - update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 739 | - } |
|
| 740 | - |
|
| 741 | - // Update the listing preview page settings |
|
| 742 | - $listing_preview_page = $wpdb->get_var( |
|
| 743 | - $wpdb->prepare( |
|
| 744 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 745 | - array('listing-preview')
|
|
| 746 | - ) |
|
| 747 | - ); |
|
| 748 | - |
|
| 749 | - if($listing_preview_page){
|
|
| 750 | - wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 751 | - update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 752 | - } |
|
| 753 | - |
|
| 754 | - // Update the listing success page settings |
|
| 755 | - $listing_success_page = $wpdb->get_var( |
|
| 756 | - $wpdb->prepare( |
|
| 757 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 758 | - array('listing-success')
|
|
| 759 | - ) |
|
| 760 | - ); |
|
| 761 | - |
|
| 762 | - if($listing_success_page){
|
|
| 763 | - wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 764 | - update_option( 'geodir_success_page', $listing_success_page); |
|
| 765 | - } |
|
| 766 | - |
|
| 767 | - // Update the listing success page settings |
|
| 768 | - $location_page = $wpdb->get_var( |
|
| 769 | - $wpdb->prepare( |
|
| 770 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 771 | - array('location')
|
|
| 772 | - ) |
|
| 773 | - ); |
|
| 774 | - |
|
| 775 | - if($location_page){
|
|
| 776 | - $location_slug = get_option('geodir_location_prefix');
|
|
| 777 | - if(!$location_slug ){$location_slug = 'location';}
|
|
| 778 | - wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 779 | - update_option( 'geodir_location_page', $location_page); |
|
| 780 | - } |
|
| 726 | + global $wpdb; |
|
| 727 | + |
|
| 728 | + // Update the add listing page settings |
|
| 729 | + $add_listing_page = $wpdb->get_var( |
|
| 730 | + $wpdb->prepare( |
|
| 731 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 732 | + array('add-listing')
|
|
| 733 | + ) |
|
| 734 | + ); |
|
| 735 | + |
|
| 736 | + if($add_listing_page){
|
|
| 737 | + wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
|
|
| 738 | + update_option( 'geodir_add_listing_page', $add_listing_page); |
|
| 739 | + } |
|
| 740 | + |
|
| 741 | + // Update the listing preview page settings |
|
| 742 | + $listing_preview_page = $wpdb->get_var( |
|
| 743 | + $wpdb->prepare( |
|
| 744 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 745 | + array('listing-preview')
|
|
| 746 | + ) |
|
| 747 | + ); |
|
| 748 | + |
|
| 749 | + if($listing_preview_page){
|
|
| 750 | + wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
|
|
| 751 | + update_option( 'geodir_preview_page', $listing_preview_page); |
|
| 752 | + } |
|
| 753 | + |
|
| 754 | + // Update the listing success page settings |
|
| 755 | + $listing_success_page = $wpdb->get_var( |
|
| 756 | + $wpdb->prepare( |
|
| 757 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 758 | + array('listing-success')
|
|
| 759 | + ) |
|
| 760 | + ); |
|
| 761 | + |
|
| 762 | + if($listing_success_page){
|
|
| 763 | + wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
|
|
| 764 | + update_option( 'geodir_success_page', $listing_success_page); |
|
| 765 | + } |
|
| 766 | + |
|
| 767 | + // Update the listing success page settings |
|
| 768 | + $location_page = $wpdb->get_var( |
|
| 769 | + $wpdb->prepare( |
|
| 770 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;", |
|
| 771 | + array('location')
|
|
| 772 | + ) |
|
| 773 | + ); |
|
| 774 | + |
|
| 775 | + if($location_page){
|
|
| 776 | + $location_slug = get_option('geodir_location_prefix');
|
|
| 777 | + if(!$location_slug ){$location_slug = 'location';}
|
|
| 778 | + wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
|
|
| 779 | + update_option( 'geodir_location_page', $location_page); |
|
| 780 | + } |
|
| 781 | 781 | |
| 782 | 782 | } |
| 783 | 783 | |
@@ -791,31 +791,31 @@ discard block |
||
| 791 | 791 | function gd_fix_cpt_rewrite_slug() |
| 792 | 792 | {
|
| 793 | 793 | |
| 794 | - $alt_post_types = array(); |
|
| 795 | - $post_types = get_option('geodir_post_types');
|
|
| 794 | + $alt_post_types = array(); |
|
| 795 | + $post_types = get_option('geodir_post_types');
|
|
| 796 | 796 | |
| 797 | 797 | |
| 798 | - if (is_array($post_types)){
|
|
| 798 | + if (is_array($post_types)){
|
|
| 799 | 799 | |
| 800 | - foreach ($post_types as $post_type => $args) {
|
|
| 800 | + foreach ($post_types as $post_type => $args) {
|
|
| 801 | 801 | |
| 802 | 802 | |
| 803 | - if(isset($args['rewrite']['slug'])){
|
|
| 804 | - $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 805 | - } |
|
| 803 | + if(isset($args['rewrite']['slug'])){
|
|
| 804 | + $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
|
|
| 805 | + } |
|
| 806 | 806 | |
| 807 | - $alt_post_types[$post_type] = $args; |
|
| 807 | + $alt_post_types[$post_type] = $args; |
|
| 808 | 808 | |
| 809 | - } |
|
| 810 | - } |
|
| 809 | + } |
|
| 810 | + } |
|
| 811 | 811 | |
| 812 | - if(!empty($alt_post_types)) {
|
|
| 813 | - update_option('geodir_post_types',$alt_post_types);
|
|
| 814 | - } |
|
| 812 | + if(!empty($alt_post_types)) {
|
|
| 813 | + update_option('geodir_post_types',$alt_post_types);
|
|
| 814 | + } |
|
| 815 | 815 | |
| 816 | 816 | |
| 817 | - // flush the rewrite rules |
|
| 818 | - flush_rewrite_rules(); |
|
| 817 | + // flush the rewrite rules |
|
| 818 | + flush_rewrite_rules(); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | |
@@ -828,18 +828,18 @@ discard block |
||
| 828 | 828 | */ |
| 829 | 829 | function gd_fix_address_detail_table_limit() |
| 830 | 830 | {
|
| 831 | - global $wpdb; |
|
| 832 | - |
|
| 833 | - $all_postypes = geodir_get_posttypes(); |
|
| 834 | - |
|
| 835 | - if (!empty($all_postypes)) {
|
|
| 836 | - foreach ($all_postypes as $key) {
|
|
| 837 | - // update each GD CTP |
|
| 838 | - try {
|
|
| 839 | - $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 840 | - } catch(Exception $e) {
|
|
| 841 | - error_log( 'Error: ' . $e->getMessage() ); |
|
| 842 | - } |
|
| 843 | - } |
|
| 844 | - } |
|
| 831 | + global $wpdb; |
|
| 832 | + |
|
| 833 | + $all_postypes = geodir_get_posttypes(); |
|
| 834 | + |
|
| 835 | + if (!empty($all_postypes)) {
|
|
| 836 | + foreach ($all_postypes as $key) {
|
|
| 837 | + // update each GD CTP |
|
| 838 | + try {
|
|
| 839 | + $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL");
|
|
| 840 | + } catch(Exception $e) {
|
|
| 841 | + error_log( 'Error: ' . $e->getMessage() ); |
|
| 842 | + } |
|
| 843 | + } |
|
| 844 | + } |
|
| 845 | 845 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function gd_compat_styles() |
| 19 | 19 | {
|
| 20 | - $tc = get_option('theme_compatibility_setting');
|
|
| 21 | - echo "<style id='gd-compat-styles' type='text/css'>"; |
|
| 22 | - echo $tc['geodir_theme_compat_css']; |
|
| 23 | - echo "</style>"; |
|
| 20 | + $tc = get_option('theme_compatibility_setting');
|
|
| 21 | + echo "<style id='gd-compat-styles' type='text/css'>"; |
|
| 22 | + echo $tc['geodir_theme_compat_css']; |
|
| 23 | + echo "</style>"; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function gd_compat_script() |
| 33 | 33 | {
|
| 34 | - $tc = get_option('theme_compatibility_setting');
|
|
| 35 | - echo "<script>"; |
|
| 36 | - echo $tc['geodir_theme_compat_js']; |
|
| 37 | - echo " </script>"; |
|
| 34 | + $tc = get_option('theme_compatibility_setting');
|
|
| 35 | + echo "<script>"; |
|
| 36 | + echo $tc['geodir_theme_compat_js']; |
|
| 37 | + echo " </script>"; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_top_content_add_dynamic() |
| 49 | 49 | {
|
| 50 | - $tc = get_option('theme_compatibility_setting');
|
|
| 51 | - echo $tc['geodir_top_content_add']; |
|
| 50 | + $tc = get_option('theme_compatibility_setting');
|
|
| 51 | + echo $tc['geodir_top_content_add']; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function geodir_before_main_content_add_dynamic() |
| 63 | 63 | {
|
| 64 | - $tc = get_option('theme_compatibility_setting');
|
|
| 65 | - echo $tc['geodir_before_main_content_add']; |
|
| 64 | + $tc = get_option('theme_compatibility_setting');
|
|
| 65 | + echo $tc['geodir_before_main_content_add']; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function geodir_full_page_class_dynamic() |
| 77 | 77 | {
|
| 78 | - $tc = get_option('theme_compatibility_setting');
|
|
| 79 | - return $tc['geodir_full_page_class_filter']; |
|
| 78 | + $tc = get_option('theme_compatibility_setting');
|
|
| 79 | + return $tc['geodir_full_page_class_filter']; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | function geodir_before_widget_dynamic() |
| 91 | 91 | {
|
| 92 | - $tc = get_option('theme_compatibility_setting');
|
|
| 93 | - return $tc['geodir_before_widget_filter']; |
|
| 92 | + $tc = get_option('theme_compatibility_setting');
|
|
| 93 | + return $tc['geodir_before_widget_filter']; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function geodir_after_widget_dynamic() |
| 105 | 105 | {
|
| 106 | - $tc = get_option('theme_compatibility_setting');
|
|
| 107 | - return $tc['geodir_after_widget_filter']; |
|
| 106 | + $tc = get_option('theme_compatibility_setting');
|
|
| 107 | + return $tc['geodir_after_widget_filter']; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function geodir_before_title_dynamic() |
| 119 | 119 | {
|
| 120 | - $tc = get_option('theme_compatibility_setting');
|
|
| 121 | - return $tc['geodir_before_title_filter']; |
|
| 120 | + $tc = get_option('theme_compatibility_setting');
|
|
| 121 | + return $tc['geodir_before_title_filter']; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function geodir_after_title_dynamic() |
| 133 | 133 | {
|
| 134 | - $tc = get_option('theme_compatibility_setting');
|
|
| 135 | - return $tc['geodir_after_title_filter']; |
|
| 134 | + $tc = get_option('theme_compatibility_setting');
|
|
| 135 | + return $tc['geodir_after_title_filter']; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | function geodir_menu_li_class_dynamic() |
| 147 | 147 | {
|
| 148 | - $tc = get_option('theme_compatibility_setting');
|
|
| 149 | - return $tc['geodir_menu_li_class_filter']; |
|
| 148 | + $tc = get_option('theme_compatibility_setting');
|
|
| 149 | + return $tc['geodir_menu_li_class_filter']; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | function geodir_sub_menu_ul_class_dynamic() |
| 161 | 161 | {
|
| 162 | - $tc = get_option('theme_compatibility_setting');
|
|
| 163 | - return $tc['geodir_sub_menu_ul_class_filter']; |
|
| 162 | + $tc = get_option('theme_compatibility_setting');
|
|
| 163 | + return $tc['geodir_sub_menu_ul_class_filter']; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function geodir_sub_menu_li_class_dynamic() |
| 175 | 175 | {
|
| 176 | - $tc = get_option('theme_compatibility_setting');
|
|
| 177 | - return $tc['geodir_sub_menu_li_class_filter']; |
|
| 176 | + $tc = get_option('theme_compatibility_setting');
|
|
| 177 | + return $tc['geodir_sub_menu_li_class_filter']; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function geodir_menu_a_class_dynamic() |
| 189 | 189 | {
|
| 190 | - $tc = get_option('theme_compatibility_setting');
|
|
| 191 | - return $tc['geodir_menu_a_class_filter']; |
|
| 190 | + $tc = get_option('theme_compatibility_setting');
|
|
| 191 | + return $tc['geodir_menu_a_class_filter']; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | function geodir_sub_menu_a_class_dynamic() |
| 203 | 203 | {
|
| 204 | - $tc = get_option('theme_compatibility_setting');
|
|
| 205 | - return $tc['geodir_sub_menu_a_class_filter']; |
|
| 204 | + $tc = get_option('theme_compatibility_setting');
|
|
| 205 | + return $tc['geodir_sub_menu_a_class_filter']; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function geodir_location_switcher_menu_li_class_dynamic() |
| 217 | 217 | {
|
| 218 | - $tc = get_option('theme_compatibility_setting');
|
|
| 219 | - return $tc['geodir_location_switcher_menu_li_class_filter']; |
|
| 218 | + $tc = get_option('theme_compatibility_setting');
|
|
| 219 | + return $tc['geodir_location_switcher_menu_li_class_filter']; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function geodir_location_switcher_menu_a_class_dynamic() |
| 231 | 231 | {
|
| 232 | - $tc = get_option('theme_compatibility_setting');
|
|
| 233 | - return $tc['geodir_location_switcher_menu_a_class_filter']; |
|
| 232 | + $tc = get_option('theme_compatibility_setting');
|
|
| 233 | + return $tc['geodir_location_switcher_menu_a_class_filter']; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | function geodir_location_switcher_menu_sub_ul_class_dynamic() |
| 245 | 245 | {
|
| 246 | - $tc = get_option('theme_compatibility_setting');
|
|
| 247 | - return $tc['geodir_location_switcher_menu_sub_ul_class_filter']; |
|
| 246 | + $tc = get_option('theme_compatibility_setting');
|
|
| 247 | + return $tc['geodir_location_switcher_menu_sub_ul_class_filter']; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | function geodir_location_switcher_menu_sub_li_class_dynamic() |
| 259 | 259 | {
|
| 260 | - $tc = get_option('theme_compatibility_setting');
|
|
| 261 | - return $tc['geodir_location_switcher_menu_sub_li_class_filter']; |
|
| 260 | + $tc = get_option('theme_compatibility_setting');
|
|
| 261 | + return $tc['geodir_location_switcher_menu_sub_li_class_filter']; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -275,106 +275,106 @@ discard block |
||
| 275 | 275 | function geodir_content_actions_dynamic() |
| 276 | 276 | {
|
| 277 | 277 | |
| 278 | - $tc = get_option('theme_compatibility_setting');
|
|
| 279 | - if (empty($tc)) {
|
|
| 280 | - return; |
|
| 281 | - } |
|
| 278 | + $tc = get_option('theme_compatibility_setting');
|
|
| 279 | + if (empty($tc)) {
|
|
| 280 | + return; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | - //php |
|
| 284 | - if (!empty($tc['geodir_theme_compat_code'])) {
|
|
| 285 | - include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 286 | - } |
|
| 283 | + //php |
|
| 284 | + if (!empty($tc['geodir_theme_compat_code'])) {
|
|
| 285 | + include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | - //geodir_full_page_class |
|
| 289 | - if (!empty($tc['geodir_full_page_class_filter'])) {
|
|
| 290 | - add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
|
|
| 291 | - } |
|
| 288 | + //geodir_full_page_class |
|
| 289 | + if (!empty($tc['geodir_full_page_class_filter'])) {
|
|
| 290 | + add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
|
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - //widget before filter |
|
| 294 | - if (!empty($tc['geodir_before_widget_filter'])) {
|
|
| 295 | - add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
|
|
| 296 | - } |
|
| 293 | + //widget before filter |
|
| 294 | + if (!empty($tc['geodir_before_widget_filter'])) {
|
|
| 295 | + add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
|
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - //widget after filter |
|
| 299 | - if (!empty($tc['geodir_after_widget_filter'])) {
|
|
| 300 | - add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
|
|
| 301 | - } |
|
| 298 | + //widget after filter |
|
| 299 | + if (!empty($tc['geodir_after_widget_filter'])) {
|
|
| 300 | + add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
|
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - //widget before title filter |
|
| 304 | - if (!empty($tc['geodir_before_title_filter'])) {
|
|
| 305 | - add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
|
|
| 306 | - } |
|
| 303 | + //widget before title filter |
|
| 304 | + if (!empty($tc['geodir_before_title_filter'])) {
|
|
| 305 | + add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
|
|
| 306 | + } |
|
| 307 | 307 | |
| 308 | - //widget before title filter |
|
| 309 | - if (!empty($tc['geodir_after_title_filter'])) {
|
|
| 310 | - add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
|
|
| 311 | - } |
|
| 308 | + //widget before title filter |
|
| 309 | + if (!empty($tc['geodir_after_title_filter'])) {
|
|
| 310 | + add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
|
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - //menu li class |
|
| 314 | - if (!empty($tc['geodir_menu_li_class_filter'])) {
|
|
| 315 | - add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
|
|
| 316 | - } |
|
| 313 | + //menu li class |
|
| 314 | + if (!empty($tc['geodir_menu_li_class_filter'])) {
|
|
| 315 | + add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
|
|
| 316 | + } |
|
| 317 | 317 | |
| 318 | - //menu ul class |
|
| 319 | - if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
|
|
| 320 | - add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
|
|
| 321 | - } |
|
| 318 | + //menu ul class |
|
| 319 | + if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
|
|
| 320 | + add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
|
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - //menu sub li class |
|
| 324 | - if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
|
|
| 325 | - add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
|
|
| 326 | - } |
|
| 323 | + //menu sub li class |
|
| 324 | + if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
|
|
| 325 | + add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
|
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | - //menu a class |
|
| 329 | - if (!empty($tc['geodir_menu_a_class_filter'])) {
|
|
| 330 | - add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
|
|
| 331 | - } |
|
| 328 | + //menu a class |
|
| 329 | + if (!empty($tc['geodir_menu_a_class_filter'])) {
|
|
| 330 | + add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
|
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - //menu sub a class |
|
| 334 | - if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
|
|
| 335 | - add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
|
|
| 336 | - } |
|
| 333 | + //menu sub a class |
|
| 334 | + if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
|
|
| 335 | + add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
|
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | - //location menu li class |
|
| 339 | - if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
|
|
| 340 | - add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
|
|
| 341 | - } |
|
| 338 | + //location menu li class |
|
| 339 | + if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
|
|
| 340 | + add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
|
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - //location menu sub ul class |
|
| 344 | - if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
|
|
| 345 | - add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
|
|
| 346 | - } |
|
| 343 | + //location menu sub ul class |
|
| 344 | + if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
|
|
| 345 | + add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
|
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | - //location menu sub li class |
|
| 349 | - if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
|
|
| 350 | - add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
|
|
| 351 | - } |
|
| 348 | + //location menu sub li class |
|
| 349 | + if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
|
|
| 350 | + add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
|
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - //location menu a class |
|
| 354 | - if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
|
|
| 355 | - add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
|
|
| 356 | - } |
|
| 353 | + //location menu a class |
|
| 354 | + if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
|
|
| 355 | + add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
|
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | - // compat styles |
|
| 359 | - if (!empty($tc['geodir_theme_compat_css'])) {
|
|
| 360 | - add_action('wp_head', 'gd_compat_styles');
|
|
| 361 | - } |
|
| 358 | + // compat styles |
|
| 359 | + if (!empty($tc['geodir_theme_compat_css'])) {
|
|
| 360 | + add_action('wp_head', 'gd_compat_styles');
|
|
| 361 | + } |
|
| 362 | 362 | |
| 363 | - // compat js |
|
| 364 | - if (!empty($tc['geodir_theme_compat_js'])) {
|
|
| 365 | - add_action('wp_footer', 'gd_compat_script');
|
|
| 366 | - } |
|
| 363 | + // compat js |
|
| 364 | + if (!empty($tc['geodir_theme_compat_js'])) {
|
|
| 365 | + add_action('wp_footer', 'gd_compat_script');
|
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | |
| 369 | - // geodir_top_content_add |
|
| 370 | - if (!empty($tc['geodir_top_content_add'])) {
|
|
| 371 | - add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
|
|
| 372 | - } |
|
| 369 | + // geodir_top_content_add |
|
| 370 | + if (!empty($tc['geodir_top_content_add'])) {
|
|
| 371 | + add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
|
|
| 372 | + } |
|
| 373 | 373 | |
| 374 | - // geodir_before_main_content_add |
|
| 375 | - if (!empty($tc['geodir_before_main_content_add'])) {
|
|
| 376 | - add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
|
|
| 377 | - } |
|
| 374 | + // geodir_before_main_content_add |
|
| 375 | + if (!empty($tc['geodir_before_main_content_add'])) {
|
|
| 376 | + add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
|
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | } |
@@ -397,23 +397,23 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | function geodir_action_wrapper_open($type = '', $id = '', $class = '') |
| 399 | 399 | {
|
| 400 | - $tc = get_option('theme_compatibility_setting');
|
|
| 401 | - if (!empty($tc['geodir_wrapper_open_replace'])) {
|
|
| 402 | - $text = $tc['geodir_wrapper_open_replace']; |
|
| 403 | - } else {
|
|
| 404 | - $text = '<div id="[id]" class="[class]">'; |
|
| 405 | - } |
|
| 400 | + $tc = get_option('theme_compatibility_setting');
|
|
| 401 | + if (!empty($tc['geodir_wrapper_open_replace'])) {
|
|
| 402 | + $text = $tc['geodir_wrapper_open_replace']; |
|
| 403 | + } else {
|
|
| 404 | + $text = '<div id="[id]" class="[class]">'; |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | - if (!empty($tc['geodir_wrapper_open_id'])) {
|
|
| 408 | - $id = $tc['geodir_wrapper_open_id']; |
|
| 409 | - } |
|
| 410 | - if (!empty($tc['geodir_wrapper_open_class'])) {
|
|
| 411 | - $class = $tc['geodir_wrapper_open_class']; |
|
| 412 | - } |
|
| 407 | + if (!empty($tc['geodir_wrapper_open_id'])) {
|
|
| 408 | + $id = $tc['geodir_wrapper_open_id']; |
|
| 409 | + } |
|
| 410 | + if (!empty($tc['geodir_wrapper_open_class'])) {
|
|
| 411 | + $class = $tc['geodir_wrapper_open_class']; |
|
| 412 | + } |
|
| 413 | 413 | |
| 414 | - $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 414 | + $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 415 | 415 | |
| 416 | - echo $text; |
|
| 416 | + echo $text; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | // action for adding the wrapperdiv closing tag |
@@ -428,14 +428,14 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | function geodir_action_wrapper_close($type = '') |
| 430 | 430 | {
|
| 431 | - $tc = get_option('theme_compatibility_setting');
|
|
| 432 | - if (!empty($tc['geodir_wrapper_close_replace'])) {
|
|
| 433 | - $text = $tc['geodir_wrapper_close_replace']; |
|
| 434 | - } else {
|
|
| 435 | - $text = '</div><!-- wrapper ends here-->'; |
|
| 436 | - } |
|
| 431 | + $tc = get_option('theme_compatibility_setting');
|
|
| 432 | + if (!empty($tc['geodir_wrapper_close_replace'])) {
|
|
| 433 | + $text = $tc['geodir_wrapper_close_replace']; |
|
| 434 | + } else {
|
|
| 435 | + $text = '</div><!-- wrapper ends here-->'; |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - echo $text; |
|
| 438 | + echo $text; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // action for adding the content div opening tag |
@@ -451,35 +451,35 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | function geodir_action_wrapper_content_open($type = '', $id = '', $class = '') |
| 453 | 453 | {
|
| 454 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
|
| 455 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 456 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
|
| 457 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 458 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
|
| 459 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 460 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
|
| 461 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 462 | - } else {
|
|
| 463 | - $width_css = ''; |
|
| 464 | - } |
|
| 465 | - |
|
| 466 | - $tc = get_option('theme_compatibility_setting');
|
|
| 467 | - if (!empty($tc['geodir_wrapper_content_open_replace'])) {
|
|
| 468 | - $text = $tc['geodir_wrapper_content_open_replace']; |
|
| 469 | - } else {
|
|
| 470 | - $text = '<div id="[id]" class="[class]" role="main" [width_css]>'; |
|
| 471 | - } |
|
| 472 | - |
|
| 473 | - if (!empty($tc['geodir_wrapper_content_open_id'])) {
|
|
| 474 | - $id = $tc['geodir_wrapper_content_open_id']; |
|
| 475 | - } |
|
| 476 | - if (!empty($tc['geodir_wrapper_content_open_class'])) {
|
|
| 477 | - $class = $tc['geodir_wrapper_content_open_class']; |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
|
|
| 481 | - |
|
| 482 | - echo $text; |
|
| 454 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
|
| 455 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 456 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
|
| 457 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 458 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
|
| 459 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 460 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
|
| 461 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 462 | + } else {
|
|
| 463 | + $width_css = ''; |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + $tc = get_option('theme_compatibility_setting');
|
|
| 467 | + if (!empty($tc['geodir_wrapper_content_open_replace'])) {
|
|
| 468 | + $text = $tc['geodir_wrapper_content_open_replace']; |
|
| 469 | + } else {
|
|
| 470 | + $text = '<div id="[id]" class="[class]" role="main" [width_css]>'; |
|
| 471 | + } |
|
| 472 | + |
|
| 473 | + if (!empty($tc['geodir_wrapper_content_open_id'])) {
|
|
| 474 | + $id = $tc['geodir_wrapper_content_open_id']; |
|
| 475 | + } |
|
| 476 | + if (!empty($tc['geodir_wrapper_content_open_class'])) {
|
|
| 477 | + $class = $tc['geodir_wrapper_content_open_class']; |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
|
|
| 481 | + |
|
| 482 | + echo $text; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | // action for adding the primary div closing tag |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | function geodir_action_wrapper_content_close($type = '') |
| 495 | 495 | {
|
| 496 | - $tc = get_option('theme_compatibility_setting');
|
|
| 497 | - if (!empty($tc['geodir_wrapper_content_close_replace'])) {
|
|
| 498 | - $text = $tc['geodir_wrapper_content_close_replace']; |
|
| 499 | - } else {
|
|
| 500 | - $text = '</div><!-- content ends here-->'; |
|
| 501 | - } |
|
| 502 | - echo $text; |
|
| 496 | + $tc = get_option('theme_compatibility_setting');
|
|
| 497 | + if (!empty($tc['geodir_wrapper_content_close_replace'])) {
|
|
| 498 | + $text = $tc['geodir_wrapper_content_close_replace']; |
|
| 499 | + } else {
|
|
| 500 | + $text = '</div><!-- content ends here-->'; |
|
| 501 | + } |
|
| 502 | + echo $text; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | // action for adding the <article> opening tag |
@@ -517,24 +517,24 @@ discard block |
||
| 517 | 517 | */ |
| 518 | 518 | function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '') |
| 519 | 519 | {
|
| 520 | - $class = implode(" ", $class);
|
|
| 521 | - $tc = get_option('theme_compatibility_setting');
|
|
| 522 | - if (!empty($tc['geodir_article_open_replace'])) {
|
|
| 523 | - $text = $tc['geodir_article_open_replace']; |
|
| 524 | - } else {
|
|
| 525 | - $text = '<article id="[id]" class="[class]" >'; |
|
| 526 | - } |
|
| 520 | + $class = implode(" ", $class);
|
|
| 521 | + $tc = get_option('theme_compatibility_setting');
|
|
| 522 | + if (!empty($tc['geodir_article_open_replace'])) {
|
|
| 523 | + $text = $tc['geodir_article_open_replace']; |
|
| 524 | + } else {
|
|
| 525 | + $text = '<article id="[id]" class="[class]" >'; |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | - if (!empty($tc['geodir_article_open_id'])) {
|
|
| 529 | - $id = $tc['geodir_article_open_id']; |
|
| 530 | - } |
|
| 531 | - if (!empty($tc['geodir_article_open_class'])) {
|
|
| 532 | - $class = $tc['geodir_article_open_class']; |
|
| 533 | - } |
|
| 528 | + if (!empty($tc['geodir_article_open_id'])) {
|
|
| 529 | + $id = $tc['geodir_article_open_id']; |
|
| 530 | + } |
|
| 531 | + if (!empty($tc['geodir_article_open_class'])) {
|
|
| 532 | + $class = $tc['geodir_article_open_class']; |
|
| 533 | + } |
|
| 534 | 534 | |
| 535 | - $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
|
|
| 535 | + $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
|
|
| 536 | 536 | |
| 537 | - echo $text; |
|
| 537 | + echo $text; |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | // action for adding the primary div closing tag |
@@ -548,13 +548,13 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | function geodir_action_article_close($type = '') |
| 550 | 550 | {
|
| 551 | - $tc = get_option('theme_compatibility_setting');
|
|
| 552 | - if (!empty($tc['geodir_article_close_replace'])) {
|
|
| 553 | - $text = $tc['geodir_article_close_replace']; |
|
| 554 | - } else {
|
|
| 555 | - $text = '</article><!-- article ends here-->'; |
|
| 556 | - } |
|
| 557 | - echo $text; |
|
| 551 | + $tc = get_option('theme_compatibility_setting');
|
|
| 552 | + if (!empty($tc['geodir_article_close_replace'])) {
|
|
| 553 | + $text = $tc['geodir_article_close_replace']; |
|
| 554 | + } else {
|
|
| 555 | + $text = '</article><!-- article ends here-->'; |
|
| 556 | + } |
|
| 557 | + echo $text; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // action for adding the sidebar opening tag |
@@ -571,35 +571,35 @@ discard block |
||
| 571 | 571 | */ |
| 572 | 572 | function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '') |
| 573 | 573 | {
|
| 574 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
|
| 575 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 576 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
|
| 577 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 578 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
|
| 579 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 580 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
|
| 581 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 582 | - } else {
|
|
| 583 | - $width_css = ''; |
|
| 584 | - } |
|
| 585 | - |
|
| 586 | - $tc = get_option('theme_compatibility_setting');
|
|
| 587 | - if (!empty($tc['geodir_sidebar_right_open_replace'])) {
|
|
| 588 | - $text = $tc['geodir_sidebar_right_open_replace']; |
|
| 589 | - } else {
|
|
| 590 | - $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - if (!empty($tc['geodir_sidebar_right_open_id'])) {
|
|
| 594 | - $id = $tc['geodir_sidebar_right_open_id']; |
|
| 595 | - } |
|
| 596 | - if (!empty($tc['geodir_sidebar_right_open_class'])) {
|
|
| 597 | - $class = $tc['geodir_sidebar_right_open_class']; |
|
| 598 | - } |
|
| 599 | - |
|
| 600 | - $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 601 | - |
|
| 602 | - echo $text; |
|
| 574 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
|
| 575 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 576 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
|
| 577 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 578 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
|
| 579 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 580 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
|
| 581 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 582 | + } else {
|
|
| 583 | + $width_css = ''; |
|
| 584 | + } |
|
| 585 | + |
|
| 586 | + $tc = get_option('theme_compatibility_setting');
|
|
| 587 | + if (!empty($tc['geodir_sidebar_right_open_replace'])) {
|
|
| 588 | + $text = $tc['geodir_sidebar_right_open_replace']; |
|
| 589 | + } else {
|
|
| 590 | + $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + if (!empty($tc['geodir_sidebar_right_open_id'])) {
|
|
| 594 | + $id = $tc['geodir_sidebar_right_open_id']; |
|
| 595 | + } |
|
| 596 | + if (!empty($tc['geodir_sidebar_right_open_class'])) {
|
|
| 597 | + $class = $tc['geodir_sidebar_right_open_class']; |
|
| 598 | + } |
|
| 599 | + |
|
| 600 | + $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 601 | + |
|
| 602 | + echo $text; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // action for adding the primary div closing tag |
@@ -613,13 +613,13 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | function geodir_action_sidebar_right_close($type = '') |
| 615 | 615 | {
|
| 616 | - $tc = get_option('theme_compatibility_setting');
|
|
| 617 | - if (!empty($tc['geodir_sidebar_right_close_replace'])) {
|
|
| 618 | - $text = $tc['geodir_sidebar_right_close_replace']; |
|
| 619 | - } else {
|
|
| 620 | - $text = '</aside><!-- sidebar ends here-->'; |
|
| 621 | - } |
|
| 622 | - echo $text; |
|
| 616 | + $tc = get_option('theme_compatibility_setting');
|
|
| 617 | + if (!empty($tc['geodir_sidebar_right_close_replace'])) {
|
|
| 618 | + $text = $tc['geodir_sidebar_right_close_replace']; |
|
| 619 | + } else {
|
|
| 620 | + $text = '</aside><!-- sidebar ends here-->'; |
|
| 621 | + } |
|
| 622 | + echo $text; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | |
@@ -640,121 +640,121 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | function geodir_action_geodir_set_preview_post() |
| 642 | 642 | {
|
| 643 | - global $post, $preview, $gd_session; |
|
| 644 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 645 | - if (!$preview || $is_backend_preview) {
|
|
| 646 | - return; |
|
| 647 | - }// bail if not previewing |
|
| 648 | - |
|
| 649 | - $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
| 650 | - |
|
| 651 | - $fields_info = geodir_get_custom_fields_type($listing_type); |
|
| 652 | - |
|
| 653 | - foreach ($_REQUEST as $pkey => $pval) {
|
|
| 654 | - if ($pkey == 'geodir_video') {
|
|
| 655 | - $tags = '<iframe>'; |
|
| 656 | - } else if ($pkey == 'post_desc') {
|
|
| 657 | - $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 658 | - } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
|
|
| 659 | - $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 660 | - } else if (is_array($_REQUEST[$pkey])) {
|
|
| 661 | - $tags = 'skip_field'; |
|
| 662 | - } else {
|
|
| 663 | - $tags = ''; |
|
| 664 | - } |
|
| 665 | - /** |
|
| 666 | - * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page. |
|
| 667 | - * |
|
| 668 | - * @since 1.0.0 |
|
| 669 | - * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'. |
|
| 670 | - * @param string|array $pkey The field id/name. If array then value is set as "skip_field". |
|
| 671 | - */ |
|
| 672 | - $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
|
|
| 673 | - |
|
| 674 | - if ($tags != 'skip_field') {
|
|
| 675 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 676 | - } |
|
| 677 | - } |
|
| 678 | - |
|
| 679 | - $post = (object)$_REQUEST; |
|
| 680 | - |
|
| 681 | - |
|
| 682 | - if (isset($post->video)) {
|
|
| 683 | - $post->video = stripslashes($post->video); |
|
| 684 | - } |
|
| 685 | - |
|
| 686 | - if (isset($post->Video2)) {
|
|
| 687 | - $post->Video2 = stripslashes($post->Video2); |
|
| 688 | - } |
|
| 689 | - |
|
| 690 | - $post_type = $post->listing_type; |
|
| 691 | - $post_type_info = get_post_type_object($post_type); |
|
| 692 | - |
|
| 693 | - $listing_label = $post_type_info->labels->singular_name; |
|
| 694 | - |
|
| 695 | - $term_icon = ''; |
|
| 696 | - |
|
| 697 | - if (!empty($post->post_category)) {
|
|
| 698 | - foreach ($post->post_category as $post_taxonomy => $post_term) {
|
|
| 699 | - |
|
| 700 | - if ($post_term != '' && !is_array($post_term)) {
|
|
| 701 | - $post_term = explode(',', trim($post_term, ','));
|
|
| 702 | - } |
|
| 643 | + global $post, $preview, $gd_session; |
|
| 644 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 645 | + if (!$preview || $is_backend_preview) {
|
|
| 646 | + return; |
|
| 647 | + }// bail if not previewing |
|
| 648 | + |
|
| 649 | + $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
| 650 | + |
|
| 651 | + $fields_info = geodir_get_custom_fields_type($listing_type); |
|
| 652 | + |
|
| 653 | + foreach ($_REQUEST as $pkey => $pval) {
|
|
| 654 | + if ($pkey == 'geodir_video') {
|
|
| 655 | + $tags = '<iframe>'; |
|
| 656 | + } else if ($pkey == 'post_desc') {
|
|
| 657 | + $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 658 | + } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
|
|
| 659 | + $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 660 | + } else if (is_array($_REQUEST[$pkey])) {
|
|
| 661 | + $tags = 'skip_field'; |
|
| 662 | + } else {
|
|
| 663 | + $tags = ''; |
|
| 664 | + } |
|
| 665 | + /** |
|
| 666 | + * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page. |
|
| 667 | + * |
|
| 668 | + * @since 1.0.0 |
|
| 669 | + * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'. |
|
| 670 | + * @param string|array $pkey The field id/name. If array then value is set as "skip_field". |
|
| 671 | + */ |
|
| 672 | + $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
|
|
| 673 | + |
|
| 674 | + if ($tags != 'skip_field') {
|
|
| 675 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 676 | + } |
|
| 677 | + } |
|
| 678 | + |
|
| 679 | + $post = (object)$_REQUEST; |
|
| 680 | + |
|
| 681 | + |
|
| 682 | + if (isset($post->video)) {
|
|
| 683 | + $post->video = stripslashes($post->video); |
|
| 684 | + } |
|
| 685 | + |
|
| 686 | + if (isset($post->Video2)) {
|
|
| 687 | + $post->Video2 = stripslashes($post->Video2); |
|
| 688 | + } |
|
| 689 | + |
|
| 690 | + $post_type = $post->listing_type; |
|
| 691 | + $post_type_info = get_post_type_object($post_type); |
|
| 692 | + |
|
| 693 | + $listing_label = $post_type_info->labels->singular_name; |
|
| 694 | + |
|
| 695 | + $term_icon = ''; |
|
| 696 | + |
|
| 697 | + if (!empty($post->post_category)) {
|
|
| 698 | + foreach ($post->post_category as $post_taxonomy => $post_term) {
|
|
| 699 | + |
|
| 700 | + if ($post_term != '' && !is_array($post_term)) {
|
|
| 701 | + $post_term = explode(',', trim($post_term, ','));
|
|
| 702 | + } |
|
| 703 | 703 | |
| 704 | - if (is_array($post_term)) {
|
|
| 705 | - $post_term = array_unique($post_term); |
|
| 706 | - } |
|
| 704 | + if (is_array($post_term)) {
|
|
| 705 | + $post_term = array_unique($post_term); |
|
| 706 | + } |
|
| 707 | 707 | |
| 708 | - if (!empty($post_term)) {
|
|
| 709 | - foreach ($post_term as $cat_id) {
|
|
| 710 | - $cat_id = trim($cat_id); |
|
| 711 | - |
|
| 712 | - if ($cat_id != '') {
|
|
| 713 | - $term_icon = get_option('geodir_default_marker_icon');
|
|
| 714 | - |
|
| 715 | - if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
|
|
| 716 | - if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
|
|
| 717 | - if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
| 718 | - $term_icon = $term_icon_url['src']; |
|
| 719 | - break; |
|
| 720 | - } |
|
| 721 | - } |
|
| 722 | - } |
|
| 723 | - } |
|
| 724 | - } |
|
| 725 | - } |
|
| 726 | - } |
|
| 708 | + if (!empty($post_term)) {
|
|
| 709 | + foreach ($post_term as $cat_id) {
|
|
| 710 | + $cat_id = trim($cat_id); |
|
| 711 | + |
|
| 712 | + if ($cat_id != '') {
|
|
| 713 | + $term_icon = get_option('geodir_default_marker_icon');
|
|
| 714 | + |
|
| 715 | + if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
|
|
| 716 | + if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
|
|
| 717 | + if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
| 718 | + $term_icon = $term_icon_url['src']; |
|
| 719 | + break; |
|
| 720 | + } |
|
| 721 | + } |
|
| 722 | + } |
|
| 723 | + } |
|
| 724 | + } |
|
| 725 | + } |
|
| 726 | + } |
|
| 727 | 727 | |
| 728 | - $post_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 729 | - $post_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 728 | + $post_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 729 | + $post_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 730 | 730 | |
| 731 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 732 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 731 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 732 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 733 | 733 | |
| 734 | - $json_title = str_replace($srcharr, $replarr, $post->post_title); |
|
| 734 | + $json_title = str_replace($srcharr, $replarr, $post->post_title); |
|
| 735 | 735 | |
| 736 | - $json = '{';
|
|
| 737 | - $json .= '"post_preview": "1",'; |
|
| 738 | - $json .= '"t": "' . $json_title . '",'; |
|
| 739 | - $json .= '"lt": "' . $post_latitude . '",'; |
|
| 740 | - $json .= '"ln": "' . $post_longitude . '",'; |
|
| 741 | - $json .= '"i":"' . $term_icon . '"'; |
|
| 742 | - $json .= '}'; |
|
| 736 | + $json = '{';
|
|
| 737 | + $json .= '"post_preview": "1",'; |
|
| 738 | + $json .= '"t": "' . $json_title . '",'; |
|
| 739 | + $json .= '"lt": "' . $post_latitude . '",'; |
|
| 740 | + $json .= '"ln": "' . $post_longitude . '",'; |
|
| 741 | + $json .= '"i":"' . $term_icon . '"'; |
|
| 742 | + $json .= '}'; |
|
| 743 | 743 | |
| 744 | - $post->marker_json = $json; |
|
| 744 | + $post->marker_json = $json; |
|
| 745 | 745 | |
| 746 | - $gd_session->set('listing', $_REQUEST);
|
|
| 746 | + $gd_session->set('listing', $_REQUEST);
|
|
| 747 | 747 | |
| 748 | - // we need to define a few things to trick the setup_postdata |
|
| 749 | - if (!isset($post->ID)) {
|
|
| 750 | - $post->ID = ''; |
|
| 751 | - $post->post_author = ''; |
|
| 752 | - $post->post_date = ''; |
|
| 753 | - $post->post_content = ''; |
|
| 754 | - $post->default_category = ''; |
|
| 755 | - $post->post_type = ''; |
|
| 756 | - } |
|
| 757 | - setup_postdata($post); |
|
| 748 | + // we need to define a few things to trick the setup_postdata |
|
| 749 | + if (!isset($post->ID)) {
|
|
| 750 | + $post->ID = ''; |
|
| 751 | + $post->post_author = ''; |
|
| 752 | + $post->post_date = ''; |
|
| 753 | + $post->post_content = ''; |
|
| 754 | + $post->default_category = ''; |
|
| 755 | + $post->post_type = ''; |
|
| 756 | + } |
|
| 757 | + setup_postdata($post); |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | /** |
@@ -766,15 +766,15 @@ discard block |
||
| 766 | 766 | */ |
| 767 | 767 | function geodir_action_geodir_preview_code() |
| 768 | 768 | {
|
| 769 | - global $preview; |
|
| 769 | + global $preview; |
|
| 770 | 770 | |
| 771 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 771 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 772 | 772 | |
| 773 | - if (!$preview || $is_backend_preview) {
|
|
| 774 | - return; |
|
| 775 | - }// bail if not previewing |
|
| 773 | + if (!$preview || $is_backend_preview) {
|
|
| 774 | + return; |
|
| 775 | + }// bail if not previewing |
|
| 776 | 776 | |
| 777 | - geodir_get_template_part('preview', 'buttons');
|
|
| 777 | + geodir_get_template_part('preview', 'buttons');
|
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // action for adding the details page top widget area |
@@ -790,20 +790,20 @@ discard block |
||
| 790 | 790 | */ |
| 791 | 791 | function geodir_action_geodir_sidebar_detail_top($class = '') |
| 792 | 792 | {
|
| 793 | - if (get_option('geodir_show_detail_top_section')) { ?>
|
|
| 793 | + if (get_option('geodir_show_detail_top_section')) { ?>
|
|
| 794 | 794 | <div |
| 795 | 795 | class="<?php |
| 796 | - /** |
|
| 797 | - * Filter the div class for the wrapper of the full width widget areas. |
|
| 798 | - * |
|
| 799 | - * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas. |
|
| 800 | - * |
|
| 801 | - * @since 1.0.0 |
|
| 802 | - * @param string $class The class of the div. |
|
| 803 | - * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section', |
|
| 804 | - * 'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'. |
|
| 805 | - */ |
|
| 806 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
|
|
| 796 | + /** |
|
| 797 | + * Filter the div class for the wrapper of the full width widget areas. |
|
| 798 | + * |
|
| 799 | + * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas. |
|
| 800 | + * |
|
| 801 | + * @since 1.0.0 |
|
| 802 | + * @param string $class The class of the div. |
|
| 803 | + * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section', |
|
| 804 | + * 'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'. |
|
| 805 | + */ |
|
| 806 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
|
|
| 807 | 807 | <?php dynamic_sidebar('geodir_detail_top'); ?>
|
| 808 | 808 | </div> |
| 809 | 809 | <?php } |
@@ -827,11 +827,11 @@ discard block |
||
| 827 | 827 | */ |
| 828 | 828 | function geodir_action_geodir_sidebar_detail_bottom_section($class = '') |
| 829 | 829 | {
|
| 830 | - if (get_option('geodir_show_detail_bottom_section')) { ?>
|
|
| 830 | + if (get_option('geodir_show_detail_bottom_section')) { ?>
|
|
| 831 | 831 | <div |
| 832 | 832 | class="<?php |
| 833 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 834 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
|
|
| 833 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 834 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
|
|
| 835 | 835 | <?php dynamic_sidebar('geodir_detail_bottom'); ?>
|
| 836 | 836 | </div><!-- clearfix ends here--> |
| 837 | 837 | <?php } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | */ |
| 846 | 846 | function geodir_details_sidebar_widget_area() |
| 847 | 847 | {
|
| 848 | - dynamic_sidebar('geodir_detail_sidebar');
|
|
| 848 | + dynamic_sidebar('geodir_detail_sidebar');
|
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | function geodir_details_sidebar_place_details() |
| 858 | 858 | {
|
| 859 | - /** |
|
| 860 | - * Used to add items to the details page sidebar. |
|
| 861 | - * |
|
| 862 | - * @since 1.0.0 |
|
| 863 | - */ |
|
| 864 | - do_action('geodir_detail_page_sidebar');
|
|
| 859 | + /** |
|
| 860 | + * Used to add items to the details page sidebar. |
|
| 861 | + * |
|
| 862 | + * @since 1.0.0 |
|
| 863 | + */ |
|
| 864 | + do_action('geodir_detail_page_sidebar');
|
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
|
@@ -876,68 +876,68 @@ discard block |
||
| 876 | 876 | */ |
| 877 | 877 | function geodir_action_details_sidebar() |
| 878 | 878 | {
|
| 879 | - // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
|
| 880 | - if (get_option('geodir_detail_sidebar_left_section')) {
|
|
| 881 | - /** |
|
| 882 | - * Called before the details page left sidebar is opened. |
|
| 883 | - * |
|
| 884 | - * This is used to add opening wrapper HTML to the details page left sidebar. |
|
| 885 | - * |
|
| 886 | - * @since 1.0.0 |
|
| 887 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 888 | - * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'. |
|
| 889 | - * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'. |
|
| 890 | - * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 891 | - */ |
|
| 892 | - do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 893 | - ?> |
|
| 879 | + // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
|
| 880 | + if (get_option('geodir_detail_sidebar_left_section')) {
|
|
| 881 | + /** |
|
| 882 | + * Called before the details page left sidebar is opened. |
|
| 883 | + * |
|
| 884 | + * This is used to add opening wrapper HTML to the details page left sidebar. |
|
| 885 | + * |
|
| 886 | + * @since 1.0.0 |
|
| 887 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 888 | + * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'. |
|
| 889 | + * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'. |
|
| 890 | + * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 891 | + */ |
|
| 892 | + do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 893 | + ?> |
|
| 894 | 894 | <div class="geodir-content-left geodir-sidebar-wrap"><?php |
| 895 | - /** |
|
| 896 | - * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar. |
|
| 897 | - * |
|
| 898 | - * This is used to add all info to the details page sidebars. |
|
| 899 | - * |
|
| 900 | - * @since 1.0.0 |
|
| 901 | - */ |
|
| 902 | - do_action('geodir_detail_sidebar_inside');
|
|
| 903 | - ?></div><!-- end geodir-content-left --><?php |
|
| 904 | - /** |
|
| 905 | - * Called after the details page left sidebar. |
|
| 906 | - * |
|
| 907 | - * This is used to add closing wrapper HTML to the details page left sidebar. |
|
| 908 | - * |
|
| 909 | - * @since 1.0.0 |
|
| 910 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 911 | - */ |
|
| 912 | - do_action('geodir_sidebar_left_close', 'details-page');
|
|
| 913 | - } else {
|
|
| 914 | - /** |
|
| 915 | - * Called before the details page right sidebar is opened. |
|
| 916 | - * |
|
| 917 | - * This is used to add opening wrapper HTML to the details page right sidebar. |
|
| 918 | - * |
|
| 919 | - * @since 1.0.0 |
|
| 920 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'. |
|
| 921 | - * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'. |
|
| 922 | - * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'. |
|
| 923 | - * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 924 | - */ |
|
| 925 | - do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 926 | - ?> |
|
| 895 | + /** |
|
| 896 | + * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar. |
|
| 897 | + * |
|
| 898 | + * This is used to add all info to the details page sidebars. |
|
| 899 | + * |
|
| 900 | + * @since 1.0.0 |
|
| 901 | + */ |
|
| 902 | + do_action('geodir_detail_sidebar_inside');
|
|
| 903 | + ?></div><!-- end geodir-content-left --><?php |
|
| 904 | + /** |
|
| 905 | + * Called after the details page left sidebar. |
|
| 906 | + * |
|
| 907 | + * This is used to add closing wrapper HTML to the details page left sidebar. |
|
| 908 | + * |
|
| 909 | + * @since 1.0.0 |
|
| 910 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 911 | + */ |
|
| 912 | + do_action('geodir_sidebar_left_close', 'details-page');
|
|
| 913 | + } else {
|
|
| 914 | + /** |
|
| 915 | + * Called before the details page right sidebar is opened. |
|
| 916 | + * |
|
| 917 | + * This is used to add opening wrapper HTML to the details page right sidebar. |
|
| 918 | + * |
|
| 919 | + * @since 1.0.0 |
|
| 920 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'. |
|
| 921 | + * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'. |
|
| 922 | + * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'. |
|
| 923 | + * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 924 | + */ |
|
| 925 | + do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 926 | + ?> |
|
| 927 | 927 | <div class="geodir-content-right geodir-sidebar-wrap"><?php |
| 928 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 929 | - do_action('geodir_detail_sidebar_inside');
|
|
| 930 | - ?></div><!-- end geodir-content-right --><?php |
|
| 931 | - /** |
|
| 932 | - * Called after the details page right sidebar. |
|
| 933 | - * |
|
| 934 | - * This is used to add closing wrapper HTML to the details page right sidebar. |
|
| 935 | - * |
|
| 936 | - * @since 1.0.0 |
|
| 937 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 938 | - */ |
|
| 939 | - do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 940 | - } |
|
| 928 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 929 | + do_action('geodir_detail_sidebar_inside');
|
|
| 930 | + ?></div><!-- end geodir-content-right --><?php |
|
| 931 | + /** |
|
| 932 | + * Called after the details page right sidebar. |
|
| 933 | + * |
|
| 934 | + * This is used to add closing wrapper HTML to the details page right sidebar. |
|
| 935 | + * |
|
| 936 | + * @since 1.0.0 |
|
| 937 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 938 | + */ |
|
| 939 | + do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 940 | + } |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | add_action('geodir_page_title', 'geodir_action_page_title', 10);
|
@@ -951,21 +951,21 @@ discard block |
||
| 951 | 951 | */ |
| 952 | 952 | function geodir_action_page_title() |
| 953 | 953 | {
|
| 954 | - /** |
|
| 955 | - * Filter the page title HTML h1 class. |
|
| 956 | - * |
|
| 957 | - * @since 1.0.0 |
|
| 958 | - * @param string $class The class to use. Default is 'entry-title fn'. |
|
| 959 | - */ |
|
| 960 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 961 | - /** |
|
| 962 | - * Filter the page title HTML header wrapper class. |
|
| 963 | - * |
|
| 964 | - * @since 1.0.0 |
|
| 965 | - * @param string $class The class to use. Default is 'entry-header'. |
|
| 966 | - */ |
|
| 967 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 968 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 954 | + /** |
|
| 955 | + * Filter the page title HTML h1 class. |
|
| 956 | + * |
|
| 957 | + * @since 1.0.0 |
|
| 958 | + * @param string $class The class to use. Default is 'entry-title fn'. |
|
| 959 | + */ |
|
| 960 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 961 | + /** |
|
| 962 | + * Filter the page title HTML header wrapper class. |
|
| 963 | + * |
|
| 964 | + * @since 1.0.0 |
|
| 965 | + * @param string $class The class to use. Default is 'entry-header'. |
|
| 966 | + */ |
|
| 967 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 968 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | |
@@ -982,87 +982,87 @@ discard block |
||
| 982 | 982 | */ |
| 983 | 983 | function geodir_action_details_slider() |
| 984 | 984 | {
|
| 985 | - global $preview, $post; |
|
| 985 | + global $preview, $post; |
|
| 986 | 986 | |
| 987 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend |
|
| 987 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend |
|
| 988 | 988 | |
| 989 | - if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
|
|
| 990 | - $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 989 | + if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
|
|
| 990 | + $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 991 | 991 | |
| 992 | - $preview_post_images = array(); |
|
| 993 | - if ($preview_get_images) {
|
|
| 994 | - foreach ($preview_get_images as $row) {
|
|
| 995 | - $preview_post_images[] = $row->src; |
|
| 996 | - } |
|
| 997 | - } |
|
| 998 | - if (!empty($preview_post_images)) {
|
|
| 999 | - $post->post_images = implode(',', $preview_post_images);
|
|
| 1000 | - } |
|
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - if ($preview) {
|
|
| 1004 | - $post_images = array(); |
|
| 1005 | - if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1006 | - $post->post_images = trim($post->post_images, ","); |
|
| 1007 | - $post_images = explode(",", $post->post_images);
|
|
| 1008 | - } |
|
| 1009 | - |
|
| 1010 | - $main_slides = ''; |
|
| 1011 | - $nav_slides = ''; |
|
| 1012 | - $slides = 0; |
|
| 1013 | - |
|
| 1014 | - if (!empty($post_images)) {
|
|
| 1015 | - foreach ($post_images as $image) {
|
|
| 1016 | - if (!empty($image)) {
|
|
| 1017 | - $sizes = getimagesize(trim($image)); |
|
| 1018 | - $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0; |
|
| 1019 | - $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
|
| 1020 | - |
|
| 1021 | - if ($image && $width && $height) {
|
|
| 1022 | - $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1023 | - } |
|
| 1024 | - |
|
| 1025 | - if (isset($image->src)) {
|
|
| 1026 | - if ($image->height >= 400) {
|
|
| 1027 | - $spacer_height = 0; |
|
| 1028 | - } else {
|
|
| 1029 | - $spacer_height = ((400 - $image->height) / 2); |
|
| 1030 | - } |
|
| 1031 | - |
|
| 1032 | - $image_title = isset($image->title) ? $image->title : ''; |
|
| 1033 | - |
|
| 1034 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1035 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1036 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1037 | - $slides++; |
|
| 1038 | - } |
|
| 1039 | - } |
|
| 1040 | - }// endfore |
|
| 1041 | - } //end if |
|
| 1042 | - } else {
|
|
| 1043 | - $main_slides = ''; |
|
| 1044 | - $nav_slides = ''; |
|
| 1045 | - $post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page. |
|
| 1046 | - $slides = 0; |
|
| 1047 | - |
|
| 1048 | - if (!empty($post_images)) {
|
|
| 1049 | - foreach ($post_images as $image) {
|
|
| 1050 | - if ($image->height >= 400) {
|
|
| 1051 | - $spacer_height = 0; |
|
| 1052 | - } else {
|
|
| 1053 | - $spacer_height = ((400 - $image->height) / 2); |
|
| 1054 | - } |
|
| 1055 | - $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1056 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1057 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1058 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1059 | - $slides++; |
|
| 1060 | - } |
|
| 1061 | - }// endfore |
|
| 1062 | - } |
|
| 992 | + $preview_post_images = array(); |
|
| 993 | + if ($preview_get_images) {
|
|
| 994 | + foreach ($preview_get_images as $row) {
|
|
| 995 | + $preview_post_images[] = $row->src; |
|
| 996 | + } |
|
| 997 | + } |
|
| 998 | + if (!empty($preview_post_images)) {
|
|
| 999 | + $post->post_images = implode(',', $preview_post_images);
|
|
| 1000 | + } |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + if ($preview) {
|
|
| 1004 | + $post_images = array(); |
|
| 1005 | + if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1006 | + $post->post_images = trim($post->post_images, ","); |
|
| 1007 | + $post_images = explode(",", $post->post_images);
|
|
| 1008 | + } |
|
| 1009 | + |
|
| 1010 | + $main_slides = ''; |
|
| 1011 | + $nav_slides = ''; |
|
| 1012 | + $slides = 0; |
|
| 1013 | + |
|
| 1014 | + if (!empty($post_images)) {
|
|
| 1015 | + foreach ($post_images as $image) {
|
|
| 1016 | + if (!empty($image)) {
|
|
| 1017 | + $sizes = getimagesize(trim($image)); |
|
| 1018 | + $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0; |
|
| 1019 | + $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
|
| 1020 | + |
|
| 1021 | + if ($image && $width && $height) {
|
|
| 1022 | + $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1023 | + } |
|
| 1024 | + |
|
| 1025 | + if (isset($image->src)) {
|
|
| 1026 | + if ($image->height >= 400) {
|
|
| 1027 | + $spacer_height = 0; |
|
| 1028 | + } else {
|
|
| 1029 | + $spacer_height = ((400 - $image->height) / 2); |
|
| 1030 | + } |
|
| 1031 | + |
|
| 1032 | + $image_title = isset($image->title) ? $image->title : ''; |
|
| 1033 | + |
|
| 1034 | + $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1035 | + $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1036 | + $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1037 | + $slides++; |
|
| 1038 | + } |
|
| 1039 | + } |
|
| 1040 | + }// endfore |
|
| 1041 | + } //end if |
|
| 1042 | + } else {
|
|
| 1043 | + $main_slides = ''; |
|
| 1044 | + $nav_slides = ''; |
|
| 1045 | + $post_images = geodir_get_images($post->ID, 'thumbnail', false); // Hide default image on listing preview/detail page. |
|
| 1046 | + $slides = 0; |
|
| 1047 | + |
|
| 1048 | + if (!empty($post_images)) {
|
|
| 1049 | + foreach ($post_images as $image) {
|
|
| 1050 | + if ($image->height >= 400) {
|
|
| 1051 | + $spacer_height = 0; |
|
| 1052 | + } else {
|
|
| 1053 | + $spacer_height = ((400 - $image->height) / 2); |
|
| 1054 | + } |
|
| 1055 | + $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1056 | + $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1057 | + $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1058 | + $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1059 | + $slides++; |
|
| 1060 | + } |
|
| 1061 | + }// endfore |
|
| 1062 | + } |
|
| 1063 | 1063 | |
| 1064 | - if (!empty($post_images)) {
|
|
| 1065 | - ?> |
|
| 1064 | + if (!empty($post_images)) {
|
|
| 1065 | + ?> |
|
| 1066 | 1066 | <div class="geodir_flex-container"> |
| 1067 | 1067 | <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div> |
| 1068 | 1068 | <div id="geodir_slider" class="geodir_flexslider "> |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | <?php } ?> |
| 1076 | 1076 | </div> |
| 1077 | 1077 | <?php |
| 1078 | - } |
|
| 1078 | + } |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
|
@@ -1090,177 +1090,177 @@ discard block |
||
| 1090 | 1090 | */ |
| 1091 | 1091 | function geodir_action_details_taxonomies() |
| 1092 | 1092 | {
|
| 1093 | - global $preview, $post;?> |
|
| 1093 | + global $preview, $post;?> |
|
| 1094 | 1094 | <p class="geodir_post_taxomomies clearfix"> |
| 1095 | 1095 | <?php |
| 1096 | - $taxonomies = array(); |
|
| 1097 | - |
|
| 1098 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1099 | - |
|
| 1100 | - if ($preview && !$is_backend_preview) {
|
|
| 1101 | - $post_type = $post->listing_type; |
|
| 1102 | - $post_taxonomy = $post_type . 'category'; |
|
| 1103 | - $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
|
| 1104 | - } else {
|
|
| 1105 | - $post_type = $post->post_type; |
|
| 1106 | - $post_taxonomy = $post_type . 'category'; |
|
| 1107 | - } |
|
| 1096 | + $taxonomies = array(); |
|
| 1097 | + |
|
| 1098 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1099 | + |
|
| 1100 | + if ($preview && !$is_backend_preview) {
|
|
| 1101 | + $post_type = $post->listing_type; |
|
| 1102 | + $post_taxonomy = $post_type . 'category'; |
|
| 1103 | + $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
|
| 1104 | + } else {
|
|
| 1105 | + $post_type = $post->post_type; |
|
| 1106 | + $post_taxonomy = $post_type . 'category'; |
|
| 1107 | + } |
|
| 1108 | 1108 | //{
|
| 1109 | - $post_type_info = get_post_type_object($post_type); |
|
| 1110 | - $listing_label = __($post_type_info->labels->singular_name, 'geodirectory'); |
|
| 1111 | - |
|
| 1112 | - if (!empty($post->post_tags)) {
|
|
| 1113 | - |
|
| 1114 | - if (taxonomy_exists($post_type . '_tags')): |
|
| 1115 | - $links = array(); |
|
| 1116 | - $terms = array(); |
|
| 1117 | - // to limit post tags |
|
| 1118 | - $post_tags = trim($post->post_tags, ","); |
|
| 1119 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 1120 | - /** |
|
| 1121 | - * Filter the post tags. |
|
| 1122 | - * |
|
| 1123 | - * Allows you to filter the post tags output on the details page of a post. |
|
| 1124 | - * |
|
| 1125 | - * @since 1.0.0 |
|
| 1126 | - * @param string $post_tags A comma seperated list of tags. |
|
| 1127 | - * @param int $post_id The current post id. |
|
| 1128 | - */ |
|
| 1129 | - $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
|
|
| 1130 | - |
|
| 1131 | - $post->post_tags = $post_tags; |
|
| 1132 | - $post_tags = explode(",", trim($post->post_tags, ","));
|
|
| 1133 | - |
|
| 1134 | - |
|
| 1135 | - foreach ($post_tags as $post_term) {
|
|
| 1136 | - |
|
| 1137 | - // fix slug creation order for tags & location |
|
| 1138 | - $post_term = trim($post_term); |
|
| 1139 | - |
|
| 1140 | - $priority_location = false; |
|
| 1141 | - if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1142 | - $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1143 | - } else {
|
|
| 1144 | - $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
|
| 1145 | - $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
|
| 1146 | - $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL; |
|
| 1147 | - $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false; |
|
| 1148 | - $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false; |
|
| 1149 | - $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
|
| 1150 | - if ($match_country || $match_region || $match_city) {
|
|
| 1151 | - $priority_location = true; |
|
| 1152 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1153 | - } else {
|
|
| 1154 | - $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1155 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1156 | - } |
|
| 1157 | - } |
|
| 1158 | - |
|
| 1159 | - if (!is_wp_error($term) && is_object($term)) {
|
|
| 1160 | - |
|
| 1161 | - // fix tag link on detail page |
|
| 1162 | - if ($priority_location) {
|
|
| 1163 | - |
|
| 1164 | - $tag_link = "<a href=''>$post_term</a>"; |
|
| 1165 | - /** |
|
| 1166 | - * Filter the tag name on the details page. |
|
| 1167 | - * |
|
| 1168 | - * @since 1.5.6 |
|
| 1169 | - * @param string $tag_link The tag link html. |
|
| 1170 | - * @param object $term The tag term object. |
|
| 1171 | - */ |
|
| 1172 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1173 | - $links[] = $tag_link; |
|
| 1174 | - } else {
|
|
| 1175 | - $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1176 | - /** This action is documented in geodirectory-template_actions.php */ |
|
| 1177 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1178 | - $links[] = $tag_link; |
|
| 1179 | - } |
|
| 1180 | - $terms[] = $term; |
|
| 1181 | - } |
|
| 1182 | - // |
|
| 1183 | - } |
|
| 1184 | - if (!isset($listing_label)) {
|
|
| 1185 | - $listing_label = ''; |
|
| 1186 | - } |
|
| 1187 | - $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1188 | - endif; |
|
| 1189 | - |
|
| 1190 | - } |
|
| 1191 | - |
|
| 1192 | - if (!empty($post->{$post_taxonomy})) {
|
|
| 1193 | - $links = array(); |
|
| 1194 | - $terms = array(); |
|
| 1195 | - $termsOrdered = array(); |
|
| 1196 | - if (!is_array($post->{$post_taxonomy})) {
|
|
| 1197 | - $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
|
|
| 1198 | - } else {
|
|
| 1199 | - $post_term = $post->{$post_taxonomy};
|
|
| 1109 | + $post_type_info = get_post_type_object($post_type); |
|
| 1110 | + $listing_label = __($post_type_info->labels->singular_name, 'geodirectory'); |
|
| 1111 | + |
|
| 1112 | + if (!empty($post->post_tags)) {
|
|
| 1113 | + |
|
| 1114 | + if (taxonomy_exists($post_type . '_tags')): |
|
| 1115 | + $links = array(); |
|
| 1116 | + $terms = array(); |
|
| 1117 | + // to limit post tags |
|
| 1118 | + $post_tags = trim($post->post_tags, ","); |
|
| 1119 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 1120 | + /** |
|
| 1121 | + * Filter the post tags. |
|
| 1122 | + * |
|
| 1123 | + * Allows you to filter the post tags output on the details page of a post. |
|
| 1124 | + * |
|
| 1125 | + * @since 1.0.0 |
|
| 1126 | + * @param string $post_tags A comma seperated list of tags. |
|
| 1127 | + * @param int $post_id The current post id. |
|
| 1128 | + */ |
|
| 1129 | + $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
|
|
| 1130 | + |
|
| 1131 | + $post->post_tags = $post_tags; |
|
| 1132 | + $post_tags = explode(",", trim($post->post_tags, ","));
|
|
| 1133 | + |
|
| 1134 | + |
|
| 1135 | + foreach ($post_tags as $post_term) {
|
|
| 1136 | + |
|
| 1137 | + // fix slug creation order for tags & location |
|
| 1138 | + $post_term = trim($post_term); |
|
| 1139 | + |
|
| 1140 | + $priority_location = false; |
|
| 1141 | + if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1142 | + $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1143 | + } else {
|
|
| 1144 | + $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
|
| 1145 | + $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
|
| 1146 | + $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL; |
|
| 1147 | + $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false; |
|
| 1148 | + $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false; |
|
| 1149 | + $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
|
| 1150 | + if ($match_country || $match_region || $match_city) {
|
|
| 1151 | + $priority_location = true; |
|
| 1152 | + $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1153 | + } else {
|
|
| 1154 | + $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1155 | + $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1156 | + } |
|
| 1157 | + } |
|
| 1158 | + |
|
| 1159 | + if (!is_wp_error($term) && is_object($term)) {
|
|
| 1160 | + |
|
| 1161 | + // fix tag link on detail page |
|
| 1162 | + if ($priority_location) {
|
|
| 1163 | + |
|
| 1164 | + $tag_link = "<a href=''>$post_term</a>"; |
|
| 1165 | + /** |
|
| 1166 | + * Filter the tag name on the details page. |
|
| 1167 | + * |
|
| 1168 | + * @since 1.5.6 |
|
| 1169 | + * @param string $tag_link The tag link html. |
|
| 1170 | + * @param object $term The tag term object. |
|
| 1171 | + */ |
|
| 1172 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1173 | + $links[] = $tag_link; |
|
| 1174 | + } else {
|
|
| 1175 | + $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1176 | + /** This action is documented in geodirectory-template_actions.php */ |
|
| 1177 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1178 | + $links[] = $tag_link; |
|
| 1179 | + } |
|
| 1180 | + $terms[] = $term; |
|
| 1181 | + } |
|
| 1182 | + // |
|
| 1183 | + } |
|
| 1184 | + if (!isset($listing_label)) {
|
|
| 1185 | + $listing_label = ''; |
|
| 1186 | + } |
|
| 1187 | + $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1188 | + endif; |
|
| 1189 | + |
|
| 1190 | + } |
|
| 1191 | + |
|
| 1192 | + if (!empty($post->{$post_taxonomy})) {
|
|
| 1193 | + $links = array(); |
|
| 1194 | + $terms = array(); |
|
| 1195 | + $termsOrdered = array(); |
|
| 1196 | + if (!is_array($post->{$post_taxonomy})) {
|
|
| 1197 | + $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
|
|
| 1198 | + } else {
|
|
| 1199 | + $post_term = $post->{$post_taxonomy};
|
|
| 1200 | 1200 | |
| 1201 | 1201 | if ($preview && !$is_backend_preview) {
|
| 1202 | 1202 | $post_term = geodir_add_parent_terms($post_term, $post_taxonomy); |
| 1203 | 1203 | } |
| 1204 | - } |
|
| 1205 | - |
|
| 1206 | - $post_term = array_unique($post_term); |
|
| 1207 | - if (!empty($post_term)) {
|
|
| 1208 | - foreach ($post_term as $post_term) {
|
|
| 1209 | - $post_term = trim($post_term); |
|
| 1210 | - |
|
| 1211 | - if ($post_term != ''): |
|
| 1212 | - $term = get_term_by('id', $post_term, $post_taxonomy);
|
|
| 1213 | - |
|
| 1214 | - if (is_object($term)) {
|
|
| 1215 | - $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1216 | - /** |
|
| 1217 | - * Filter the category name on the details page. |
|
| 1218 | - * |
|
| 1219 | - * @since 1.5.6 |
|
| 1220 | - * @param string $term_link The link html to the category. |
|
| 1221 | - * @param object $term The category term object. |
|
| 1222 | - */ |
|
| 1223 | - $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1224 | - $links[] = $term_link; |
|
| 1225 | - $terms[] = $term; |
|
| 1226 | - } |
|
| 1227 | - endif; |
|
| 1228 | - } |
|
| 1229 | - // order alphabetically |
|
| 1230 | - asort($links); |
|
| 1231 | - foreach (array_keys($links) as $key) {
|
|
| 1232 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1233 | - } |
|
| 1234 | - $terms = $termsOrdered; |
|
| 1204 | + } |
|
| 1205 | + |
|
| 1206 | + $post_term = array_unique($post_term); |
|
| 1207 | + if (!empty($post_term)) {
|
|
| 1208 | + foreach ($post_term as $post_term) {
|
|
| 1209 | + $post_term = trim($post_term); |
|
| 1210 | + |
|
| 1211 | + if ($post_term != ''): |
|
| 1212 | + $term = get_term_by('id', $post_term, $post_taxonomy);
|
|
| 1213 | + |
|
| 1214 | + if (is_object($term)) {
|
|
| 1215 | + $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1216 | + /** |
|
| 1217 | + * Filter the category name on the details page. |
|
| 1218 | + * |
|
| 1219 | + * @since 1.5.6 |
|
| 1220 | + * @param string $term_link The link html to the category. |
|
| 1221 | + * @param object $term The category term object. |
|
| 1222 | + */ |
|
| 1223 | + $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1224 | + $links[] = $term_link; |
|
| 1225 | + $terms[] = $term; |
|
| 1226 | + } |
|
| 1227 | + endif; |
|
| 1228 | + } |
|
| 1229 | + // order alphabetically |
|
| 1230 | + asort($links); |
|
| 1231 | + foreach (array_keys($links) as $key) {
|
|
| 1232 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1233 | + } |
|
| 1234 | + $terms = $termsOrdered; |
|
| 1235 | 1235 | |
| 1236 | - } |
|
| 1236 | + } |
|
| 1237 | 1237 | |
| 1238 | - if (!isset($listing_label)) {
|
|
| 1239 | - $listing_label = ''; |
|
| 1240 | - } |
|
| 1241 | - $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1238 | + if (!isset($listing_label)) {
|
|
| 1239 | + $listing_label = ''; |
|
| 1240 | + } |
|
| 1241 | + $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1242 | 1242 | |
| 1243 | - } |
|
| 1243 | + } |
|
| 1244 | 1244 | |
| 1245 | - /** |
|
| 1246 | - * Filter the taxonomies array before output. |
|
| 1247 | - * |
|
| 1248 | - * @since 1.5.9 |
|
| 1249 | - * @param array $taxonomies The array of cats and tags. |
|
| 1250 | - * @param string $post_type The post type being output. |
|
| 1251 | - * @param string $listing_label The post type label. |
|
| 1252 | - * @param string $listing_label The post type label with ucwords function. |
|
| 1253 | - */ |
|
| 1254 | - $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1245 | + /** |
|
| 1246 | + * Filter the taxonomies array before output. |
|
| 1247 | + * |
|
| 1248 | + * @since 1.5.9 |
|
| 1249 | + * @param array $taxonomies The array of cats and tags. |
|
| 1250 | + * @param string $post_type The post type being output. |
|
| 1251 | + * @param string $listing_label The post type label. |
|
| 1252 | + * @param string $listing_label The post type label with ucwords function. |
|
| 1253 | + */ |
|
| 1254 | + $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1255 | 1255 | |
| 1256 | - if (isset($taxonomies[$post_taxonomy])) {
|
|
| 1257 | - echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1258 | - } |
|
| 1256 | + if (isset($taxonomies[$post_taxonomy])) {
|
|
| 1257 | + echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1258 | + } |
|
| 1259 | 1259 | |
| 1260 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1261 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1260 | + if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1261 | + echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1262 | 1262 | |
| 1263 | - ?> |
|
| 1263 | + ?> |
|
| 1264 | 1264 | </p><?php |
| 1265 | 1265 | } |
| 1266 | 1266 | |
@@ -1282,140 +1282,140 @@ discard block |
||
| 1282 | 1282 | function geodir_action_details_micordata($post='') |
| 1283 | 1283 | {
|
| 1284 | 1284 | |
| 1285 | - global $preview; |
|
| 1286 | - if(empty($post)){global $post;}
|
|
| 1287 | - if ($preview || !geodir_is_page('detail')) {
|
|
| 1288 | - return; |
|
| 1289 | - } |
|
| 1290 | - |
|
| 1291 | - // url |
|
| 1292 | - $c_url = geodir_curPageURL(); |
|
| 1293 | - |
|
| 1294 | - // post reviews |
|
| 1295 | - $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
|
|
| 1296 | - if (empty($post_reviews)) {
|
|
| 1297 | - $reviews = ''; |
|
| 1298 | - } else {
|
|
| 1299 | - foreach ($post_reviews as $review) {
|
|
| 1300 | - $reviews[] = array( |
|
| 1301 | - "@type" => "Review", |
|
| 1302 | - "author" => $review->comment_author, |
|
| 1303 | - "datePublished" => $review->comment_date, |
|
| 1304 | - "description" => $review->comment_content, |
|
| 1305 | - "reviewRating" => array( |
|
| 1306 | - "@type" => "Rating", |
|
| 1307 | - "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1308 | - "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
|
| 1309 | - "worstRating" => "1" |
|
| 1310 | - ) |
|
| 1311 | - ); |
|
| 1312 | - } |
|
| 1313 | - |
|
| 1314 | - } |
|
| 1315 | - |
|
| 1316 | - // post images |
|
| 1317 | - $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 1318 | - if (empty($post_images)) {
|
|
| 1319 | - $images = ''; |
|
| 1320 | - } else {
|
|
| 1321 | - $i_arr = array(); |
|
| 1322 | - foreach ($post_images as $img) {
|
|
| 1323 | - $i_arr[] = $img->src; |
|
| 1324 | - } |
|
| 1325 | - |
|
| 1326 | - if (count($i_arr) == 1) {
|
|
| 1327 | - $images = $i_arr[0]; |
|
| 1328 | - } else {
|
|
| 1329 | - $images = $i_arr; |
|
| 1330 | - } |
|
| 1331 | - |
|
| 1332 | - } |
|
| 1333 | - //print_r($post); |
|
| 1334 | - // external links |
|
| 1335 | - $external_links = array(); |
|
| 1336 | - $external_links[] = $post->geodir_website; |
|
| 1337 | - $external_links[] = $post->geodir_twitter; |
|
| 1338 | - $external_links[] = $post->geodir_facebook; |
|
| 1339 | - $external_links = array_filter($external_links); |
|
| 1340 | - |
|
| 1341 | - if(!empty($external_links)){
|
|
| 1342 | - $external_links = array_values($external_links); |
|
| 1343 | - } |
|
| 1344 | - |
|
| 1345 | - // reviews |
|
| 1346 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1347 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1348 | - |
|
| 1349 | - // schema type |
|
| 1350 | - $schema_type = 'LocalBusiness'; |
|
| 1351 | - if(isset($post->default_category) && $post->default_category){
|
|
| 1352 | - $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
|
| 1353 | - if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1354 | - if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1355 | - } |
|
| 1356 | - |
|
| 1357 | - $schema = array(); |
|
| 1358 | - $schema['@context'] = "http://schema.org"; |
|
| 1359 | - $schema['@type'] = $schema_type; |
|
| 1360 | - $schema['name'] = $post->post_name; |
|
| 1361 | - $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1362 | - $schema['telephone'] = $post->geodir_contact; |
|
| 1363 | - $schema['url'] = $c_url; |
|
| 1364 | - $schema['sameAs'] = $external_links; |
|
| 1365 | - $schema['image'] = $images; |
|
| 1366 | - $schema['address'] = array( |
|
| 1367 | - "@type" => "PostalAddress", |
|
| 1368 | - "streetAddress" => $post->post_address, |
|
| 1369 | - "addressLocality" => $post->post_city, |
|
| 1370 | - "addressRegion" => $post->post_region, |
|
| 1371 | - "addressCountry" => $post->post_country, |
|
| 1372 | - "postalCode" => $post->post_zip |
|
| 1373 | - ); |
|
| 1374 | - |
|
| 1375 | - if($post->post_latitude && $post->post_longitude) {
|
|
| 1376 | - $schema['geo'] = array( |
|
| 1377 | - "@type" => "GeoCoordinates", |
|
| 1378 | - "latitude" => $post->post_latitude, |
|
| 1379 | - "longitude" => $post->post_longitude |
|
| 1380 | - ); |
|
| 1381 | - } |
|
| 1382 | - |
|
| 1383 | - if($post_avgratings) {
|
|
| 1384 | - $schema['aggregateRating'] = array( |
|
| 1385 | - "@type" => "AggregateRating", |
|
| 1386 | - "ratingValue" => $post_avgratings, |
|
| 1387 | - "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1388 | - "worstRating" => "1", |
|
| 1389 | - "ratingCount" => $comment_count |
|
| 1390 | - ); |
|
| 1391 | - } |
|
| 1392 | - $schema['review'] = $reviews; |
|
| 1393 | - |
|
| 1394 | - /** |
|
| 1395 | - * Allow the schema JSON-LD info to be filtered. |
|
| 1396 | - * |
|
| 1397 | - * @since 1.5.4 |
|
| 1398 | - * @since 1.5.7 Added $post variable. |
|
| 1399 | - * @param array $schema The array of schema data to be filtered. |
|
| 1400 | - * @param object $post The post object. |
|
| 1401 | - */ |
|
| 1402 | - $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1403 | - |
|
| 1404 | - |
|
| 1405 | - echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1406 | - |
|
| 1407 | - |
|
| 1408 | - $uploads = wp_upload_dir(); |
|
| 1409 | - $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : ''; |
|
| 1410 | - |
|
| 1411 | - /** |
|
| 1412 | - * Show facebook open graph meta info |
|
| 1413 | - * |
|
| 1414 | - * @since 1.6.6 |
|
| 1415 | - * @param string $facebook_og The open graph html to be filtered. |
|
| 1416 | - * @param object $post The post object. |
|
| 1417 | - */ |
|
| 1418 | - echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1285 | + global $preview; |
|
| 1286 | + if(empty($post)){global $post;}
|
|
| 1287 | + if ($preview || !geodir_is_page('detail')) {
|
|
| 1288 | + return; |
|
| 1289 | + } |
|
| 1290 | + |
|
| 1291 | + // url |
|
| 1292 | + $c_url = geodir_curPageURL(); |
|
| 1293 | + |
|
| 1294 | + // post reviews |
|
| 1295 | + $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
|
|
| 1296 | + if (empty($post_reviews)) {
|
|
| 1297 | + $reviews = ''; |
|
| 1298 | + } else {
|
|
| 1299 | + foreach ($post_reviews as $review) {
|
|
| 1300 | + $reviews[] = array( |
|
| 1301 | + "@type" => "Review", |
|
| 1302 | + "author" => $review->comment_author, |
|
| 1303 | + "datePublished" => $review->comment_date, |
|
| 1304 | + "description" => $review->comment_content, |
|
| 1305 | + "reviewRating" => array( |
|
| 1306 | + "@type" => "Rating", |
|
| 1307 | + "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1308 | + "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
|
| 1309 | + "worstRating" => "1" |
|
| 1310 | + ) |
|
| 1311 | + ); |
|
| 1312 | + } |
|
| 1313 | + |
|
| 1314 | + } |
|
| 1315 | + |
|
| 1316 | + // post images |
|
| 1317 | + $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 1318 | + if (empty($post_images)) {
|
|
| 1319 | + $images = ''; |
|
| 1320 | + } else {
|
|
| 1321 | + $i_arr = array(); |
|
| 1322 | + foreach ($post_images as $img) {
|
|
| 1323 | + $i_arr[] = $img->src; |
|
| 1324 | + } |
|
| 1325 | + |
|
| 1326 | + if (count($i_arr) == 1) {
|
|
| 1327 | + $images = $i_arr[0]; |
|
| 1328 | + } else {
|
|
| 1329 | + $images = $i_arr; |
|
| 1330 | + } |
|
| 1331 | + |
|
| 1332 | + } |
|
| 1333 | + //print_r($post); |
|
| 1334 | + // external links |
|
| 1335 | + $external_links = array(); |
|
| 1336 | + $external_links[] = $post->geodir_website; |
|
| 1337 | + $external_links[] = $post->geodir_twitter; |
|
| 1338 | + $external_links[] = $post->geodir_facebook; |
|
| 1339 | + $external_links = array_filter($external_links); |
|
| 1340 | + |
|
| 1341 | + if(!empty($external_links)){
|
|
| 1342 | + $external_links = array_values($external_links); |
|
| 1343 | + } |
|
| 1344 | + |
|
| 1345 | + // reviews |
|
| 1346 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1347 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1348 | + |
|
| 1349 | + // schema type |
|
| 1350 | + $schema_type = 'LocalBusiness'; |
|
| 1351 | + if(isset($post->default_category) && $post->default_category){
|
|
| 1352 | + $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
|
| 1353 | + if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1354 | + if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1355 | + } |
|
| 1356 | + |
|
| 1357 | + $schema = array(); |
|
| 1358 | + $schema['@context'] = "http://schema.org"; |
|
| 1359 | + $schema['@type'] = $schema_type; |
|
| 1360 | + $schema['name'] = $post->post_name; |
|
| 1361 | + $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1362 | + $schema['telephone'] = $post->geodir_contact; |
|
| 1363 | + $schema['url'] = $c_url; |
|
| 1364 | + $schema['sameAs'] = $external_links; |
|
| 1365 | + $schema['image'] = $images; |
|
| 1366 | + $schema['address'] = array( |
|
| 1367 | + "@type" => "PostalAddress", |
|
| 1368 | + "streetAddress" => $post->post_address, |
|
| 1369 | + "addressLocality" => $post->post_city, |
|
| 1370 | + "addressRegion" => $post->post_region, |
|
| 1371 | + "addressCountry" => $post->post_country, |
|
| 1372 | + "postalCode" => $post->post_zip |
|
| 1373 | + ); |
|
| 1374 | + |
|
| 1375 | + if($post->post_latitude && $post->post_longitude) {
|
|
| 1376 | + $schema['geo'] = array( |
|
| 1377 | + "@type" => "GeoCoordinates", |
|
| 1378 | + "latitude" => $post->post_latitude, |
|
| 1379 | + "longitude" => $post->post_longitude |
|
| 1380 | + ); |
|
| 1381 | + } |
|
| 1382 | + |
|
| 1383 | + if($post_avgratings) {
|
|
| 1384 | + $schema['aggregateRating'] = array( |
|
| 1385 | + "@type" => "AggregateRating", |
|
| 1386 | + "ratingValue" => $post_avgratings, |
|
| 1387 | + "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1388 | + "worstRating" => "1", |
|
| 1389 | + "ratingCount" => $comment_count |
|
| 1390 | + ); |
|
| 1391 | + } |
|
| 1392 | + $schema['review'] = $reviews; |
|
| 1393 | + |
|
| 1394 | + /** |
|
| 1395 | + * Allow the schema JSON-LD info to be filtered. |
|
| 1396 | + * |
|
| 1397 | + * @since 1.5.4 |
|
| 1398 | + * @since 1.5.7 Added $post variable. |
|
| 1399 | + * @param array $schema The array of schema data to be filtered. |
|
| 1400 | + * @param object $post The post object. |
|
| 1401 | + */ |
|
| 1402 | + $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1403 | + |
|
| 1404 | + |
|
| 1405 | + echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1406 | + |
|
| 1407 | + |
|
| 1408 | + $uploads = wp_upload_dir(); |
|
| 1409 | + $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : ''; |
|
| 1410 | + |
|
| 1411 | + /** |
|
| 1412 | + * Show facebook open graph meta info |
|
| 1413 | + * |
|
| 1414 | + * @since 1.6.6 |
|
| 1415 | + * @param string $facebook_og The open graph html to be filtered. |
|
| 1416 | + * @param object $post The post object. |
|
| 1417 | + */ |
|
| 1418 | + echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1419 | 1419 | |
| 1420 | 1420 | |
| 1421 | 1421 | |
@@ -1435,7 +1435,7 @@ discard block |
||
| 1435 | 1435 | */ |
| 1436 | 1436 | function geodir_action_details_next_prev() |
| 1437 | 1437 | {
|
| 1438 | - ?> |
|
| 1438 | + ?> |
|
| 1439 | 1439 | <div class="geodir-pos_navigation clearfix"> |
| 1440 | 1440 | <div |
| 1441 | 1441 | class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
|
@@ -1453,15 +1453,15 @@ discard block |
||
| 1453 | 1453 | */ |
| 1454 | 1454 | function geodir_action_before_single_post() |
| 1455 | 1455 | {
|
| 1456 | - global $post; |
|
| 1457 | - /** |
|
| 1458 | - * Called at the very start of the details page output, before the title section. |
|
| 1459 | - * |
|
| 1460 | - * @since 1.0.0 |
|
| 1461 | - * @param object $post The current post object. |
|
| 1462 | - * @global WP_Post|null $post The current post, if available. |
|
| 1463 | - */ |
|
| 1464 | - do_action('geodir_before_single_post', $post); // extra action
|
|
| 1456 | + global $post; |
|
| 1457 | + /** |
|
| 1458 | + * Called at the very start of the details page output, before the title section. |
|
| 1459 | + * |
|
| 1460 | + * @since 1.0.0 |
|
| 1461 | + * @param object $post The current post object. |
|
| 1462 | + * @global WP_Post|null $post The current post, if available. |
|
| 1463 | + */ |
|
| 1464 | + do_action('geodir_before_single_post', $post); // extra action
|
|
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | 1467 | /** |
@@ -1472,13 +1472,13 @@ discard block |
||
| 1472 | 1472 | */ |
| 1473 | 1473 | function geodir_action_after_single_post($post) |
| 1474 | 1474 | {
|
| 1475 | - /** |
|
| 1476 | - * Called on the details page after the details page tabs section and before the next/prev buttons. |
|
| 1477 | - * |
|
| 1478 | - * @since 1.0.0 |
|
| 1479 | - * @param object $post The current post object. |
|
| 1480 | - */ |
|
| 1481 | - do_action('geodir_after_single_post', $post); // extra action
|
|
| 1475 | + /** |
|
| 1476 | + * Called on the details page after the details page tabs section and before the next/prev buttons. |
|
| 1477 | + * |
|
| 1478 | + * @since 1.0.0 |
|
| 1479 | + * @param object $post The current post object. |
|
| 1480 | + */ |
|
| 1481 | + do_action('geodir_after_single_post', $post); // extra action
|
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
|
@@ -1504,167 +1504,167 @@ discard block |
||
| 1504 | 1504 | */ |
| 1505 | 1505 | function geodir_action_listings_title() |
| 1506 | 1506 | {
|
| 1507 | - global $wp, $term; |
|
| 1507 | + global $wp, $term; |
|
| 1508 | 1508 | |
| 1509 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 1510 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 1509 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 1510 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 1511 | 1511 | |
| 1512 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1513 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1514 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1515 | - } |
|
| 1512 | + $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1513 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1514 | + $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1515 | + } |
|
| 1516 | 1516 | |
| 1517 | - $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory'); |
|
| 1518 | - $single_name = $post_type_info->labels->singular_name; |
|
| 1517 | + $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory'); |
|
| 1518 | + $single_name = $post_type_info->labels->singular_name; |
|
| 1519 | 1519 | |
| 1520 | - $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
|
| 1520 | + $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
|
| 1521 | 1521 | |
| 1522 | - $gd_country = get_query_var('gd_country');
|
|
| 1523 | - $gd_region = get_query_var('gd_region');
|
|
| 1524 | - $gd_city = get_query_var('gd_city');
|
|
| 1522 | + $gd_country = get_query_var('gd_country');
|
|
| 1523 | + $gd_region = get_query_var('gd_region');
|
|
| 1524 | + $gd_city = get_query_var('gd_city');
|
|
| 1525 | 1525 | |
| 1526 | - if (!empty($term)) {
|
|
| 1527 | - $location_name = ''; |
|
| 1528 | - if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
|
|
| 1529 | - if ($gd_country != '') {
|
|
| 1530 | - $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
|
|
| 1531 | - } |
|
| 1532 | - |
|
| 1533 | - if ($gd_region != '') {
|
|
| 1534 | - $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
|
|
| 1535 | - } |
|
| 1536 | - |
|
| 1537 | - if ($gd_city != '') {
|
|
| 1538 | - $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
|
|
| 1539 | - } |
|
| 1540 | - } |
|
| 1541 | - |
|
| 1542 | - $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 1543 | - if (!empty($current_term)) {
|
|
| 1544 | - $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1545 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1546 | - $location_last_char = substr($location_name, -1); |
|
| 1547 | - $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1548 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1549 | - } else {
|
|
| 1550 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1551 | - } |
|
| 1552 | - } else {
|
|
| 1553 | - if (count($taxonomy) > 1) {
|
|
| 1554 | - $current_term = get_term_by('slug', $term, $taxonomy[1]);
|
|
| 1555 | - |
|
| 1556 | - if (!empty($current_term)) {
|
|
| 1557 | - $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1558 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1559 | - $location_last_char = substr($location_name, -1); |
|
| 1560 | - $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1561 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1562 | - } else {
|
|
| 1563 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1564 | - } |
|
| 1565 | - } |
|
| 1566 | - } |
|
| 1567 | - } |
|
| 1568 | - |
|
| 1569 | - } else {
|
|
| 1570 | - $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 1571 | - $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 1572 | - $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 1573 | - |
|
| 1574 | - $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
| 1575 | - |
|
| 1576 | - if (function_exists('get_actual_location_name')) {
|
|
| 1577 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 1578 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 1579 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 1580 | - } |
|
| 1581 | - |
|
| 1582 | - if ($gd_city != '') {
|
|
| 1583 | - if ($gd_city_actual != '') {
|
|
| 1584 | - $gd_city = $gd_city_actual; |
|
| 1585 | - } else {
|
|
| 1586 | - $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 1587 | - $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 1588 | - $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 1589 | - } |
|
| 1590 | - |
|
| 1591 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1592 | - } else if ($gd_region != '') {
|
|
| 1593 | - if ($gd_region_actual != '') {
|
|
| 1594 | - $gd_region = $gd_region_actual; |
|
| 1595 | - } else {
|
|
| 1596 | - $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 1597 | - $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 1598 | - $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 1599 | - } |
|
| 1600 | - |
|
| 1601 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1602 | - } else if ($gd_country != '') {
|
|
| 1603 | - if ($gd_country_actual != '') {
|
|
| 1604 | - $gd_country = $gd_country_actual; |
|
| 1605 | - } else {
|
|
| 1606 | - $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 1607 | - $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 1608 | - $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 1609 | - } |
|
| 1610 | - |
|
| 1611 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1612 | - } |
|
| 1613 | - } |
|
| 1614 | - |
|
| 1615 | - if (is_search()) {
|
|
| 1616 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1617 | - } |
|
| 1618 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1619 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 1620 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1621 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 1622 | - |
|
| 1623 | - |
|
| 1624 | - $title = $list_title; |
|
| 1625 | - if(geodir_is_page('pt')){
|
|
| 1626 | - $gd_page = 'pt'; |
|
| 1627 | - $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1628 | - } |
|
| 1629 | - elseif(geodir_is_page('listing')){
|
|
| 1630 | - $gd_page = 'listing'; |
|
| 1631 | - global $wp_query; |
|
| 1632 | - $current_term = $wp_query->get_queried_object(); |
|
| 1633 | - if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1634 | - $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
|
| 1635 | - }else{
|
|
| 1636 | - $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
|
| 1637 | - } |
|
| 1526 | + if (!empty($term)) {
|
|
| 1527 | + $location_name = ''; |
|
| 1528 | + if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
|
|
| 1529 | + if ($gd_country != '') {
|
|
| 1530 | + $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
|
|
| 1531 | + } |
|
| 1638 | 1532 | |
| 1639 | - } |
|
| 1640 | - elseif(geodir_is_page('author')){
|
|
| 1641 | - $gd_page = 'author'; |
|
| 1642 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1643 | - $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 1644 | - }else{
|
|
| 1645 | - $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 1646 | - } |
|
| 1533 | + if ($gd_region != '') {
|
|
| 1534 | + $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
|
|
| 1535 | + } |
|
| 1647 | 1536 | |
| 1648 | - } |
|
| 1537 | + if ($gd_city != '') {
|
|
| 1538 | + $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
|
|
| 1539 | + } |
|
| 1540 | + } |
|
| 1541 | + |
|
| 1542 | + $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 1543 | + if (!empty($current_term)) {
|
|
| 1544 | + $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1545 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1546 | + $location_last_char = substr($location_name, -1); |
|
| 1547 | + $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1548 | + $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1549 | + } else {
|
|
| 1550 | + $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1551 | + } |
|
| 1552 | + } else {
|
|
| 1553 | + if (count($taxonomy) > 1) {
|
|
| 1554 | + $current_term = get_term_by('slug', $term, $taxonomy[1]);
|
|
| 1555 | + |
|
| 1556 | + if (!empty($current_term)) {
|
|
| 1557 | + $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1558 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1559 | + $location_last_char = substr($location_name, -1); |
|
| 1560 | + $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1561 | + $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1562 | + } else {
|
|
| 1563 | + $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1564 | + } |
|
| 1565 | + } |
|
| 1566 | + } |
|
| 1567 | + } |
|
| 1568 | + |
|
| 1569 | + } else {
|
|
| 1570 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 1571 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 1572 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 1573 | + |
|
| 1574 | + $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
| 1575 | + |
|
| 1576 | + if (function_exists('get_actual_location_name')) {
|
|
| 1577 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 1578 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 1579 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 1580 | + } |
|
| 1581 | + |
|
| 1582 | + if ($gd_city != '') {
|
|
| 1583 | + if ($gd_city_actual != '') {
|
|
| 1584 | + $gd_city = $gd_city_actual; |
|
| 1585 | + } else {
|
|
| 1586 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 1587 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 1588 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 1589 | + } |
|
| 1649 | 1590 | |
| 1591 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1592 | + } else if ($gd_region != '') {
|
|
| 1593 | + if ($gd_region_actual != '') {
|
|
| 1594 | + $gd_region = $gd_region_actual; |
|
| 1595 | + } else {
|
|
| 1596 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 1597 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 1598 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 1599 | + } |
|
| 1650 | 1600 | |
| 1651 | - /** |
|
| 1652 | - * Filter page title to replace variables. |
|
| 1653 | - * |
|
| 1654 | - * @since 1.5.4 |
|
| 1655 | - * @param string $title The page title including variables. |
|
| 1656 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1657 | - */ |
|
| 1658 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1601 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1602 | + } else if ($gd_country != '') {
|
|
| 1603 | + if ($gd_country_actual != '') {
|
|
| 1604 | + $gd_country = $gd_country_actual; |
|
| 1605 | + } else {
|
|
| 1606 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 1607 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 1608 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 1609 | + } |
|
| 1659 | 1610 | |
| 1660 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1661 | - /** |
|
| 1662 | - * Filter the listing page title. |
|
| 1663 | - * |
|
| 1664 | - * @since 1.0.0 |
|
| 1665 | - * @param string $list_title The title for the category page. |
|
| 1666 | - */ |
|
| 1667 | - apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1611 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1612 | + } |
|
| 1613 | + } |
|
| 1614 | + |
|
| 1615 | + if (is_search()) {
|
|
| 1616 | + $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1617 | + } |
|
| 1618 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1619 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 1620 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1621 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 1622 | + |
|
| 1623 | + |
|
| 1624 | + $title = $list_title; |
|
| 1625 | + if(geodir_is_page('pt')){
|
|
| 1626 | + $gd_page = 'pt'; |
|
| 1627 | + $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1628 | + } |
|
| 1629 | + elseif(geodir_is_page('listing')){
|
|
| 1630 | + $gd_page = 'listing'; |
|
| 1631 | + global $wp_query; |
|
| 1632 | + $current_term = $wp_query->get_queried_object(); |
|
| 1633 | + if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1634 | + $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
|
| 1635 | + }else{
|
|
| 1636 | + $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
|
| 1637 | + } |
|
| 1638 | + |
|
| 1639 | + } |
|
| 1640 | + elseif(geodir_is_page('author')){
|
|
| 1641 | + $gd_page = 'author'; |
|
| 1642 | + if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1643 | + $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 1644 | + }else{
|
|
| 1645 | + $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 1646 | + } |
|
| 1647 | + |
|
| 1648 | + } |
|
| 1649 | + |
|
| 1650 | + |
|
| 1651 | + /** |
|
| 1652 | + * Filter page title to replace variables. |
|
| 1653 | + * |
|
| 1654 | + * @since 1.5.4 |
|
| 1655 | + * @param string $title The page title including variables. |
|
| 1656 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1657 | + */ |
|
| 1658 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1659 | + |
|
| 1660 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1661 | + /** |
|
| 1662 | + * Filter the listing page title. |
|
| 1663 | + * |
|
| 1664 | + * @since 1.0.0 |
|
| 1665 | + * @param string $list_title The title for the category page. |
|
| 1666 | + */ |
|
| 1667 | + apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
|
@@ -1677,46 +1677,46 @@ discard block |
||
| 1677 | 1677 | */ |
| 1678 | 1678 | function geodir_action_listings_description() |
| 1679 | 1679 | {
|
| 1680 | - global $wp_query; |
|
| 1681 | - $current_term = $wp_query->get_queried_object(); |
|
| 1680 | + global $wp_query; |
|
| 1681 | + $current_term = $wp_query->get_queried_object(); |
|
| 1682 | 1682 | |
| 1683 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 1684 | - if (isset($current_term->term_id) && $current_term->term_id != '') {
|
|
| 1683 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 1684 | + if (isset($current_term->term_id) && $current_term->term_id != '') {
|
|
| 1685 | 1685 | |
| 1686 | - $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1687 | - $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
|
| 1688 | - if ($term_desc && !$saved_data) {
|
|
| 1689 | - $saved_data = $term_desc; |
|
| 1690 | - } |
|
| 1686 | + $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1687 | + $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
|
| 1688 | + if ($term_desc && !$saved_data) {
|
|
| 1689 | + $saved_data = $term_desc; |
|
| 1690 | + } |
|
| 1691 | 1691 | |
| 1692 | - // stop payment manager filtering content length |
|
| 1693 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1694 | - if ( false !== $filter_priority ) {
|
|
| 1695 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1696 | - } |
|
| 1692 | + // stop payment manager filtering content length |
|
| 1693 | + $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1694 | + if ( false !== $filter_priority ) {
|
|
| 1695 | + remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1696 | + } |
|
| 1697 | 1697 | |
| 1698 | - /** |
|
| 1699 | - * Apply the core filter `the_content` filter to the variable string. |
|
| 1700 | - * |
|
| 1701 | - * This is a WordPress core filter that does many things. |
|
| 1702 | - * |
|
| 1703 | - * @since 1.0.0 |
|
| 1704 | - * @param string $var The string to apply the filter to. |
|
| 1705 | - */ |
|
| 1706 | - $cat_description = apply_filters('the_content', $saved_data);
|
|
| 1698 | + /** |
|
| 1699 | + * Apply the core filter `the_content` filter to the variable string. |
|
| 1700 | + * |
|
| 1701 | + * This is a WordPress core filter that does many things. |
|
| 1702 | + * |
|
| 1703 | + * @since 1.0.0 |
|
| 1704 | + * @param string $var The string to apply the filter to. |
|
| 1705 | + */ |
|
| 1706 | + $cat_description = apply_filters('the_content', $saved_data);
|
|
| 1707 | 1707 | |
| 1708 | 1708 | |
| 1709 | - if ( false !== $filter_priority ) {
|
|
| 1710 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1711 | - } |
|
| 1709 | + if ( false !== $filter_priority ) {
|
|
| 1710 | + add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1711 | + } |
|
| 1712 | 1712 | |
| 1713 | - if ($cat_description) {
|
|
| 1714 | - ?> |
|
| 1713 | + if ($cat_description) {
|
|
| 1714 | + ?> |
|
| 1715 | 1715 | |
| 1716 | 1716 | <div class="term_description"><?php echo $cat_description;?></div> <?php |
| 1717 | - } |
|
| 1717 | + } |
|
| 1718 | 1718 | |
| 1719 | - } |
|
| 1719 | + } |
|
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | 1722 | // action for adding the listings page top widget area |
@@ -1735,11 +1735,11 @@ discard block |
||
| 1735 | 1735 | */ |
| 1736 | 1736 | function geodir_action_geodir_sidebar_listings_top() |
| 1737 | 1737 | {
|
| 1738 | - if (get_option('geodir_show_listing_top_section')) { ?>
|
|
| 1738 | + if (get_option('geodir_show_listing_top_section')) { ?>
|
|
| 1739 | 1739 | <div |
| 1740 | 1740 | class="<?php |
| 1741 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1742 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
|
|
| 1741 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1742 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
|
|
| 1743 | 1743 | <?php dynamic_sidebar('geodir_listing_top'); ?>
|
| 1744 | 1744 | </div><!-- clearfix ends here--> |
| 1745 | 1745 | <?php } |
@@ -1762,35 +1762,35 @@ discard block |
||
| 1762 | 1762 | */ |
| 1763 | 1763 | function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '') |
| 1764 | 1764 | {
|
| 1765 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
|
| 1766 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1767 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
|
| 1768 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1769 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
|
| 1770 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1771 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
|
| 1772 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1773 | - } else {
|
|
| 1774 | - $width_css = ''; |
|
| 1775 | - } |
|
| 1776 | - |
|
| 1777 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1778 | - if (!empty($tc['geodir_sidebar_left_open_replace'])) {
|
|
| 1779 | - $text = $tc['geodir_sidebar_left_open_replace']; |
|
| 1780 | - } else {
|
|
| 1781 | - $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 1782 | - } |
|
| 1783 | - |
|
| 1784 | - if (!empty($tc['geodir_sidebar_left_open_id'])) {
|
|
| 1785 | - $id = $tc['geodir_sidebar_left_open_id']; |
|
| 1786 | - } |
|
| 1787 | - if (!empty($tc['geodir_sidebar_left_open_class'])) {
|
|
| 1788 | - $class = $tc['geodir_sidebar_left_open_class']; |
|
| 1789 | - } |
|
| 1790 | - |
|
| 1791 | - $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 1792 | - |
|
| 1793 | - echo $text; |
|
| 1765 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
|
| 1766 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1767 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
|
| 1768 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1769 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
|
| 1770 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1771 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
|
| 1772 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1773 | + } else {
|
|
| 1774 | + $width_css = ''; |
|
| 1775 | + } |
|
| 1776 | + |
|
| 1777 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1778 | + if (!empty($tc['geodir_sidebar_left_open_replace'])) {
|
|
| 1779 | + $text = $tc['geodir_sidebar_left_open_replace']; |
|
| 1780 | + } else {
|
|
| 1781 | + $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 1782 | + } |
|
| 1783 | + |
|
| 1784 | + if (!empty($tc['geodir_sidebar_left_open_id'])) {
|
|
| 1785 | + $id = $tc['geodir_sidebar_left_open_id']; |
|
| 1786 | + } |
|
| 1787 | + if (!empty($tc['geodir_sidebar_left_open_class'])) {
|
|
| 1788 | + $class = $tc['geodir_sidebar_left_open_class']; |
|
| 1789 | + } |
|
| 1790 | + |
|
| 1791 | + $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 1792 | + |
|
| 1793 | + echo $text; |
|
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | // action for adding the primary div closing tag |
@@ -1806,13 +1806,13 @@ discard block |
||
| 1806 | 1806 | */ |
| 1807 | 1807 | function geodir_action_sidebar_left_close($type = '') |
| 1808 | 1808 | {
|
| 1809 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1810 | - if (!empty($tc['geodir_sidebar_left_close_replace'])) {
|
|
| 1811 | - $text = $tc['geodir_sidebar_left_close_replace']; |
|
| 1812 | - } else {
|
|
| 1813 | - $text = '</aside><!-- sidebar ends here-->'; |
|
| 1814 | - } |
|
| 1815 | - echo $text; |
|
| 1809 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1810 | + if (!empty($tc['geodir_sidebar_left_close_replace'])) {
|
|
| 1811 | + $text = $tc['geodir_sidebar_left_close_replace']; |
|
| 1812 | + } else {
|
|
| 1813 | + $text = '</aside><!-- sidebar ends here-->'; |
|
| 1814 | + } |
|
| 1815 | + echo $text; |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | /** |
@@ -1825,7 +1825,7 @@ discard block |
||
| 1825 | 1825 | */ |
| 1826 | 1826 | function geodir_listing_left_section() |
| 1827 | 1827 | {
|
| 1828 | - if (get_option('geodir_show_listing_left_section')) { ?>
|
|
| 1828 | + if (get_option('geodir_show_listing_left_section')) { ?>
|
|
| 1829 | 1829 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 1830 | 1830 | <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
|
| 1831 | 1831 | </div><!-- end geodir-content-left --> |
@@ -1843,20 +1843,20 @@ discard block |
||
| 1843 | 1843 | */ |
| 1844 | 1844 | function geodir_action_listings_sidebar_left() |
| 1845 | 1845 | {
|
| 1846 | - if (get_option('geodir_show_listing_left_section')) {
|
|
| 1847 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1848 | - do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 1849 | - /** |
|
| 1850 | - * Calls the listings page (category) left sidebar content. |
|
| 1851 | - * |
|
| 1852 | - * All the content for the listings page left sidebar is added via this hook. |
|
| 1853 | - * |
|
| 1854 | - * @since 1.0.0 |
|
| 1855 | - */ |
|
| 1856 | - do_action('geodir_listings_sidebar_left_inside');
|
|
| 1857 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1858 | - do_action('geodir_sidebar_left_close', 'listings-page');
|
|
| 1859 | - } |
|
| 1846 | + if (get_option('geodir_show_listing_left_section')) {
|
|
| 1847 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1848 | + do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 1849 | + /** |
|
| 1850 | + * Calls the listings page (category) left sidebar content. |
|
| 1851 | + * |
|
| 1852 | + * All the content for the listings page left sidebar is added via this hook. |
|
| 1853 | + * |
|
| 1854 | + * @since 1.0.0 |
|
| 1855 | + */ |
|
| 1856 | + do_action('geodir_listings_sidebar_left_inside');
|
|
| 1857 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1858 | + do_action('geodir_sidebar_left_close', 'listings-page');
|
|
| 1859 | + } |
|
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | /** |
@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | */ |
| 1870 | 1870 | function geodir_listing_right_section() |
| 1871 | 1871 | {
|
| 1872 | - if (get_option('geodir_show_listing_right_section')) { ?>
|
|
| 1872 | + if (get_option('geodir_show_listing_right_section')) { ?>
|
|
| 1873 | 1873 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 1874 | 1874 | <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
|
| 1875 | 1875 | </div><!-- end geodir-content-right --> |
@@ -1887,20 +1887,20 @@ discard block |
||
| 1887 | 1887 | */ |
| 1888 | 1888 | function geodir_action_listings_sidebar_right() |
| 1889 | 1889 | {
|
| 1890 | - if (get_option('geodir_show_listing_right_section')) {
|
|
| 1891 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1892 | - do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 1893 | - /** |
|
| 1894 | - * Calls the listings page (category) right sidebar content. |
|
| 1895 | - * |
|
| 1896 | - * All the content for the listings page right sidebar is added via this hook. |
|
| 1897 | - * |
|
| 1898 | - * @since 1.0.0 |
|
| 1899 | - */ |
|
| 1900 | - do_action('geodir_listings_sidebar_right_inside');
|
|
| 1901 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1902 | - do_action('geodir_sidebar_right_close', 'listings-page');
|
|
| 1903 | - } |
|
| 1890 | + if (get_option('geodir_show_listing_right_section')) {
|
|
| 1891 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1892 | + do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 1893 | + /** |
|
| 1894 | + * Calls the listings page (category) right sidebar content. |
|
| 1895 | + * |
|
| 1896 | + * All the content for the listings page right sidebar is added via this hook. |
|
| 1897 | + * |
|
| 1898 | + * @since 1.0.0 |
|
| 1899 | + */ |
|
| 1900 | + do_action('geodir_listings_sidebar_right_inside');
|
|
| 1901 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1902 | + do_action('geodir_sidebar_right_close', 'listings-page');
|
|
| 1903 | + } |
|
| 1904 | 1904 | } |
| 1905 | 1905 | |
| 1906 | 1906 | |
@@ -1917,23 +1917,23 @@ discard block |
||
| 1917 | 1917 | */ |
| 1918 | 1918 | function geodir_action_main_content_open($type = '', $id = '', $class = '') |
| 1919 | 1919 | {
|
| 1920 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1921 | - if (!empty($tc['geodir_main_content_open_replace'])) {
|
|
| 1922 | - $text = $tc['geodir_main_content_open_replace']; |
|
| 1923 | - } else {
|
|
| 1924 | - $text = '<main id="[id]" class="[class]" role="main">'; |
|
| 1925 | - } |
|
| 1920 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1921 | + if (!empty($tc['geodir_main_content_open_replace'])) {
|
|
| 1922 | + $text = $tc['geodir_main_content_open_replace']; |
|
| 1923 | + } else {
|
|
| 1924 | + $text = '<main id="[id]" class="[class]" role="main">'; |
|
| 1925 | + } |
|
| 1926 | 1926 | |
| 1927 | - if (!empty($tc['geodir_main_content_open_id'])) {
|
|
| 1928 | - $id = $tc['geodir_main_content_open_id']; |
|
| 1929 | - } |
|
| 1930 | - if (!empty($tc['geodir_main_content_open_class'])) {
|
|
| 1931 | - $class = $tc['geodir_main_content_open_class']; |
|
| 1932 | - } |
|
| 1927 | + if (!empty($tc['geodir_main_content_open_id'])) {
|
|
| 1928 | + $id = $tc['geodir_main_content_open_id']; |
|
| 1929 | + } |
|
| 1930 | + if (!empty($tc['geodir_main_content_open_class'])) {
|
|
| 1931 | + $class = $tc['geodir_main_content_open_class']; |
|
| 1932 | + } |
|
| 1933 | 1933 | |
| 1934 | - $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 1934 | + $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 1935 | 1935 | |
| 1936 | - echo $text; |
|
| 1936 | + echo $text; |
|
| 1937 | 1937 | } |
| 1938 | 1938 | |
| 1939 | 1939 | // action for adding the primary div closing tag |
@@ -1946,13 +1946,13 @@ discard block |
||
| 1946 | 1946 | */ |
| 1947 | 1947 | function geodir_action_main_content_close() |
| 1948 | 1948 | {
|
| 1949 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1950 | - if (!empty($tc['geodir_main_content_close_replace'])) {
|
|
| 1951 | - $text = $tc['geodir_main_content_close_replace']; |
|
| 1952 | - } else {
|
|
| 1953 | - $text = '</main><!-- main ends here-->'; |
|
| 1954 | - } |
|
| 1955 | - echo $text; |
|
| 1949 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1950 | + if (!empty($tc['geodir_main_content_close_replace'])) {
|
|
| 1951 | + $text = $tc['geodir_main_content_close_replace']; |
|
| 1952 | + } else {
|
|
| 1953 | + $text = '</main><!-- main ends here-->'; |
|
| 1954 | + } |
|
| 1955 | + echo $text; |
|
| 1956 | 1956 | } |
| 1957 | 1957 | |
| 1958 | 1958 | /** |
@@ -1964,14 +1964,14 @@ discard block |
||
| 1964 | 1964 | */ |
| 1965 | 1965 | function geodir_action_listings_content_inside() |
| 1966 | 1966 | {
|
| 1967 | - global $gridview_columns; |
|
| 1968 | - $listing_view = get_option('geodir_listing_view');
|
|
| 1969 | - if (strstr($listing_view, 'gridview')) {
|
|
| 1970 | - $gridview_columns = $listing_view; |
|
| 1971 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 1972 | - $listing_view = $listing_view_exp[0]; |
|
| 1973 | - } |
|
| 1974 | - geodir_get_template_part('listing', 'listview');
|
|
| 1967 | + global $gridview_columns; |
|
| 1968 | + $listing_view = get_option('geodir_listing_view');
|
|
| 1969 | + if (strstr($listing_view, 'gridview')) {
|
|
| 1970 | + $gridview_columns = $listing_view; |
|
| 1971 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 1972 | + $listing_view = $listing_view_exp[0]; |
|
| 1973 | + } |
|
| 1974 | + geodir_get_template_part('listing', 'listview');
|
|
| 1975 | 1975 | } |
| 1976 | 1976 | |
| 1977 | 1977 | add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
|
@@ -1987,47 +1987,47 @@ discard block |
||
| 1987 | 1987 | */ |
| 1988 | 1988 | function geodir_action_listings_content() |
| 1989 | 1989 | {
|
| 1990 | - /** |
|
| 1991 | - * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 1992 | - * |
|
| 1993 | - * @since 1.0.0 |
|
| 1994 | - * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 1995 | - * @param string $id The id for the div. Usually 'geodir-main-content'. |
|
| 1996 | - * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 1997 | - * @see 'geodir_main_content_close' Where the oposing closing tag is added. |
|
| 1998 | - */ |
|
| 1999 | - do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
|
|
| 2000 | - $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
|
|
| 2001 | - echo '<div class="clearfix '.$extra_class.'">'; |
|
| 2002 | - /** |
|
| 2003 | - * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages. |
|
| 2004 | - * |
|
| 2005 | - * @since 1.0.0 |
|
| 2006 | - */ |
|
| 2007 | - do_action('geodir_before_listing');
|
|
| 2008 | - echo '</div>'; |
|
| 2009 | - |
|
| 2010 | - /** |
|
| 2011 | - * This actions calls the listings list content. Used on listings pages and search and author pages. |
|
| 2012 | - * |
|
| 2013 | - * @since 1.0.0 |
|
| 2014 | - */ |
|
| 2015 | - do_action('geodir_listings_content_inside');
|
|
| 2016 | - |
|
| 2017 | - /** |
|
| 2018 | - * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages. |
|
| 2019 | - * |
|
| 2020 | - * @since 1.0.0 |
|
| 2021 | - */ |
|
| 2022 | - do_action('geodir_after_listing');
|
|
| 2023 | - |
|
| 2024 | - /** |
|
| 2025 | - * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2026 | - * |
|
| 2027 | - * @since 1.0.0 |
|
| 2028 | - * @see 'geodir_main_content_open' Where the oposing opening tag is added. |
|
| 2029 | - */ |
|
| 2030 | - do_action('geodir_main_content_close', 'listings-page');
|
|
| 1990 | + /** |
|
| 1991 | + * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 1992 | + * |
|
| 1993 | + * @since 1.0.0 |
|
| 1994 | + * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 1995 | + * @param string $id The id for the div. Usually 'geodir-main-content'. |
|
| 1996 | + * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 1997 | + * @see 'geodir_main_content_close' Where the oposing closing tag is added. |
|
| 1998 | + */ |
|
| 1999 | + do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
|
|
| 2000 | + $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
|
|
| 2001 | + echo '<div class="clearfix '.$extra_class.'">'; |
|
| 2002 | + /** |
|
| 2003 | + * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages. |
|
| 2004 | + * |
|
| 2005 | + * @since 1.0.0 |
|
| 2006 | + */ |
|
| 2007 | + do_action('geodir_before_listing');
|
|
| 2008 | + echo '</div>'; |
|
| 2009 | + |
|
| 2010 | + /** |
|
| 2011 | + * This actions calls the listings list content. Used on listings pages and search and author pages. |
|
| 2012 | + * |
|
| 2013 | + * @since 1.0.0 |
|
| 2014 | + */ |
|
| 2015 | + do_action('geodir_listings_content_inside');
|
|
| 2016 | + |
|
| 2017 | + /** |
|
| 2018 | + * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages. |
|
| 2019 | + * |
|
| 2020 | + * @since 1.0.0 |
|
| 2021 | + */ |
|
| 2022 | + do_action('geodir_after_listing');
|
|
| 2023 | + |
|
| 2024 | + /** |
|
| 2025 | + * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2026 | + * |
|
| 2027 | + * @since 1.0.0 |
|
| 2028 | + * @see 'geodir_main_content_open' Where the oposing opening tag is added. |
|
| 2029 | + */ |
|
| 2030 | + do_action('geodir_main_content_close', 'listings-page');
|
|
| 2031 | 2031 | } |
| 2032 | 2032 | |
| 2033 | 2033 | |
@@ -2042,10 +2042,10 @@ discard block |
||
| 2042 | 2042 | */ |
| 2043 | 2043 | function geodir_action_sidebar_listings_bottom_section() |
| 2044 | 2044 | {
|
| 2045 | - if (get_option('geodir_show_listing_bottom_section')) { ?>
|
|
| 2045 | + if (get_option('geodir_show_listing_bottom_section')) { ?>
|
|
| 2046 | 2046 | <div class="<?php |
| 2047 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2048 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
|
|
| 2047 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2048 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
|
|
| 2049 | 2049 | <?php dynamic_sidebar('geodir_listing_bottom'); ?>
|
| 2050 | 2050 | </div><!-- clearfix ends here--> |
| 2051 | 2051 | <?php } |
@@ -2065,38 +2065,38 @@ discard block |
||
| 2065 | 2065 | */ |
| 2066 | 2066 | function geodir_action_add_listing_page_title() |
| 2067 | 2067 | {
|
| 2068 | - if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
| 2069 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2070 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2071 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2072 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2073 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2074 | - |
|
| 2075 | - $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
|
| 2076 | - |
|
| 2077 | - if(geodir_is_page('add-listing')){
|
|
| 2078 | - $gd_page = 'add-listing'; |
|
| 2079 | - if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2080 | - $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
|
| 2081 | - }elseif(isset($listing_type)){
|
|
| 2082 | - $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
|
| 2083 | - } |
|
| 2068 | + if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
| 2069 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2070 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2071 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2072 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2073 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2074 | + |
|
| 2075 | + $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
|
| 2076 | + |
|
| 2077 | + if(geodir_is_page('add-listing')){
|
|
| 2078 | + $gd_page = 'add-listing'; |
|
| 2079 | + if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2080 | + $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
|
| 2081 | + }elseif(isset($listing_type)){
|
|
| 2082 | + $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
|
| 2083 | + } |
|
| 2084 | 2084 | |
| 2085 | - } |
|
| 2085 | + } |
|
| 2086 | 2086 | |
| 2087 | 2087 | |
| 2088 | - /** |
|
| 2089 | - * Filter page title to replace variables. |
|
| 2090 | - * |
|
| 2091 | - * @since 1.5.4 |
|
| 2092 | - * @param string $title The page title including variables. |
|
| 2093 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 2094 | - */ |
|
| 2095 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2088 | + /** |
|
| 2089 | + * Filter page title to replace variables. |
|
| 2090 | + * |
|
| 2091 | + * @since 1.5.4 |
|
| 2092 | + * @param string $title The page title including variables. |
|
| 2093 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 2094 | + */ |
|
| 2095 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2096 | 2096 | |
| 2097 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2098 | - echo $title; |
|
| 2099 | - echo '</h1></header>'; |
|
| 2097 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2098 | + echo $title; |
|
| 2099 | + echo '</h1></header>'; |
|
| 2100 | 2100 | } |
| 2101 | 2101 | |
| 2102 | 2102 | add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
|
@@ -2127,59 +2127,59 @@ discard block |
||
| 2127 | 2127 | */ |
| 2128 | 2128 | function geodir_action_add_listing_form() |
| 2129 | 2129 | {
|
| 2130 | - global $cat_display, $post_cat, $current_user, $gd_session; |
|
| 2131 | - $page_id = get_the_ID(); |
|
| 2132 | - $post = ''; |
|
| 2133 | - $title = ''; |
|
| 2134 | - $desc = ''; |
|
| 2135 | - $kw_tags = ''; |
|
| 2136 | - $required_msg = ''; |
|
| 2137 | - $submit_button = ''; |
|
| 2138 | - |
|
| 2139 | - $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add'; |
|
| 2140 | - |
|
| 2141 | - $thumb_img_arr = array(); |
|
| 2142 | - $curImages = ''; |
|
| 2143 | - |
|
| 2144 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 2145 | - global $post; |
|
| 2146 | - $post = (object)$gd_session->get('listing');
|
|
| 2147 | - $listing_type = $post->listing_type; |
|
| 2148 | - $title = $post->post_title; |
|
| 2149 | - $desc = $post->post_desc; |
|
| 2150 | - $post_cat = $post->post_category; |
|
| 2151 | - |
|
| 2152 | - $kw_tags = $post->post_tags; |
|
| 2153 | - $curImages = isset($post->post_images) ? $post->post_images : ''; |
|
| 2154 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2155 | - global $post, $post_images; |
|
| 2156 | - |
|
| 2157 | - $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 2158 | - $thumb_img_arr = geodir_get_images($post->ID); |
|
| 2159 | - if ($thumb_img_arr) {
|
|
| 2160 | - foreach ($thumb_img_arr as $post_img) {
|
|
| 2161 | - $curImages .= $post_img->src . ','; |
|
| 2162 | - } |
|
| 2163 | - } |
|
| 2130 | + global $cat_display, $post_cat, $current_user, $gd_session; |
|
| 2131 | + $page_id = get_the_ID(); |
|
| 2132 | + $post = ''; |
|
| 2133 | + $title = ''; |
|
| 2134 | + $desc = ''; |
|
| 2135 | + $kw_tags = ''; |
|
| 2136 | + $required_msg = ''; |
|
| 2137 | + $submit_button = ''; |
|
| 2138 | + |
|
| 2139 | + $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add'; |
|
| 2140 | + |
|
| 2141 | + $thumb_img_arr = array(); |
|
| 2142 | + $curImages = ''; |
|
| 2143 | + |
|
| 2144 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 2145 | + global $post; |
|
| 2146 | + $post = (object)$gd_session->get('listing');
|
|
| 2147 | + $listing_type = $post->listing_type; |
|
| 2148 | + $title = $post->post_title; |
|
| 2149 | + $desc = $post->post_desc; |
|
| 2150 | + $post_cat = $post->post_category; |
|
| 2151 | + |
|
| 2152 | + $kw_tags = $post->post_tags; |
|
| 2153 | + $curImages = isset($post->post_images) ? $post->post_images : ''; |
|
| 2154 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2155 | + global $post, $post_images; |
|
| 2156 | + |
|
| 2157 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 2158 | + $thumb_img_arr = geodir_get_images($post->ID); |
|
| 2159 | + if ($thumb_img_arr) {
|
|
| 2160 | + foreach ($thumb_img_arr as $post_img) {
|
|
| 2161 | + $curImages .= $post_img->src . ','; |
|
| 2162 | + } |
|
| 2163 | + } |
|
| 2164 | 2164 | |
| 2165 | - $listing_type = $post->post_type; |
|
| 2166 | - $title = $post->post_title; |
|
| 2167 | - $desc = $post->post_content; |
|
| 2168 | - $kw_tags = $post->post_tags; |
|
| 2169 | - $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2170 | - } else {
|
|
| 2171 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2172 | - } |
|
| 2165 | + $listing_type = $post->post_type; |
|
| 2166 | + $title = $post->post_title; |
|
| 2167 | + $desc = $post->post_content; |
|
| 2168 | + $kw_tags = $post->post_tags; |
|
| 2169 | + $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2170 | + } else {
|
|
| 2171 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2172 | + } |
|
| 2173 | 2173 | |
| 2174 | - if ($current_user->ID != '0') {
|
|
| 2175 | - $user_login = true; |
|
| 2176 | - } |
|
| 2174 | + if ($current_user->ID != '0') {
|
|
| 2175 | + $user_login = true; |
|
| 2176 | + } |
|
| 2177 | 2177 | |
| 2178 | - $post_type_info = geodir_get_posttype_info($listing_type); |
|
| 2178 | + $post_type_info = geodir_get_posttype_info($listing_type); |
|
| 2179 | 2179 | |
| 2180 | - $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
|
|
| 2180 | + $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
|
|
| 2181 | 2181 | |
| 2182 | - ?> |
|
| 2182 | + ?> |
|
| 2183 | 2183 | <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data"> |
| 2184 | 2184 | <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/> |
| 2185 | 2185 | <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/> |
@@ -2190,27 +2190,27 @@ discard block |
||
| 2190 | 2190 | <?php } if (isset($_REQUEST['backandedit'])) { ?>
|
| 2191 | 2191 | <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/> |
| 2192 | 2192 | <?php |
| 2193 | - } |
|
| 2194 | - /** |
|
| 2195 | - * Called at the very top of the add listing page form for frontend. |
|
| 2196 | - * |
|
| 2197 | - * This is called just before the "Enter Listing Details" text. |
|
| 2198 | - * |
|
| 2199 | - * @since 1.0.0 |
|
| 2200 | - */ |
|
| 2201 | - do_action('geodir_before_detail_fields');
|
|
| 2202 | - ?> |
|
| 2193 | + } |
|
| 2194 | + /** |
|
| 2195 | + * Called at the very top of the add listing page form for frontend. |
|
| 2196 | + * |
|
| 2197 | + * This is called just before the "Enter Listing Details" text. |
|
| 2198 | + * |
|
| 2199 | + * @since 1.0.0 |
|
| 2200 | + */ |
|
| 2201 | + do_action('geodir_before_detail_fields');
|
|
| 2202 | + ?> |
|
| 2203 | 2203 | <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5> |
| 2204 | 2204 | <?php |
| 2205 | - /** |
|
| 2206 | - * Called at the top of the add listing page form for frontend. |
|
| 2207 | - * |
|
| 2208 | - * This is called after the "Enter Listing Details" text. |
|
| 2209 | - * |
|
| 2210 | - * @since 1.0.0 |
|
| 2211 | - */ |
|
| 2212 | - do_action('geodir_before_main_form_fields');
|
|
| 2213 | - ?> |
|
| 2205 | + /** |
|
| 2206 | + * Called at the top of the add listing page form for frontend. |
|
| 2207 | + * |
|
| 2208 | + * This is called after the "Enter Listing Details" text. |
|
| 2209 | + * |
|
| 2210 | + * @since 1.0.0 |
|
| 2211 | + */ |
|
| 2212 | + do_action('geodir_before_main_form_fields');
|
|
| 2213 | + ?> |
|
| 2214 | 2214 | <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details"> |
| 2215 | 2215 | <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
|
| 2216 | 2216 | <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" |
@@ -2218,57 +2218,57 @@ discard block |
||
| 2218 | 2218 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span> |
| 2219 | 2219 | </div> |
| 2220 | 2220 | <?php |
| 2221 | - $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
|
| 2222 | - |
|
| 2223 | - $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc)); |
|
| 2224 | - $desc_limit = ''; |
|
| 2225 | - /** |
|
| 2226 | - * Filter the add listing description field character limit number. |
|
| 2227 | - * |
|
| 2228 | - * @since 1.0.0 |
|
| 2229 | - * @param int $desc_limit The amount of characters to limit the description to. |
|
| 2230 | - */ |
|
| 2231 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
|
|
| 2232 | - /** |
|
| 2233 | - * Filter the add listing description field text. |
|
| 2234 | - * |
|
| 2235 | - * @since 1.0.0 |
|
| 2236 | - * @param string $desc The text for the description field. |
|
| 2237 | - * @param int $desc_limit The character limit number if any. |
|
| 2238 | - */ |
|
| 2239 | - $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
|
|
| 2240 | - $desc_limit_msg = ''; |
|
| 2241 | - /** |
|
| 2242 | - * Filter the add listing description limit message. |
|
| 2243 | - * |
|
| 2244 | - * This is the message shown if there is a limit applied to the amount of characters the description can use. |
|
| 2245 | - * |
|
| 2246 | - * @since 1.0.0 |
|
| 2247 | - * @param string $desc_limit_msg The limit message string if any. |
|
| 2248 | - * @param int $desc_limit The character limit numer if any. |
|
| 2249 | - */ |
|
| 2250 | - $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
|
| 2221 | + $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
|
| 2222 | + |
|
| 2223 | + $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc)); |
|
| 2224 | + $desc_limit = ''; |
|
| 2225 | + /** |
|
| 2226 | + * Filter the add listing description field character limit number. |
|
| 2227 | + * |
|
| 2228 | + * @since 1.0.0 |
|
| 2229 | + * @param int $desc_limit The amount of characters to limit the description to. |
|
| 2230 | + */ |
|
| 2231 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
|
|
| 2232 | + /** |
|
| 2233 | + * Filter the add listing description field text. |
|
| 2234 | + * |
|
| 2235 | + * @since 1.0.0 |
|
| 2236 | + * @param string $desc The text for the description field. |
|
| 2237 | + * @param int $desc_limit The character limit number if any. |
|
| 2238 | + */ |
|
| 2239 | + $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
|
|
| 2240 | + $desc_limit_msg = ''; |
|
| 2241 | + /** |
|
| 2242 | + * Filter the add listing description limit message. |
|
| 2243 | + * |
|
| 2244 | + * This is the message shown if there is a limit applied to the amount of characters the description can use. |
|
| 2245 | + * |
|
| 2246 | + * @since 1.0.0 |
|
| 2247 | + * @param string $desc_limit_msg The limit message string if any. |
|
| 2248 | + * @param int $desc_limit The character limit numer if any. |
|
| 2249 | + */ |
|
| 2250 | + $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
|
| 2251 | 2251 | |
| 2252 | - $desc_class = ''; |
|
| 2253 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2254 | - /** |
|
| 2255 | - * Called on the add listing page form for frontend just before the description field. |
|
| 2256 | - * |
|
| 2257 | - * @since 1.0.0 |
|
| 2258 | - */ |
|
| 2259 | - do_action('geodir_before_description_field');
|
|
| 2252 | + $desc_class = ''; |
|
| 2253 | + if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2254 | + /** |
|
| 2255 | + * Called on the add listing page form for frontend just before the description field. |
|
| 2256 | + * |
|
| 2257 | + * @since 1.0.0 |
|
| 2258 | + */ |
|
| 2259 | + do_action('geodir_before_description_field');
|
|
| 2260 | 2260 | |
| 2261 | - $desc_class = ' required_field'; |
|
| 2262 | - } else {
|
|
| 2263 | - $desc_class = ' hidden'; |
|
| 2264 | - } |
|
| 2265 | - ?> |
|
| 2261 | + $desc_class = ' required_field'; |
|
| 2262 | + } else {
|
|
| 2263 | + $desc_class = ' hidden'; |
|
| 2264 | + } |
|
| 2265 | + ?> |
|
| 2266 | 2266 | <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>"> |
| 2267 | 2267 | <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
| 2268 | 2268 | <?php |
| 2269 | - if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
|
|
| 2270 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 2271 | - ?> |
|
| 2269 | + if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
|
|
| 2270 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 2271 | + ?> |
|
| 2272 | 2272 | <div class="editor" field_id="post_desc" field_type="editor"> |
| 2273 | 2273 | <?php wp_editor($desc, "post_desc", $editor_settings); ?> |
| 2274 | 2274 | </div> |
@@ -2282,56 +2282,56 @@ discard block |
||
| 2282 | 2282 | <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span> |
| 2283 | 2283 | </div> |
| 2284 | 2284 | <?php |
| 2285 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2286 | - /** |
|
| 2287 | - * Called on the add listing page form for frontend just after the description field. |
|
| 2288 | - * |
|
| 2289 | - * @since 1.0.0 |
|
| 2290 | - */ |
|
| 2291 | - do_action('geodir_after_description_field');
|
|
| 2292 | - } |
|
| 2285 | + if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2286 | + /** |
|
| 2287 | + * Called on the add listing page form for frontend just after the description field. |
|
| 2288 | + * |
|
| 2289 | + * @since 1.0.0 |
|
| 2290 | + */ |
|
| 2291 | + do_action('geodir_after_description_field');
|
|
| 2292 | + } |
|
| 2293 | 2293 | |
| 2294 | - $kw_tags = esc_attr(stripslashes($kw_tags)); |
|
| 2295 | - $kw_tags_count = TAGKW_TEXT_COUNT; |
|
| 2296 | - $kw_tags_msg = TAGKW_MSG; |
|
| 2297 | - /** |
|
| 2298 | - * Filter the add listing tags character limit. |
|
| 2299 | - * |
|
| 2300 | - * @since 1.0.0 |
|
| 2301 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2302 | - */ |
|
| 2303 | - $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
|
|
| 2304 | - /** |
|
| 2305 | - * Filter the add listing tags field value. |
|
| 2306 | - * |
|
| 2307 | - * You can use the $_REQUEST values to check if this is a go back and edit value etc. |
|
| 2308 | - * |
|
| 2309 | - * @since 1.0.0 |
|
| 2310 | - * @param string $kw_tags The tag field value, usually a comma separated list of tags. |
|
| 2311 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2312 | - */ |
|
| 2313 | - $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
|
|
| 2314 | - /** |
|
| 2315 | - * Filter the add listing tags field message text. |
|
| 2316 | - * |
|
| 2317 | - * @since 1.0.0 |
|
| 2318 | - * @param string $kw_tags_msg The message shown under the field. |
|
| 2319 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2320 | - */ |
|
| 2321 | - $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
|
| 2294 | + $kw_tags = esc_attr(stripslashes($kw_tags)); |
|
| 2295 | + $kw_tags_count = TAGKW_TEXT_COUNT; |
|
| 2296 | + $kw_tags_msg = TAGKW_MSG; |
|
| 2297 | + /** |
|
| 2298 | + * Filter the add listing tags character limit. |
|
| 2299 | + * |
|
| 2300 | + * @since 1.0.0 |
|
| 2301 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2302 | + */ |
|
| 2303 | + $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
|
|
| 2304 | + /** |
|
| 2305 | + * Filter the add listing tags field value. |
|
| 2306 | + * |
|
| 2307 | + * You can use the $_REQUEST values to check if this is a go back and edit value etc. |
|
| 2308 | + * |
|
| 2309 | + * @since 1.0.0 |
|
| 2310 | + * @param string $kw_tags The tag field value, usually a comma separated list of tags. |
|
| 2311 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2312 | + */ |
|
| 2313 | + $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
|
|
| 2314 | + /** |
|
| 2315 | + * Filter the add listing tags field message text. |
|
| 2316 | + * |
|
| 2317 | + * @since 1.0.0 |
|
| 2318 | + * @param string $kw_tags_msg The message shown under the field. |
|
| 2319 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2320 | + */ |
|
| 2321 | + $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
|
| 2322 | 2322 | |
| 2323 | - $tags_class = ''; |
|
| 2324 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2325 | - /** |
|
| 2326 | - * Called on the add listing page form for frontend just before the tags field. |
|
| 2327 | - * |
|
| 2328 | - * @since 1.0.0 |
|
| 2329 | - */ |
|
| 2330 | - do_action('geodir_before_listing_tags_field');
|
|
| 2331 | - } else {
|
|
| 2332 | - $tags_class = ' hidden'; |
|
| 2333 | - } |
|
| 2334 | - ?> |
|
| 2323 | + $tags_class = ''; |
|
| 2324 | + if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2325 | + /** |
|
| 2326 | + * Called on the add listing page form for frontend just before the tags field. |
|
| 2327 | + * |
|
| 2328 | + * @since 1.0.0 |
|
| 2329 | + */ |
|
| 2330 | + do_action('geodir_before_listing_tags_field');
|
|
| 2331 | + } else {
|
|
| 2332 | + $tags_class = ' hidden'; |
|
| 2333 | + } |
|
| 2334 | + ?> |
|
| 2335 | 2335 | <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>"> |
| 2336 | 2336 | <label><?php echo TAGKW_TEXT; ?></label> |
| 2337 | 2337 | <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield" |
@@ -2339,90 +2339,90 @@ discard block |
||
| 2339 | 2339 | <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span> |
| 2340 | 2340 | </div> |
| 2341 | 2341 | <?php |
| 2342 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2343 | - /** |
|
| 2344 | - * Called on the add listing page form for frontend just after the tags field. |
|
| 2345 | - * |
|
| 2346 | - * @since 1.0.0 |
|
| 2347 | - */ |
|
| 2348 | - do_action('geodir_after_listing_tags_field');
|
|
| 2349 | - } |
|
| 2342 | + if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2343 | + /** |
|
| 2344 | + * Called on the add listing page form for frontend just after the tags field. |
|
| 2345 | + * |
|
| 2346 | + * @since 1.0.0 |
|
| 2347 | + */ |
|
| 2348 | + do_action('geodir_after_listing_tags_field');
|
|
| 2349 | + } |
|
| 2350 | 2350 | |
| 2351 | - $package_info = array(); |
|
| 2352 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 2351 | + $package_info = array(); |
|
| 2352 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 2353 | 2353 | |
| 2354 | - geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); |
|
| 2354 | + geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); |
|
| 2355 | 2355 | |
| 2356 | - // adjust values here |
|
| 2357 | - $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2358 | - |
|
| 2359 | - $multiple = true; // allow multiple files upload |
|
| 2356 | + // adjust values here |
|
| 2357 | + $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2360 | 2358 | |
| 2361 | - $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2359 | + $multiple = true; // allow multiple files upload |
|
| 2362 | 2360 | |
| 2363 | - $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2361 | + $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2364 | 2362 | |
| 2365 | - $thumb_img_arr = array(); |
|
| 2366 | - $totImg = 0; |
|
| 2367 | - if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
|
| 2368 | - $post = (object)$gd_session->get('listing');
|
|
| 2369 | - if (isset($post->post_images)) |
|
| 2370 | - $curImages = trim($post->post_images, ","); |
|
| 2363 | + $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2371 | 2364 | |
| 2365 | + $thumb_img_arr = array(); |
|
| 2366 | + $totImg = 0; |
|
| 2367 | + if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
|
| 2368 | + $post = (object)$gd_session->get('listing');
|
|
| 2369 | + if (isset($post->post_images)) |
|
| 2370 | + $curImages = trim($post->post_images, ","); |
|
| 2372 | 2371 | |
| 2373 | - if ($curImages != '') {
|
|
| 2374 | - $curImages_array = explode(',', $curImages);
|
|
| 2375 | - $totImg = count($curImages_array); |
|
| 2376 | - } |
|
| 2377 | 2372 | |
| 2378 | - $listing_type = $post->listing_type; |
|
| 2373 | + if ($curImages != '') {
|
|
| 2374 | + $curImages_array = explode(',', $curImages);
|
|
| 2375 | + $totImg = count($curImages_array); |
|
| 2376 | + } |
|
| 2379 | 2377 | |
| 2380 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2381 | - $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2382 | - $listing_type = $post->post_type; |
|
| 2383 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 2378 | + $listing_type = $post->listing_type; |
|
| 2384 | 2379 | |
| 2385 | - } else {
|
|
| 2386 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2387 | - } |
|
| 2380 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2381 | + $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2382 | + $listing_type = $post->post_type; |
|
| 2383 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 2388 | 2384 | |
| 2385 | + } else {
|
|
| 2386 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2387 | + } |
|
| 2389 | 2388 | |
| 2390 | - if (!empty($thumb_img_arr)) {
|
|
| 2391 | - foreach ($thumb_img_arr as $img) {
|
|
| 2392 | - //$curImages = $img->src.","; |
|
| 2393 | - } |
|
| 2394 | 2389 | |
| 2395 | - $totImg = count((array)$thumb_img_arr); |
|
| 2396 | - } |
|
| 2390 | + if (!empty($thumb_img_arr)) {
|
|
| 2391 | + foreach ($thumb_img_arr as $img) {
|
|
| 2392 | + //$curImages = $img->src.","; |
|
| 2393 | + } |
|
| 2397 | 2394 | |
| 2398 | - if ($curImages != '') |
|
| 2399 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 2400 | - else |
|
| 2401 | - $svalue = ''; |
|
| 2402 | - |
|
| 2403 | - $image_limit = $package_info->image_limit; |
|
| 2404 | - $show_image_input_box = ($image_limit != '0'); |
|
| 2405 | - /** |
|
| 2406 | - * Filter to be able to show/hide the image upload section of the add listing form. |
|
| 2407 | - * |
|
| 2408 | - * @since 1.0.0 |
|
| 2409 | - * @param bool $show_image_input_box Set true to show. Set false to not show. |
|
| 2410 | - * @param string $listing_type The custom post type slug. |
|
| 2411 | - */ |
|
| 2412 | - $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
|
|
| 2413 | - if ($show_image_input_box) {
|
|
| 2414 | - ?> |
|
| 2395 | + $totImg = count((array)$thumb_img_arr); |
|
| 2396 | + } |
|
| 2397 | + |
|
| 2398 | + if ($curImages != '') |
|
| 2399 | + $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 2400 | + else |
|
| 2401 | + $svalue = ''; |
|
| 2402 | + |
|
| 2403 | + $image_limit = $package_info->image_limit; |
|
| 2404 | + $show_image_input_box = ($image_limit != '0'); |
|
| 2405 | + /** |
|
| 2406 | + * Filter to be able to show/hide the image upload section of the add listing form. |
|
| 2407 | + * |
|
| 2408 | + * @since 1.0.0 |
|
| 2409 | + * @param bool $show_image_input_box Set true to show. Set false to not show. |
|
| 2410 | + * @param string $listing_type The custom post type slug. |
|
| 2411 | + */ |
|
| 2412 | + $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
|
|
| 2413 | + if ($show_image_input_box) {
|
|
| 2414 | + ?> |
|
| 2415 | 2415 | |
| 2416 | 2416 | <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?> |
| 2417 | 2417 | <?php if ($image_limit == 1) {
|
| 2418 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2419 | - } ?> |
|
| 2418 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2419 | + } ?> |
|
| 2420 | 2420 | <?php if ($image_limit > 1) {
|
| 2421 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2422 | - } ?> |
|
| 2421 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2422 | + } ?> |
|
| 2423 | 2423 | <?php if ($image_limit == '') {
|
| 2424 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2425 | - } ?> |
|
| 2424 | + echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2425 | + } ?> |
|
| 2426 | 2426 | </h5> |
| 2427 | 2427 | |
| 2428 | 2428 | <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox" |
@@ -2460,12 +2460,12 @@ discard block |
||
| 2460 | 2460 | <?php } ?> |
| 2461 | 2461 | |
| 2462 | 2462 | <?php |
| 2463 | - /** |
|
| 2464 | - * Called on the add listing page form for frontend just after the image upload field. |
|
| 2465 | - * |
|
| 2466 | - * @since 1.0.0 |
|
| 2467 | - */ |
|
| 2468 | - do_action('geodir_after_main_form_fields');?>
|
|
| 2463 | + /** |
|
| 2464 | + * Called on the add listing page form for frontend just after the image upload field. |
|
| 2465 | + * |
|
| 2466 | + * @since 1.0.0 |
|
| 2467 | + */ |
|
| 2468 | + do_action('geodir_after_main_form_fields');?>
|
|
| 2469 | 2469 | |
| 2470 | 2470 | |
| 2471 | 2471 | <!-- add captcha code --> |
@@ -2494,7 +2494,7 @@ discard block |
||
| 2494 | 2494 | |
| 2495 | 2495 | </form> |
| 2496 | 2496 | <?php |
| 2497 | - wp_reset_query(); |
|
| 2497 | + wp_reset_query(); |
|
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | 2500 | /** |
@@ -2505,7 +2505,7 @@ discard block |
||
| 2505 | 2505 | */ |
| 2506 | 2506 | function geodir_add_listing_sidebar_widget_area() |
| 2507 | 2507 | {
|
| 2508 | - dynamic_sidebar('geodir_add_listing_sidebar');
|
|
| 2508 | + dynamic_sidebar('geodir_add_listing_sidebar');
|
|
| 2509 | 2509 | } |
| 2510 | 2510 | |
| 2511 | 2511 | add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
|
@@ -2520,16 +2520,16 @@ discard block |
||
| 2520 | 2520 | */ |
| 2521 | 2521 | function geodir_action_add_listing_sidebar() |
| 2522 | 2522 | {
|
| 2523 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2524 | - do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2525 | - /** |
|
| 2526 | - * This is used to add the content to the add listing page sidebar. |
|
| 2527 | - * |
|
| 2528 | - * @since 1.0.0 |
|
| 2529 | - */ |
|
| 2530 | - do_action('geodir_add_listing_sidebar_inside');
|
|
| 2531 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2532 | - do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 2523 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2524 | + do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2525 | + /** |
|
| 2526 | + * This is used to add the content to the add listing page sidebar. |
|
| 2527 | + * |
|
| 2528 | + * @since 1.0.0 |
|
| 2529 | + */ |
|
| 2530 | + do_action('geodir_add_listing_sidebar_inside');
|
|
| 2531 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2532 | + do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 2533 | 2533 | } |
| 2534 | 2534 | |
| 2535 | 2535 | ############################################### |
@@ -2546,11 +2546,11 @@ discard block |
||
| 2546 | 2546 | */ |
| 2547 | 2547 | function geodir_action_geodir_sidebar_signup_top() |
| 2548 | 2548 | {
|
| 2549 | - ?> |
|
| 2549 | + ?> |
|
| 2550 | 2550 | <div |
| 2551 | 2551 | class="<?php |
| 2552 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2553 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
|
| 2552 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2553 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
|
| 2554 | 2554 | <?php dynamic_sidebar('Reg/Login Top Section');?>
|
| 2555 | 2555 | </div><!-- clearfix ends here--> |
| 2556 | 2556 | <?php |
@@ -2569,9 +2569,9 @@ discard block |
||
| 2569 | 2569 | function geodir_action_signup_forms() |
| 2570 | 2570 | {
|
| 2571 | 2571 | |
| 2572 | - global $user_login; |
|
| 2572 | + global $user_login; |
|
| 2573 | 2573 | |
| 2574 | - ?> |
|
| 2574 | + ?> |
|
| 2575 | 2575 | <script type="text/javascript"> |
| 2576 | 2576 | <?php if ( $user_login ) { ?>
|
| 2577 | 2577 | setTimeout(function () {
|
@@ -2607,65 +2607,65 @@ discard block |
||
| 2607 | 2607 | <?php } ?> |
| 2608 | 2608 | </script><?php |
| 2609 | 2609 | |
| 2610 | - global $errors; |
|
| 2611 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
| 2612 | - $errors->add('claim_login', LOGIN_CLAIM);
|
|
| 2613 | - |
|
| 2614 | - if (!empty($errors)) {
|
|
| 2615 | - foreach ($errors as $errorsObj) {
|
|
| 2616 | - foreach ($errorsObj as $key => $val) {
|
|
| 2617 | - for ($i = 0; $i < count($val); $i++) {
|
|
| 2618 | - echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2619 | - $registration_error_msg = 1; |
|
| 2620 | - } |
|
| 2621 | - } |
|
| 2622 | - } |
|
| 2623 | - } |
|
| 2610 | + global $errors; |
|
| 2611 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
| 2612 | + $errors->add('claim_login', LOGIN_CLAIM);
|
|
| 2613 | + |
|
| 2614 | + if (!empty($errors)) {
|
|
| 2615 | + foreach ($errors as $errorsObj) {
|
|
| 2616 | + foreach ($errorsObj as $key => $val) {
|
|
| 2617 | + for ($i = 0; $i < count($val); $i++) {
|
|
| 2618 | + echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2619 | + $registration_error_msg = 1; |
|
| 2620 | + } |
|
| 2621 | + } |
|
| 2622 | + } |
|
| 2623 | + } |
|
| 2624 | 2624 | |
| 2625 | - if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
|
|
| 2626 | - ?> |
|
| 2625 | + if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
|
|
| 2626 | + ?> |
|
| 2627 | 2627 | |
| 2628 | 2628 | <div class="login_form"> |
| 2629 | 2629 | <?php |
| 2630 | - /** |
|
| 2631 | - * Contains login form template. |
|
| 2632 | - * |
|
| 2633 | - * @since 1.0.0 |
|
| 2634 | - */ |
|
| 2635 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2630 | + /** |
|
| 2631 | + * Contains login form template. |
|
| 2632 | + * |
|
| 2633 | + * @since 1.0.0 |
|
| 2634 | + */ |
|
| 2635 | + include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2636 | 2636 | </div> |
| 2637 | 2637 | |
| 2638 | 2638 | <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
|
| 2639 | 2639 | |
| 2640 | 2640 | <div class="registration_form"> |
| 2641 | 2641 | <?php |
| 2642 | - /** |
|
| 2643 | - * Contains registration form template. |
|
| 2644 | - * |
|
| 2645 | - * @since 1.0.0 |
|
| 2646 | - */ |
|
| 2647 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2642 | + /** |
|
| 2643 | + * Contains registration form template. |
|
| 2644 | + * |
|
| 2645 | + * @since 1.0.0 |
|
| 2646 | + */ |
|
| 2647 | + include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2648 | 2648 | </div> |
| 2649 | 2649 | |
| 2650 | 2650 | <?php } else { ?>
|
| 2651 | 2651 | |
| 2652 | 2652 | <div class="login_form_l"> |
| 2653 | 2653 | <?php |
| 2654 | - /** |
|
| 2655 | - * Contains login form template. |
|
| 2656 | - * |
|
| 2657 | - * @since 1.0.0 |
|
| 2658 | - */ |
|
| 2659 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2654 | + /** |
|
| 2655 | + * Contains login form template. |
|
| 2656 | + * |
|
| 2657 | + * @since 1.0.0 |
|
| 2658 | + */ |
|
| 2659 | + include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2660 | 2660 | </div> |
| 2661 | 2661 | <div class="registration_form_r"> |
| 2662 | 2662 | <?php |
| 2663 | - /** |
|
| 2664 | - * Contains registration form template. |
|
| 2665 | - * |
|
| 2666 | - * @since 1.0.0 |
|
| 2667 | - */ |
|
| 2668 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2663 | + /** |
|
| 2664 | + * Contains registration form template. |
|
| 2665 | + * |
|
| 2666 | + * @since 1.0.0 |
|
| 2667 | + */ |
|
| 2668 | + include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2669 | 2669 | </div> |
| 2670 | 2670 | |
| 2671 | 2671 | <?php }?> |
@@ -2696,66 +2696,66 @@ discard block |
||
| 2696 | 2696 | */ |
| 2697 | 2697 | function geodir_action_author_page_title() |
| 2698 | 2698 | {
|
| 2699 | - global $term; |
|
| 2699 | + global $term; |
|
| 2700 | 2700 | |
| 2701 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 2702 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 2701 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 2702 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 2703 | 2703 | |
| 2704 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2705 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2706 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2707 | - } |
|
| 2704 | + $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2705 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2706 | + $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2707 | + } |
|
| 2708 | 2708 | |
| 2709 | - $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2710 | - $single_name = $post_type_info->labels->singular_name; |
|
| 2709 | + $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2710 | + $single_name = $post_type_info->labels->singular_name; |
|
| 2711 | 2711 | |
| 2712 | - $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 2712 | + $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 2713 | 2713 | |
| 2714 | - if (!empty($term)) {
|
|
| 2715 | - $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 2716 | - if (!empty($current_term)) |
|
| 2717 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2718 | - } |
|
| 2714 | + if (!empty($term)) {
|
|
| 2715 | + $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 2716 | + if (!empty($current_term)) |
|
| 2717 | + $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2718 | + } |
|
| 2719 | 2719 | |
| 2720 | 2720 | |
| 2721 | - if (is_search()) {
|
|
| 2722 | - $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2721 | + if (is_search()) {
|
|
| 2722 | + $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2723 | 2723 | |
| 2724 | - } |
|
| 2725 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2726 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2727 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2728 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2724 | + } |
|
| 2725 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2726 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2727 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2728 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2729 | 2729 | |
| 2730 | - $title = $list_title; |
|
| 2731 | - if(geodir_is_page('author')){
|
|
| 2732 | - $gd_page = 'author'; |
|
| 2733 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2734 | - $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 2735 | - }else{
|
|
| 2736 | - $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 2737 | - } |
|
| 2730 | + $title = $list_title; |
|
| 2731 | + if(geodir_is_page('author')){
|
|
| 2732 | + $gd_page = 'author'; |
|
| 2733 | + if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2734 | + $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 2735 | + }else{
|
|
| 2736 | + $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 2737 | + } |
|
| 2738 | 2738 | |
| 2739 | - } |
|
| 2739 | + } |
|
| 2740 | 2740 | |
| 2741 | 2741 | |
| 2742 | - /** |
|
| 2743 | - * Filter page title to replace variables. |
|
| 2744 | - * |
|
| 2745 | - * @since 1.5.4 |
|
| 2746 | - * @param string $title The page title including variables. |
|
| 2747 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 2748 | - */ |
|
| 2749 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2742 | + /** |
|
| 2743 | + * Filter page title to replace variables. |
|
| 2744 | + * |
|
| 2745 | + * @since 1.5.4 |
|
| 2746 | + * @param string $title The page title including variables. |
|
| 2747 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 2748 | + */ |
|
| 2749 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2750 | 2750 | |
| 2751 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2752 | - /** |
|
| 2753 | - * Filter the author page title text. |
|
| 2754 | - * |
|
| 2755 | - * @since 1.0.0 |
|
| 2756 | - * @param string $list_title The title for the page. |
|
| 2757 | - */ |
|
| 2758 | - apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2751 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2752 | + /** |
|
| 2753 | + * Filter the author page title text. |
|
| 2754 | + * |
|
| 2755 | + * @since 1.0.0 |
|
| 2756 | + * @param string $list_title The title for the page. |
|
| 2757 | + */ |
|
| 2758 | + apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2759 | 2759 | } |
| 2760 | 2760 | |
| 2761 | 2761 | |
@@ -2773,11 +2773,11 @@ discard block |
||
| 2773 | 2773 | */ |
| 2774 | 2774 | function geodir_action_geodir_sidebar_author_top() |
| 2775 | 2775 | {
|
| 2776 | - if (get_option('geodir_show_author_top_section')) { ?>
|
|
| 2776 | + if (get_option('geodir_show_author_top_section')) { ?>
|
|
| 2777 | 2777 | <div |
| 2778 | 2778 | class="<?php |
| 2779 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2780 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
|
|
| 2779 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2780 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
|
|
| 2781 | 2781 | <?php dynamic_sidebar('geodir_author_top'); ?>
|
| 2782 | 2782 | </div><!-- clearfix ends here--> |
| 2783 | 2783 | <?php } |
@@ -2793,7 +2793,7 @@ discard block |
||
| 2793 | 2793 | */ |
| 2794 | 2794 | function geodir_author_left_section() |
| 2795 | 2795 | {
|
| 2796 | - if (get_option('geodir_show_author_left_section')) { ?>
|
|
| 2796 | + if (get_option('geodir_show_author_left_section')) { ?>
|
|
| 2797 | 2797 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 2798 | 2798 | <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
|
| 2799 | 2799 | </div><!-- end geodir-content-left --> |
@@ -2814,19 +2814,19 @@ discard block |
||
| 2814 | 2814 | */ |
| 2815 | 2815 | function geodir_action_author_sidebar_left() |
| 2816 | 2816 | {
|
| 2817 | - if (get_option('geodir_show_author_left_section')) {
|
|
| 2817 | + if (get_option('geodir_show_author_left_section')) {
|
|
| 2818 | 2818 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 2819 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2820 | - do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 2821 | - /** |
|
| 2822 | - * This is used to add the content to the author page left sidebar (if active). |
|
| 2823 | - * |
|
| 2824 | - * @since 1.0.0 |
|
| 2825 | - */ |
|
| 2826 | - do_action('geodir_author_sidebar_left_inside');
|
|
| 2827 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2828 | - do_action('geodir_sidebar_left_close', 'author-page');
|
|
| 2829 | - } |
|
| 2819 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2820 | + do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 2821 | + /** |
|
| 2822 | + * This is used to add the content to the author page left sidebar (if active). |
|
| 2823 | + * |
|
| 2824 | + * @since 1.0.0 |
|
| 2825 | + */ |
|
| 2826 | + do_action('geodir_author_sidebar_left_inside');
|
|
| 2827 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2828 | + do_action('geodir_sidebar_left_close', 'author-page');
|
|
| 2829 | + } |
|
| 2830 | 2830 | } |
| 2831 | 2831 | |
| 2832 | 2832 | /** |
@@ -2839,7 +2839,7 @@ discard block |
||
| 2839 | 2839 | */ |
| 2840 | 2840 | function geodir_author_right_section() |
| 2841 | 2841 | {
|
| 2842 | - if (get_option('geodir_show_author_right_section')) { ?>
|
|
| 2842 | + if (get_option('geodir_show_author_right_section')) { ?>
|
|
| 2843 | 2843 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 2844 | 2844 | <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
|
| 2845 | 2845 | </div><!-- end geodir-content-right --> |
@@ -2859,18 +2859,18 @@ discard block |
||
| 2859 | 2859 | */ |
| 2860 | 2860 | function geodir_action_author_sidebar_right() |
| 2861 | 2861 | {
|
| 2862 | - if (get_option('geodir_show_author_right_section')) {
|
|
| 2863 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2864 | - do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2865 | - /** |
|
| 2866 | - * This is used to add the content to the author page right sidebar (if active). |
|
| 2867 | - * |
|
| 2868 | - * @since 1.0.0 |
|
| 2869 | - */ |
|
| 2870 | - do_action('geodir_author_sidebar_right_inside');
|
|
| 2871 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2872 | - do_action('geodir_sidebar_right_close', 'author-page');
|
|
| 2873 | - } |
|
| 2862 | + if (get_option('geodir_show_author_right_section')) {
|
|
| 2863 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2864 | + do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2865 | + /** |
|
| 2866 | + * This is used to add the content to the author page right sidebar (if active). |
|
| 2867 | + * |
|
| 2868 | + * @since 1.0.0 |
|
| 2869 | + */ |
|
| 2870 | + do_action('geodir_author_sidebar_right_inside');
|
|
| 2871 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2872 | + do_action('geodir_sidebar_right_close', 'author-page');
|
|
| 2873 | + } |
|
| 2874 | 2874 | } |
| 2875 | 2875 | |
| 2876 | 2876 | /** |
@@ -2882,14 +2882,14 @@ discard block |
||
| 2882 | 2882 | */ |
| 2883 | 2883 | function geodir_action_author_content_inside() |
| 2884 | 2884 | {
|
| 2885 | - global $gridview_columns; |
|
| 2886 | - $listing_view = get_option('geodir_author_view');
|
|
| 2887 | - if (strstr($listing_view, 'gridview')) {
|
|
| 2888 | - $gridview_columns = $listing_view; |
|
| 2889 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 2890 | - $listing_view = $listing_view_exp[0]; |
|
| 2891 | - } |
|
| 2892 | - geodir_get_template_part('listing', 'listview');
|
|
| 2885 | + global $gridview_columns; |
|
| 2886 | + $listing_view = get_option('geodir_author_view');
|
|
| 2887 | + if (strstr($listing_view, 'gridview')) {
|
|
| 2888 | + $gridview_columns = $listing_view; |
|
| 2889 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 2890 | + $listing_view = $listing_view_exp[0]; |
|
| 2891 | + } |
|
| 2892 | + geodir_get_template_part('listing', 'listview');
|
|
| 2893 | 2893 | } |
| 2894 | 2894 | |
| 2895 | 2895 | add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
|
@@ -2904,22 +2904,22 @@ discard block |
||
| 2904 | 2904 | */ |
| 2905 | 2905 | function geodir_action_author_content() |
| 2906 | 2906 | {
|
| 2907 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2908 | - do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
|
|
| 2909 | - echo '<div class="clearfix">'; |
|
| 2910 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2911 | - do_action('geodir_before_listing');
|
|
| 2912 | - echo '</div>'; |
|
| 2913 | - /** |
|
| 2914 | - * This is used to add the content to the author page main content. |
|
| 2915 | - * |
|
| 2916 | - * @since 1.0.0 |
|
| 2917 | - */ |
|
| 2918 | - do_action('geodir_author_content_inside');
|
|
| 2919 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2920 | - do_action('geodir_after_listing');
|
|
| 2921 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2922 | - do_action('geodir_main_content_close', 'author-page');
|
|
| 2907 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2908 | + do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
|
|
| 2909 | + echo '<div class="clearfix">'; |
|
| 2910 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2911 | + do_action('geodir_before_listing');
|
|
| 2912 | + echo '</div>'; |
|
| 2913 | + /** |
|
| 2914 | + * This is used to add the content to the author page main content. |
|
| 2915 | + * |
|
| 2916 | + * @since 1.0.0 |
|
| 2917 | + */ |
|
| 2918 | + do_action('geodir_author_content_inside');
|
|
| 2919 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2920 | + do_action('geodir_after_listing');
|
|
| 2921 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2922 | + do_action('geodir_main_content_close', 'author-page');
|
|
| 2923 | 2923 | } |
| 2924 | 2924 | |
| 2925 | 2925 | add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
|
@@ -2933,11 +2933,11 @@ discard block |
||
| 2933 | 2933 | */ |
| 2934 | 2934 | function geodir_action_sidebar_author_bottom_section() |
| 2935 | 2935 | {
|
| 2936 | - if (get_option('geodir_show_author_bottom_section')) { ?>
|
|
| 2936 | + if (get_option('geodir_show_author_bottom_section')) { ?>
|
|
| 2937 | 2937 | <div |
| 2938 | 2938 | class="<?php |
| 2939 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2940 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
|
|
| 2939 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2940 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
|
|
| 2941 | 2941 | <?php dynamic_sidebar('geodir_author_bottom'); ?>
|
| 2942 | 2942 | </div><!-- clearfix ends here--> |
| 2943 | 2943 | <?php } |
@@ -2956,23 +2956,23 @@ discard block |
||
| 2956 | 2956 | */ |
| 2957 | 2957 | function geodir_action_search_page_title() |
| 2958 | 2958 | {
|
| 2959 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 2960 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 2959 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 2960 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 2961 | 2961 | |
| 2962 | - $pt_name = ''; |
|
| 2963 | - if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 2962 | + $pt_name = ''; |
|
| 2963 | + if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 2964 | 2964 | |
| 2965 | - if (is_search()) {
|
|
| 2966 | - $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2965 | + if (is_search()) {
|
|
| 2966 | + $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2967 | 2967 | |
| 2968 | - } |
|
| 2969 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2970 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2971 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2972 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2973 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2974 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2975 | - apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 2968 | + } |
|
| 2969 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2970 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2971 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2972 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2973 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2974 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2975 | + apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 2976 | 2976 | } |
| 2977 | 2977 | |
| 2978 | 2978 | // action for adding the listings page top widget area |
@@ -2988,11 +2988,11 @@ discard block |
||
| 2988 | 2988 | */ |
| 2989 | 2989 | function geodir_action_geodir_sidebar_search_top() |
| 2990 | 2990 | {
|
| 2991 | - if (get_option('geodir_show_search_top_section')) { ?>
|
|
| 2991 | + if (get_option('geodir_show_search_top_section')) { ?>
|
|
| 2992 | 2992 | <div |
| 2993 | 2993 | class="<?php |
| 2994 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2995 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
|
|
| 2994 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2995 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
|
|
| 2996 | 2996 | <?php dynamic_sidebar('geodir_search_top'); ?>
|
| 2997 | 2997 | </div><!-- clearfix ends here--> |
| 2998 | 2998 | <?php } |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | */ |
| 3009 | 3009 | function geodir_search_left_section() |
| 3010 | 3010 | {
|
| 3011 | - if (get_option('geodir_show_search_left_section')) { ?>
|
|
| 3011 | + if (get_option('geodir_show_search_left_section')) { ?>
|
|
| 3012 | 3012 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 3013 | 3013 | <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
|
| 3014 | 3014 | </div><!-- end geodir-content-left --> |
@@ -3028,19 +3028,19 @@ discard block |
||
| 3028 | 3028 | */ |
| 3029 | 3029 | function geodir_action_search_sidebar_left() |
| 3030 | 3030 | {
|
| 3031 | - if (get_option('geodir_show_search_left_section')) {
|
|
| 3031 | + if (get_option('geodir_show_search_left_section')) {
|
|
| 3032 | 3032 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 3033 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3034 | - do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3035 | - /** |
|
| 3036 | - * This is used to add the content to the search page left sidebar (if active). |
|
| 3037 | - * |
|
| 3038 | - * @since 1.0.0 |
|
| 3039 | - */ |
|
| 3040 | - do_action('geodir_search_sidebar_left_inside');
|
|
| 3041 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3042 | - do_action('geodir_sidebar_left_close', 'search-page');
|
|
| 3043 | - } |
|
| 3033 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3034 | + do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3035 | + /** |
|
| 3036 | + * This is used to add the content to the search page left sidebar (if active). |
|
| 3037 | + * |
|
| 3038 | + * @since 1.0.0 |
|
| 3039 | + */ |
|
| 3040 | + do_action('geodir_search_sidebar_left_inside');
|
|
| 3041 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3042 | + do_action('geodir_sidebar_left_close', 'search-page');
|
|
| 3043 | + } |
|
| 3044 | 3044 | } |
| 3045 | 3045 | |
| 3046 | 3046 | /** |
@@ -3053,7 +3053,7 @@ discard block |
||
| 3053 | 3053 | */ |
| 3054 | 3054 | function geodir_search_right_section() |
| 3055 | 3055 | {
|
| 3056 | - if (get_option('geodir_show_search_right_section')) { ?>
|
|
| 3056 | + if (get_option('geodir_show_search_right_section')) { ?>
|
|
| 3057 | 3057 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 3058 | 3058 | <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
|
| 3059 | 3059 | </div><!-- end geodir-content-right --> |
@@ -3073,18 +3073,18 @@ discard block |
||
| 3073 | 3073 | */ |
| 3074 | 3074 | function geodir_action_search_sidebar_right() |
| 3075 | 3075 | {
|
| 3076 | - if (get_option('geodir_show_search_right_section')) {
|
|
| 3077 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3078 | - do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3079 | - /** |
|
| 3080 | - * This is used to add the content to the search page right sidebar (if active). |
|
| 3081 | - * |
|
| 3082 | - * @since 1.0.0 |
|
| 3083 | - */ |
|
| 3084 | - do_action('geodir_search_sidebar_right_inside');
|
|
| 3085 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3086 | - do_action('geodir_sidebar_right_close', 'search-page');
|
|
| 3087 | - } |
|
| 3076 | + if (get_option('geodir_show_search_right_section')) {
|
|
| 3077 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3078 | + do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3079 | + /** |
|
| 3080 | + * This is used to add the content to the search page right sidebar (if active). |
|
| 3081 | + * |
|
| 3082 | + * @since 1.0.0 |
|
| 3083 | + */ |
|
| 3084 | + do_action('geodir_search_sidebar_right_inside');
|
|
| 3085 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3086 | + do_action('geodir_sidebar_right_close', 'search-page');
|
|
| 3087 | + } |
|
| 3088 | 3088 | } |
| 3089 | 3089 | |
| 3090 | 3090 | |
@@ -3099,11 +3099,11 @@ discard block |
||
| 3099 | 3099 | */ |
| 3100 | 3100 | function geodir_action_sidebar_search_bottom_section() |
| 3101 | 3101 | {
|
| 3102 | - if (get_option('geodir_show_search_bottom_section')) { ?>
|
|
| 3102 | + if (get_option('geodir_show_search_bottom_section')) { ?>
|
|
| 3103 | 3103 | <div |
| 3104 | 3104 | class="<?php |
| 3105 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3106 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
|
|
| 3105 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3106 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
|
|
| 3107 | 3107 | <?php dynamic_sidebar('geodir_search_bottom'); ?>
|
| 3108 | 3108 | </div><!-- clearfix ends here--> |
| 3109 | 3109 | <?php } |
@@ -3118,14 +3118,14 @@ discard block |
||
| 3118 | 3118 | */ |
| 3119 | 3119 | function geodir_action_search_content_inside() |
| 3120 | 3120 | {
|
| 3121 | - global $gridview_columns; |
|
| 3122 | - $listing_view = get_option('geodir_search_view');
|
|
| 3123 | - if (strstr($listing_view, 'gridview')) {
|
|
| 3124 | - $gridview_columns = $listing_view; |
|
| 3125 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 3126 | - $listing_view = $listing_view_exp[0]; |
|
| 3127 | - } |
|
| 3128 | - geodir_get_template_part('listing', 'listview');
|
|
| 3121 | + global $gridview_columns; |
|
| 3122 | + $listing_view = get_option('geodir_search_view');
|
|
| 3123 | + if (strstr($listing_view, 'gridview')) {
|
|
| 3124 | + $gridview_columns = $listing_view; |
|
| 3125 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 3126 | + $listing_view = $listing_view_exp[0]; |
|
| 3127 | + } |
|
| 3128 | + geodir_get_template_part('listing', 'listview');
|
|
| 3129 | 3129 | } |
| 3130 | 3130 | |
| 3131 | 3131 | add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
|
@@ -3141,22 +3141,22 @@ discard block |
||
| 3141 | 3141 | */ |
| 3142 | 3142 | function geodir_action_search_content() |
| 3143 | 3143 | {
|
| 3144 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3145 | - do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
|
|
| 3146 | - echo '<div class="clearfix">'; |
|
| 3147 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3148 | - do_action('geodir_before_listing');
|
|
| 3149 | - echo '</div>'; |
|
| 3150 | - /** |
|
| 3151 | - * This is used to add the content to the search page main content. |
|
| 3152 | - * |
|
| 3153 | - * @since 1.0.0 |
|
| 3154 | - */ |
|
| 3155 | - do_action('geodir_search_content_inside');
|
|
| 3156 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3157 | - do_action('geodir_after_listing');
|
|
| 3158 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3159 | - do_action('geodir_main_content_close', 'search-page');
|
|
| 3144 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3145 | + do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
|
|
| 3146 | + echo '<div class="clearfix">'; |
|
| 3147 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3148 | + do_action('geodir_before_listing');
|
|
| 3149 | + echo '</div>'; |
|
| 3150 | + /** |
|
| 3151 | + * This is used to add the content to the search page main content. |
|
| 3152 | + * |
|
| 3153 | + * @since 1.0.0 |
|
| 3154 | + */ |
|
| 3155 | + do_action('geodir_search_content_inside');
|
|
| 3156 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3157 | + do_action('geodir_after_listing');
|
|
| 3158 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3159 | + do_action('geodir_main_content_close', 'search-page');
|
|
| 3160 | 3160 | } |
| 3161 | 3161 | |
| 3162 | 3162 | ############################################### |
@@ -3179,11 +3179,11 @@ discard block |
||
| 3179 | 3179 | */ |
| 3180 | 3180 | function geodir_action_geodir_sidebar_home_top() |
| 3181 | 3181 | {
|
| 3182 | - if (get_option('geodir_show_home_top_section')) { ?>
|
|
| 3182 | + if (get_option('geodir_show_home_top_section')) { ?>
|
|
| 3183 | 3183 | <div |
| 3184 | 3184 | class="<?php |
| 3185 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3186 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
|
|
| 3185 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3186 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
|
|
| 3187 | 3187 | <?php dynamic_sidebar('geodir_home_top'); ?>
|
| 3188 | 3188 | </div><!-- clearfix ends here--> |
| 3189 | 3189 | <?php } |
@@ -3199,7 +3199,7 @@ discard block |
||
| 3199 | 3199 | */ |
| 3200 | 3200 | function geodir_home_left_section() |
| 3201 | 3201 | {
|
| 3202 | - if (get_option('geodir_show_home_left_section')) { ?>
|
|
| 3202 | + if (get_option('geodir_show_home_left_section')) { ?>
|
|
| 3203 | 3203 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 3204 | 3204 | <?php dynamic_sidebar('geodir_home_left'); ?>
|
| 3205 | 3205 | </div><!-- end geodir-content-left --> |
@@ -3221,19 +3221,19 @@ discard block |
||
| 3221 | 3221 | */ |
| 3222 | 3222 | function geodir_action_home_sidebar_left() |
| 3223 | 3223 | {
|
| 3224 | - if (get_option('geodir_show_home_left_section')) {
|
|
| 3224 | + if (get_option('geodir_show_home_left_section')) {
|
|
| 3225 | 3225 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 3226 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3227 | - do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3228 | - /** |
|
| 3229 | - * This is used to add the content to the home page left sidebar (if active). |
|
| 3230 | - * |
|
| 3231 | - * @since 1.0.0 |
|
| 3232 | - */ |
|
| 3233 | - do_action('geodir_home_sidebar_left_inside');
|
|
| 3234 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3235 | - do_action('geodir_sidebar_left_close', 'home-page');
|
|
| 3236 | - } |
|
| 3226 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3227 | + do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3228 | + /** |
|
| 3229 | + * This is used to add the content to the home page left sidebar (if active). |
|
| 3230 | + * |
|
| 3231 | + * @since 1.0.0 |
|
| 3232 | + */ |
|
| 3233 | + do_action('geodir_home_sidebar_left_inside');
|
|
| 3234 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3235 | + do_action('geodir_sidebar_left_close', 'home-page');
|
|
| 3236 | + } |
|
| 3237 | 3237 | } |
| 3238 | 3238 | |
| 3239 | 3239 | /** |
@@ -3246,7 +3246,7 @@ discard block |
||
| 3246 | 3246 | */ |
| 3247 | 3247 | function geodir_home_right_section() |
| 3248 | 3248 | {
|
| 3249 | - if (get_option('geodir_show_home_right_section')) { ?>
|
|
| 3249 | + if (get_option('geodir_show_home_right_section')) { ?>
|
|
| 3250 | 3250 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 3251 | 3251 | <?php dynamic_sidebar('geodir_home_right'); ?>
|
| 3252 | 3252 | </div><!-- end geodir-content-right --> |
@@ -3267,18 +3267,18 @@ discard block |
||
| 3267 | 3267 | */ |
| 3268 | 3268 | function geodir_action_home_sidebar_right() |
| 3269 | 3269 | {
|
| 3270 | - if (get_option('geodir_show_home_right_section')) {
|
|
| 3271 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3272 | - do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3273 | - /** |
|
| 3274 | - * This is used to add the content to the home page right sidebar (if active). |
|
| 3275 | - * |
|
| 3276 | - * @since 1.0.0 |
|
| 3277 | - */ |
|
| 3278 | - do_action('geodir_home_sidebar_right_inside');
|
|
| 3279 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3280 | - do_action('geodir_sidebar_right_close', 'home-page');
|
|
| 3281 | - } |
|
| 3270 | + if (get_option('geodir_show_home_right_section')) {
|
|
| 3271 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3272 | + do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3273 | + /** |
|
| 3274 | + * This is used to add the content to the home page right sidebar (if active). |
|
| 3275 | + * |
|
| 3276 | + * @since 1.0.0 |
|
| 3277 | + */ |
|
| 3278 | + do_action('geodir_home_sidebar_right_inside');
|
|
| 3279 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3280 | + do_action('geodir_sidebar_right_close', 'home-page');
|
|
| 3281 | + } |
|
| 3282 | 3282 | } |
| 3283 | 3283 | |
| 3284 | 3284 | /** |
@@ -3289,7 +3289,7 @@ discard block |
||
| 3289 | 3289 | */ |
| 3290 | 3290 | function geodir_action_home_content_inside() |
| 3291 | 3291 | {
|
| 3292 | - dynamic_sidebar('geodir_home_content');
|
|
| 3292 | + dynamic_sidebar('geodir_home_content');
|
|
| 3293 | 3293 | } |
| 3294 | 3294 | |
| 3295 | 3295 | add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
|
@@ -3304,28 +3304,28 @@ discard block |
||
| 3304 | 3304 | */ |
| 3305 | 3305 | function geodir_action_home_content() |
| 3306 | 3306 | {
|
| 3307 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3308 | - do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
|
|
| 3309 | - /** |
|
| 3310 | - * This called before the home page main content. |
|
| 3311 | - * |
|
| 3312 | - * @since 1.0.0 |
|
| 3313 | - */ |
|
| 3314 | - do_action('geodir_before_home_content');
|
|
| 3315 | - /** |
|
| 3316 | - * This is used to add the content to the home page main content. |
|
| 3317 | - * |
|
| 3318 | - * @since 1.0.0 |
|
| 3319 | - */ |
|
| 3320 | - do_action('geodir_home_content_inside');
|
|
| 3321 | - /** |
|
| 3322 | - * This is called after the homepage main content. |
|
| 3323 | - * |
|
| 3324 | - * @since 1.0.0 |
|
| 3325 | - */ |
|
| 3326 | - do_action('geodir_after_home_content');
|
|
| 3327 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3328 | - do_action('geodir_main_content_close', 'home-page');
|
|
| 3307 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3308 | + do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
|
|
| 3309 | + /** |
|
| 3310 | + * This called before the home page main content. |
|
| 3311 | + * |
|
| 3312 | + * @since 1.0.0 |
|
| 3313 | + */ |
|
| 3314 | + do_action('geodir_before_home_content');
|
|
| 3315 | + /** |
|
| 3316 | + * This is used to add the content to the home page main content. |
|
| 3317 | + * |
|
| 3318 | + * @since 1.0.0 |
|
| 3319 | + */ |
|
| 3320 | + do_action('geodir_home_content_inside');
|
|
| 3321 | + /** |
|
| 3322 | + * This is called after the homepage main content. |
|
| 3323 | + * |
|
| 3324 | + * @since 1.0.0 |
|
| 3325 | + */ |
|
| 3326 | + do_action('geodir_after_home_content');
|
|
| 3327 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3328 | + do_action('geodir_main_content_close', 'home-page');
|
|
| 3329 | 3329 | } |
| 3330 | 3330 | |
| 3331 | 3331 | add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
|
@@ -3340,11 +3340,11 @@ discard block |
||
| 3340 | 3340 | */ |
| 3341 | 3341 | function geodir_action_sidebar_home_bottom_section() |
| 3342 | 3342 | {
|
| 3343 | - if (get_option('geodir_show_home_bottom_section')) { ?>
|
|
| 3343 | + if (get_option('geodir_show_home_bottom_section')) { ?>
|
|
| 3344 | 3344 | <div |
| 3345 | 3345 | class="<?php |
| 3346 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3347 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
|
|
| 3346 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3347 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
|
|
| 3348 | 3348 | <?php dynamic_sidebar('geodir_home_bottom'); ?>
|
| 3349 | 3349 | </div><!-- clearfix ends here--> |
| 3350 | 3350 | <?php } |
@@ -3372,13 +3372,13 @@ discard block |
||
| 3372 | 3372 | */ |
| 3373 | 3373 | function geodir_filter_listing_page_title($list_title) |
| 3374 | 3374 | {
|
| 3375 | - if (is_search() && trim(get_search_query()) == '') {
|
|
| 3376 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 3377 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 3375 | + if (is_search() && trim(get_search_query()) == '') {
|
|
| 3376 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 3377 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 3378 | 3378 | |
| 3379 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3380 | - } |
|
| 3381 | - return $list_title; |
|
| 3379 | + $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3380 | + } |
|
| 3381 | + return $list_title; |
|
| 3382 | 3382 | } |
| 3383 | 3383 | |
| 3384 | 3384 | add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
|
@@ -3393,61 +3393,61 @@ discard block |
||
| 3393 | 3393 | * @param string $gd_page The geodirectory page type. Default null. |
| 3394 | 3394 | */ |
| 3395 | 3395 | function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
|
| 3396 | - global $post; |
|
| 3396 | + global $post; |
|
| 3397 | 3397 | |
| 3398 | - $gd_page_id = NULL; |
|
| 3399 | - if ($gd_page == 'home-page' && geodir_is_page('home')) {
|
|
| 3400 | - $gd_page_id = geodir_home_page_id(); |
|
| 3401 | - } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
|
|
| 3402 | - $gd_page_id = geodir_preview_page_id(); |
|
| 3403 | - } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
|
|
| 3404 | - $gd_page_id = geodir_add_listing_page_id(); |
|
| 3405 | - } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
|
|
| 3406 | - $gd_page_id = geodir_success_page_id(); |
|
| 3407 | - } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
|
|
| 3408 | - $gd_page_id = geodir_location_page_id(); |
|
| 3409 | - } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
|
|
| 3410 | - $gd_page_id = geodir_info_page_id(); |
|
| 3411 | - } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
|
|
| 3412 | - $gd_page_id = geodir_login_page_id(); |
|
| 3413 | - } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
|
|
| 3414 | - $gd_page_id = geodir_payment_checkout_page_id(); |
|
| 3415 | - } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
|
|
| 3416 | - $gd_page_id = geodir_payment_invoices_page_id(); |
|
| 3417 | - } |
|
| 3398 | + $gd_page_id = NULL; |
|
| 3399 | + if ($gd_page == 'home-page' && geodir_is_page('home')) {
|
|
| 3400 | + $gd_page_id = geodir_home_page_id(); |
|
| 3401 | + } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
|
|
| 3402 | + $gd_page_id = geodir_preview_page_id(); |
|
| 3403 | + } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
|
|
| 3404 | + $gd_page_id = geodir_add_listing_page_id(); |
|
| 3405 | + } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
|
|
| 3406 | + $gd_page_id = geodir_success_page_id(); |
|
| 3407 | + } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
|
|
| 3408 | + $gd_page_id = geodir_location_page_id(); |
|
| 3409 | + } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
|
|
| 3410 | + $gd_page_id = geodir_info_page_id(); |
|
| 3411 | + } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
|
|
| 3412 | + $gd_page_id = geodir_login_page_id(); |
|
| 3413 | + } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
|
|
| 3414 | + $gd_page_id = geodir_payment_checkout_page_id(); |
|
| 3415 | + } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
|
|
| 3416 | + $gd_page_id = geodir_payment_invoices_page_id(); |
|
| 3417 | + } |
|
| 3418 | 3418 | |
| 3419 | - if (!$gd_page_id > 0) {
|
|
| 3420 | - return; |
|
| 3421 | - } |
|
| 3419 | + if (!$gd_page_id > 0) {
|
|
| 3420 | + return; |
|
| 3421 | + } |
|
| 3422 | 3422 | |
| 3423 | - $display = 'before'; |
|
| 3424 | - /** |
|
| 3425 | - * Filter the position to display the page content. |
|
| 3426 | - * |
|
| 3427 | - * @since 1.6.3 |
|
| 3428 | - * |
|
| 3429 | - * @param string $display Position to add the post content. |
|
| 3430 | - * @param string $gd_page The geodirectory page type. |
|
| 3431 | - */ |
|
| 3432 | - $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
|
|
| 3423 | + $display = 'before'; |
|
| 3424 | + /** |
|
| 3425 | + * Filter the position to display the page content. |
|
| 3426 | + * |
|
| 3427 | + * @since 1.6.3 |
|
| 3428 | + * |
|
| 3429 | + * @param string $display Position to add the post content. |
|
| 3430 | + * @param string $gd_page The geodirectory page type. |
|
| 3431 | + */ |
|
| 3432 | + $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
|
|
| 3433 | 3433 | |
| 3434 | - if ($position !== $display) {
|
|
| 3435 | - return; |
|
| 3436 | - } |
|
| 3434 | + if ($position !== $display) {
|
|
| 3435 | + return; |
|
| 3436 | + } |
|
| 3437 | 3437 | |
| 3438 | - $gd_post = $post; |
|
| 3438 | + $gd_post = $post; |
|
| 3439 | 3439 | |
| 3440 | - setup_postdata(get_post($gd_page_id)); |
|
| 3440 | + setup_postdata(get_post($gd_page_id)); |
|
| 3441 | 3441 | |
| 3442 | - if (get_the_content()) {
|
|
| 3443 | - ?> |
|
| 3442 | + if (get_the_content()) {
|
|
| 3443 | + ?> |
|
| 3444 | 3444 | <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section> |
| 3445 | 3445 | <?php |
| 3446 | - } |
|
| 3446 | + } |
|
| 3447 | 3447 | |
| 3448 | - $post = $gd_post; |
|
| 3449 | - if (!empty($gd_post) && is_object($gd_post)) {
|
|
| 3450 | - setup_postdata($gd_post); |
|
| 3451 | - } |
|
| 3448 | + $post = $gd_post; |
|
| 3449 | + if (!empty($gd_post) && is_object($gd_post)) {
|
|
| 3450 | + setup_postdata($gd_post); |
|
| 3451 | + } |
|
| 3452 | 3452 | } |
| 3453 | 3453 | add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2); |
| 3454 | 3454 | \ No newline at end of file |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | //php |
| 284 | 284 | if (!empty($tc['geodir_theme_compat_code'])) {
|
| 285 | - include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 285 | + include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
|
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | //geodir_full_page_class |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | function geodir_action_wrapper_content_open($type = '', $id = '', $class = '') |
| 453 | 453 | {
|
| 454 | 454 | if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
| 455 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 455 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 456 | 456 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
| 457 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 457 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 458 | 458 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
| 459 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 459 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 460 | 460 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
| 461 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 461 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 462 | 462 | } else {
|
| 463 | 463 | $width_css = ''; |
| 464 | 464 | } |
@@ -572,13 +572,13 @@ discard block |
||
| 572 | 572 | function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '') |
| 573 | 573 | {
|
| 574 | 574 | if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
| 575 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 575 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 576 | 576 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
| 577 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 577 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 578 | 578 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
| 579 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 579 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 580 | 580 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
| 581 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 581 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 582 | 582 | } else {
|
| 583 | 583 | $width_css = ''; |
| 584 | 584 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | } |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - $post = (object)$_REQUEST; |
|
| 679 | + $post = (object) $_REQUEST; |
|
| 680 | 680 | |
| 681 | 681 | |
| 682 | 682 | if (isset($post->video)) {
|
@@ -735,10 +735,10 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | $json = '{';
|
| 737 | 737 | $json .= '"post_preview": "1",'; |
| 738 | - $json .= '"t": "' . $json_title . '",'; |
|
| 739 | - $json .= '"lt": "' . $post_latitude . '",'; |
|
| 740 | - $json .= '"ln": "' . $post_longitude . '",'; |
|
| 741 | - $json .= '"i":"' . $term_icon . '"'; |
|
| 738 | + $json .= '"t": "'.$json_title.'",'; |
|
| 739 | + $json .= '"lt": "'.$post_latitude.'",'; |
|
| 740 | + $json .= '"ln": "'.$post_longitude.'",'; |
|
| 741 | + $json .= '"i":"'.$term_icon.'"'; |
|
| 742 | 742 | $json .= '}'; |
| 743 | 743 | |
| 744 | 744 | $post->marker_json = $json; |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | * @param string $class The class to use. Default is 'entry-header'. |
| 966 | 966 | */ |
| 967 | 967 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 968 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 968 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>'; |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
| 1020 | 1020 | |
| 1021 | 1021 | if ($image && $width && $height) {
|
| 1022 | - $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1022 | + $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | if (isset($image->src)) {
|
@@ -1031,9 +1031,9 @@ discard block |
||
| 1031 | 1031 | |
| 1032 | 1032 | $image_title = isset($image->title) ? $image->title : ''; |
| 1033 | 1033 | |
| 1034 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1035 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1036 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1034 | + $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />'; |
|
| 1035 | + $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1036 | + $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1037 | 1037 | $slides++; |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
@@ -1052,10 +1052,10 @@ discard block |
||
| 1052 | 1052 | } else {
|
| 1053 | 1053 | $spacer_height = ((400 - $image->height) / 2); |
| 1054 | 1054 | } |
| 1055 | - $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1056 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1057 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1058 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1055 | + $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1056 | + $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />'; |
|
| 1057 | + $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1058 | + $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1059 | 1059 | $slides++; |
| 1060 | 1060 | } |
| 1061 | 1061 | }// endfore |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | */ |
| 1091 | 1091 | function geodir_action_details_taxonomies() |
| 1092 | 1092 | {
|
| 1093 | - global $preview, $post;?> |
|
| 1093 | + global $preview, $post; ?> |
|
| 1094 | 1094 | <p class="geodir_post_taxomomies clearfix"> |
| 1095 | 1095 | <?php |
| 1096 | 1096 | $taxonomies = array(); |
@@ -1099,11 +1099,11 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | if ($preview && !$is_backend_preview) {
|
| 1101 | 1101 | $post_type = $post->listing_type; |
| 1102 | - $post_taxonomy = $post_type . 'category'; |
|
| 1102 | + $post_taxonomy = $post_type.'category'; |
|
| 1103 | 1103 | $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
| 1104 | 1104 | } else {
|
| 1105 | 1105 | $post_type = $post->post_type; |
| 1106 | - $post_taxonomy = $post_type . 'category'; |
|
| 1106 | + $post_taxonomy = $post_type.'category'; |
|
| 1107 | 1107 | } |
| 1108 | 1108 | //{
|
| 1109 | 1109 | $post_type_info = get_post_type_object($post_type); |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | if (!empty($post->post_tags)) {
|
| 1113 | 1113 | |
| 1114 | - if (taxonomy_exists($post_type . '_tags')): |
|
| 1114 | + if (taxonomy_exists($post_type.'_tags')): |
|
| 1115 | 1115 | $links = array(); |
| 1116 | 1116 | $terms = array(); |
| 1117 | 1117 | // to limit post tags |
@@ -1138,8 +1138,8 @@ discard block |
||
| 1138 | 1138 | $post_term = trim($post_term); |
| 1139 | 1139 | |
| 1140 | 1140 | $priority_location = false; |
| 1141 | - if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1142 | - $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1141 | + if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
|
|
| 1142 | + $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
|
|
| 1143 | 1143 | } else {
|
| 1144 | 1144 | $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
| 1145 | 1145 | $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
@@ -1149,10 +1149,10 @@ discard block |
||
| 1149 | 1149 | $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
| 1150 | 1150 | if ($match_country || $match_region || $match_city) {
|
| 1151 | 1151 | $priority_location = true; |
| 1152 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1152 | + $term = get_term_by('name', $post_term, $post_type.'_tags');
|
|
| 1153 | 1153 | } else {
|
| 1154 | - $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1155 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1154 | + $insert_term = wp_insert_term($post_term, $post_type.'_tags'); |
|
| 1155 | + $term = get_term_by('name', $post_term, $post_type.'_tags');
|
|
| 1156 | 1156 | } |
| 1157 | 1157 | } |
| 1158 | 1158 | |
@@ -1169,12 +1169,12 @@ discard block |
||
| 1169 | 1169 | * @param string $tag_link The tag link html. |
| 1170 | 1170 | * @param object $term The tag term object. |
| 1171 | 1171 | */ |
| 1172 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1172 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
|
|
| 1173 | 1173 | $links[] = $tag_link; |
| 1174 | 1174 | } else {
|
| 1175 | - $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1175 | + $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>"; |
|
| 1176 | 1176 | /** This action is documented in geodirectory-template_actions.php */ |
| 1177 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1177 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
|
|
| 1178 | 1178 | $links[] = $tag_link; |
| 1179 | 1179 | } |
| 1180 | 1180 | $terms[] = $term; |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | if (!isset($listing_label)) {
|
| 1185 | 1185 | $listing_label = ''; |
| 1186 | 1186 | } |
| 1187 | - $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1187 | + $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
|
|
| 1188 | 1188 | endif; |
| 1189 | 1189 | |
| 1190 | 1190 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | $term = get_term_by('id', $post_term, $post_taxonomy);
|
| 1213 | 1213 | |
| 1214 | 1214 | if (is_object($term)) {
|
| 1215 | - $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1215 | + $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>"; |
|
| 1216 | 1216 | /** |
| 1217 | 1217 | * Filter the category name on the details page. |
| 1218 | 1218 | * |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | * @param string $term_link The link html to the category. |
| 1221 | 1221 | * @param object $term The category term object. |
| 1222 | 1222 | */ |
| 1223 | - $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1223 | + $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
|
|
| 1224 | 1224 | $links[] = $term_link; |
| 1225 | 1225 | $terms[] = $term; |
| 1226 | 1226 | } |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | if (!isset($listing_label)) {
|
| 1239 | 1239 | $listing_label = ''; |
| 1240 | 1240 | } |
| 1241 | - $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1241 | + $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
|
|
| 1242 | 1242 | |
| 1243 | 1243 | } |
| 1244 | 1244 | |
@@ -1251,14 +1251,14 @@ discard block |
||
| 1251 | 1251 | * @param string $listing_label The post type label. |
| 1252 | 1252 | * @param string $listing_label The post type label with ucwords function. |
| 1253 | 1253 | */ |
| 1254 | - $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1254 | + $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
|
|
| 1255 | 1255 | |
| 1256 | 1256 | if (isset($taxonomies[$post_taxonomy])) {
|
| 1257 | - echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1257 | + echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>'; |
|
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1261 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1260 | + if (isset($taxonomies[$post_type.'_tags'])) |
|
| 1261 | + echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>'; |
|
| 1262 | 1262 | |
| 1263 | 1263 | ?> |
| 1264 | 1264 | </p><?php |
@@ -1279,11 +1279,11 @@ discard block |
||
| 1279 | 1279 | * @param object $post Optional. The post object or blank. |
| 1280 | 1280 | * @package GeoDirectory |
| 1281 | 1281 | */ |
| 1282 | -function geodir_action_details_micordata($post='') |
|
| 1282 | +function geodir_action_details_micordata($post = '') |
|
| 1283 | 1283 | {
|
| 1284 | 1284 | |
| 1285 | 1285 | global $preview; |
| 1286 | - if(empty($post)){global $post;}
|
|
| 1286 | + if (empty($post)) {global $post; }
|
|
| 1287 | 1287 | if ($preview || !geodir_is_page('detail')) {
|
| 1288 | 1288 | return; |
| 1289 | 1289 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | "description" => $review->comment_content, |
| 1305 | 1305 | "reviewRating" => array( |
| 1306 | 1306 | "@type" => "Rating", |
| 1307 | - "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1307 | + "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1308 | 1308 | "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
| 1309 | 1309 | "worstRating" => "1" |
| 1310 | 1310 | ) |
@@ -1332,13 +1332,13 @@ discard block |
||
| 1332 | 1332 | } |
| 1333 | 1333 | //print_r($post); |
| 1334 | 1334 | // external links |
| 1335 | - $external_links = array(); |
|
| 1335 | + $external_links = array(); |
|
| 1336 | 1336 | $external_links[] = $post->geodir_website; |
| 1337 | 1337 | $external_links[] = $post->geodir_twitter; |
| 1338 | 1338 | $external_links[] = $post->geodir_facebook; |
| 1339 | 1339 | $external_links = array_filter($external_links); |
| 1340 | 1340 | |
| 1341 | - if(!empty($external_links)){
|
|
| 1341 | + if (!empty($external_links)) {
|
|
| 1342 | 1342 | $external_links = array_values($external_links); |
| 1343 | 1343 | } |
| 1344 | 1344 | |
@@ -1348,17 +1348,17 @@ discard block |
||
| 1348 | 1348 | |
| 1349 | 1349 | // schema type |
| 1350 | 1350 | $schema_type = 'LocalBusiness'; |
| 1351 | - if(isset($post->default_category) && $post->default_category){
|
|
| 1351 | + if (isset($post->default_category) && $post->default_category) {
|
|
| 1352 | 1352 | $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
| 1353 | - if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1354 | - if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1353 | + if ($cat_schema) {$schema_type = $cat_schema; }
|
|
| 1354 | + if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
|
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | $schema = array(); |
| 1358 | 1358 | $schema['@context'] = "http://schema.org"; |
| 1359 | 1359 | $schema['@type'] = $schema_type; |
| 1360 | 1360 | $schema['name'] = $post->post_name; |
| 1361 | - $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1361 | + $schema['description'] = wp_strip_all_tags($post->post_content, true); |
|
| 1362 | 1362 | $schema['telephone'] = $post->geodir_contact; |
| 1363 | 1363 | $schema['url'] = $c_url; |
| 1364 | 1364 | $schema['sameAs'] = $external_links; |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | "postalCode" => $post->post_zip |
| 1373 | 1373 | ); |
| 1374 | 1374 | |
| 1375 | - if($post->post_latitude && $post->post_longitude) {
|
|
| 1375 | + if ($post->post_latitude && $post->post_longitude) {
|
|
| 1376 | 1376 | $schema['geo'] = array( |
| 1377 | 1377 | "@type" => "GeoCoordinates", |
| 1378 | 1378 | "latitude" => $post->post_latitude, |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | ); |
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | - if($post_avgratings) {
|
|
| 1383 | + if ($post_avgratings) {
|
|
| 1384 | 1384 | $schema['aggregateRating'] = array( |
| 1385 | 1385 | "@type" => "AggregateRating", |
| 1386 | 1386 | "ratingValue" => $post_avgratings, |
@@ -1399,10 +1399,10 @@ discard block |
||
| 1399 | 1399 | * @param array $schema The array of schema data to be filtered. |
| 1400 | 1400 | * @param object $post The post object. |
| 1401 | 1401 | */ |
| 1402 | - $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1402 | + $schema = apply_filters('geodir_details_schema', $schema, $post);
|
|
| 1403 | 1403 | |
| 1404 | 1404 | |
| 1405 | - echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1405 | + echo '<script type="application/ld+json">'.json_encode($schema).'</script>'; |
|
| 1406 | 1406 | |
| 1407 | 1407 | |
| 1408 | 1408 | $uploads = wp_upload_dir(); |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | * @param string $facebook_og The open graph html to be filtered. |
| 1416 | 1416 | * @param object $post The post object. |
| 1417 | 1417 | */ |
| 1418 | - echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1418 | + echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
|
|
| 1419 | 1419 | |
| 1420 | 1420 | |
| 1421 | 1421 | |
@@ -1438,9 +1438,9 @@ discard block |
||
| 1438 | 1438 | ?> |
| 1439 | 1439 | <div class="geodir-pos_navigation clearfix"> |
| 1440 | 1440 | <div |
| 1441 | - class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
|
|
| 1441 | + class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
|
|
| 1442 | 1442 | <div |
| 1443 | - class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
|
|
| 1443 | + class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
|
|
| 1444 | 1444 | </div><?php |
| 1445 | 1445 | } |
| 1446 | 1446 | |
@@ -1509,12 +1509,12 @@ discard block |
||
| 1509 | 1509 | $gd_post_type = geodir_get_current_posttype(); |
| 1510 | 1510 | $post_type_info = get_post_type_object($gd_post_type); |
| 1511 | 1511 | |
| 1512 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1512 | + $add_string_in_title = __('All', 'geodirectory').' ';
|
|
| 1513 | 1513 | if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
| 1514 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1514 | + $add_string_in_title = __('My Favorite', 'geodirectory').' ';
|
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | - $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory'); |
|
| 1517 | + $list_title = $add_string_in_title.__(ucfirst($post_type_info->labels->name), 'geodirectory'); |
|
| 1518 | 1518 | $single_name = $post_type_info->labels->singular_name; |
| 1519 | 1519 | |
| 1520 | 1520 | $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
@@ -1542,12 +1542,12 @@ discard block |
||
| 1542 | 1542 | $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
| 1543 | 1543 | if (!empty($current_term)) {
|
| 1544 | 1544 | $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
| 1545 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1545 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
|
|
| 1546 | 1546 | $location_last_char = substr($location_name, -1); |
| 1547 | 1547 | $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
| 1548 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1548 | + $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
|
|
| 1549 | 1549 | } else {
|
| 1550 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1550 | + $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
|
|
| 1551 | 1551 | } |
| 1552 | 1552 | } else {
|
| 1553 | 1553 | if (count($taxonomy) > 1) {
|
@@ -1555,12 +1555,12 @@ discard block |
||
| 1555 | 1555 | |
| 1556 | 1556 | if (!empty($current_term)) {
|
| 1557 | 1557 | $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
| 1558 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1558 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
|
|
| 1559 | 1559 | $location_last_char = substr($location_name, -1); |
| 1560 | 1560 | $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
| 1561 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1561 | + $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
|
|
| 1562 | 1562 | } else {
|
| 1563 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1563 | + $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
|
|
| 1564 | 1564 | } |
| 1565 | 1565 | } |
| 1566 | 1566 | } |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1591 | + $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
|
|
| 1592 | 1592 | } else if ($gd_region != '') {
|
| 1593 | 1593 | if ($gd_region_actual != '') {
|
| 1594 | 1594 | $gd_region = $gd_region_actual; |
@@ -1598,7 +1598,7 @@ discard block |
||
| 1598 | 1598 | $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1601 | + $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
|
|
| 1602 | 1602 | } else if ($gd_country != '') {
|
| 1603 | 1603 | if ($gd_country_actual != '') {
|
| 1604 | 1604 | $gd_country = $gd_country_actual; |
@@ -1608,12 +1608,12 @@ discard block |
||
| 1608 | 1608 | $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1611 | + $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
|
|
| 1612 | 1612 | } |
| 1613 | 1613 | } |
| 1614 | 1614 | |
| 1615 | 1615 | if (is_search()) {
|
| 1616 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1616 | + $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 1617 | 1617 | } |
| 1618 | 1618 | /** This action is documented in geodirectory_template_actions.php */ |
| 1619 | 1619 | $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
@@ -1622,26 +1622,26 @@ discard block |
||
| 1622 | 1622 | |
| 1623 | 1623 | |
| 1624 | 1624 | $title = $list_title; |
| 1625 | - if(geodir_is_page('pt')){
|
|
| 1625 | + if (geodir_is_page('pt')) {
|
|
| 1626 | 1626 | $gd_page = 'pt'; |
| 1627 | - $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1627 | + $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1628 | 1628 | } |
| 1629 | - elseif(geodir_is_page('listing')){
|
|
| 1629 | + elseif (geodir_is_page('listing')) {
|
|
| 1630 | 1630 | $gd_page = 'listing'; |
| 1631 | 1631 | global $wp_query; |
| 1632 | 1632 | $current_term = $wp_query->get_queried_object(); |
| 1633 | - if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1633 | + if (strpos($current_term->taxonomy, '_tags') !== false) {
|
|
| 1634 | 1634 | $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
| 1635 | - }else{
|
|
| 1635 | + } else {
|
|
| 1636 | 1636 | $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | 1639 | } |
| 1640 | - elseif(geodir_is_page('author')){
|
|
| 1640 | + elseif (geodir_is_page('author')) {
|
|
| 1641 | 1641 | $gd_page = 'author'; |
| 1642 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1642 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1643 | 1643 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 1644 | - }else{
|
|
| 1644 | + } else {
|
|
| 1645 | 1645 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 1646 | 1646 | } |
| 1647 | 1647 | |
@@ -1655,16 +1655,16 @@ discard block |
||
| 1655 | 1655 | * @param string $title The page title including variables. |
| 1656 | 1656 | * @param string $gd_page The GeoDirectory page type if any. |
| 1657 | 1657 | */ |
| 1658 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1658 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1659 | 1659 | |
| 1660 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1660 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 1661 | 1661 | /** |
| 1662 | 1662 | * Filter the listing page title. |
| 1663 | 1663 | * |
| 1664 | 1664 | * @since 1.0.0 |
| 1665 | 1665 | * @param string $list_title The title for the category page. |
| 1666 | 1666 | */ |
| 1667 | - apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1667 | + apply_filters('geodir_listing_page_title', $title).'</h1></header>';
|
|
| 1668 | 1668 | } |
| 1669 | 1669 | |
| 1670 | 1670 | add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
|
@@ -1683,16 +1683,16 @@ discard block |
||
| 1683 | 1683 | $gd_post_type = geodir_get_current_posttype(); |
| 1684 | 1684 | if (isset($current_term->term_id) && $current_term->term_id != '') {
|
| 1685 | 1685 | |
| 1686 | - $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1686 | + $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags'); |
|
| 1687 | 1687 | $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
| 1688 | 1688 | if ($term_desc && !$saved_data) {
|
| 1689 | 1689 | $saved_data = $term_desc; |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | // stop payment manager filtering content length |
| 1693 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1694 | - if ( false !== $filter_priority ) {
|
|
| 1695 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1693 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
|
|
| 1694 | + if (false !== $filter_priority) {
|
|
| 1695 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | /** |
@@ -1706,14 +1706,14 @@ discard block |
||
| 1706 | 1706 | $cat_description = apply_filters('the_content', $saved_data);
|
| 1707 | 1707 | |
| 1708 | 1708 | |
| 1709 | - if ( false !== $filter_priority ) {
|
|
| 1710 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1709 | + if (false !== $filter_priority) {
|
|
| 1710 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | if ($cat_description) {
|
| 1714 | 1714 | ?> |
| 1715 | 1715 | |
| 1716 | - <div class="term_description"><?php echo $cat_description;?></div> <?php |
|
| 1716 | + <div class="term_description"><?php echo $cat_description; ?></div> <?php |
|
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | } |
@@ -1763,13 +1763,13 @@ discard block |
||
| 1763 | 1763 | function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '') |
| 1764 | 1764 | {
|
| 1765 | 1765 | if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
| 1766 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1766 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1767 | 1767 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
| 1768 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1768 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1769 | 1769 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
| 1770 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1770 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1771 | 1771 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
| 1772 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1772 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1773 | 1773 | } else {
|
| 1774 | 1774 | $width_css = ''; |
| 1775 | 1775 | } |
@@ -2074,11 +2074,11 @@ discard block |
||
| 2074 | 2074 | |
| 2075 | 2075 | $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
| 2076 | 2076 | |
| 2077 | - if(geodir_is_page('add-listing')){
|
|
| 2077 | + if (geodir_is_page('add-listing')) {
|
|
| 2078 | 2078 | $gd_page = 'add-listing'; |
| 2079 | - if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2079 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2080 | 2080 | $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
| 2081 | - }elseif(isset($listing_type)){
|
|
| 2081 | + }elseif (isset($listing_type)) {
|
|
| 2082 | 2082 | $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
| 2083 | 2083 | } |
| 2084 | 2084 | |
@@ -2092,9 +2092,9 @@ discard block |
||
| 2092 | 2092 | * @param string $title The page title including variables. |
| 2093 | 2093 | * @param string $gd_page The GeoDirectory page type if any. |
| 2094 | 2094 | */ |
| 2095 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2095 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2096 | 2096 | |
| 2097 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2097 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'; |
|
| 2098 | 2098 | echo $title; |
| 2099 | 2099 | echo '</h1></header>'; |
| 2100 | 2100 | } |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | */ |
| 2109 | 2109 | function geodir_action_add_listing_page_mandatory() |
| 2110 | 2110 | {?>
|
| 2111 | - <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p> |
|
| 2111 | + <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p> |
|
| 2112 | 2112 | <?php |
| 2113 | 2113 | } |
| 2114 | 2114 | |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | |
| 2144 | 2144 | if (isset($_REQUEST['backandedit'])) {
|
| 2145 | 2145 | global $post; |
| 2146 | - $post = (object)$gd_session->get('listing');
|
|
| 2146 | + $post = (object) $gd_session->get('listing');
|
|
| 2147 | 2147 | $listing_type = $post->listing_type; |
| 2148 | 2148 | $title = $post->post_title; |
| 2149 | 2149 | $desc = $post->post_desc; |
@@ -2158,7 +2158,7 @@ discard block |
||
| 2158 | 2158 | $thumb_img_arr = geodir_get_images($post->ID); |
| 2159 | 2159 | if ($thumb_img_arr) {
|
| 2160 | 2160 | foreach ($thumb_img_arr as $post_img) {
|
| 2161 | - $curImages .= $post_img->src . ','; |
|
| 2161 | + $curImages .= $post_img->src.','; |
|
| 2162 | 2162 | } |
| 2163 | 2163 | } |
| 2164 | 2164 | |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | $title = $post->post_title; |
| 2167 | 2167 | $desc = $post->post_content; |
| 2168 | 2168 | $kw_tags = $post->post_tags; |
| 2169 | - $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2169 | + $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
|
|
| 2170 | 2170 | } else {
|
| 2171 | 2171 | $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
| 2172 | 2172 | } |
@@ -2177,18 +2177,18 @@ discard block |
||
| 2177 | 2177 | |
| 2178 | 2178 | $post_type_info = geodir_get_posttype_info($listing_type); |
| 2179 | 2179 | |
| 2180 | - $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing','geodirectory');
|
|
| 2180 | + $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? $post_type_info['labels']['singular_name'] : __('Listing', 'geodirectory');
|
|
| 2181 | 2181 | |
| 2182 | 2182 | ?> |
| 2183 | - <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data"> |
|
| 2184 | - <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
| 2185 | - <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
| 2183 | + <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data"> |
|
| 2184 | + <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
| 2185 | + <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
| 2186 | 2186 | <?php if ($page_id) { ?>
|
| 2187 | - <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/> |
|
| 2187 | + <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/> |
|
| 2188 | 2188 | <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
|
| 2189 | - <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/> |
|
| 2189 | + <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/> |
|
| 2190 | 2190 | <?php } if (isset($_REQUEST['backandedit'])) { ?>
|
| 2191 | - <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/> |
|
| 2191 | + <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/> |
|
| 2192 | 2192 | <?php |
| 2193 | 2193 | } |
| 2194 | 2194 | /** |
@@ -2200,7 +2200,7 @@ discard block |
||
| 2200 | 2200 | */ |
| 2201 | 2201 | do_action('geodir_before_detail_fields');
|
| 2202 | 2202 | ?> |
| 2203 | - <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5> |
|
| 2203 | + <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5> |
|
| 2204 | 2204 | <?php |
| 2205 | 2205 | /** |
| 2206 | 2206 | * Called at the top of the add listing page form for frontend. |
@@ -2212,10 +2212,10 @@ discard block |
||
| 2212 | 2212 | do_action('geodir_before_main_form_fields');
|
| 2213 | 2213 | ?> |
| 2214 | 2214 | <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details"> |
| 2215 | - <label><?php echo sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ); ?><span>*</span> </label>
|
|
| 2215 | + <label><?php echo sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name); ?><span>*</span> </label>
|
|
| 2216 | 2216 | <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" |
| 2217 | 2217 | value="<?php echo esc_attr(stripslashes($title)); ?>"/> |
| 2218 | - <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span> |
|
| 2218 | + <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
|
| 2219 | 2219 | </div> |
| 2220 | 2220 | <?php |
| 2221 | 2221 | $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
@@ -2250,7 +2250,7 @@ discard block |
||
| 2250 | 2250 | $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
| 2251 | 2251 | |
| 2252 | 2252 | $desc_class = ''; |
| 2253 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2253 | + if ($desc_limit === '' || (int) $desc_limit > 0) {
|
|
| 2254 | 2254 | /** |
| 2255 | 2255 | * Called on the add listing page form for frontend just before the description field. |
| 2256 | 2256 | * |
@@ -2263,8 +2263,8 @@ discard block |
||
| 2263 | 2263 | $desc_class = ' hidden'; |
| 2264 | 2264 | } |
| 2265 | 2265 | ?> |
| 2266 | - <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>"> |
|
| 2267 | - <label><?php echo sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2266 | + <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>"> |
|
| 2267 | + <label><?php echo sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2268 | 2268 | <?php |
| 2269 | 2269 | if (!empty($show_editor) && in_array($listing_type, $show_editor)) {
|
| 2270 | 2270 | $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
@@ -2273,16 +2273,16 @@ discard block |
||
| 2273 | 2273 | <?php wp_editor($desc, "post_desc", $editor_settings); ?> |
| 2274 | 2274 | </div> |
| 2275 | 2275 | <?php if ($desc_limit != '') { ?>
|
| 2276 | - <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
|
|
| 2276 | + <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
|
|
| 2277 | 2277 | <?php } } else { ?>
|
| 2278 | 2278 | <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea> |
| 2279 | 2279 | <?php } if ($desc_limit_msg != '') { ?>
|
| 2280 | 2280 | <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span> |
| 2281 | 2281 | <?php } ?> |
| 2282 | - <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span> |
|
| 2282 | + <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span> |
|
| 2283 | 2283 | </div> |
| 2284 | 2284 | <?php |
| 2285 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2285 | + if ($desc_limit === '' || (int) $desc_limit > 0) {
|
|
| 2286 | 2286 | /** |
| 2287 | 2287 | * Called on the add listing page form for frontend just after the description field. |
| 2288 | 2288 | * |
@@ -2321,7 +2321,7 @@ discard block |
||
| 2321 | 2321 | $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
| 2322 | 2322 | |
| 2323 | 2323 | $tags_class = ''; |
| 2324 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2324 | + if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
|
|
| 2325 | 2325 | /** |
| 2326 | 2326 | * Called on the add listing page form for frontend just before the tags field. |
| 2327 | 2327 | * |
@@ -2332,14 +2332,14 @@ discard block |
||
| 2332 | 2332 | $tags_class = ' hidden'; |
| 2333 | 2333 | } |
| 2334 | 2334 | ?> |
| 2335 | - <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>"> |
|
| 2335 | + <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>"> |
|
| 2336 | 2336 | <label><?php echo TAGKW_TEXT; ?></label> |
| 2337 | 2337 | <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield" |
| 2338 | - maxlength="<?php echo $kw_tags_count;?>"/> |
|
| 2339 | - <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span> |
|
| 2338 | + maxlength="<?php echo $kw_tags_count; ?>"/> |
|
| 2339 | + <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span> |
|
| 2340 | 2340 | </div> |
| 2341 | 2341 | <?php |
| 2342 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2342 | + if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
|
|
| 2343 | 2343 | /** |
| 2344 | 2344 | * Called on the add listing page form for frontend just after the tags field. |
| 2345 | 2345 | * |
@@ -2365,7 +2365,7 @@ discard block |
||
| 2365 | 2365 | $thumb_img_arr = array(); |
| 2366 | 2366 | $totImg = 0; |
| 2367 | 2367 | if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
| 2368 | - $post = (object)$gd_session->get('listing');
|
|
| 2368 | + $post = (object) $gd_session->get('listing');
|
|
| 2369 | 2369 | if (isset($post->post_images)) |
| 2370 | 2370 | $curImages = trim($post->post_images, ","); |
| 2371 | 2371 | |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | $listing_type = $post->listing_type; |
| 2379 | 2379 | |
| 2380 | 2380 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 2381 | - $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2381 | + $post = geodir_get_post_info((int) $_REQUEST['pid']); |
|
| 2382 | 2382 | $listing_type = $post->post_type; |
| 2383 | 2383 | $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
| 2384 | 2384 | |
@@ -2392,7 +2392,7 @@ discard block |
||
| 2392 | 2392 | //$curImages = $img->src.","; |
| 2393 | 2393 | } |
| 2394 | 2394 | |
| 2395 | - $totImg = count((array)$thumb_img_arr); |
|
| 2395 | + $totImg = count((array) $thumb_img_arr); |
|
| 2396 | 2396 | } |
| 2397 | 2397 | |
| 2398 | 2398 | if ($curImages != '') |
@@ -2413,15 +2413,15 @@ discard block |
||
| 2413 | 2413 | if ($show_image_input_box) {
|
| 2414 | 2414 | ?> |
| 2415 | 2415 | |
| 2416 | - <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?> |
|
| 2416 | + <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?> |
|
| 2417 | 2417 | <?php if ($image_limit == 1) {
|
| 2418 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2418 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
|
|
| 2419 | 2419 | } ?> |
| 2420 | 2420 | <?php if ($image_limit > 1) {
|
| 2421 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2421 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
|
|
| 2422 | 2422 | } ?> |
| 2423 | 2423 | <?php if ($image_limit == '') {
|
| 2424 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2424 | + echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
|
|
| 2425 | 2425 | } ?> |
| 2426 | 2426 | </h5> |
| 2427 | 2427 | |
@@ -2436,11 +2436,11 @@ discard block |
||
| 2436 | 2436 | <div |
| 2437 | 2437 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 2438 | 2438 | id="<?php echo $id; ?>plupload-upload-ui"> |
| 2439 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
|
|
| 2439 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
|
|
| 2440 | 2440 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
| 2441 | 2441 | value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
|
| 2442 | 2442 | <span class="ajaxnonceplu" |
| 2443 | - id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
|
| 2443 | + id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span> |
|
| 2444 | 2444 | <?php if ($width && $height): ?> |
| 2445 | 2445 | <span class="plupload-resize"></span> |
| 2446 | 2446 | <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span> |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
| 2454 | 2454 | </div> |
| 2455 | 2455 | <span |
| 2456 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
| 2456 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span>
|
|
| 2457 | 2457 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
| 2458 | 2458 | </div> |
| 2459 | 2459 | |
@@ -2465,7 +2465,7 @@ discard block |
||
| 2465 | 2465 | * |
| 2466 | 2466 | * @since 1.0.0 |
| 2467 | 2467 | */ |
| 2468 | - do_action('geodir_after_main_form_fields');?>
|
|
| 2468 | + do_action('geodir_after_main_form_fields'); ?>
|
|
| 2469 | 2469 | |
| 2470 | 2470 | |
| 2471 | 2471 | <!-- add captcha code --> |
@@ -2476,7 +2476,7 @@ discard block |
||
| 2476 | 2476 | </script> |
| 2477 | 2477 | <noscript> |
| 2478 | 2478 | <div> |
| 2479 | - <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
|
|
| 2479 | + <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
|
|
| 2480 | 2480 | <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/> |
| 2481 | 2481 | </div> |
| 2482 | 2482 | </noscript> |
@@ -2486,10 +2486,10 @@ discard block |
||
| 2486 | 2486 | <!-- end captcha code --> |
| 2487 | 2487 | |
| 2488 | 2488 | <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;"> |
| 2489 | - <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>" |
|
| 2490 | - class="geodir_button" <?php echo $submit_button;?>/> |
|
| 2489 | + <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>" |
|
| 2490 | + class="geodir_button" <?php echo $submit_button; ?>/> |
|
| 2491 | 2491 | <span class="geodir_message_note" |
| 2492 | - style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
|
|
| 2492 | + style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
|
|
| 2493 | 2493 | </div> |
| 2494 | 2494 | |
| 2495 | 2495 | </form> |
@@ -2551,7 +2551,7 @@ discard block |
||
| 2551 | 2551 | class="<?php |
| 2552 | 2552 | /** This action is documented in geodirectory_template_actions.php */ |
| 2553 | 2553 | echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
| 2554 | - <?php dynamic_sidebar('Reg/Login Top Section');?>
|
|
| 2554 | + <?php dynamic_sidebar('Reg/Login Top Section'); ?>
|
|
| 2555 | 2555 | </div><!-- clearfix ends here--> |
| 2556 | 2556 | <?php |
| 2557 | 2557 | } |
@@ -2573,7 +2573,7 @@ discard block |
||
| 2573 | 2573 | |
| 2574 | 2574 | ?> |
| 2575 | 2575 | <script type="text/javascript"> |
| 2576 | - <?php if ( $user_login ) { ?>
|
|
| 2576 | + <?php if ($user_login) { ?>
|
|
| 2577 | 2577 | setTimeout(function () {
|
| 2578 | 2578 | try {
|
| 2579 | 2579 | d = document.getElementById('user_pass');
|
@@ -2590,7 +2590,7 @@ discard block |
||
| 2590 | 2590 | <?php } ?> |
| 2591 | 2591 | </script> |
| 2592 | 2592 | <script type="text/javascript"> |
| 2593 | - <?php if ( $user_login ) { ?>
|
|
| 2593 | + <?php if ($user_login) { ?>
|
|
| 2594 | 2594 | setTimeout(function () {
|
| 2595 | 2595 | try {
|
| 2596 | 2596 | d = document.getElementById('user_pass');
|
@@ -2615,7 +2615,7 @@ discard block |
||
| 2615 | 2615 | foreach ($errors as $errorsObj) {
|
| 2616 | 2616 | foreach ($errorsObj as $key => $val) {
|
| 2617 | 2617 | for ($i = 0; $i < count($val); $i++) {
|
| 2618 | - echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2618 | + echo "<div class=error_msg_fix>".$val[$i].'</div>'; |
|
| 2619 | 2619 | $registration_error_msg = 1; |
| 2620 | 2620 | } |
| 2621 | 2621 | } |
@@ -2632,7 +2632,7 @@ discard block |
||
| 2632 | 2632 | * |
| 2633 | 2633 | * @since 1.0.0 |
| 2634 | 2634 | */ |
| 2635 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2635 | + include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?> |
|
| 2636 | 2636 | </div> |
| 2637 | 2637 | |
| 2638 | 2638 | <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?>
|
@@ -2644,7 +2644,7 @@ discard block |
||
| 2644 | 2644 | * |
| 2645 | 2645 | * @since 1.0.0 |
| 2646 | 2646 | */ |
| 2647 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2647 | + include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?> |
|
| 2648 | 2648 | </div> |
| 2649 | 2649 | |
| 2650 | 2650 | <?php } else { ?>
|
@@ -2656,7 +2656,7 @@ discard block |
||
| 2656 | 2656 | * |
| 2657 | 2657 | * @since 1.0.0 |
| 2658 | 2658 | */ |
| 2659 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2659 | + include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?> |
|
| 2660 | 2660 | </div> |
| 2661 | 2661 | <div class="registration_form_r"> |
| 2662 | 2662 | <?php |
@@ -2665,7 +2665,7 @@ discard block |
||
| 2665 | 2665 | * |
| 2666 | 2666 | * @since 1.0.0 |
| 2667 | 2667 | */ |
| 2668 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2668 | + include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?> |
|
| 2669 | 2669 | </div> |
| 2670 | 2670 | |
| 2671 | 2671 | <?php }?> |
@@ -2701,12 +2701,12 @@ discard block |
||
| 2701 | 2701 | $gd_post_type = geodir_get_current_posttype(); |
| 2702 | 2702 | $post_type_info = get_post_type_object($gd_post_type); |
| 2703 | 2703 | |
| 2704 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2704 | + $add_string_in_title = __('All', 'geodirectory').' ';
|
|
| 2705 | 2705 | if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
| 2706 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2706 | + $add_string_in_title = __('My Favorite', 'geodirectory').' ';
|
|
| 2707 | 2707 | } |
| 2708 | 2708 | |
| 2709 | - $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2709 | + $list_title = $add_string_in_title.$post_type_info->labels->name; |
|
| 2710 | 2710 | $single_name = $post_type_info->labels->singular_name; |
| 2711 | 2711 | |
| 2712 | 2712 | $taxonomy = geodir_get_taxonomies($gd_post_type); |
@@ -2714,12 +2714,12 @@ discard block |
||
| 2714 | 2714 | if (!empty($term)) {
|
| 2715 | 2715 | $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
| 2716 | 2716 | if (!empty($current_term)) |
| 2717 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2717 | + $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
|
|
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | 2720 | |
| 2721 | 2721 | if (is_search()) {
|
| 2722 | - $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2722 | + $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 2723 | 2723 | |
| 2724 | 2724 | } |
| 2725 | 2725 | /** This action is documented in geodirectory_template_actions.php */ |
@@ -2728,11 +2728,11 @@ discard block |
||
| 2728 | 2728 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 2729 | 2729 | |
| 2730 | 2730 | $title = $list_title; |
| 2731 | - if(geodir_is_page('author')){
|
|
| 2731 | + if (geodir_is_page('author')) {
|
|
| 2732 | 2732 | $gd_page = 'author'; |
| 2733 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2733 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2734 | 2734 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 2735 | - }else{
|
|
| 2735 | + } else {
|
|
| 2736 | 2736 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 2737 | 2737 | } |
| 2738 | 2738 | |
@@ -2746,16 +2746,16 @@ discard block |
||
| 2746 | 2746 | * @param string $title The page title including variables. |
| 2747 | 2747 | * @param string $gd_page The GeoDirectory page type if any. |
| 2748 | 2748 | */ |
| 2749 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2749 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2750 | 2750 | |
| 2751 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2751 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 2752 | 2752 | /** |
| 2753 | 2753 | * Filter the author page title text. |
| 2754 | 2754 | * |
| 2755 | 2755 | * @since 1.0.0 |
| 2756 | 2756 | * @param string $list_title The title for the page. |
| 2757 | 2757 | */ |
| 2758 | - apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2758 | + apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
|
|
| 2759 | 2759 | } |
| 2760 | 2760 | |
| 2761 | 2761 | |
@@ -2960,19 +2960,19 @@ discard block |
||
| 2960 | 2960 | $post_type_info = get_post_type_object($gd_post_type); |
| 2961 | 2961 | |
| 2962 | 2962 | $pt_name = ''; |
| 2963 | - if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 2963 | + if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
|
|
| 2964 | 2964 | |
| 2965 | 2965 | if (is_search()) {
|
| 2966 | - $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2966 | + $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 2967 | 2967 | |
| 2968 | 2968 | } |
| 2969 | 2969 | /** This action is documented in geodirectory_template_actions.php */ |
| 2970 | 2970 | $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
| 2971 | 2971 | /** This action is documented in geodirectory_template_actions.php */ |
| 2972 | 2972 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 2973 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2973 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 2974 | 2974 | /** This action is documented in geodirectory_template_actions.php */ |
| 2975 | - apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 2975 | + apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
|
|
| 2976 | 2976 | } |
| 2977 | 2977 | |
| 2978 | 2978 | // action for adding the listings page top widget area |
@@ -3376,7 +3376,7 @@ discard block |
||
| 3376 | 3376 | $gd_post_type = geodir_get_current_posttype(); |
| 3377 | 3377 | $post_type_info = get_post_type_object($gd_post_type); |
| 3378 | 3378 | |
| 3379 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3379 | + $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
|
|
| 3380 | 3380 | } |
| 3381 | 3381 | return $list_title; |
| 3382 | 3382 | } |
@@ -3392,7 +3392,7 @@ discard block |
||
| 3392 | 3392 | * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'. |
| 3393 | 3393 | * @param string $gd_page The geodirectory page type. Default null. |
| 3394 | 3394 | */ |
| 3395 | -function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
|
|
| 3395 | +function geodir_add_page_content($position = 'before', $gd_page = '') {
|
|
| 3396 | 3396 | global $post; |
| 3397 | 3397 | |
| 3398 | 3398 | $gd_page_id = NULL; |
@@ -19,35 +19,35 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_cfi_fieldset($html,$cf){ |
| 21 | 21 | |
| 22 | - $html_var = $cf['htmlvar_name']; |
|
| 23 | - |
|
| 24 | - // Check if there is a custom field specific filter. |
|
| 25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | - /** |
|
| 27 | - * Filter the fieldset html by individual custom field. |
|
| 28 | - * |
|
| 29 | - * @param string $html The html to filter. |
|
| 30 | - * @param array $cf The custom field array. |
|
| 31 | - * @since 1.6.6 |
|
| 32 | - */ |
|
| 33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - // If no html then we run the standard output. |
|
| 37 | - if(empty($html)) { |
|
| 38 | - |
|
| 39 | - ob_start(); // Start buffering; |
|
| 40 | - ?> |
|
| 22 | + $html_var = $cf['htmlvar_name']; |
|
| 23 | + |
|
| 24 | + // Check if there is a custom field specific filter. |
|
| 25 | + if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | + /** |
|
| 27 | + * Filter the fieldset html by individual custom field. |
|
| 28 | + * |
|
| 29 | + * @param string $html The html to filter. |
|
| 30 | + * @param array $cf The custom field array. |
|
| 31 | + * @since 1.6.6 |
|
| 32 | + */ |
|
| 33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + // If no html then we run the standard output. |
|
| 37 | + if(empty($html)) { |
|
| 38 | + |
|
| 39 | + ob_start(); // Start buffering; |
|
| 40 | + ?> |
|
| 41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
| 42 | 42 | gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?> |
| 43 | 43 | <?php if ( $cf['desc'] != '' ) { |
| 44 | - echo '<small>( ' . $cf['desc'] . ' )</small>'; |
|
| 45 | - } ?></h5> |
|
| 44 | + echo '<small>( ' . $cf['desc'] . ' )</small>'; |
|
| 45 | + } ?></h5> |
|
| 46 | 46 | <?php |
| 47 | - $html = ob_get_clean(); |
|
| 48 | - } |
|
| 47 | + $html = ob_get_clean(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $html; |
|
| 50 | + return $html; |
|
| 51 | 51 | } |
| 52 | 52 | add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
| 53 | 53 | |
@@ -64,47 +64,47 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function geodir_cfi_text($html,$cf){ |
| 66 | 66 | |
| 67 | - $html_var = $cf['htmlvar_name']; |
|
| 68 | - |
|
| 69 | - // Check if there is a custom field specific filter. |
|
| 70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | - /** |
|
| 72 | - * Filter the text html by individual custom field. |
|
| 73 | - * |
|
| 74 | - * @param string $html The html to filter. |
|
| 75 | - * @param array $cf The custom field array. |
|
| 76 | - * @since 1.6.6 |
|
| 77 | - */ |
|
| 78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // If no html then we run the standard output. |
|
| 82 | - if(empty($html)) { |
|
| 83 | - |
|
| 84 | - ob_start(); // Start buffering; |
|
| 85 | - |
|
| 86 | - $value = geodir_get_cf_value($cf); |
|
| 87 | - $type = $cf['type']; |
|
| 88 | - //number and float validation $validation_pattern |
|
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | - |
|
| 92 | - //validation |
|
| 93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | - $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | - }else{$validation='';} |
|
| 96 | - |
|
| 97 | - // validation message |
|
| 98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | - $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | - }else{$validation_msg='';} |
|
| 101 | - ?> |
|
| 67 | + $html_var = $cf['htmlvar_name']; |
|
| 68 | + |
|
| 69 | + // Check if there is a custom field specific filter. |
|
| 70 | + if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | + /** |
|
| 72 | + * Filter the text html by individual custom field. |
|
| 73 | + * |
|
| 74 | + * @param string $html The html to filter. |
|
| 75 | + * @param array $cf The custom field array. |
|
| 76 | + * @since 1.6.6 |
|
| 77 | + */ |
|
| 78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // If no html then we run the standard output. |
|
| 82 | + if(empty($html)) { |
|
| 83 | + |
|
| 84 | + ob_start(); // Start buffering; |
|
| 85 | + |
|
| 86 | + $value = geodir_get_cf_value($cf); |
|
| 87 | + $type = $cf['type']; |
|
| 88 | + //number and float validation $validation_pattern |
|
| 89 | + if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | + elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | + |
|
| 92 | + //validation |
|
| 93 | + if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | + $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | + }else{$validation='';} |
|
| 96 | + |
|
| 97 | + // validation message |
|
| 98 | + if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | + $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | + }else{$validation_msg='';} |
|
| 101 | + ?> |
|
| 102 | 102 | |
| 103 | 103 | <div id="<?php echo $cf['name'];?>_row" |
| 104 | 104 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 105 | 105 | <label> |
| 106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 107 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 108 | 108 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 109 | 109 | </label> |
| 110 | 110 | <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | </div> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - $html = ob_get_clean(); |
|
| 120 | - } |
|
| 119 | + $html = ob_get_clean(); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return $html; |
|
| 122 | + return $html; |
|
| 123 | 123 | } |
| 124 | 124 | add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
| 125 | 125 | |
@@ -135,35 +135,35 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function geodir_cfi_email($html,$cf){ |
| 137 | 137 | |
| 138 | - $html_var = $cf['htmlvar_name']; |
|
| 138 | + $html_var = $cf['htmlvar_name']; |
|
| 139 | 139 | |
| 140 | - // Check if there is a custom field specific filter. |
|
| 141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | - /** |
|
| 143 | - * Filter the email html by individual custom field. |
|
| 144 | - * |
|
| 145 | - * @param string $html The html to filter. |
|
| 146 | - * @param array $cf The custom field array. |
|
| 147 | - * @since 1.6.6 |
|
| 148 | - */ |
|
| 149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | - } |
|
| 140 | + // Check if there is a custom field specific filter. |
|
| 141 | + if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | + /** |
|
| 143 | + * Filter the email html by individual custom field. |
|
| 144 | + * |
|
| 145 | + * @param string $html The html to filter. |
|
| 146 | + * @param array $cf The custom field array. |
|
| 147 | + * @since 1.6.6 |
|
| 148 | + */ |
|
| 149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // If no html then we run the standard output. |
|
| 153 | - if(empty($html)) { |
|
| 152 | + // If no html then we run the standard output. |
|
| 153 | + if(empty($html)) { |
|
| 154 | 154 | |
| 155 | - ob_start(); // Start buffering; |
|
| 156 | - $value = geodir_get_cf_value($cf); |
|
| 155 | + ob_start(); // Start buffering; |
|
| 156 | + $value = geodir_get_cf_value($cf); |
|
| 157 | 157 | |
| 158 | - if ($value == $cf['default']) { |
|
| 159 | - $value = ''; |
|
| 160 | - }?> |
|
| 158 | + if ($value == $cf['default']) { |
|
| 159 | + $value = ''; |
|
| 160 | + }?> |
|
| 161 | 161 | |
| 162 | 162 | <div id="<?php echo $cf['name'];?>_row" |
| 163 | 163 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 164 | 164 | <label> |
| 165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 166 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 167 | 167 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 168 | 168 | </label> |
| 169 | 169 | <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | </div> |
| 176 | 176 | |
| 177 | 177 | <?php |
| 178 | - $html = ob_get_clean(); |
|
| 179 | - } |
|
| 178 | + $html = ob_get_clean(); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - return $html; |
|
| 181 | + return $html; |
|
| 182 | 182 | } |
| 183 | 183 | add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
| 184 | 184 | |
@@ -195,35 +195,35 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function geodir_cfi_phone($html,$cf){ |
| 197 | 197 | |
| 198 | - $html_var = $cf['htmlvar_name']; |
|
| 198 | + $html_var = $cf['htmlvar_name']; |
|
| 199 | 199 | |
| 200 | - // Check if there is a custom field specific filter. |
|
| 201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | - /** |
|
| 203 | - * Filter the phone html by individual custom field. |
|
| 204 | - * |
|
| 205 | - * @param string $html The html to filter. |
|
| 206 | - * @param array $cf The custom field array. |
|
| 207 | - * @since 1.6.6 |
|
| 208 | - */ |
|
| 209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | - } |
|
| 200 | + // Check if there is a custom field specific filter. |
|
| 201 | + if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | + /** |
|
| 203 | + * Filter the phone html by individual custom field. |
|
| 204 | + * |
|
| 205 | + * @param string $html The html to filter. |
|
| 206 | + * @param array $cf The custom field array. |
|
| 207 | + * @since 1.6.6 |
|
| 208 | + */ |
|
| 209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - // If no html then we run the standard output. |
|
| 213 | - if(empty($html)) { |
|
| 212 | + // If no html then we run the standard output. |
|
| 213 | + if(empty($html)) { |
|
| 214 | 214 | |
| 215 | - ob_start(); // Start buffering; |
|
| 216 | - $value = geodir_get_cf_value($cf); |
|
| 215 | + ob_start(); // Start buffering; |
|
| 216 | + $value = geodir_get_cf_value($cf); |
|
| 217 | 217 | |
| 218 | - if ($value == $cf['default']) { |
|
| 219 | - $value = ''; |
|
| 220 | - }?> |
|
| 218 | + if ($value == $cf['default']) { |
|
| 219 | + $value = ''; |
|
| 220 | + }?> |
|
| 221 | 221 | |
| 222 | 222 | <div id="<?php echo $cf['name'];?>_row" |
| 223 | 223 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 224 | 224 | <label> |
| 225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 226 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 227 | 227 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 228 | 228 | </label> |
| 229 | 229 | <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | |
| 237 | 237 | <?php |
| 238 | - $html = ob_get_clean(); |
|
| 239 | - } |
|
| 238 | + $html = ob_get_clean(); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - return $html; |
|
| 241 | + return $html; |
|
| 242 | 242 | } |
| 243 | 243 | add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
| 244 | 244 | |
@@ -255,35 +255,35 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function geodir_cfi_url($html,$cf){ |
| 257 | 257 | |
| 258 | - $html_var = $cf['htmlvar_name']; |
|
| 258 | + $html_var = $cf['htmlvar_name']; |
|
| 259 | 259 | |
| 260 | - // Check if there is a custom field specific filter. |
|
| 261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | - /** |
|
| 263 | - * Filter the url html by individual custom field. |
|
| 264 | - * |
|
| 265 | - * @param string $html The html to filter. |
|
| 266 | - * @param array $cf The custom field array. |
|
| 267 | - * @since 1.6.6 |
|
| 268 | - */ |
|
| 269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | - } |
|
| 260 | + // Check if there is a custom field specific filter. |
|
| 261 | + if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | + /** |
|
| 263 | + * Filter the url html by individual custom field. |
|
| 264 | + * |
|
| 265 | + * @param string $html The html to filter. |
|
| 266 | + * @param array $cf The custom field array. |
|
| 267 | + * @since 1.6.6 |
|
| 268 | + */ |
|
| 269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - // If no html then we run the standard output. |
|
| 273 | - if(empty($html)) { |
|
| 272 | + // If no html then we run the standard output. |
|
| 273 | + if(empty($html)) { |
|
| 274 | 274 | |
| 275 | - ob_start(); // Start buffering; |
|
| 276 | - $value = geodir_get_cf_value($cf); |
|
| 275 | + ob_start(); // Start buffering; |
|
| 276 | + $value = geodir_get_cf_value($cf); |
|
| 277 | 277 | |
| 278 | - if ($value == $cf['default']) { |
|
| 279 | - $value = ''; |
|
| 280 | - }?> |
|
| 278 | + if ($value == $cf['default']) { |
|
| 279 | + $value = ''; |
|
| 280 | + }?> |
|
| 281 | 281 | |
| 282 | 282 | <div id="<?php echo $cf['name'];?>_row" |
| 283 | 283 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 284 | 284 | <label> |
| 285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 286 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 287 | 287 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 288 | 288 | </label> |
| 289 | 289 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | </div> |
| 299 | 299 | |
| 300 | 300 | <?php |
| 301 | - $html = ob_get_clean(); |
|
| 302 | - } |
|
| 301 | + $html = ob_get_clean(); |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - return $html; |
|
| 304 | + return $html; |
|
| 305 | 305 | } |
| 306 | 306 | add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
| 307 | 307 | |
@@ -317,48 +317,48 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | function geodir_cfi_radio($html,$cf){ |
| 319 | 319 | |
| 320 | - $html_var = $cf['htmlvar_name']; |
|
| 320 | + $html_var = $cf['htmlvar_name']; |
|
| 321 | 321 | |
| 322 | - // Check if there is a custom field specific filter. |
|
| 323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | - /** |
|
| 325 | - * Filter the radio html by individual custom field. |
|
| 326 | - * |
|
| 327 | - * @param string $html The html to filter. |
|
| 328 | - * @param array $cf The custom field array. |
|
| 329 | - * @since 1.6.6 |
|
| 330 | - */ |
|
| 331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | - } |
|
| 322 | + // Check if there is a custom field specific filter. |
|
| 323 | + if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | + /** |
|
| 325 | + * Filter the radio html by individual custom field. |
|
| 326 | + * |
|
| 327 | + * @param string $html The html to filter. |
|
| 328 | + * @param array $cf The custom field array. |
|
| 329 | + * @since 1.6.6 |
|
| 330 | + */ |
|
| 331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - // If no html then we run the standard output. |
|
| 335 | - if(empty($html)) { |
|
| 334 | + // If no html then we run the standard output. |
|
| 335 | + if(empty($html)) { |
|
| 336 | 336 | |
| 337 | - ob_start(); // Start buffering; |
|
| 338 | - $value = geodir_get_cf_value($cf); |
|
| 337 | + ob_start(); // Start buffering; |
|
| 338 | + $value = geodir_get_cf_value($cf); |
|
| 339 | 339 | |
| 340 | - ?> |
|
| 340 | + ?> |
|
| 341 | 341 | <div id="<?php echo $cf['name'];?>_row" |
| 342 | 342 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 343 | 343 | <label> |
| 344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 345 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 346 | 346 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 347 | 347 | </label> |
| 348 | 348 | <?php if ($cf['option_values']) { |
| 349 | - $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 349 | + $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 350 | 350 | |
| 351 | - if (!empty($option_values)) { |
|
| 352 | - foreach ($option_values as $option_value) { |
|
| 353 | - if (empty($option_value['optgroup'])) { |
|
| 354 | - ?> |
|
| 351 | + if (!empty($option_values)) { |
|
| 352 | + foreach ($option_values as $option_value) { |
|
| 353 | + if (empty($option_value['optgroup'])) { |
|
| 354 | + ?> |
|
| 355 | 355 | <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
| 356 | 356 | <?php |
| 357 | - } |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - } |
|
| 361 | - ?> |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + } |
|
| 361 | + ?> |
|
| 362 | 362 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 363 | 363 | <?php if ($cf['is_required']) { ?> |
| 364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | </div> |
| 367 | 367 | |
| 368 | 368 | <?php |
| 369 | - $html = ob_get_clean(); |
|
| 370 | - } |
|
| 369 | + $html = ob_get_clean(); |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - return $html; |
|
| 372 | + return $html; |
|
| 373 | 373 | } |
| 374 | 374 | add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
| 375 | 375 | |
@@ -385,44 +385,44 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function geodir_cfi_checkbox($html,$cf){ |
| 387 | 387 | |
| 388 | - $html_var = $cf['htmlvar_name']; |
|
| 388 | + $html_var = $cf['htmlvar_name']; |
|
| 389 | 389 | |
| 390 | - // Check if there is a custom field specific filter. |
|
| 391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | - /** |
|
| 393 | - * Filter the checkbox html by individual custom field. |
|
| 394 | - * |
|
| 395 | - * @param string $html The html to filter. |
|
| 396 | - * @param array $cf The custom field array. |
|
| 397 | - * @since 1.6.6 |
|
| 398 | - */ |
|
| 399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | - } |
|
| 390 | + // Check if there is a custom field specific filter. |
|
| 391 | + if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | + /** |
|
| 393 | + * Filter the checkbox html by individual custom field. |
|
| 394 | + * |
|
| 395 | + * @param string $html The html to filter. |
|
| 396 | + * @param array $cf The custom field array. |
|
| 397 | + * @since 1.6.6 |
|
| 398 | + */ |
|
| 399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | + } |
|
| 401 | 401 | |
| 402 | - // If no html then we run the standard output. |
|
| 403 | - if(empty($html)) { |
|
| 402 | + // If no html then we run the standard output. |
|
| 403 | + if(empty($html)) { |
|
| 404 | 404 | |
| 405 | - ob_start(); // Start buffering; |
|
| 406 | - $value = geodir_get_cf_value($cf); |
|
| 405 | + ob_start(); // Start buffering; |
|
| 406 | + $value = geodir_get_cf_value($cf); |
|
| 407 | 407 | |
| 408 | - if ($value == $cf['default']) { |
|
| 409 | - $value = ''; |
|
| 410 | - }?> |
|
| 408 | + if ($value == $cf['default']) { |
|
| 409 | + $value = ''; |
|
| 410 | + }?> |
|
| 411 | 411 | |
| 412 | 412 | <div id="<?php echo $cf['name'];?>_row" |
| 413 | 413 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 414 | 414 | <label> |
| 415 | 415 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 416 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 416 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 417 | 417 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 418 | 418 | </label> |
| 419 | 419 | <?php if ($value != '1') { |
| 420 | - $value = '0'; |
|
| 421 | - }?> |
|
| 420 | + $value = '0'; |
|
| 421 | + }?> |
|
| 422 | 422 | <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
| 423 | 423 | <input <?php if ($value == '1') { |
| 424 | - echo 'checked="checked"'; |
|
| 425 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 424 | + echo 'checked="checked"'; |
|
| 425 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 426 | 426 | onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
| 427 | 427 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 428 | 428 | <?php if ($cf['is_required']) { ?> |
@@ -431,10 +431,10 @@ discard block |
||
| 431 | 431 | </div> |
| 432 | 432 | |
| 433 | 433 | <?php |
| 434 | - $html = ob_get_clean(); |
|
| 435 | - } |
|
| 434 | + $html = ob_get_clean(); |
|
| 435 | + } |
|
| 436 | 436 | |
| 437 | - return $html; |
|
| 437 | + return $html; |
|
| 438 | 438 | } |
| 439 | 439 | add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
| 440 | 440 | |
@@ -450,52 +450,52 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | function geodir_cfi_textarea($html,$cf){ |
| 452 | 452 | |
| 453 | - $html_var = $cf['htmlvar_name']; |
|
| 453 | + $html_var = $cf['htmlvar_name']; |
|
| 454 | 454 | |
| 455 | - // Check if there is a custom field specific filter. |
|
| 456 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 457 | - /** |
|
| 458 | - * Filter the textarea html by individual custom field. |
|
| 459 | - * |
|
| 460 | - * @param string $html The html to filter. |
|
| 461 | - * @param array $cf The custom field array. |
|
| 462 | - * @since 1.6.6 |
|
| 463 | - */ |
|
| 464 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 465 | - } |
|
| 455 | + // Check if there is a custom field specific filter. |
|
| 456 | + if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 457 | + /** |
|
| 458 | + * Filter the textarea html by individual custom field. |
|
| 459 | + * |
|
| 460 | + * @param string $html The html to filter. |
|
| 461 | + * @param array $cf The custom field array. |
|
| 462 | + * @since 1.6.6 |
|
| 463 | + */ |
|
| 464 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 465 | + } |
|
| 466 | 466 | |
| 467 | - // If no html then we run the standard output. |
|
| 468 | - if(empty($html)) { |
|
| 467 | + // If no html then we run the standard output. |
|
| 468 | + if(empty($html)) { |
|
| 469 | 469 | |
| 470 | - ob_start(); // Start buffering; |
|
| 471 | - $value = geodir_get_cf_value($cf); |
|
| 470 | + ob_start(); // Start buffering; |
|
| 471 | + $value = geodir_get_cf_value($cf); |
|
| 472 | 472 | |
| 473 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 474 | - ?> |
|
| 473 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 474 | + ?> |
|
| 475 | 475 | |
| 476 | 476 | <div id="<?php echo $cf['name'];?>_row" |
| 477 | 477 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 478 | 478 | <label> |
| 479 | 479 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 480 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 480 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 481 | 481 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 482 | 482 | </label><?php |
| 483 | 483 | |
| 484 | 484 | |
| 485 | - if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 485 | + if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 486 | 486 | |
| 487 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 487 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 488 | 488 | |
| 489 | 489 | <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
| 490 | 490 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
| 491 | 491 | </div><?php |
| 492 | 492 | |
| 493 | - } else { |
|
| 493 | + } else { |
|
| 494 | 494 | |
| 495 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 495 | + ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 496 | 496 | id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
| 497 | 497 | |
| 498 | - }?> |
|
| 498 | + }?> |
|
| 499 | 499 | |
| 500 | 500 | |
| 501 | 501 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
@@ -505,10 +505,10 @@ discard block |
||
| 505 | 505 | </div> |
| 506 | 506 | |
| 507 | 507 | <?php |
| 508 | - $html = ob_get_clean(); |
|
| 509 | - } |
|
| 508 | + $html = ob_get_clean(); |
|
| 509 | + } |
|
| 510 | 510 | |
| 511 | - return $html; |
|
| 511 | + return $html; |
|
| 512 | 512 | } |
| 513 | 513 | add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
| 514 | 514 | |
@@ -524,53 +524,53 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | function geodir_cfi_select($html,$cf){ |
| 526 | 526 | |
| 527 | - $html_var = $cf['htmlvar_name']; |
|
| 527 | + $html_var = $cf['htmlvar_name']; |
|
| 528 | 528 | |
| 529 | - // Check if there is a custom field specific filter. |
|
| 530 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 531 | - /** |
|
| 532 | - * Filter the select html by individual custom field. |
|
| 533 | - * |
|
| 534 | - * @param string $html The html to filter. |
|
| 535 | - * @param array $cf The custom field array. |
|
| 536 | - * @since 1.6.6 |
|
| 537 | - */ |
|
| 538 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 539 | - } |
|
| 529 | + // Check if there is a custom field specific filter. |
|
| 530 | + if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 531 | + /** |
|
| 532 | + * Filter the select html by individual custom field. |
|
| 533 | + * |
|
| 534 | + * @param string $html The html to filter. |
|
| 535 | + * @param array $cf The custom field array. |
|
| 536 | + * @since 1.6.6 |
|
| 537 | + */ |
|
| 538 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 539 | + } |
|
| 540 | 540 | |
| 541 | - // If no html then we run the standard output. |
|
| 542 | - if(empty($html)) { |
|
| 541 | + // If no html then we run the standard output. |
|
| 542 | + if(empty($html)) { |
|
| 543 | 543 | |
| 544 | - ob_start(); // Start buffering; |
|
| 545 | - $value = geodir_get_cf_value($cf); |
|
| 544 | + ob_start(); // Start buffering; |
|
| 545 | + $value = geodir_get_cf_value($cf); |
|
| 546 | 546 | |
| 547 | - ?> |
|
| 547 | + ?> |
|
| 548 | 548 | <div id="<?php echo $cf['name'];?>_row" |
| 549 | 549 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
| 550 | 550 | <label> |
| 551 | 551 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 552 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 552 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 553 | 553 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 554 | 554 | </label> |
| 555 | 555 | <?php |
| 556 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 557 | - $select_options = ''; |
|
| 558 | - if (!empty($option_values_arr)) { |
|
| 559 | - foreach ($option_values_arr as $option_row) { |
|
| 560 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 561 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 562 | - |
|
| 563 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 564 | - } else { |
|
| 565 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 566 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 567 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 568 | - |
|
| 569 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 570 | - } |
|
| 571 | - } |
|
| 572 | - } |
|
| 573 | - ?> |
|
| 556 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 557 | + $select_options = ''; |
|
| 558 | + if (!empty($option_values_arr)) { |
|
| 559 | + foreach ($option_values_arr as $option_row) { |
|
| 560 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 561 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 562 | + |
|
| 563 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 564 | + } else { |
|
| 565 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 566 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 567 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 568 | + |
|
| 569 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + } |
|
| 573 | + ?> |
|
| 574 | 574 | <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 575 | 575 | class="geodir_textfield textfield_x chosen_select" |
| 576 | 576 | data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
@@ -582,10 +582,10 @@ discard block |
||
| 582 | 582 | </div> |
| 583 | 583 | |
| 584 | 584 | <?php |
| 585 | - $html = ob_get_clean(); |
|
| 586 | - } |
|
| 585 | + $html = ob_get_clean(); |
|
| 586 | + } |
|
| 587 | 587 | |
| 588 | - return $html; |
|
| 588 | + return $html; |
|
| 589 | 589 | } |
| 590 | 590 | add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
| 591 | 591 | |
@@ -601,36 +601,36 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | function geodir_cfi_multiselect($html,$cf){ |
| 603 | 603 | |
| 604 | - $html_var = $cf['htmlvar_name']; |
|
| 605 | - |
|
| 606 | - // Check if there is a custom field specific filter. |
|
| 607 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 608 | - /** |
|
| 609 | - * Filter the multiselect html by individual custom field. |
|
| 610 | - * |
|
| 611 | - * @param string $html The html to filter. |
|
| 612 | - * @param array $cf The custom field array. |
|
| 613 | - * @since 1.6.6 |
|
| 614 | - */ |
|
| 615 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - // If no html then we run the standard output. |
|
| 619 | - if(empty($html)) { |
|
| 620 | - |
|
| 621 | - ob_start(); // Start buffering; |
|
| 622 | - $value = geodir_get_cf_value($cf); |
|
| 623 | - |
|
| 624 | - $multi_display = 'select'; |
|
| 625 | - if (!empty($val['extra_fields'])) { |
|
| 626 | - $multi_display = unserialize($val['extra_fields']); |
|
| 627 | - } |
|
| 628 | - ?> |
|
| 604 | + $html_var = $cf['htmlvar_name']; |
|
| 605 | + |
|
| 606 | + // Check if there is a custom field specific filter. |
|
| 607 | + if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 608 | + /** |
|
| 609 | + * Filter the multiselect html by individual custom field. |
|
| 610 | + * |
|
| 611 | + * @param string $html The html to filter. |
|
| 612 | + * @param array $cf The custom field array. |
|
| 613 | + * @since 1.6.6 |
|
| 614 | + */ |
|
| 615 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + // If no html then we run the standard output. |
|
| 619 | + if(empty($html)) { |
|
| 620 | + |
|
| 621 | + ob_start(); // Start buffering; |
|
| 622 | + $value = geodir_get_cf_value($cf); |
|
| 623 | + |
|
| 624 | + $multi_display = 'select'; |
|
| 625 | + if (!empty($val['extra_fields'])) { |
|
| 626 | + $multi_display = unserialize($val['extra_fields']); |
|
| 627 | + } |
|
| 628 | + ?> |
|
| 629 | 629 | <div id="<?php echo $cf['name']; ?>_row" |
| 630 | 630 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 631 | 631 | <label> |
| 632 | 632 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 633 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 633 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 634 | 634 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 635 | 635 | </label> |
| 636 | 636 | <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/> |
@@ -641,55 +641,55 @@ discard block |
||
| 641 | 641 | data-placeholder="<?php _e('Select', 'geodirectory'); ?>" |
| 642 | 642 | option-ajaxchosen="false"> |
| 643 | 643 | <?php |
| 644 | - } else { |
|
| 645 | - echo '<ul class="gd_multi_choice">'; |
|
| 646 | - } |
|
| 647 | - |
|
| 648 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 649 | - $select_options = ''; |
|
| 650 | - if (!empty($option_values_arr)) { |
|
| 651 | - foreach ($option_values_arr as $option_row) { |
|
| 652 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 653 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 654 | - |
|
| 655 | - if ($multi_display == 'select') { |
|
| 656 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 657 | - } else { |
|
| 658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 659 | - } |
|
| 660 | - } else { |
|
| 661 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 662 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 663 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 664 | - $selected = ''; |
|
| 665 | - $checked = ''; |
|
| 666 | - |
|
| 667 | - if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 668 | - if (!is_array($value)) { |
|
| 669 | - $value_array = explode(',', $value); |
|
| 670 | - } else { |
|
| 671 | - $value_array = $value; |
|
| 672 | - } |
|
| 673 | - |
|
| 674 | - if (is_array($value_array)) { |
|
| 675 | - if (in_array($option_value, $value_array)) { |
|
| 676 | - $selected = 'selected="selected"'; |
|
| 677 | - $checked = 'checked="checked"'; |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - } |
|
| 681 | - |
|
| 682 | - if ($multi_display == 'select') { |
|
| 683 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 684 | - } else { |
|
| 685 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - } |
|
| 689 | - } |
|
| 690 | - echo $select_options; |
|
| 691 | - |
|
| 692 | - if ($multi_display == 'select') { ?></select></div> |
|
| 644 | + } else { |
|
| 645 | + echo '<ul class="gd_multi_choice">'; |
|
| 646 | + } |
|
| 647 | + |
|
| 648 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 649 | + $select_options = ''; |
|
| 650 | + if (!empty($option_values_arr)) { |
|
| 651 | + foreach ($option_values_arr as $option_row) { |
|
| 652 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 653 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 654 | + |
|
| 655 | + if ($multi_display == 'select') { |
|
| 656 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 657 | + } else { |
|
| 658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 659 | + } |
|
| 660 | + } else { |
|
| 661 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 662 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 663 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 664 | + $selected = ''; |
|
| 665 | + $checked = ''; |
|
| 666 | + |
|
| 667 | + if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 668 | + if (!is_array($value)) { |
|
| 669 | + $value_array = explode(',', $value); |
|
| 670 | + } else { |
|
| 671 | + $value_array = $value; |
|
| 672 | + } |
|
| 673 | + |
|
| 674 | + if (is_array($value_array)) { |
|
| 675 | + if (in_array($option_value, $value_array)) { |
|
| 676 | + $selected = 'selected="selected"'; |
|
| 677 | + $checked = 'checked="checked"'; |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + } |
|
| 681 | + |
|
| 682 | + if ($multi_display == 'select') { |
|
| 683 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 684 | + } else { |
|
| 685 | + $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | + } |
|
| 690 | + echo $select_options; |
|
| 691 | + |
|
| 692 | + if ($multi_display == 'select') { ?></select></div> |
|
| 693 | 693 | <?php } else { ?></ul><?php } ?> |
| 694 | 694 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
| 695 | 695 | <?php if ($cf['is_required']) { ?> |
@@ -697,10 +697,10 @@ discard block |
||
| 697 | 697 | <?php } ?> |
| 698 | 698 | </div> |
| 699 | 699 | <?php |
| 700 | - $html = ob_get_clean(); |
|
| 701 | - } |
|
| 700 | + $html = ob_get_clean(); |
|
| 701 | + } |
|
| 702 | 702 | |
| 703 | - return $html; |
|
| 703 | + return $html; |
|
| 704 | 704 | } |
| 705 | 705 | add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
| 706 | 706 | |
@@ -716,32 +716,32 @@ discard block |
||
| 716 | 716 | */ |
| 717 | 717 | function geodir_cfi_html($html,$cf){ |
| 718 | 718 | |
| 719 | - $html_var = $cf['htmlvar_name']; |
|
| 719 | + $html_var = $cf['htmlvar_name']; |
|
| 720 | 720 | |
| 721 | - // Check if there is a custom field specific filter. |
|
| 722 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 723 | - /** |
|
| 724 | - * Filter the html html by individual custom field. |
|
| 725 | - * |
|
| 726 | - * @param string $html The html to filter. |
|
| 727 | - * @param array $cf The custom field array. |
|
| 728 | - * @since 1.6.6 |
|
| 729 | - */ |
|
| 730 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 731 | - } |
|
| 721 | + // Check if there is a custom field specific filter. |
|
| 722 | + if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 723 | + /** |
|
| 724 | + * Filter the html html by individual custom field. |
|
| 725 | + * |
|
| 726 | + * @param string $html The html to filter. |
|
| 727 | + * @param array $cf The custom field array. |
|
| 728 | + * @since 1.6.6 |
|
| 729 | + */ |
|
| 730 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 731 | + } |
|
| 732 | 732 | |
| 733 | - // If no html then we run the standard output. |
|
| 734 | - if(empty($html)) { |
|
| 733 | + // If no html then we run the standard output. |
|
| 734 | + if(empty($html)) { |
|
| 735 | 735 | |
| 736 | - ob_start(); // Start buffering; |
|
| 737 | - $value = geodir_get_cf_value($cf); |
|
| 738 | - ?> |
|
| 736 | + ob_start(); // Start buffering; |
|
| 737 | + $value = geodir_get_cf_value($cf); |
|
| 738 | + ?> |
|
| 739 | 739 | |
| 740 | 740 | <div id="<?php echo $cf['name']; ?>_row" |
| 741 | 741 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 742 | 742 | <label> |
| 743 | 743 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 744 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 744 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 745 | 745 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 746 | 746 | </label> |
| 747 | 747 | |
@@ -759,10 +759,10 @@ discard block |
||
| 759 | 759 | </div> |
| 760 | 760 | |
| 761 | 761 | <?php |
| 762 | - $html = ob_get_clean(); |
|
| 763 | - } |
|
| 762 | + $html = ob_get_clean(); |
|
| 763 | + } |
|
| 764 | 764 | |
| 765 | - return $html; |
|
| 765 | + return $html; |
|
| 766 | 766 | } |
| 767 | 767 | add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
| 768 | 768 | |
@@ -779,67 +779,67 @@ discard block |
||
| 779 | 779 | */ |
| 780 | 780 | function geodir_cfi_datepicker($html,$cf){ |
| 781 | 781 | |
| 782 | - $html_var = $cf['htmlvar_name']; |
|
| 782 | + $html_var = $cf['htmlvar_name']; |
|
| 783 | 783 | |
| 784 | - // Check if there is a custom field specific filter. |
|
| 785 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 786 | - /** |
|
| 787 | - * Filter the datepicker html by individual custom field. |
|
| 788 | - * |
|
| 789 | - * @param string $html The html to filter. |
|
| 790 | - * @param array $cf The custom field array. |
|
| 791 | - * @since 1.6.6 |
|
| 792 | - */ |
|
| 793 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 794 | - } |
|
| 784 | + // Check if there is a custom field specific filter. |
|
| 785 | + if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 786 | + /** |
|
| 787 | + * Filter the datepicker html by individual custom field. |
|
| 788 | + * |
|
| 789 | + * @param string $html The html to filter. |
|
| 790 | + * @param array $cf The custom field array. |
|
| 791 | + * @since 1.6.6 |
|
| 792 | + */ |
|
| 793 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 794 | + } |
|
| 795 | 795 | |
| 796 | - // If no html then we run the standard output. |
|
| 797 | - if(empty($html)) { |
|
| 796 | + // If no html then we run the standard output. |
|
| 797 | + if(empty($html)) { |
|
| 798 | 798 | |
| 799 | - ob_start(); // Start buffering; |
|
| 800 | - $value = geodir_get_cf_value($cf); |
|
| 799 | + ob_start(); // Start buffering; |
|
| 800 | + $value = geodir_get_cf_value($cf); |
|
| 801 | 801 | |
| 802 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 803 | - $name = $cf['name']; |
|
| 802 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 803 | + $name = $cf['name']; |
|
| 804 | 804 | |
| 805 | - if ($extra_fields['date_format'] == '') |
|
| 806 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 805 | + if ($extra_fields['date_format'] == '') |
|
| 806 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 807 | 807 | |
| 808 | - $date_format = $extra_fields['date_format']; |
|
| 809 | - $jquery_date_format = $date_format; |
|
| 808 | + $date_format = $extra_fields['date_format']; |
|
| 809 | + $jquery_date_format = $date_format; |
|
| 810 | 810 | |
| 811 | 811 | |
| 812 | - // check if we need to change the format or not |
|
| 813 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 814 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 812 | + // check if we need to change the format or not |
|
| 813 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 814 | + if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 815 | 815 | |
| 816 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 817 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 816 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 817 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 818 | 818 | |
| 819 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 820 | - }else{ |
|
| 821 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 822 | - } |
|
| 819 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 820 | + }else{ |
|
| 821 | + $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 825 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
| 826 | - $time = strtotime($value); |
|
| 827 | - $value = date_i18n($date_format, $time); |
|
| 828 | - } |
|
| 824 | + if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 825 | + if($value && !isset($_REQUEST['backandedit'])) { |
|
| 826 | + $time = strtotime($value); |
|
| 827 | + $value = date_i18n($date_format, $time); |
|
| 828 | + } |
|
| 829 | 829 | |
| 830 | - ?> |
|
| 830 | + ?> |
|
| 831 | 831 | <script type="text/javascript"> |
| 832 | 832 | |
| 833 | 833 | jQuery(function () { |
| 834 | 834 | |
| 835 | 835 | jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
| 836 | - /** |
|
| 837 | - * Used to add extra option to datepicker per custom field. |
|
| 838 | - * |
|
| 839 | - * @since 1.5.7 |
|
| 840 | - * @param string $name The custom field name. |
|
| 841 | - */ |
|
| 842 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 836 | + /** |
|
| 837 | + * Used to add extra option to datepicker per custom field. |
|
| 838 | + * |
|
| 839 | + * @since 1.5.7 |
|
| 840 | + * @param string $name The custom field name. |
|
| 841 | + */ |
|
| 842 | + echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 843 | 843 | |
| 844 | 844 | jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
| 845 | 845 | |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | <label> |
| 856 | 856 | |
| 857 | 857 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 858 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 858 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 859 | 859 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 860 | 860 | </label> |
| 861 | 861 | |
@@ -869,10 +869,10 @@ discard block |
||
| 869 | 869 | </div> |
| 870 | 870 | |
| 871 | 871 | <?php |
| 872 | - $html = ob_get_clean(); |
|
| 873 | - } |
|
| 872 | + $html = ob_get_clean(); |
|
| 873 | + } |
|
| 874 | 874 | |
| 875 | - return $html; |
|
| 875 | + return $html; |
|
| 876 | 876 | } |
| 877 | 877 | add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
| 878 | 878 | |
@@ -888,31 +888,31 @@ discard block |
||
| 888 | 888 | */ |
| 889 | 889 | function geodir_cfi_time($html,$cf){ |
| 890 | 890 | |
| 891 | - $html_var = $cf['htmlvar_name']; |
|
| 891 | + $html_var = $cf['htmlvar_name']; |
|
| 892 | 892 | |
| 893 | - // Check if there is a custom field specific filter. |
|
| 894 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 895 | - /** |
|
| 896 | - * Filter the time html by individual custom field. |
|
| 897 | - * |
|
| 898 | - * @param string $html The html to filter. |
|
| 899 | - * @param array $cf The custom field array. |
|
| 900 | - * @since 1.6.6 |
|
| 901 | - */ |
|
| 902 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 903 | - } |
|
| 893 | + // Check if there is a custom field specific filter. |
|
| 894 | + if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 895 | + /** |
|
| 896 | + * Filter the time html by individual custom field. |
|
| 897 | + * |
|
| 898 | + * @param string $html The html to filter. |
|
| 899 | + * @param array $cf The custom field array. |
|
| 900 | + * @since 1.6.6 |
|
| 901 | + */ |
|
| 902 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 903 | + } |
|
| 904 | 904 | |
| 905 | - // If no html then we run the standard output. |
|
| 906 | - if(empty($html)) { |
|
| 905 | + // If no html then we run the standard output. |
|
| 906 | + if(empty($html)) { |
|
| 907 | 907 | |
| 908 | - ob_start(); // Start buffering; |
|
| 909 | - $value = geodir_get_cf_value($cf); |
|
| 908 | + ob_start(); // Start buffering; |
|
| 909 | + $value = geodir_get_cf_value($cf); |
|
| 910 | 910 | |
| 911 | - $name = $cf['name']; |
|
| 911 | + $name = $cf['name']; |
|
| 912 | 912 | |
| 913 | - if ($value != '') |
|
| 914 | - $value = date('H:i', strtotime($value)); |
|
| 915 | - ?> |
|
| 913 | + if ($value != '') |
|
| 914 | + $value = date('H:i', strtotime($value)); |
|
| 915 | + ?> |
|
| 916 | 916 | <script type="text/javascript"> |
| 917 | 917 | jQuery(document).ready(function () { |
| 918 | 918 | |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | <label> |
| 929 | 929 | |
| 930 | 930 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 931 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 931 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 932 | 932 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 933 | 933 | </label> |
| 934 | 934 | <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
@@ -940,10 +940,10 @@ discard block |
||
| 940 | 940 | <?php } ?> |
| 941 | 941 | </div> |
| 942 | 942 | <?php |
| 943 | - $html = ob_get_clean(); |
|
| 944 | - } |
|
| 943 | + $html = ob_get_clean(); |
|
| 944 | + } |
|
| 945 | 945 | |
| 946 | - return $html; |
|
| 946 | + return $html; |
|
| 947 | 947 | } |
| 948 | 948 | add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
| 949 | 949 | |
@@ -959,100 +959,100 @@ discard block |
||
| 959 | 959 | */ |
| 960 | 960 | function geodir_cfi_address($html,$cf){ |
| 961 | 961 | |
| 962 | - $html_var = $cf['htmlvar_name']; |
|
| 963 | - |
|
| 964 | - // Check if there is a custom field specific filter. |
|
| 965 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 966 | - /** |
|
| 967 | - * Filter the address html by individual custom field. |
|
| 968 | - * |
|
| 969 | - * @param string $html The html to filter. |
|
| 970 | - * @param array $cf The custom field array. |
|
| 971 | - * @since 1.6.6 |
|
| 972 | - */ |
|
| 973 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 974 | - } |
|
| 975 | - |
|
| 976 | - // If no html then we run the standard output. |
|
| 977 | - if(empty($html)) { |
|
| 978 | - |
|
| 979 | - global $gd_session; |
|
| 980 | - ob_start(); // Start buffering; |
|
| 981 | - $value = geodir_get_cf_value($cf); |
|
| 982 | - $name = $cf['name']; |
|
| 983 | - $type = $cf['type']; |
|
| 984 | - $admin_desc = $cf['desc']; |
|
| 985 | - $is_required = $cf['is_required']; |
|
| 986 | - $required_msg = $cf['required_msg']; |
|
| 987 | - $site_title = $cf['site_title']; |
|
| 988 | - $is_admin = $cf['is_admin']; |
|
| 989 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 990 | - $prefix = $name . '_'; |
|
| 991 | - |
|
| 992 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 993 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 994 | - ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 995 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 996 | - |
|
| 997 | - $address = ''; |
|
| 998 | - $zip = ''; |
|
| 999 | - $mapview = ''; |
|
| 1000 | - $mapzoom = ''; |
|
| 1001 | - $lat = ''; |
|
| 1002 | - $lng = ''; |
|
| 1003 | - |
|
| 1004 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1005 | - $post = $gd_ses_listing; |
|
| 1006 | - $address = $post[$prefix . 'address']; |
|
| 1007 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1008 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1009 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1010 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1011 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1012 | - } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1013 | - $post_info = (array)$post_info; |
|
| 1014 | - |
|
| 1015 | - $address = $post_info[$prefix . 'address']; |
|
| 1016 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1017 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1018 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1019 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1020 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1021 | - } |
|
| 1022 | - |
|
| 1023 | - $location = geodir_get_default_location(); |
|
| 1024 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1025 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1026 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1027 | - |
|
| 1028 | - $lat_lng_blank = false; |
|
| 1029 | - if (empty($lat) && empty($lng)) { |
|
| 1030 | - $lat_lng_blank = true; |
|
| 1031 | - } |
|
| 1032 | - |
|
| 1033 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1034 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1035 | - |
|
| 1036 | - /** |
|
| 1037 | - * Filter the default latitude. |
|
| 1038 | - * |
|
| 1039 | - * @since 1.0.0 |
|
| 1040 | - * |
|
| 1041 | - * @param float $lat Default latitude. |
|
| 1042 | - * @param bool $is_admin For admin use only?. |
|
| 1043 | - */ |
|
| 1044 | - $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1045 | - /** |
|
| 1046 | - * Filter the default longitude. |
|
| 1047 | - * |
|
| 1048 | - * @since 1.0.0 |
|
| 1049 | - * |
|
| 1050 | - * @param float $lat Default longitude. |
|
| 1051 | - * @param bool $is_admin For admin use only?. |
|
| 1052 | - */ |
|
| 1053 | - $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1054 | - |
|
| 1055 | - ?> |
|
| 962 | + $html_var = $cf['htmlvar_name']; |
|
| 963 | + |
|
| 964 | + // Check if there is a custom field specific filter. |
|
| 965 | + if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 966 | + /** |
|
| 967 | + * Filter the address html by individual custom field. |
|
| 968 | + * |
|
| 969 | + * @param string $html The html to filter. |
|
| 970 | + * @param array $cf The custom field array. |
|
| 971 | + * @since 1.6.6 |
|
| 972 | + */ |
|
| 973 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 974 | + } |
|
| 975 | + |
|
| 976 | + // If no html then we run the standard output. |
|
| 977 | + if(empty($html)) { |
|
| 978 | + |
|
| 979 | + global $gd_session; |
|
| 980 | + ob_start(); // Start buffering; |
|
| 981 | + $value = geodir_get_cf_value($cf); |
|
| 982 | + $name = $cf['name']; |
|
| 983 | + $type = $cf['type']; |
|
| 984 | + $admin_desc = $cf['desc']; |
|
| 985 | + $is_required = $cf['is_required']; |
|
| 986 | + $required_msg = $cf['required_msg']; |
|
| 987 | + $site_title = $cf['site_title']; |
|
| 988 | + $is_admin = $cf['is_admin']; |
|
| 989 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 990 | + $prefix = $name . '_'; |
|
| 991 | + |
|
| 992 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 993 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 994 | + ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 995 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 996 | + |
|
| 997 | + $address = ''; |
|
| 998 | + $zip = ''; |
|
| 999 | + $mapview = ''; |
|
| 1000 | + $mapzoom = ''; |
|
| 1001 | + $lat = ''; |
|
| 1002 | + $lng = ''; |
|
| 1003 | + |
|
| 1004 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1005 | + $post = $gd_ses_listing; |
|
| 1006 | + $address = $post[$prefix . 'address']; |
|
| 1007 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1008 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1009 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1010 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1011 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1012 | + } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1013 | + $post_info = (array)$post_info; |
|
| 1014 | + |
|
| 1015 | + $address = $post_info[$prefix . 'address']; |
|
| 1016 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1017 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1018 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1019 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1020 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1021 | + } |
|
| 1022 | + |
|
| 1023 | + $location = geodir_get_default_location(); |
|
| 1024 | + if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1025 | + if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1026 | + if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1027 | + |
|
| 1028 | + $lat_lng_blank = false; |
|
| 1029 | + if (empty($lat) && empty($lng)) { |
|
| 1030 | + $lat_lng_blank = true; |
|
| 1031 | + } |
|
| 1032 | + |
|
| 1033 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1034 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1035 | + |
|
| 1036 | + /** |
|
| 1037 | + * Filter the default latitude. |
|
| 1038 | + * |
|
| 1039 | + * @since 1.0.0 |
|
| 1040 | + * |
|
| 1041 | + * @param float $lat Default latitude. |
|
| 1042 | + * @param bool $is_admin For admin use only?. |
|
| 1043 | + */ |
|
| 1044 | + $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1045 | + /** |
|
| 1046 | + * Filter the default longitude. |
|
| 1047 | + * |
|
| 1048 | + * @since 1.0.0 |
|
| 1049 | + * |
|
| 1050 | + * @param float $lat Default longitude. |
|
| 1051 | + * @param bool $is_admin For admin use only?. |
|
| 1052 | + */ |
|
| 1053 | + $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1054 | + |
|
| 1055 | + ?> |
|
| 1056 | 1056 | |
| 1057 | 1057 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1058 | 1058 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1071,17 +1071,17 @@ discard block |
||
| 1071 | 1071 | |
| 1072 | 1072 | |
| 1073 | 1073 | <?php |
| 1074 | - /** |
|
| 1075 | - * Called after the address input on the add listings. |
|
| 1076 | - * |
|
| 1077 | - * This is used by the location manage to add further locations info etc. |
|
| 1078 | - * |
|
| 1079 | - * @since 1.0.0 |
|
| 1080 | - * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1081 | - */ |
|
| 1082 | - do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1083 | - |
|
| 1084 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1074 | + /** |
|
| 1075 | + * Called after the address input on the add listings. |
|
| 1076 | + * |
|
| 1077 | + * This is used by the location manage to add further locations info etc. |
|
| 1078 | + * |
|
| 1079 | + * @since 1.0.0 |
|
| 1080 | + * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1081 | + */ |
|
| 1082 | + do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1083 | + |
|
| 1084 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1085 | 1085 | |
| 1086 | 1086 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
| 1087 | 1087 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1102,22 +1102,22 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
| 1104 | 1104 | <?php |
| 1105 | - /** |
|
| 1106 | - * Contains add listing page map functions. |
|
| 1107 | - * |
|
| 1108 | - * @since 1.0.0 |
|
| 1109 | - */ |
|
| 1110 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1111 | - if ($lat_lng_blank) { |
|
| 1112 | - $lat = ''; |
|
| 1113 | - $lng = ''; |
|
| 1114 | - } |
|
| 1115 | - ?> |
|
| 1105 | + /** |
|
| 1106 | + * Contains add listing page map functions. |
|
| 1107 | + * |
|
| 1108 | + * @since 1.0.0 |
|
| 1109 | + */ |
|
| 1110 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1111 | + if ($lat_lng_blank) { |
|
| 1112 | + $lat = ''; |
|
| 1113 | + $lng = ''; |
|
| 1114 | + } |
|
| 1115 | + ?> |
|
| 1116 | 1116 | <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span> |
| 1117 | 1117 | </div> |
| 1118 | 1118 | <?php |
| 1119 | - /* show lat lng */ |
|
| 1120 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1119 | + /* show lat lng */ |
|
| 1120 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1121 | 1121 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1122 | 1122 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1123 | 1123 | <label> |
@@ -1158,27 +1158,27 @@ discard block |
||
| 1158 | 1158 | class="gd-checkbox" |
| 1159 | 1159 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1160 | 1160 | id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
| 1161 | - echo 'checked="checked"'; |
|
| 1162 | - } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1161 | + echo 'checked="checked"'; |
|
| 1162 | + } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1163 | 1163 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1164 | 1164 | class="gd-checkbox" |
| 1165 | 1165 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1166 | 1166 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
| 1167 | - echo 'checked="checked"'; |
|
| 1168 | - } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1167 | + echo 'checked="checked"'; |
|
| 1168 | + } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1169 | 1169 | |
| 1170 | 1170 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1171 | 1171 | class="gd-checkbox" |
| 1172 | 1172 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1173 | 1173 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
| 1174 | - echo 'checked="checked"'; |
|
| 1175 | - } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1174 | + echo 'checked="checked"'; |
|
| 1175 | + } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1176 | 1176 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1177 | 1177 | class="gd-checkbox" |
| 1178 | 1178 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1179 | 1179 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
| 1180 | - echo 'checked="checked"'; |
|
| 1181 | - } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1180 | + echo 'checked="checked"'; |
|
| 1181 | + } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1182 | 1182 | |
| 1183 | 1183 | |
| 1184 | 1184 | </div> |
@@ -1186,14 +1186,14 @@ discard block |
||
| 1186 | 1186 | |
| 1187 | 1187 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
| 1188 | 1188 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
| 1189 | - echo esc_attr($mapzoom); |
|
| 1190 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1189 | + echo esc_attr($mapzoom); |
|
| 1190 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1191 | 1191 | <?php } |
| 1192 | 1192 | |
| 1193 | - $html = ob_get_clean(); |
|
| 1194 | - } |
|
| 1193 | + $html = ob_get_clean(); |
|
| 1194 | + } |
|
| 1195 | 1195 | |
| 1196 | - return $html; |
|
| 1196 | + return $html; |
|
| 1197 | 1197 | } |
| 1198 | 1198 | add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
| 1199 | 1199 | |
@@ -1210,137 +1210,137 @@ discard block |
||
| 1210 | 1210 | */ |
| 1211 | 1211 | function geodir_cfi_taxonomy($html,$cf){ |
| 1212 | 1212 | |
| 1213 | - $html_var = $cf['htmlvar_name']; |
|
| 1214 | - |
|
| 1215 | - // Check if there is a custom field specific filter. |
|
| 1216 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1217 | - /** |
|
| 1218 | - * Filter the taxonomy html by individual custom field. |
|
| 1219 | - * |
|
| 1220 | - * @param string $html The html to filter. |
|
| 1221 | - * @param array $cf The custom field array. |
|
| 1222 | - * @since 1.6.6 |
|
| 1223 | - */ |
|
| 1224 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1225 | - } |
|
| 1226 | - |
|
| 1227 | - // If no html then we run the standard output. |
|
| 1228 | - if(empty($html)) { |
|
| 1229 | - |
|
| 1230 | - ob_start(); // Start buffering; |
|
| 1231 | - $value = geodir_get_cf_value($cf); |
|
| 1232 | - |
|
| 1233 | - $name = $cf['name']; |
|
| 1234 | - $site_title = $cf['site_title']; |
|
| 1235 | - $admin_desc = $cf['desc']; |
|
| 1236 | - $is_required = $cf['is_required']; |
|
| 1237 | - $is_admin = $cf['is_admin']; |
|
| 1238 | - $required_msg = $cf['required_msg']; |
|
| 1239 | - |
|
| 1240 | - if ($value == $cf['default']) { |
|
| 1241 | - $value = ''; |
|
| 1242 | - } ?> |
|
| 1213 | + $html_var = $cf['htmlvar_name']; |
|
| 1214 | + |
|
| 1215 | + // Check if there is a custom field specific filter. |
|
| 1216 | + if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1217 | + /** |
|
| 1218 | + * Filter the taxonomy html by individual custom field. |
|
| 1219 | + * |
|
| 1220 | + * @param string $html The html to filter. |
|
| 1221 | + * @param array $cf The custom field array. |
|
| 1222 | + * @since 1.6.6 |
|
| 1223 | + */ |
|
| 1224 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1225 | + } |
|
| 1226 | + |
|
| 1227 | + // If no html then we run the standard output. |
|
| 1228 | + if(empty($html)) { |
|
| 1229 | + |
|
| 1230 | + ob_start(); // Start buffering; |
|
| 1231 | + $value = geodir_get_cf_value($cf); |
|
| 1232 | + |
|
| 1233 | + $name = $cf['name']; |
|
| 1234 | + $site_title = $cf['site_title']; |
|
| 1235 | + $admin_desc = $cf['desc']; |
|
| 1236 | + $is_required = $cf['is_required']; |
|
| 1237 | + $is_admin = $cf['is_admin']; |
|
| 1238 | + $required_msg = $cf['required_msg']; |
|
| 1239 | + |
|
| 1240 | + if ($value == $cf['default']) { |
|
| 1241 | + $value = ''; |
|
| 1242 | + } ?> |
|
| 1243 | 1243 | <div id="<?php echo $name;?>_row" |
| 1244 | 1244 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 1245 | 1245 | <label> |
| 1246 | 1246 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1247 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1247 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1248 | 1248 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1249 | 1249 | </label> |
| 1250 | 1250 | |
| 1251 | 1251 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
| 1252 | 1252 | <?php |
| 1253 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1253 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1254 | 1254 | |
| 1255 | - $exclude_cats = array(); |
|
| 1255 | + $exclude_cats = array(); |
|
| 1256 | 1256 | |
| 1257 | - if ($is_admin == '1') { |
|
| 1257 | + if ($is_admin == '1') { |
|
| 1258 | 1258 | |
| 1259 | - $post_type = get_post_type(); |
|
| 1259 | + $post_type = get_post_type(); |
|
| 1260 | 1260 | |
| 1261 | - $package_info = array(); |
|
| 1261 | + $package_info = array(); |
|
| 1262 | 1262 | |
| 1263 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1263 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1264 | 1264 | |
| 1265 | - if (!empty($package_info)) { |
|
| 1265 | + if (!empty($package_info)) { |
|
| 1266 | 1266 | |
| 1267 | - if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1267 | + if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1268 | 1268 | |
| 1269 | - $exclude_cats = explode(',', $package_info['cat']); |
|
| 1269 | + $exclude_cats = explode(',', $package_info['cat']); |
|
| 1270 | 1270 | |
| 1271 | - } |
|
| 1272 | - } |
|
| 1273 | - } |
|
| 1271 | + } |
|
| 1272 | + } |
|
| 1273 | + } |
|
| 1274 | 1274 | |
| 1275 | - $cat_display = unserialize($cf['extra_fields']); |
|
| 1275 | + $cat_display = unserialize($cf['extra_fields']); |
|
| 1276 | 1276 | |
| 1277 | - if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1277 | + if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1278 | 1278 | |
| 1279 | - $post_cat = implode(",", $post_cat[$name]); |
|
| 1279 | + $post_cat = implode(",", $post_cat[$name]); |
|
| 1280 | 1280 | |
| 1281 | - } else { |
|
| 1282 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1283 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1284 | - } |
|
| 1281 | + } else { |
|
| 1282 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1283 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1284 | + } |
|
| 1285 | 1285 | |
| 1286 | 1286 | |
| 1287 | - global $geodir_addon_list; |
|
| 1288 | - if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1287 | + global $geodir_addon_list; |
|
| 1288 | + if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1289 | 1289 | |
| 1290 | - $catadd_limit = $wpdb->get_var( |
|
| 1291 | - $wpdb->prepare( |
|
| 1292 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1293 | - array($package_id) |
|
| 1294 | - ) |
|
| 1295 | - ); |
|
| 1290 | + $catadd_limit = $wpdb->get_var( |
|
| 1291 | + $wpdb->prepare( |
|
| 1292 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1293 | + array($package_id) |
|
| 1294 | + ) |
|
| 1295 | + ); |
|
| 1296 | 1296 | |
| 1297 | 1297 | |
| 1298 | - } else { |
|
| 1299 | - $catadd_limit = 0; |
|
| 1300 | - } |
|
| 1298 | + } else { |
|
| 1299 | + $catadd_limit = 0; |
|
| 1300 | + } |
|
| 1301 | 1301 | |
| 1302 | 1302 | |
| 1303 | - if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1303 | + if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1304 | 1304 | |
| 1305 | - $required_limit_msg = ''; |
|
| 1306 | - if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1305 | + $required_limit_msg = ''; |
|
| 1306 | + if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1307 | 1307 | |
| 1308 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1308 | + $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1309 | 1309 | |
| 1310 | - } else { |
|
| 1311 | - $required_limit_msg = $required_msg; |
|
| 1312 | - } |
|
| 1310 | + } else { |
|
| 1311 | + $required_limit_msg = $required_msg; |
|
| 1312 | + } |
|
| 1313 | 1313 | |
| 1314 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1314 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1315 | 1315 | |
| 1316 | 1316 | |
| 1317 | - if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1317 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1318 | 1318 | |
| 1319 | - $cat_display == ''; |
|
| 1320 | - $multiple = ''; |
|
| 1321 | - if ($cat_display == 'multiselect') |
|
| 1322 | - $multiple = 'multiple="multiple"'; |
|
| 1319 | + $cat_display == ''; |
|
| 1320 | + $multiple = ''; |
|
| 1321 | + if ($cat_display == 'multiselect') |
|
| 1322 | + $multiple = 'multiple="multiple"'; |
|
| 1323 | 1323 | |
| 1324 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1324 | + echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1325 | 1325 | |
| 1326 | 1326 | |
| 1327 | - if ($cat_display == 'select') |
|
| 1328 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1327 | + if ($cat_display == 'select') |
|
| 1328 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1329 | 1329 | |
| 1330 | - } |
|
| 1330 | + } |
|
| 1331 | 1331 | |
| 1332 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1332 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1333 | 1333 | |
| 1334 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1335 | - echo '</select>'; |
|
| 1334 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1335 | + echo '</select>'; |
|
| 1336 | 1336 | |
| 1337 | - } else { |
|
| 1337 | + } else { |
|
| 1338 | 1338 | |
| 1339 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1339 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1340 | 1340 | |
| 1341 | - } |
|
| 1341 | + } |
|
| 1342 | 1342 | |
| 1343 | - ?> |
|
| 1343 | + ?> |
|
| 1344 | 1344 | </div> |
| 1345 | 1345 | |
| 1346 | 1346 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -1350,10 +1350,10 @@ discard block |
||
| 1350 | 1350 | </div> |
| 1351 | 1351 | |
| 1352 | 1352 | <?php |
| 1353 | - $html = ob_get_clean(); |
|
| 1354 | - } |
|
| 1353 | + $html = ob_get_clean(); |
|
| 1354 | + } |
|
| 1355 | 1355 | |
| 1356 | - return $html; |
|
| 1356 | + return $html; |
|
| 1357 | 1357 | } |
| 1358 | 1358 | add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
| 1359 | 1359 | |
@@ -1369,74 +1369,74 @@ discard block |
||
| 1369 | 1369 | */ |
| 1370 | 1370 | function geodir_cfi_file($html,$cf){ |
| 1371 | 1371 | |
| 1372 | - $html_var = $cf['htmlvar_name']; |
|
| 1372 | + $html_var = $cf['htmlvar_name']; |
|
| 1373 | 1373 | |
| 1374 | - // Check if there is a custom field specific filter. |
|
| 1375 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1376 | - /** |
|
| 1377 | - * Filter the file html by individual custom field. |
|
| 1378 | - * |
|
| 1379 | - * @param string $html The html to filter. |
|
| 1380 | - * @param array $cf The custom field array. |
|
| 1381 | - * @since 1.6.6 |
|
| 1382 | - */ |
|
| 1383 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1384 | - } |
|
| 1374 | + // Check if there is a custom field specific filter. |
|
| 1375 | + if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1376 | + /** |
|
| 1377 | + * Filter the file html by individual custom field. |
|
| 1378 | + * |
|
| 1379 | + * @param string $html The html to filter. |
|
| 1380 | + * @param array $cf The custom field array. |
|
| 1381 | + * @since 1.6.6 |
|
| 1382 | + */ |
|
| 1383 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1384 | + } |
|
| 1385 | 1385 | |
| 1386 | - // If no html then we run the standard output. |
|
| 1387 | - if(empty($html)) { |
|
| 1386 | + // If no html then we run the standard output. |
|
| 1387 | + if(empty($html)) { |
|
| 1388 | 1388 | |
| 1389 | - ob_start(); // Start buffering; |
|
| 1390 | - $value = geodir_get_cf_value($cf); |
|
| 1389 | + ob_start(); // Start buffering; |
|
| 1390 | + $value = geodir_get_cf_value($cf); |
|
| 1391 | 1391 | |
| 1392 | - $name = $cf['name']; |
|
| 1393 | - $site_title = $cf['site_title']; |
|
| 1394 | - $admin_desc = $cf['desc']; |
|
| 1395 | - $is_required = $cf['is_required']; |
|
| 1396 | - $required_msg = $cf['required_msg']; |
|
| 1397 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 1392 | + $name = $cf['name']; |
|
| 1393 | + $site_title = $cf['site_title']; |
|
| 1394 | + $admin_desc = $cf['desc']; |
|
| 1395 | + $is_required = $cf['is_required']; |
|
| 1396 | + $required_msg = $cf['required_msg']; |
|
| 1397 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | - // adjust values here |
|
| 1401 | - $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1400 | + // adjust values here |
|
| 1401 | + $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1402 | 1402 | |
| 1403 | - if ($value != '') { |
|
| 1403 | + if ($value != '') { |
|
| 1404 | 1404 | |
| 1405 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1405 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1406 | 1406 | |
| 1407 | - } else |
|
| 1408 | - $file_value = ''; |
|
| 1407 | + } else |
|
| 1408 | + $file_value = ''; |
|
| 1409 | 1409 | |
| 1410 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1411 | - $file_multiple = true; // allow multiple files upload |
|
| 1412 | - else |
|
| 1413 | - $file_multiple = false; |
|
| 1410 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1411 | + $file_multiple = true; // allow multiple files upload |
|
| 1412 | + else |
|
| 1413 | + $file_multiple = false; |
|
| 1414 | 1414 | |
| 1415 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1416 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 1417 | - else |
|
| 1418 | - $file_image_limit = 1; |
|
| 1415 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1416 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 1417 | + else |
|
| 1418 | + $file_image_limit = 1; |
|
| 1419 | 1419 | |
| 1420 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1420 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1421 | 1421 | |
| 1422 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1422 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1423 | 1423 | |
| 1424 | - if (!empty($file_value)) { |
|
| 1425 | - $curImages = explode(',', $file_value); |
|
| 1426 | - if (!empty($curImages)) |
|
| 1427 | - $file_totImg = count($curImages); |
|
| 1428 | - } |
|
| 1424 | + if (!empty($file_value)) { |
|
| 1425 | + $curImages = explode(',', $file_value); |
|
| 1426 | + if (!empty($curImages)) |
|
| 1427 | + $file_totImg = count($curImages); |
|
| 1428 | + } |
|
| 1429 | 1429 | |
| 1430 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1431 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1430 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1431 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1432 | 1432 | |
| 1433 | - ?> |
|
| 1433 | + ?> |
|
| 1434 | 1434 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
| 1435 | 1435 | <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> |
| 1436 | 1436 | <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> |
| 1437 | 1437 | <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> |
| 1438 | 1438 | </h5> <?php */ |
| 1439 | - ?> |
|
| 1439 | + ?> |
|
| 1440 | 1440 | |
| 1441 | 1441 | <div id="<?php echo $name;?>_row" |
| 1442 | 1442 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1444,7 +1444,7 @@ discard block |
||
| 1444 | 1444 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1445 | 1445 | <label |
| 1446 | 1446 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1447 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1447 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1448 | 1448 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1449 | 1449 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1450 | 1450 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1456,17 +1456,17 @@ discard block |
||
| 1456 | 1456 | <?php } ?> |
| 1457 | 1457 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 1458 | 1458 | value="<?php if (isset($file_totImg)) { |
| 1459 | - echo esc_attr($file_totImg); |
|
| 1460 | - } else { |
|
| 1461 | - echo '0'; |
|
| 1462 | - } ?>"/> |
|
| 1459 | + echo esc_attr($file_totImg); |
|
| 1460 | + } else { |
|
| 1461 | + echo '0'; |
|
| 1462 | + } ?>"/> |
|
| 1463 | 1463 | |
| 1464 | 1464 | <div style="float:left; width:55%;"> |
| 1465 | 1465 | <div |
| 1466 | 1466 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 1467 | 1467 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;"> |
| 1468 | 1468 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
| 1469 | - ?> |
|
| 1469 | + ?> |
|
| 1470 | 1470 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 1471 | 1471 | value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
| 1472 | 1472 | class="geodir_button" style="margin-top:10px;"/> |
@@ -1485,7 +1485,7 @@ discard block |
||
| 1485 | 1485 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> |
| 1486 | 1486 | </div> |
| 1487 | 1487 | <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ |
| 1488 | - ?> |
|
| 1488 | + ?> |
|
| 1489 | 1489 | |
| 1490 | 1490 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span> |
| 1491 | 1491 | |
@@ -1499,9 +1499,9 @@ discard block |
||
| 1499 | 1499 | |
| 1500 | 1500 | |
| 1501 | 1501 | <?php |
| 1502 | - $html = ob_get_clean(); |
|
| 1503 | - } |
|
| 1502 | + $html = ob_get_clean(); |
|
| 1503 | + } |
|
| 1504 | 1504 | |
| 1505 | - return $html; |
|
| 1505 | + return $html; |
|
| 1506 | 1506 | } |
| 1507 | 1507 | add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
| 1508 | 1508 | \ No newline at end of file |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return string The html to output for the custom field. |
| 19 | 19 | */ |
| 20 | -function geodir_cfi_fieldset($html,$cf){ |
|
| 20 | +function geodir_cfi_fieldset($html, $cf) { |
|
| 21 | 21 | |
| 22 | 22 | $html_var = $cf['htmlvar_name']; |
| 23 | 23 | |
| 24 | 24 | // Check if there is a custom field specific filter. |
| 25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 25 | + if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) { |
|
| 26 | 26 | /** |
| 27 | 27 | * Filter the fieldset html by individual custom field. |
| 28 | 28 | * |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | * @param array $cf The custom field array. |
| 31 | 31 | * @since 1.6.6 |
| 32 | 32 | */ |
| 33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // If no html then we run the standard output. |
| 37 | - if(empty($html)) { |
|
| 37 | + if (empty($html)) { |
|
| 38 | 38 | |
| 39 | 39 | ob_start(); // Start buffering; |
| 40 | 40 | ?> |
| 41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
| 42 | 42 | gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?> |
| 43 | - <?php if ( $cf['desc'] != '' ) { |
|
| 44 | - echo '<small>( ' . $cf['desc'] . ' )</small>'; |
|
| 43 | + <?php if ($cf['desc'] != '') { |
|
| 44 | + echo '<small>( '.$cf['desc'].' )</small>'; |
|
| 45 | 45 | } ?></h5> |
| 46 | 46 | <?php |
| 47 | 47 | $html = ob_get_clean(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | return $html; |
| 51 | 51 | } |
| 52 | -add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
|
| 52 | +add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2); |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string The html to output for the custom field. |
| 64 | 64 | */ |
| 65 | -function geodir_cfi_text($html,$cf){ |
|
| 65 | +function geodir_cfi_text($html, $cf) { |
|
| 66 | 66 | |
| 67 | 67 | $html_var = $cf['htmlvar_name']; |
| 68 | 68 | |
| 69 | 69 | // Check if there is a custom field specific filter. |
| 70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 70 | + if (has_filter("geodir_custom_field_input_text_{$html_var}")) { |
|
| 71 | 71 | /** |
| 72 | 72 | * Filter the text html by individual custom field. |
| 73 | 73 | * |
@@ -75,41 +75,41 @@ discard block |
||
| 75 | 75 | * @param array $cf The custom field array. |
| 76 | 76 | * @since 1.6.6 |
| 77 | 77 | */ |
| 78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // If no html then we run the standard output. |
| 82 | - if(empty($html)) { |
|
| 82 | + if (empty($html)) { |
|
| 83 | 83 | |
| 84 | 84 | ob_start(); // Start buffering; |
| 85 | 85 | |
| 86 | 86 | $value = geodir_get_cf_value($cf); |
| 87 | 87 | $type = $cf['type']; |
| 88 | 88 | //number and float validation $validation_pattern |
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 89 | + if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; } |
|
| 90 | + elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; } |
|
| 91 | 91 | |
| 92 | 92 | //validation |
| 93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 93 | + if (isset($cf['validation_pattern']) && $cf['validation_pattern']) { |
|
| 94 | 94 | $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
| 95 | - }else{$validation='';} |
|
| 95 | + } else {$validation = ''; } |
|
| 96 | 96 | |
| 97 | 97 | // validation message |
| 98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 98 | + if (isset($cf['validation_msg']) && $cf['validation_msg']) { |
|
| 99 | 99 | $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
| 100 | - }else{$validation_msg='';} |
|
| 100 | + } else {$validation_msg = ''; } |
|
| 101 | 101 | ?> |
| 102 | 102 | |
| 103 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 104 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 103 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 104 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 105 | 105 | <label> |
| 106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | 107 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 108 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 108 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 109 | 109 | </label> |
| 110 | - <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 111 | - value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
|
| 112 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 110 | + <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 111 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> /> |
|
| 112 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 113 | 113 | <?php if ($cf['is_required']) { ?> |
| 114 | 114 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 115 | 115 | <?php } ?> |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | return $html; |
| 123 | 123 | } |
| 124 | -add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
|
| 124 | +add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2); |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return string The html to output for the custom field. |
| 135 | 135 | */ |
| 136 | -function geodir_cfi_email($html,$cf){ |
|
| 136 | +function geodir_cfi_email($html, $cf) { |
|
| 137 | 137 | |
| 138 | 138 | $html_var = $cf['htmlvar_name']; |
| 139 | 139 | |
| 140 | 140 | // Check if there is a custom field specific filter. |
| 141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 141 | + if (has_filter("geodir_custom_field_input_email_{$html_var}")) { |
|
| 142 | 142 | /** |
| 143 | 143 | * Filter the email html by individual custom field. |
| 144 | 144 | * |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * @param array $cf The custom field array. |
| 147 | 147 | * @since 1.6.6 |
| 148 | 148 | */ |
| 149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // If no html then we run the standard output. |
| 153 | - if(empty($html)) { |
|
| 153 | + if (empty($html)) { |
|
| 154 | 154 | |
| 155 | 155 | ob_start(); // Start buffering; |
| 156 | 156 | $value = geodir_get_cf_value($cf); |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | $value = ''; |
| 160 | 160 | }?> |
| 161 | 161 | |
| 162 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 163 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 162 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 163 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 164 | 164 | <label> |
| 165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | 166 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 167 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 167 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 168 | 168 | </label> |
| 169 | - <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 170 | - value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
|
| 171 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 169 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 170 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/> |
|
| 171 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 172 | 172 | <?php if ($cf['is_required']) { ?> |
| 173 | 173 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 174 | 174 | <?php } ?> |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | return $html; |
| 182 | 182 | } |
| 183 | -add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
|
| 183 | +add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2); |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return string The html to output for the custom field. |
| 195 | 195 | */ |
| 196 | -function geodir_cfi_phone($html,$cf){ |
|
| 196 | +function geodir_cfi_phone($html, $cf) { |
|
| 197 | 197 | |
| 198 | 198 | $html_var = $cf['htmlvar_name']; |
| 199 | 199 | |
| 200 | 200 | // Check if there is a custom field specific filter. |
| 201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 201 | + if (has_filter("geodir_custom_field_input_phone_{$html_var}")) { |
|
| 202 | 202 | /** |
| 203 | 203 | * Filter the phone html by individual custom field. |
| 204 | 204 | * |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * @param array $cf The custom field array. |
| 207 | 207 | * @since 1.6.6 |
| 208 | 208 | */ |
| 209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // If no html then we run the standard output. |
| 213 | - if(empty($html)) { |
|
| 213 | + if (empty($html)) { |
|
| 214 | 214 | |
| 215 | 215 | ob_start(); // Start buffering; |
| 216 | 216 | $value = geodir_get_cf_value($cf); |
@@ -219,16 +219,16 @@ discard block |
||
| 219 | 219 | $value = ''; |
| 220 | 220 | }?> |
| 221 | 221 | |
| 222 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 223 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 222 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 223 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 224 | 224 | <label> |
| 225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | 226 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 227 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 227 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 228 | 228 | </label> |
| 229 | - <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 230 | - value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
|
| 231 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 229 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 230 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/> |
|
| 231 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 232 | 232 | <?php if ($cf['is_required']) { ?> |
| 233 | 233 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 234 | 234 | <?php } ?> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | return $html; |
| 242 | 242 | } |
| 243 | -add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
|
| 243 | +add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2); |
|
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return string The html to output for the custom field. |
| 255 | 255 | */ |
| 256 | -function geodir_cfi_url($html,$cf){ |
|
| 256 | +function geodir_cfi_url($html, $cf) { |
|
| 257 | 257 | |
| 258 | 258 | $html_var = $cf['htmlvar_name']; |
| 259 | 259 | |
| 260 | 260 | // Check if there is a custom field specific filter. |
| 261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 261 | + if (has_filter("geodir_custom_field_input_url_{$html_var}")) { |
|
| 262 | 262 | /** |
| 263 | 263 | * Filter the url html by individual custom field. |
| 264 | 264 | * |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | * @param array $cf The custom field array. |
| 267 | 267 | * @since 1.6.6 |
| 268 | 268 | */ |
| 269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // If no html then we run the standard output. |
| 273 | - if(empty($html)) { |
|
| 273 | + if (empty($html)) { |
|
| 274 | 274 | |
| 275 | 275 | ob_start(); // Start buffering; |
| 276 | 276 | $value = geodir_get_cf_value($cf); |
@@ -279,19 +279,19 @@ discard block |
||
| 279 | 279 | $value = ''; |
| 280 | 280 | }?> |
| 281 | 281 | |
| 282 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 283 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 282 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 283 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 284 | 284 | <label> |
| 285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | 286 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 287 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 287 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 288 | 288 | </label> |
| 289 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 290 | - value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
|
| 289 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 290 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield" |
|
| 291 | 291 | oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')" |
| 292 | 292 | onchange="try{setCustomValidity('')}catch(e){}" |
| 293 | 293 | /> |
| 294 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 294 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 295 | 295 | <?php if ($cf['is_required']) { ?> |
| 296 | 296 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 297 | 297 | <?php } ?> |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | return $html; |
| 305 | 305 | } |
| 306 | -add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
|
| 306 | +add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2); |
|
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string The html to output for the custom field. |
| 317 | 317 | */ |
| 318 | -function geodir_cfi_radio($html,$cf){ |
|
| 318 | +function geodir_cfi_radio($html, $cf) { |
|
| 319 | 319 | |
| 320 | 320 | $html_var = $cf['htmlvar_name']; |
| 321 | 321 | |
| 322 | 322 | // Check if there is a custom field specific filter. |
| 323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 323 | + if (has_filter("geodir_custom_field_input_radio_{$html_var}")) { |
|
| 324 | 324 | /** |
| 325 | 325 | * Filter the radio html by individual custom field. |
| 326 | 326 | * |
@@ -328,22 +328,22 @@ discard block |
||
| 328 | 328 | * @param array $cf The custom field array. |
| 329 | 329 | * @since 1.6.6 |
| 330 | 330 | */ |
| 331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // If no html then we run the standard output. |
| 335 | - if(empty($html)) { |
|
| 335 | + if (empty($html)) { |
|
| 336 | 336 | |
| 337 | 337 | ob_start(); // Start buffering; |
| 338 | 338 | $value = geodir_get_cf_value($cf); |
| 339 | 339 | |
| 340 | 340 | ?> |
| 341 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 342 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 341 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 342 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 343 | 343 | <label> |
| 344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | 345 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 346 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 346 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 347 | 347 | </label> |
| 348 | 348 | <?php if ($cf['option_values']) { |
| 349 | 349 | $option_values = geodir_string_values_to_options($cf['option_values'], true); |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | foreach ($option_values as $option_value) { |
| 353 | 353 | if (empty($option_value['optgroup'])) { |
| 354 | 354 | ?> |
| 355 | - <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
|
| 355 | + <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span> |
|
| 356 | 356 | <?php |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | ?> |
| 362 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 362 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 363 | 363 | <?php if ($cf['is_required']) { ?> |
| 364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 365 | 365 | <?php } ?> |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | return $html; |
| 373 | 373 | } |
| 374 | -add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
|
| 374 | +add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return string The html to output for the custom field. |
| 385 | 385 | */ |
| 386 | -function geodir_cfi_checkbox($html,$cf){ |
|
| 386 | +function geodir_cfi_checkbox($html, $cf) { |
|
| 387 | 387 | |
| 388 | 388 | $html_var = $cf['htmlvar_name']; |
| 389 | 389 | |
| 390 | 390 | // Check if there is a custom field specific filter. |
| 391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 391 | + if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) { |
|
| 392 | 392 | /** |
| 393 | 393 | * Filter the checkbox html by individual custom field. |
| 394 | 394 | * |
@@ -396,11 +396,11 @@ discard block |
||
| 396 | 396 | * @param array $cf The custom field array. |
| 397 | 397 | * @since 1.6.6 |
| 398 | 398 | */ |
| 399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // If no html then we run the standard output. |
| 403 | - if(empty($html)) { |
|
| 403 | + if (empty($html)) { |
|
| 404 | 404 | |
| 405 | 405 | ob_start(); // Start buffering; |
| 406 | 406 | $value = geodir_get_cf_value($cf); |
@@ -409,22 +409,22 @@ discard block |
||
| 409 | 409 | $value = ''; |
| 410 | 410 | }?> |
| 411 | 411 | |
| 412 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 413 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 412 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 413 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 414 | 414 | <label> |
| 415 | 415 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 416 | 416 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 417 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 417 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 418 | 418 | </label> |
| 419 | 419 | <?php if ($value != '1') { |
| 420 | 420 | $value = '0'; |
| 421 | 421 | }?> |
| 422 | - <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
|
| 422 | + <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/> |
|
| 423 | 423 | <input <?php if ($value == '1') { |
| 424 | 424 | echo 'checked="checked"'; |
| 425 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 426 | - onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
|
| 427 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 425 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox" |
|
| 426 | + onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/> |
|
| 427 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 428 | 428 | <?php if ($cf['is_required']) { ?> |
| 429 | 429 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 430 | 430 | <?php } ?> |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | return $html; |
| 438 | 438 | } |
| 439 | -add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
|
| 439 | +add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2); |
|
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -448,12 +448,12 @@ discard block |
||
| 448 | 448 | * |
| 449 | 449 | * @return string The html to output for the custom field. |
| 450 | 450 | */ |
| 451 | -function geodir_cfi_textarea($html,$cf){ |
|
| 451 | +function geodir_cfi_textarea($html, $cf) { |
|
| 452 | 452 | |
| 453 | 453 | $html_var = $cf['htmlvar_name']; |
| 454 | 454 | |
| 455 | 455 | // Check if there is a custom field specific filter. |
| 456 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 456 | + if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) { |
|
| 457 | 457 | /** |
| 458 | 458 | * Filter the textarea html by individual custom field. |
| 459 | 459 | * |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | * @param array $cf The custom field array. |
| 462 | 462 | * @since 1.6.6 |
| 463 | 463 | */ |
| 464 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 464 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf); |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | // If no html then we run the standard output. |
| 468 | - if(empty($html)) { |
|
| 468 | + if (empty($html)) { |
|
| 469 | 469 | |
| 470 | 470 | ob_start(); // Start buffering; |
| 471 | 471 | $value = geodir_get_cf_value($cf); |
@@ -473,32 +473,32 @@ discard block |
||
| 473 | 473 | $extra_fields = unserialize($cf['extra_fields']); |
| 474 | 474 | ?> |
| 475 | 475 | |
| 476 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 477 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 476 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 477 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 478 | 478 | <label> |
| 479 | 479 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 480 | 480 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 481 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 481 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 482 | 482 | </label><?php |
| 483 | 483 | |
| 484 | 484 | |
| 485 | 485 | if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
| 486 | 486 | |
| 487 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 487 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> |
|
| 488 | 488 | |
| 489 | - <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
|
| 489 | + <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor"> |
|
| 490 | 490 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
| 491 | 491 | </div><?php |
| 492 | 492 | |
| 493 | 493 | } else { |
| 494 | 494 | |
| 495 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 496 | - id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
|
| 495 | + ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>" |
|
| 496 | + id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php |
|
| 497 | 497 | |
| 498 | 498 | }?> |
| 499 | 499 | |
| 500 | 500 | |
| 501 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 501 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 502 | 502 | <?php if ($cf['is_required']) { ?> |
| 503 | 503 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 504 | 504 | <?php } ?> |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | return $html; |
| 512 | 512 | } |
| 513 | -add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
|
| 513 | +add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2); |
|
| 514 | 514 | |
| 515 | 515 | |
| 516 | 516 | /** |
@@ -522,12 +522,12 @@ discard block |
||
| 522 | 522 | * |
| 523 | 523 | * @return string The html to output for the custom field. |
| 524 | 524 | */ |
| 525 | -function geodir_cfi_select($html,$cf){ |
|
| 525 | +function geodir_cfi_select($html, $cf) { |
|
| 526 | 526 | |
| 527 | 527 | $html_var = $cf['htmlvar_name']; |
| 528 | 528 | |
| 529 | 529 | // Check if there is a custom field specific filter. |
| 530 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 530 | + if (has_filter("geodir_custom_field_input_select_{$html_var}")) { |
|
| 531 | 531 | /** |
| 532 | 532 | * Filter the select html by individual custom field. |
| 533 | 533 | * |
@@ -535,22 +535,22 @@ discard block |
||
| 535 | 535 | * @param array $cf The custom field array. |
| 536 | 536 | * @since 1.6.6 |
| 537 | 537 | */ |
| 538 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 538 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | // If no html then we run the standard output. |
| 542 | - if(empty($html)) { |
|
| 542 | + if (empty($html)) { |
|
| 543 | 543 | |
| 544 | 544 | ob_start(); // Start buffering; |
| 545 | 545 | $value = geodir_get_cf_value($cf); |
| 546 | 546 | |
| 547 | 547 | ?> |
| 548 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 549 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 548 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 549 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 550 | 550 | <label> |
| 551 | 551 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 552 | 552 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 553 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 553 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 554 | 554 | </label> |
| 555 | 555 | <?php |
| 556 | 556 | $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
@@ -560,22 +560,22 @@ discard block |
||
| 560 | 560 | if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
| 561 | 561 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 562 | 562 | |
| 563 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 563 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 564 | 564 | } else { |
| 565 | 565 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 566 | 566 | $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
| 567 | 567 | $selected = $option_value == $value ? 'selected="selected"' : ''; |
| 568 | 568 | |
| 569 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 569 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | ?> |
| 574 | - <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 574 | + <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 575 | 575 | class="geodir_textfield textfield_x chosen_select" |
| 576 | - data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
|
| 577 | - option-ajaxchosen="false"><?php echo $select_options;?></select> |
|
| 578 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 576 | + data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'…'; ?>" |
|
| 577 | + option-ajaxchosen="false"><?php echo $select_options; ?></select> |
|
| 578 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 579 | 579 | <?php if ($cf['is_required']) { ?> |
| 580 | 580 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 581 | 581 | <?php } ?> |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | return $html; |
| 589 | 589 | } |
| 590 | -add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
|
| 590 | +add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2); |
|
| 591 | 591 | |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -599,12 +599,12 @@ discard block |
||
| 599 | 599 | * |
| 600 | 600 | * @return string The html to output for the custom field. |
| 601 | 601 | */ |
| 602 | -function geodir_cfi_multiselect($html,$cf){ |
|
| 602 | +function geodir_cfi_multiselect($html, $cf) { |
|
| 603 | 603 | |
| 604 | 604 | $html_var = $cf['htmlvar_name']; |
| 605 | 605 | |
| 606 | 606 | // Check if there is a custom field specific filter. |
| 607 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 607 | + if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) { |
|
| 608 | 608 | /** |
| 609 | 609 | * Filter the multiselect html by individual custom field. |
| 610 | 610 | * |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | * @param array $cf The custom field array. |
| 613 | 613 | * @since 1.6.6 |
| 614 | 614 | */ |
| 615 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 615 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // If no html then we run the standard output. |
| 619 | - if(empty($html)) { |
|
| 619 | + if (empty($html)) { |
|
| 620 | 620 | |
| 621 | 621 | ob_start(); // Start buffering; |
| 622 | 622 | $value = geodir_get_cf_value($cf); |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 654 | 654 | |
| 655 | 655 | if ($multi_display == 'select') { |
| 656 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 656 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 657 | 657 | } else { |
| 658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : ''; |
|
| 659 | 659 | } |
| 660 | 660 | } else { |
| 661 | 661 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
@@ -680,9 +680,9 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | if ($multi_display == 'select') { |
| 683 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 683 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 684 | 684 | } else { |
| 685 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 685 | + $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" /> '.$option_label.' </li>'; |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | } |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | return $html; |
| 704 | 704 | } |
| 705 | -add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
|
| 705 | +add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2); |
|
| 706 | 706 | |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -714,12 +714,12 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @return string The html to output for the custom field. |
| 716 | 716 | */ |
| 717 | -function geodir_cfi_html($html,$cf){ |
|
| 717 | +function geodir_cfi_html($html, $cf) { |
|
| 718 | 718 | |
| 719 | 719 | $html_var = $cf['htmlvar_name']; |
| 720 | 720 | |
| 721 | 721 | // Check if there is a custom field specific filter. |
| 722 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 722 | + if (has_filter("geodir_custom_field_input_html_{$html_var}")) { |
|
| 723 | 723 | /** |
| 724 | 724 | * Filter the html html by individual custom field. |
| 725 | 725 | * |
@@ -727,11 +727,11 @@ discard block |
||
| 727 | 727 | * @param array $cf The custom field array. |
| 728 | 728 | * @since 1.6.6 |
| 729 | 729 | */ |
| 730 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 730 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf); |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | // If no html then we run the standard output. |
| 734 | - if(empty($html)) { |
|
| 734 | + if (empty($html)) { |
|
| 735 | 735 | |
| 736 | 736 | ob_start(); // Start buffering; |
| 737 | 737 | $value = geodir_get_cf_value($cf); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | return $html; |
| 766 | 766 | } |
| 767 | -add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
|
| 767 | +add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2); |
|
| 768 | 768 | |
| 769 | 769 | |
| 770 | 770 | |
@@ -777,12 +777,12 @@ discard block |
||
| 777 | 777 | * |
| 778 | 778 | * @return string The html to output for the custom field. |
| 779 | 779 | */ |
| 780 | -function geodir_cfi_datepicker($html,$cf){ |
|
| 780 | +function geodir_cfi_datepicker($html, $cf) { |
|
| 781 | 781 | |
| 782 | 782 | $html_var = $cf['htmlvar_name']; |
| 783 | 783 | |
| 784 | 784 | // Check if there is a custom field specific filter. |
| 785 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 785 | + if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) { |
|
| 786 | 786 | /** |
| 787 | 787 | * Filter the datepicker html by individual custom field. |
| 788 | 788 | * |
@@ -790,11 +790,11 @@ discard block |
||
| 790 | 790 | * @param array $cf The custom field array. |
| 791 | 791 | * @since 1.6.6 |
| 792 | 792 | */ |
| 793 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 793 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf); |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // If no html then we run the standard output. |
| 797 | - if(empty($html)) { |
|
| 797 | + if (empty($html)) { |
|
| 798 | 798 | |
| 799 | 799 | ob_start(); // Start buffering; |
| 800 | 800 | $value = geodir_get_cf_value($cf); |
@@ -806,23 +806,23 @@ discard block |
||
| 806 | 806 | $extra_fields['date_format'] = 'yy-mm-dd'; |
| 807 | 807 | |
| 808 | 808 | $date_format = $extra_fields['date_format']; |
| 809 | - $jquery_date_format = $date_format; |
|
| 809 | + $jquery_date_format = $date_format; |
|
| 810 | 810 | |
| 811 | 811 | |
| 812 | 812 | // check if we need to change the format or not |
| 813 | 813 | $date_format_len = strlen(str_replace(' ', '', $date_format)); |
| 814 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 814 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format. |
|
| 815 | 815 | |
| 816 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 817 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 816 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
| 817 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
| 818 | 818 | |
| 819 | 819 | $date_format = str_replace($search, $replace, $date_format); |
| 820 | - }else{ |
|
| 821 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 820 | + } else { |
|
| 821 | + $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format); |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 825 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
| 824 | + if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty |
|
| 825 | + if ($value && !isset($_REQUEST['backandedit'])) { |
|
| 826 | 826 | $time = strtotime($value); |
| 827 | 827 | $value = date_i18n($date_format, $time); |
| 828 | 828 | } |
@@ -832,37 +832,37 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | jQuery(function () { |
| 834 | 834 | |
| 835 | - jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
|
| 835 | + jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php |
|
| 836 | 836 | /** |
| 837 | 837 | * Used to add extra option to datepicker per custom field. |
| 838 | 838 | * |
| 839 | 839 | * @since 1.5.7 |
| 840 | 840 | * @param string $name The custom field name. |
| 841 | 841 | */ |
| 842 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 842 | + echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>}); |
|
| 843 | 843 | |
| 844 | - jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
|
| 844 | + jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>'); |
|
| 845 | 845 | |
| 846 | - <?php if(!empty($value)){?> |
|
| 847 | - jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>"); |
|
| 846 | + <?php if (!empty($value)) {?> |
|
| 847 | + jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>"); |
|
| 848 | 848 | <?php } ?> |
| 849 | 849 | |
| 850 | 850 | }); |
| 851 | 851 | |
| 852 | 852 | </script> |
| 853 | - <div id="<?php echo $name;?>_row" |
|
| 854 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 853 | + <div id="<?php echo $name; ?>_row" |
|
| 854 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 855 | 855 | <label> |
| 856 | 856 | |
| 857 | 857 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 858 | 858 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 859 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 859 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 860 | 860 | </label> |
| 861 | 861 | |
| 862 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 863 | - value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 862 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 863 | + value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 864 | 864 | |
| 865 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 865 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 866 | 866 | <?php if ($cf['is_required']) { ?> |
| 867 | 867 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 868 | 868 | <?php } ?> |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | return $html; |
| 876 | 876 | } |
| 877 | -add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
|
| 877 | +add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2); |
|
| 878 | 878 | |
| 879 | 879 | |
| 880 | 880 | /** |
@@ -886,12 +886,12 @@ discard block |
||
| 886 | 886 | * |
| 887 | 887 | * @return string The html to output for the custom field. |
| 888 | 888 | */ |
| 889 | -function geodir_cfi_time($html,$cf){ |
|
| 889 | +function geodir_cfi_time($html, $cf) { |
|
| 890 | 890 | |
| 891 | 891 | $html_var = $cf['htmlvar_name']; |
| 892 | 892 | |
| 893 | 893 | // Check if there is a custom field specific filter. |
| 894 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 894 | + if (has_filter("geodir_custom_field_input_time_{$html_var}")) { |
|
| 895 | 895 | /** |
| 896 | 896 | * Filter the time html by individual custom field. |
| 897 | 897 | * |
@@ -899,11 +899,11 @@ discard block |
||
| 899 | 899 | * @param array $cf The custom field array. |
| 900 | 900 | * @since 1.6.6 |
| 901 | 901 | */ |
| 902 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 902 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf); |
|
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | // If no html then we run the standard output. |
| 906 | - if(empty($html)) { |
|
| 906 | + if (empty($html)) { |
|
| 907 | 907 | |
| 908 | 908 | ob_start(); // Start buffering; |
| 909 | 909 | $value = geodir_get_cf_value($cf); |
@@ -916,25 +916,25 @@ discard block |
||
| 916 | 916 | <script type="text/javascript"> |
| 917 | 917 | jQuery(document).ready(function () { |
| 918 | 918 | |
| 919 | - jQuery('#<?php echo $name;?>').timepicker({ |
|
| 919 | + jQuery('#<?php echo $name; ?>').timepicker({ |
|
| 920 | 920 | showPeriod: true, |
| 921 | 921 | showLeadingZero: true, |
| 922 | 922 | showPeriod: true, |
| 923 | 923 | }); |
| 924 | 924 | }); |
| 925 | 925 | </script> |
| 926 | - <div id="<?php echo $name;?>_row" |
|
| 927 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 926 | + <div id="<?php echo $name; ?>_row" |
|
| 927 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 928 | 928 | <label> |
| 929 | 929 | |
| 930 | 930 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 931 | 931 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 932 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 932 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 933 | 933 | </label> |
| 934 | - <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
|
| 935 | - id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 934 | + <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" |
|
| 935 | + id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 936 | 936 | |
| 937 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 937 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 938 | 938 | <?php if ($cf['is_required']) { ?> |
| 939 | 939 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 940 | 940 | <?php } ?> |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | return $html; |
| 947 | 947 | } |
| 948 | -add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
|
| 948 | +add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2); |
|
| 949 | 949 | |
| 950 | 950 | |
| 951 | 951 | /** |
@@ -957,12 +957,12 @@ discard block |
||
| 957 | 957 | * |
| 958 | 958 | * @return string The html to output for the custom field. |
| 959 | 959 | */ |
| 960 | -function geodir_cfi_address($html,$cf){ |
|
| 960 | +function geodir_cfi_address($html, $cf) { |
|
| 961 | 961 | |
| 962 | 962 | $html_var = $cf['htmlvar_name']; |
| 963 | 963 | |
| 964 | 964 | // Check if there is a custom field specific filter. |
| 965 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 965 | + if (has_filter("geodir_custom_field_input_address_{$html_var}")) { |
|
| 966 | 966 | /** |
| 967 | 967 | * Filter the address html by individual custom field. |
| 968 | 968 | * |
@@ -970,11 +970,11 @@ discard block |
||
| 970 | 970 | * @param array $cf The custom field array. |
| 971 | 971 | * @since 1.6.6 |
| 972 | 972 | */ |
| 973 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 973 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf); |
|
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | // If no html then we run the standard output. |
| 977 | - if(empty($html)) { |
|
| 977 | + if (empty($html)) { |
|
| 978 | 978 | |
| 979 | 979 | global $gd_session; |
| 980 | 980 | ob_start(); // Start buffering; |
@@ -987,12 +987,12 @@ discard block |
||
| 987 | 987 | $site_title = $cf['site_title']; |
| 988 | 988 | $is_admin = $cf['is_admin']; |
| 989 | 989 | $extra_fields = unserialize($cf['extra_fields']); |
| 990 | - $prefix = $name . '_'; |
|
| 990 | + $prefix = $name.'_'; |
|
| 991 | 991 | |
| 992 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 993 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 992 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address'); |
|
| 993 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code '); |
|
| 994 | 994 | ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
| 995 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 995 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview'); |
|
| 996 | 996 | |
| 997 | 997 | $address = ''; |
| 998 | 998 | $zip = ''; |
@@ -1003,21 +1003,21 @@ discard block |
||
| 1003 | 1003 | |
| 1004 | 1004 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
| 1005 | 1005 | $post = $gd_ses_listing; |
| 1006 | - $address = $post[$prefix . 'address']; |
|
| 1007 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1008 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1009 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1010 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1011 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1006 | + $address = $post[$prefix.'address']; |
|
| 1007 | + $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : ''; |
|
| 1008 | + $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : ''; |
|
| 1009 | + $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : ''; |
|
| 1010 | + $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : ''; |
|
| 1011 | + $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : ''; |
|
| 1012 | 1012 | } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
| 1013 | - $post_info = (array)$post_info; |
|
| 1014 | - |
|
| 1015 | - $address = $post_info[$prefix . 'address']; |
|
| 1016 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1017 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1018 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1019 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1020 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1013 | + $post_info = (array) $post_info; |
|
| 1014 | + |
|
| 1015 | + $address = $post_info[$prefix.'address']; |
|
| 1016 | + $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : ''; |
|
| 1017 | + $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : ''; |
|
| 1018 | + $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : ''; |
|
| 1019 | + $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : ''; |
|
| 1020 | + $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : ''; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | $location = geodir_get_default_location(); |
@@ -1054,16 +1054,16 @@ discard block |
||
| 1054 | 1054 | |
| 1055 | 1055 | ?> |
| 1056 | 1056 | |
| 1057 | - <div id="geodir_<?php echo $prefix . 'address';?>_row" |
|
| 1058 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1057 | + <div id="geodir_<?php echo $prefix.'address'; ?>_row" |
|
| 1058 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1059 | 1059 | <label> |
| 1060 | 1060 | <?php _e($address_title, 'geodirectory'); ?> |
| 1061 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1061 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1062 | 1062 | </label> |
| 1063 | - <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
|
| 1064 | - id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
|
| 1063 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>" |
|
| 1064 | + id="<?php echo $prefix.'address'; ?>" class="geodir_textfield" |
|
| 1065 | 1065 | value="<?php echo esc_attr(stripslashes($address)); ?>"/> |
| 1066 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1066 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1067 | 1067 | <?php if ($is_required) { ?> |
| 1068 | 1068 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1069 | 1069 | <?php } ?> |
@@ -1083,14 +1083,14 @@ discard block |
||
| 1083 | 1083 | |
| 1084 | 1084 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
| 1085 | 1085 | |
| 1086 | - <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
|
| 1086 | + <div id="geodir_<?php echo $prefix.'zip'; ?>_row" |
|
| 1087 | 1087 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
| 1088 | 1088 | <label> |
| 1089 | 1089 | <?php _e($zip_title, 'geodirectory'); ?> |
| 1090 | 1090 | <?php /*if($is_required) echo '<span>*</span>';*/ ?> |
| 1091 | 1091 | </label> |
| 1092 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>" |
|
| 1093 | - id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill" |
|
| 1092 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>" |
|
| 1093 | + id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill" |
|
| 1094 | 1094 | value="<?php echo esc_attr(stripslashes($zip)); ?>"/> |
| 1095 | 1095 | <?php /*if($is_required) {?> |
| 1096 | 1096 | <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span> |
@@ -1100,14 +1100,14 @@ discard block |
||
| 1100 | 1100 | |
| 1101 | 1101 | <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?> |
| 1102 | 1102 | |
| 1103 | - <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1103 | + <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1104 | 1104 | <?php |
| 1105 | 1105 | /** |
| 1106 | 1106 | * Contains add listing page map functions. |
| 1107 | 1107 | * |
| 1108 | 1108 | * @since 1.0.0 |
| 1109 | 1109 | */ |
| 1110 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1110 | + include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1111 | 1111 | if ($lat_lng_blank) { |
| 1112 | 1112 | $lat = ''; |
| 1113 | 1113 | $lng = ''; |
@@ -1118,14 +1118,14 @@ discard block |
||
| 1118 | 1118 | <?php |
| 1119 | 1119 | /* show lat lng */ |
| 1120 | 1120 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1121 | - <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
|
| 1121 | + <div id="geodir_<?php echo $prefix.'latitude'; ?>_row" |
|
| 1122 | 1122 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1123 | 1123 | <label> |
| 1124 | 1124 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1125 | 1125 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1126 | 1126 | </label> |
| 1127 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
|
| 1128 | - id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
|
| 1127 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>" |
|
| 1128 | + id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield" |
|
| 1129 | 1129 | value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/> |
| 1130 | 1130 | <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span> |
| 1131 | 1131 | <?php if ($is_required) { ?> |
@@ -1133,14 +1133,14 @@ discard block |
||
| 1133 | 1133 | <?php } ?> |
| 1134 | 1134 | </div> |
| 1135 | 1135 | |
| 1136 | - <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
|
| 1136 | + <div id="geodir_<?php echo $prefix.'longitude'; ?>_row" |
|
| 1137 | 1137 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1138 | 1138 | <label> |
| 1139 | 1139 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1140 | 1140 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1141 | 1141 | </label> |
| 1142 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
|
| 1143 | - id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
|
| 1142 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>" |
|
| 1143 | + id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield" |
|
| 1144 | 1144 | value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/> |
| 1145 | 1145 | <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span> |
| 1146 | 1146 | <?php if ($is_required) { ?> |
@@ -1150,32 +1150,32 @@ discard block |
||
| 1150 | 1150 | <?php } ?> |
| 1151 | 1151 | |
| 1152 | 1152 | <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?> |
| 1153 | - <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1153 | + <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1154 | 1154 | <label><?php _e($mapview_title, 'geodirectory'); ?></label> |
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1158 | 1158 | class="gd-checkbox" |
| 1159 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1160 | - id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
|
| 1159 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1160 | + id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
|
| 1161 | 1161 | echo 'checked="checked"'; |
| 1162 | 1162 | } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
| 1163 | 1163 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1164 | 1164 | class="gd-checkbox" |
| 1165 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1165 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1166 | 1166 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
| 1167 | 1167 | echo 'checked="checked"'; |
| 1168 | 1168 | } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
| 1169 | 1169 | |
| 1170 | 1170 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1171 | 1171 | class="gd-checkbox" |
| 1172 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1172 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1173 | 1173 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
| 1174 | 1174 | echo 'checked="checked"'; |
| 1175 | 1175 | } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
| 1176 | 1176 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1177 | 1177 | class="gd-checkbox" |
| 1178 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1178 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1179 | 1179 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
| 1180 | 1180 | echo 'checked="checked"'; |
| 1181 | 1181 | } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
| 1188 | 1188 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
| 1189 | 1189 | echo esc_attr($mapzoom); |
| 1190 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1190 | + } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/> |
|
| 1191 | 1191 | <?php } |
| 1192 | 1192 | |
| 1193 | 1193 | $html = ob_get_clean(); |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | |
| 1196 | 1196 | return $html; |
| 1197 | 1197 | } |
| 1198 | -add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
|
| 1198 | +add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2); |
|
| 1199 | 1199 | |
| 1200 | 1200 | |
| 1201 | 1201 | |
@@ -1208,12 +1208,12 @@ discard block |
||
| 1208 | 1208 | * |
| 1209 | 1209 | * @return string The html to output for the custom field. |
| 1210 | 1210 | */ |
| 1211 | -function geodir_cfi_taxonomy($html,$cf){ |
|
| 1211 | +function geodir_cfi_taxonomy($html, $cf) { |
|
| 1212 | 1212 | |
| 1213 | 1213 | $html_var = $cf['htmlvar_name']; |
| 1214 | 1214 | |
| 1215 | 1215 | // Check if there is a custom field specific filter. |
| 1216 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1216 | + if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) { |
|
| 1217 | 1217 | /** |
| 1218 | 1218 | * Filter the taxonomy html by individual custom field. |
| 1219 | 1219 | * |
@@ -1221,11 +1221,11 @@ discard block |
||
| 1221 | 1221 | * @param array $cf The custom field array. |
| 1222 | 1222 | * @since 1.6.6 |
| 1223 | 1223 | */ |
| 1224 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1224 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf); |
|
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | // If no html then we run the standard output. |
| 1228 | - if(empty($html)) { |
|
| 1228 | + if (empty($html)) { |
|
| 1229 | 1229 | |
| 1230 | 1230 | ob_start(); // Start buffering; |
| 1231 | 1231 | $value = geodir_get_cf_value($cf); |
@@ -1240,15 +1240,15 @@ discard block |
||
| 1240 | 1240 | if ($value == $cf['default']) { |
| 1241 | 1241 | $value = ''; |
| 1242 | 1242 | } ?> |
| 1243 | - <div id="<?php echo $name;?>_row" |
|
| 1244 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1243 | + <div id="<?php echo $name; ?>_row" |
|
| 1244 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1245 | 1245 | <label> |
| 1246 | 1246 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1247 | 1247 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1248 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1248 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1249 | 1249 | </label> |
| 1250 | 1250 | |
| 1251 | - <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1251 | + <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1252 | 1252 | <?php |
| 1253 | 1253 | global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
| 1254 | 1254 | |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | |
| 1261 | 1261 | $package_info = array(); |
| 1262 | 1262 | |
| 1263 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1263 | + $package_info = (array) geodir_post_package_info($package_info, $post, $post_type); |
|
| 1264 | 1264 | |
| 1265 | 1265 | if (!empty($package_info)) { |
| 1266 | 1266 | |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | |
| 1290 | 1290 | $catadd_limit = $wpdb->get_var( |
| 1291 | 1291 | $wpdb->prepare( |
| 1292 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1292 | + "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d", |
|
| 1293 | 1293 | array($package_id) |
| 1294 | 1294 | ) |
| 1295 | 1295 | ); |
@@ -1305,13 +1305,13 @@ discard block |
||
| 1305 | 1305 | $required_limit_msg = ''; |
| 1306 | 1306 | if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
| 1307 | 1307 | |
| 1308 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1308 | + $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory'); |
|
| 1309 | 1309 | |
| 1310 | 1310 | } else { |
| 1311 | 1311 | $required_limit_msg = $required_msg; |
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1314 | + echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']" />'; |
|
| 1315 | 1315 | |
| 1316 | 1316 | |
| 1317 | 1317 | if ($cat_display == 'select' || $cat_display == 'multiselect') { |
@@ -1321,11 +1321,11 @@ discard block |
||
| 1321 | 1321 | if ($cat_display == 'multiselect') |
| 1322 | 1322 | $multiple = 'multiple="multiple"'; |
| 1323 | 1323 | |
| 1324 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1324 | + echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">'; |
|
| 1325 | 1325 | |
| 1326 | 1326 | |
| 1327 | 1327 | if ($cat_display == 'select') |
| 1328 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1328 | + echo '<option value="">'.__('Select Category', 'geodirectory').'</option>'; |
|
| 1329 | 1329 | |
| 1330 | 1330 | } |
| 1331 | 1331 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | ?> |
| 1344 | 1344 | </div> |
| 1345 | 1345 | |
| 1346 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1346 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1347 | 1347 | <?php if ($is_required) { ?> |
| 1348 | 1348 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1349 | 1349 | <?php } ?> |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | |
| 1356 | 1356 | return $html; |
| 1357 | 1357 | } |
| 1358 | -add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
|
| 1358 | +add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2); |
|
| 1359 | 1359 | |
| 1360 | 1360 | |
| 1361 | 1361 | /** |
@@ -1367,12 +1367,12 @@ discard block |
||
| 1367 | 1367 | * |
| 1368 | 1368 | * @return string The html to output for the custom field. |
| 1369 | 1369 | */ |
| 1370 | -function geodir_cfi_file($html,$cf){ |
|
| 1370 | +function geodir_cfi_file($html, $cf) { |
|
| 1371 | 1371 | |
| 1372 | 1372 | $html_var = $cf['htmlvar_name']; |
| 1373 | 1373 | |
| 1374 | 1374 | // Check if there is a custom field specific filter. |
| 1375 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1375 | + if (has_filter("geodir_custom_field_input_file_{$html_var}")) { |
|
| 1376 | 1376 | /** |
| 1377 | 1377 | * Filter the file html by individual custom field. |
| 1378 | 1378 | * |
@@ -1380,11 +1380,11 @@ discard block |
||
| 1380 | 1380 | * @param array $cf The custom field array. |
| 1381 | 1381 | * @since 1.6.6 |
| 1382 | 1382 | */ |
| 1383 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1383 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf); |
|
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | // If no html then we run the standard output. |
| 1387 | - if(empty($html)) { |
|
| 1387 | + if (empty($html)) { |
|
| 1388 | 1388 | |
| 1389 | 1389 | ob_start(); // Start buffering; |
| 1390 | 1390 | $value = geodir_get_cf_value($cf); |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | $file_totImg = count($curImages); |
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1431 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1430 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1431 | + $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1432 | 1432 | |
| 1433 | 1433 | ?> |
| 1434 | 1434 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
@@ -1438,13 +1438,13 @@ discard block |
||
| 1438 | 1438 | </h5> <?php */ |
| 1439 | 1439 | ?> |
| 1440 | 1440 | |
| 1441 | - <div id="<?php echo $name;?>_row" |
|
| 1442 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1441 | + <div id="<?php echo $name; ?>_row" |
|
| 1442 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1443 | 1443 | |
| 1444 | 1444 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1445 | 1445 | <label |
| 1446 | 1446 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1447 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1447 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label> |
|
| 1448 | 1448 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1449 | 1449 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1450 | 1450 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/> |
| 1453 | 1453 | <?php if ($allowed_file_types != '') { ?> |
| 1454 | 1454 | <input type="hidden" name="<?php echo $file_id; ?>_allowed_types" |
| 1455 | - id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/> |
|
| 1455 | + id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/> |
|
| 1456 | 1456 | <?php } ?> |
| 1457 | 1457 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 1458 | 1458 | value="<?php if (isset($file_totImg)) { |
@@ -1468,10 +1468,10 @@ discard block |
||
| 1468 | 1468 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
| 1469 | 1469 | ?> |
| 1470 | 1470 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 1471 | - value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
|
| 1471 | + value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>" |
|
| 1472 | 1472 | class="geodir_button" style="margin-top:10px;"/> |
| 1473 | 1473 | <span class="ajaxnonceplu" |
| 1474 | - id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span> |
|
| 1474 | + id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span> |
|
| 1475 | 1475 | <?php if ($file_width && $file_height): ?> |
| 1476 | 1476 | <span class="plupload-resize"></span> |
| 1477 | 1477 | <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span> |
@@ -1491,7 +1491,7 @@ discard block |
||
| 1491 | 1491 | |
| 1492 | 1492 | </div> |
| 1493 | 1493 | </div> |
| 1494 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span> |
|
| 1494 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span> |
|
| 1495 | 1495 | <?php if ($is_required) { ?> |
| 1496 | 1496 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1497 | 1497 | <?php } ?> |
@@ -1504,4 +1504,4 @@ discard block |
||
| 1504 | 1504 | |
| 1505 | 1505 | return $html; |
| 1506 | 1506 | } |
| 1507 | -add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
|
| 1508 | 1507 | \ No newline at end of file |
| 1508 | +add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2); |
|
| 1509 | 1509 | \ No newline at end of file |
@@ -86,26 +86,31 @@ discard block |
||
| 86 | 86 | $value = geodir_get_cf_value($cf); |
| 87 | 87 | $type = $cf['type']; |
| 88 | 88 | //number and float validation $validation_pattern |
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 89 | + if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | 90 | |
| 92 | 91 | //validation |
| 93 | 92 | if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
| 94 | 93 | $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
| 95 | - }else{$validation='';} |
|
| 94 | + } else{$validation='';} |
|
| 96 | 95 | |
| 97 | 96 | // validation message |
| 98 | 97 | if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
| 99 | 98 | $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
| 100 | - }else{$validation_msg='';} |
|
| 99 | + } else{$validation_msg='';} |
|
| 101 | 100 | ?> |
| 102 | 101 | |
| 103 | 102 | <div id="<?php echo $cf['name'];?>_row" |
| 104 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 103 | + class="<?php if ($cf['is_required']) { |
|
| 104 | + echo 'required_field'; |
|
| 105 | +} |
|
| 106 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 105 | 107 | <label> |
| 106 | 108 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | 109 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 108 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 110 | + <?php if ($cf['is_required']) { |
|
| 111 | + echo '<span>*</span>'; |
|
| 112 | +} |
|
| 113 | +?> |
|
| 109 | 114 | </label> |
| 110 | 115 | <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 111 | 116 | value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
@@ -160,11 +165,17 @@ discard block |
||
| 160 | 165 | }?> |
| 161 | 166 | |
| 162 | 167 | <div id="<?php echo $cf['name'];?>_row" |
| 163 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 168 | + class="<?php if ($cf['is_required']) { |
|
| 169 | + echo 'required_field'; |
|
| 170 | +} |
|
| 171 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 164 | 172 | <label> |
| 165 | 173 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | 174 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 167 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 175 | + <?php if ($cf['is_required']) { |
|
| 176 | + echo '<span>*</span>'; |
|
| 177 | +} |
|
| 178 | +?> |
|
| 168 | 179 | </label> |
| 169 | 180 | <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 170 | 181 | value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
@@ -220,11 +231,17 @@ discard block |
||
| 220 | 231 | }?> |
| 221 | 232 | |
| 222 | 233 | <div id="<?php echo $cf['name'];?>_row" |
| 223 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 234 | + class="<?php if ($cf['is_required']) { |
|
| 235 | + echo 'required_field'; |
|
| 236 | +} |
|
| 237 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 224 | 238 | <label> |
| 225 | 239 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | 240 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 227 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 241 | + <?php if ($cf['is_required']) { |
|
| 242 | + echo '<span>*</span>'; |
|
| 243 | +} |
|
| 244 | +?> |
|
| 228 | 245 | </label> |
| 229 | 246 | <input field_type="<?php echo $cf['type'];?>" name="<?php $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 230 | 247 | value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
@@ -280,11 +297,17 @@ discard block |
||
| 280 | 297 | }?> |
| 281 | 298 | |
| 282 | 299 | <div id="<?php echo $cf['name'];?>_row" |
| 283 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 300 | + class="<?php if ($cf['is_required']) { |
|
| 301 | + echo 'required_field'; |
|
| 302 | +} |
|
| 303 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 284 | 304 | <label> |
| 285 | 305 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | 306 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 287 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 307 | + <?php if ($cf['is_required']) { |
|
| 308 | + echo '<span>*</span>'; |
|
| 309 | +} |
|
| 310 | +?> |
|
| 288 | 311 | </label> |
| 289 | 312 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 290 | 313 | value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
@@ -339,11 +362,17 @@ discard block |
||
| 339 | 362 | |
| 340 | 363 | ?> |
| 341 | 364 | <div id="<?php echo $cf['name'];?>_row" |
| 342 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 365 | + class="<?php if ($cf['is_required']) { |
|
| 366 | + echo 'required_field'; |
|
| 367 | +} |
|
| 368 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 343 | 369 | <label> |
| 344 | 370 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | 371 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 346 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 372 | + <?php if ($cf['is_required']) { |
|
| 373 | + echo '<span>*</span>'; |
|
| 374 | +} |
|
| 375 | +?> |
|
| 347 | 376 | </label> |
| 348 | 377 | <?php if ($cf['option_values']) { |
| 349 | 378 | $option_values = geodir_string_values_to_options($cf['option_values'], true); |
@@ -410,11 +439,17 @@ discard block |
||
| 410 | 439 | }?> |
| 411 | 440 | |
| 412 | 441 | <div id="<?php echo $cf['name'];?>_row" |
| 413 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 442 | + class="<?php if ($cf['is_required']) { |
|
| 443 | + echo 'required_field'; |
|
| 444 | +} |
|
| 445 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 414 | 446 | <label> |
| 415 | 447 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 416 | 448 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 417 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 449 | + <?php if ($cf['is_required']) { |
|
| 450 | + echo '<span>*</span>'; |
|
| 451 | +} |
|
| 452 | +?> |
|
| 418 | 453 | </label> |
| 419 | 454 | <?php if ($value != '1') { |
| 420 | 455 | $value = '0'; |
@@ -474,11 +509,17 @@ discard block |
||
| 474 | 509 | ?> |
| 475 | 510 | |
| 476 | 511 | <div id="<?php echo $cf['name'];?>_row" |
| 477 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 512 | + class="<?php if ($cf['is_required']) { |
|
| 513 | + echo 'required_field'; |
|
| 514 | +} |
|
| 515 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 478 | 516 | <label> |
| 479 | 517 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 480 | 518 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 481 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 519 | + <?php if ($cf['is_required']) { |
|
| 520 | + echo '<span>*</span>'; |
|
| 521 | +} |
|
| 522 | +?> |
|
| 482 | 523 | </label><?php |
| 483 | 524 | |
| 484 | 525 | |
@@ -546,11 +587,17 @@ discard block |
||
| 546 | 587 | |
| 547 | 588 | ?> |
| 548 | 589 | <div id="<?php echo $cf['name'];?>_row" |
| 549 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 590 | + class="<?php if ($cf['is_required']) { |
|
| 591 | + echo 'required_field'; |
|
| 592 | +} |
|
| 593 | +?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 550 | 594 | <label> |
| 551 | 595 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 552 | 596 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 553 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 597 | + <?php if ($cf['is_required']) { |
|
| 598 | + echo '<span>*</span>'; |
|
| 599 | +} |
|
| 600 | +?> |
|
| 554 | 601 | </label> |
| 555 | 602 | <?php |
| 556 | 603 | $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
@@ -627,11 +674,17 @@ discard block |
||
| 627 | 674 | } |
| 628 | 675 | ?> |
| 629 | 676 | <div id="<?php echo $cf['name']; ?>_row" |
| 630 | - class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 677 | + class="<?php if ($cf['is_required']) { |
|
| 678 | + echo 'required_field'; |
|
| 679 | +} |
|
| 680 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 631 | 681 | <label> |
| 632 | 682 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 633 | 683 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 634 | - <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 684 | + <?php if ($cf['is_required']) { |
|
| 685 | + echo '<span>*</span>'; |
|
| 686 | +} |
|
| 687 | +?> |
|
| 635 | 688 | </label> |
| 636 | 689 | <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/> |
| 637 | 690 | <?php if ($multi_display == 'select') { ?> |
@@ -738,11 +791,17 @@ discard block |
||
| 738 | 791 | ?> |
| 739 | 792 | |
| 740 | 793 | <div id="<?php echo $cf['name']; ?>_row" |
| 741 | - class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 794 | + class="<?php if ($cf['is_required']) { |
|
| 795 | + echo 'required_field'; |
|
| 796 | +} |
|
| 797 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 742 | 798 | <label> |
| 743 | 799 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 744 | 800 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 745 | - <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 801 | + <?php if ($cf['is_required']) { |
|
| 802 | + echo '<span>*</span>'; |
|
| 803 | +} |
|
| 804 | +?> |
|
| 746 | 805 | </label> |
| 747 | 806 | |
| 748 | 807 | <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> |
@@ -802,8 +861,9 @@ discard block |
||
| 802 | 861 | $extra_fields = unserialize($cf['extra_fields']); |
| 803 | 862 | $name = $cf['name']; |
| 804 | 863 | |
| 805 | - if ($extra_fields['date_format'] == '') |
|
| 806 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 864 | + if ($extra_fields['date_format'] == '') { |
|
| 865 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 866 | + } |
|
| 807 | 867 | |
| 808 | 868 | $date_format = $extra_fields['date_format']; |
| 809 | 869 | $jquery_date_format = $date_format; |
@@ -817,7 +877,7 @@ discard block |
||
| 817 | 877 | $replace = array('d','j','l','m','n','F','Y');//PHP date format |
| 818 | 878 | |
| 819 | 879 | $date_format = str_replace($search, $replace, $date_format); |
| 820 | - }else{ |
|
| 880 | + } else{ |
|
| 821 | 881 | $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
| 822 | 882 | } |
| 823 | 883 | |
@@ -851,12 +911,18 @@ discard block |
||
| 851 | 911 | |
| 852 | 912 | </script> |
| 853 | 913 | <div id="<?php echo $name;?>_row" |
| 854 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 914 | + class="<?php if ($cf['is_required']) { |
|
| 915 | + echo 'required_field'; |
|
| 916 | +} |
|
| 917 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 855 | 918 | <label> |
| 856 | 919 | |
| 857 | 920 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 858 | 921 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 859 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 922 | + <?php if ($cf['is_required']) { |
|
| 923 | + echo '<span>*</span>'; |
|
| 924 | +} |
|
| 925 | +?> |
|
| 860 | 926 | </label> |
| 861 | 927 | |
| 862 | 928 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
@@ -910,8 +976,9 @@ discard block |
||
| 910 | 976 | |
| 911 | 977 | $name = $cf['name']; |
| 912 | 978 | |
| 913 | - if ($value != '') |
|
| 914 | - $value = date('H:i', strtotime($value)); |
|
| 979 | + if ($value != '') { |
|
| 980 | + $value = date('H:i', strtotime($value)); |
|
| 981 | + } |
|
| 915 | 982 | ?> |
| 916 | 983 | <script type="text/javascript"> |
| 917 | 984 | jQuery(document).ready(function () { |
@@ -924,12 +991,18 @@ discard block |
||
| 924 | 991 | }); |
| 925 | 992 | </script> |
| 926 | 993 | <div id="<?php echo $name;?>_row" |
| 927 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 994 | + class="<?php if ($cf['is_required']) { |
|
| 995 | + echo 'required_field'; |
|
| 996 | +} |
|
| 997 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 928 | 998 | <label> |
| 929 | 999 | |
| 930 | 1000 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 931 | 1001 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 932 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 1002 | + <?php if ($cf['is_required']) { |
|
| 1003 | + echo '<span>*</span>'; |
|
| 1004 | +} |
|
| 1005 | +?> |
|
| 933 | 1006 | </label> |
| 934 | 1007 | <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
| 935 | 1008 | id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
@@ -1021,17 +1094,27 @@ discard block |
||
| 1021 | 1094 | } |
| 1022 | 1095 | |
| 1023 | 1096 | $location = geodir_get_default_location(); |
| 1024 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1025 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1026 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1097 | + if (empty($city)) { |
|
| 1098 | + $city = isset($location->city) ? $location->city : ''; |
|
| 1099 | + } |
|
| 1100 | + if (empty($region)) { |
|
| 1101 | + $region = isset($location->region) ? $location->region : ''; |
|
| 1102 | + } |
|
| 1103 | + if (empty($country)) { |
|
| 1104 | + $country = isset($location->country) ? $location->country : ''; |
|
| 1105 | + } |
|
| 1027 | 1106 | |
| 1028 | 1107 | $lat_lng_blank = false; |
| 1029 | 1108 | if (empty($lat) && empty($lng)) { |
| 1030 | 1109 | $lat_lng_blank = true; |
| 1031 | 1110 | } |
| 1032 | 1111 | |
| 1033 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1034 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1112 | + if (empty($lat)) { |
|
| 1113 | + $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1114 | + } |
|
| 1115 | + if (empty($lng)) { |
|
| 1116 | + $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1117 | + } |
|
| 1035 | 1118 | |
| 1036 | 1119 | /** |
| 1037 | 1120 | * Filter the default latitude. |
@@ -1055,10 +1138,16 @@ discard block |
||
| 1055 | 1138 | ?> |
| 1056 | 1139 | |
| 1057 | 1140 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1058 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1141 | + class="<?php if ($is_required) { |
|
| 1142 | + echo 'required_field'; |
|
| 1143 | +} |
|
| 1144 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1059 | 1145 | <label> |
| 1060 | 1146 | <?php _e($address_title, 'geodirectory'); ?> |
| 1061 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1147 | + <?php if ($is_required) { |
|
| 1148 | + echo '<span>*</span>'; |
|
| 1149 | +} |
|
| 1150 | +?> |
|
| 1062 | 1151 | </label> |
| 1063 | 1152 | <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
| 1064 | 1153 | id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
@@ -1119,10 +1208,16 @@ discard block |
||
| 1119 | 1208 | /* show lat lng */ |
| 1120 | 1209 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1121 | 1210 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1122 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
|
| 1211 | + class="<?php if ($is_required) { |
|
| 1212 | + echo 'required_field'; |
|
| 1213 | +} |
|
| 1214 | +?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
|
| 1123 | 1215 | <label> |
| 1124 | 1216 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1125 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1217 | + <?php if ($is_required) { |
|
| 1218 | + echo '<span>*</span>'; |
|
| 1219 | +} |
|
| 1220 | +?> |
|
| 1126 | 1221 | </label> |
| 1127 | 1222 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
| 1128 | 1223 | id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
@@ -1134,10 +1229,16 @@ discard block |
||
| 1134 | 1229 | </div> |
| 1135 | 1230 | |
| 1136 | 1231 | <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
| 1137 | - class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
|
| 1232 | + class="<?php if ($is_required) { |
|
| 1233 | + echo 'required_field'; |
|
| 1234 | +} |
|
| 1235 | +?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
|
| 1138 | 1236 | <label> |
| 1139 | 1237 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1140 | - <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1238 | + <?php if ($is_required) { |
|
| 1239 | + echo '<span>*</span>'; |
|
| 1240 | +} |
|
| 1241 | +?> |
|
| 1141 | 1242 | </label> |
| 1142 | 1243 | <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
| 1143 | 1244 | id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
@@ -1241,11 +1342,17 @@ discard block |
||
| 1241 | 1342 | $value = ''; |
| 1242 | 1343 | } ?> |
| 1243 | 1344 | <div id="<?php echo $name;?>_row" |
| 1244 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1345 | + class="<?php if ($is_required) { |
|
| 1346 | + echo 'required_field'; |
|
| 1347 | +} |
|
| 1348 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1245 | 1349 | <label> |
| 1246 | 1350 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1247 | 1351 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1248 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1352 | + <?php if ($is_required) { |
|
| 1353 | + echo '<span>*</span>'; |
|
| 1354 | +} |
|
| 1355 | +?> |
|
| 1249 | 1356 | </label> |
| 1250 | 1357 | |
| 1251 | 1358 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
@@ -1279,8 +1386,9 @@ discard block |
||
| 1279 | 1386 | $post_cat = implode(",", $post_cat[$name]); |
| 1280 | 1387 | |
| 1281 | 1388 | } else { |
| 1282 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1283 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1389 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 1390 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1391 | + } |
|
| 1284 | 1392 | } |
| 1285 | 1393 | |
| 1286 | 1394 | |
@@ -1318,21 +1426,24 @@ discard block |
||
| 1318 | 1426 | |
| 1319 | 1427 | $cat_display == ''; |
| 1320 | 1428 | $multiple = ''; |
| 1321 | - if ($cat_display == 'multiselect') |
|
| 1322 | - $multiple = 'multiple="multiple"'; |
|
| 1429 | + if ($cat_display == 'multiselect') { |
|
| 1430 | + $multiple = 'multiple="multiple"'; |
|
| 1431 | + } |
|
| 1323 | 1432 | |
| 1324 | 1433 | echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
| 1325 | 1434 | |
| 1326 | 1435 | |
| 1327 | - if ($cat_display == 'select') |
|
| 1328 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1436 | + if ($cat_display == 'select') { |
|
| 1437 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1438 | + } |
|
| 1329 | 1439 | |
| 1330 | 1440 | } |
| 1331 | 1441 | |
| 1332 | 1442 | echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
| 1333 | 1443 | |
| 1334 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1335 | - echo '</select>'; |
|
| 1444 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1445 | + echo '</select>'; |
|
| 1446 | + } |
|
| 1336 | 1447 | |
| 1337 | 1448 | } else { |
| 1338 | 1449 | |
@@ -1404,18 +1515,23 @@ discard block |
||
| 1404 | 1515 | |
| 1405 | 1516 | $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
| 1406 | 1517 | |
| 1407 | - } else |
|
| 1408 | - $file_value = ''; |
|
| 1518 | + } else { |
|
| 1519 | + $file_value = ''; |
|
| 1520 | + } |
|
| 1409 | 1521 | |
| 1410 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1411 | - $file_multiple = true; // allow multiple files upload |
|
| 1412 | - else |
|
| 1413 | - $file_multiple = false; |
|
| 1522 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { |
|
| 1523 | + $file_multiple = true; |
|
| 1524 | + } |
|
| 1525 | + // allow multiple files upload |
|
| 1526 | + else { |
|
| 1527 | + $file_multiple = false; |
|
| 1528 | + } |
|
| 1414 | 1529 | |
| 1415 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1416 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 1417 | - else |
|
| 1418 | - $file_image_limit = 1; |
|
| 1530 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { |
|
| 1531 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 1532 | + } else { |
|
| 1533 | + $file_image_limit = 1; |
|
| 1534 | + } |
|
| 1419 | 1535 | |
| 1420 | 1536 | $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
| 1421 | 1537 | |
@@ -1423,8 +1539,9 @@ discard block |
||
| 1423 | 1539 | |
| 1424 | 1540 | if (!empty($file_value)) { |
| 1425 | 1541 | $curImages = explode(',', $file_value); |
| 1426 | - if (!empty($curImages)) |
|
| 1427 | - $file_totImg = count($curImages); |
|
| 1542 | + if (!empty($curImages)) { |
|
| 1543 | + $file_totImg = count($curImages); |
|
| 1544 | + } |
|
| 1428 | 1545 | } |
| 1429 | 1546 | |
| 1430 | 1547 | $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
@@ -1439,12 +1556,18 @@ discard block |
||
| 1439 | 1556 | ?> |
| 1440 | 1557 | |
| 1441 | 1558 | <div id="<?php echo $name;?>_row" |
| 1442 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1559 | + class="<?php if ($is_required) { |
|
| 1560 | + echo 'required_field'; |
|
| 1561 | +} |
|
| 1562 | +?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1443 | 1563 | |
| 1444 | 1564 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1445 | 1565 | <label |
| 1446 | 1566 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1447 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1567 | + echo $site_title; ?><?php if ($is_required) { |
|
| 1568 | + echo '<span>*</span>'; |
|
| 1569 | + } |
|
| 1570 | + ?></label> |
|
| 1448 | 1571 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1449 | 1572 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1450 | 1573 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -10,52 +10,52 @@ discard block |
||
| 10 | 10 | global $wpdb, $table_prefix; |
| 11 | 11 | |
| 12 | 12 | if (!function_exists('geodir_column_exist')) {
|
| 13 | - /** |
|
| 14 | - * Check table column exist or not. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global object $wpdb WordPress Database object. |
|
| 19 | - * @param string $db The table name. |
|
| 20 | - * @param string $column The column name. |
|
| 21 | - * @return bool If column exists returns true. Otherwise false. |
|
| 22 | - */ |
|
| 23 | - function geodir_column_exist($db, $column) |
|
| 24 | - {
|
|
| 25 | - global $wpdb; |
|
| 26 | - $exists = false; |
|
| 27 | - $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | - foreach ($columns as $c) {
|
|
| 29 | - if ($c == $column) {
|
|
| 30 | - $exists = true; |
|
| 31 | - break; |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - return $exists; |
|
| 35 | - } |
|
| 13 | + /** |
|
| 14 | + * Check table column exist or not. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global object $wpdb WordPress Database object. |
|
| 19 | + * @param string $db The table name. |
|
| 20 | + * @param string $column The column name. |
|
| 21 | + * @return bool If column exists returns true. Otherwise false. |
|
| 22 | + */ |
|
| 23 | + function geodir_column_exist($db, $column) |
|
| 24 | + {
|
|
| 25 | + global $wpdb; |
|
| 26 | + $exists = false; |
|
| 27 | + $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | + foreach ($columns as $c) {
|
|
| 29 | + if ($c == $column) {
|
|
| 30 | + $exists = true; |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + return $exists; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!function_exists('geodir_add_column_if_not_exist')) {
|
| 39 | - /** |
|
| 40 | - * Add column if table column not exist. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * @package GeoDirectory |
|
| 44 | - * @global object $wpdb WordPress Database object. |
|
| 45 | - * @param string $db The table name. |
|
| 46 | - * @param string $column The column name. |
|
| 47 | - * @param string $column_attr The column attributes. |
|
| 48 | - */ |
|
| 49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | - {
|
|
| 51 | - global $wpdb; |
|
| 52 | - $result = 0;// no rows affected |
|
| 53 | - if (!geodir_column_exist($db, $column)) {
|
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | - } |
|
| 57 | - return $result; |
|
| 58 | - } |
|
| 39 | + /** |
|
| 40 | + * Add column if table column not exist. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * @package GeoDirectory |
|
| 44 | + * @global object $wpdb WordPress Database object. |
|
| 45 | + * @param string $db The table name. |
|
| 46 | + * @param string $column The column name. |
|
| 47 | + * @param string $column_attr The column attributes. |
|
| 48 | + */ |
|
| 49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | + {
|
|
| 51 | + global $wpdb; |
|
| 52 | + $result = 0;// no rows affected |
|
| 53 | + if (!geodir_column_exist($db, $column)) {
|
|
| 54 | + if (!empty($db) && !empty($column)) |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | + } |
|
| 57 | + return $result; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -72,705 +72,705 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none') |
| 74 | 74 | {
|
| 75 | - global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | - |
|
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | - |
|
| 79 | - if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | - return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $default_query = ''; |
|
| 84 | - |
|
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query .= " and is_admin = '0' "; |
|
| 89 | - |
|
| 90 | - if ($fields_location == 'none') {
|
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 93 | - $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $post_meta_info = $wpdb->get_results( |
|
| 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",
|
|
| 99 | - array($post_type) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - $return_arr = array(); |
|
| 105 | - if ($post_meta_info) {
|
|
| 106 | - |
|
| 107 | - foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | - |
|
| 109 | - $custom_fields = array( |
|
| 110 | - "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | - "label" => $post_meta_info_obj->clabels, |
|
| 112 | - "default" => $post_meta_info_obj->default_value, |
|
| 113 | - "type" => $post_meta_info_obj->field_type, |
|
| 114 | - "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | - |
|
| 116 | - if ($post_meta_info_obj->field_type) {
|
|
| 117 | - $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | - $custom_fields["options"] = $options; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | - $custom_fields[$key] = $val; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $pricearr = array(); |
|
| 126 | - $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | - |
|
| 128 | - if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | - } elseif ($package_id == '') {
|
|
| 131 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | - |
|
| 137 | - if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | - /** |
|
| 139 | - * Filter the post custom fields array. |
|
| 140 | - * |
|
| 141 | - * @since 1.0.0 |
|
| 142 | - * |
|
| 143 | - * @param array $return_arr Post custom fields array. |
|
| 144 | - * @param int|string $package_id The package ID. |
|
| 145 | - * @param string $post_type Optional. The wordpress post type. |
|
| 146 | - * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | - */ |
|
| 148 | - $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - return $return_arr; |
|
| 75 | + global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | + |
|
| 77 | + $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | + |
|
| 79 | + if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | + return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $default_query = ''; |
|
| 84 | + |
|
| 85 | + if ($default == 'default') |
|
| 86 | + $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | + elseif ($default == 'custom') |
|
| 88 | + $default_query .= " and is_admin = '0' "; |
|
| 89 | + |
|
| 90 | + if ($fields_location == 'none') {
|
|
| 91 | + } else{
|
|
| 92 | + $fields_location = esc_sql( $fields_location ); |
|
| 93 | + $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $post_meta_info = $wpdb->get_results( |
|
| 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",
|
|
| 99 | + array($post_type) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + $return_arr = array(); |
|
| 105 | + if ($post_meta_info) {
|
|
| 106 | + |
|
| 107 | + foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | + |
|
| 109 | + $custom_fields = array( |
|
| 110 | + "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | + "label" => $post_meta_info_obj->clabels, |
|
| 112 | + "default" => $post_meta_info_obj->default_value, |
|
| 113 | + "type" => $post_meta_info_obj->field_type, |
|
| 114 | + "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | + |
|
| 116 | + if ($post_meta_info_obj->field_type) {
|
|
| 117 | + $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | + $custom_fields["options"] = $options; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | + $custom_fields[$key] = $val; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $pricearr = array(); |
|
| 126 | + $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | + |
|
| 128 | + if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | + } elseif ($package_id == '') {
|
|
| 131 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | + |
|
| 137 | + if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | + /** |
|
| 139 | + * Filter the post custom fields array. |
|
| 140 | + * |
|
| 141 | + * @since 1.0.0 |
|
| 142 | + * |
|
| 143 | + * @param array $return_arr Post custom fields array. |
|
| 144 | + * @param int|string $package_id The package ID. |
|
| 145 | + * @param string $post_type Optional. The wordpress post type. |
|
| 146 | + * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | + */ |
|
| 148 | + $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + return $return_arr; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Adds admin html for custom fields. |
|
| 156 | - * |
|
| 157 | - * @since 1.0.0 |
|
| 158 | - * @package GeoDirectory |
|
| 159 | - * @global object $wpdb WordPress Database object. |
|
| 160 | - * @param string $field_type The form field type. |
|
| 161 | - * @param object|int $result_str The custom field results object or row id. |
|
| 162 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | - * @param string $field_type_key The key of the custom field. |
|
| 164 | - */ |
|
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | - {
|
|
| 167 | - global $wpdb; |
|
| 168 | - $cf = $result_str; |
|
| 169 | - if (!is_object($cf)) {
|
|
| 170 | - |
|
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | - |
|
| 173 | - } else {
|
|
| 174 | - $field_info = $cf; |
|
| 175 | - $result_str = $cf->id; |
|
| 176 | - } |
|
| 177 | - /** |
|
| 178 | - * Contains custom field html. |
|
| 179 | - * |
|
| 180 | - * @since 1.0.0 |
|
| 181 | - */ |
|
| 182 | - include('custom_field_html.php');
|
|
| 183 | - |
|
| 184 | - } |
|
| 154 | + /** |
|
| 155 | + * Adds admin html for custom fields. |
|
| 156 | + * |
|
| 157 | + * @since 1.0.0 |
|
| 158 | + * @package GeoDirectory |
|
| 159 | + * @global object $wpdb WordPress Database object. |
|
| 160 | + * @param string $field_type The form field type. |
|
| 161 | + * @param object|int $result_str The custom field results object or row id. |
|
| 162 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | + * @param string $field_type_key The key of the custom field. |
|
| 164 | + */ |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | + {
|
|
| 167 | + global $wpdb; |
|
| 168 | + $cf = $result_str; |
|
| 169 | + if (!is_object($cf)) {
|
|
| 170 | + |
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | + |
|
| 173 | + } else {
|
|
| 174 | + $field_info = $cf; |
|
| 175 | + $result_str = $cf->id; |
|
| 176 | + } |
|
| 177 | + /** |
|
| 178 | + * Contains custom field html. |
|
| 179 | + * |
|
| 180 | + * @since 1.0.0 |
|
| 181 | + */ |
|
| 182 | + include('custom_field_html.php');
|
|
| 183 | + |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | if (!function_exists('geodir_custom_field_delete')) {
|
| 188 | - /** |
|
| 189 | - * Delete custom field using field id. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | - * @package GeoDirectory |
|
| 194 | - * @global object $wpdb WordPress Database object. |
|
| 195 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | - * @param string $field_id The custom field ID. |
|
| 197 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | - */ |
|
| 199 | - function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | - global $wpdb, $plugin_prefix; |
|
| 201 | - |
|
| 202 | - if ($field_id != '') {
|
|
| 203 | - $cf = trim($field_id, '_'); |
|
| 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)));
|
|
| 207 | - |
|
| 208 | - $post_type = $field->post_type; |
|
| 209 | - $htmlvar_name = $field->htmlvar_name; |
|
| 210 | - |
|
| 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)));
|
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Called after a custom field is deleted. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $cf The fields ID. |
|
| 220 | - * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | - * @param string $post_type The post type the field belongs to. |
|
| 222 | - */ |
|
| 223 | - do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | - |
|
| 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`");
|
|
| 235 | - } else {
|
|
| 236 | - if ($field->field_type != 'fieldset') {
|
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - return $field_id; |
|
| 242 | - } else |
|
| 243 | - return 0; |
|
| 244 | - } else |
|
| 245 | - return 0; |
|
| 246 | - } |
|
| 188 | + /** |
|
| 189 | + * Delete custom field using field id. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | + * @package GeoDirectory |
|
| 194 | + * @global object $wpdb WordPress Database object. |
|
| 195 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | + * @param string $field_id The custom field ID. |
|
| 197 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | + */ |
|
| 199 | + function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | + global $wpdb, $plugin_prefix; |
|
| 201 | + |
|
| 202 | + if ($field_id != '') {
|
|
| 203 | + $cf = trim($field_id, '_'); |
|
| 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)));
|
|
| 207 | + |
|
| 208 | + $post_type = $field->post_type; |
|
| 209 | + $htmlvar_name = $field->htmlvar_name; |
|
| 210 | + |
|
| 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)));
|
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Called after a custom field is deleted. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $cf The fields ID. |
|
| 220 | + * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | + * @param string $post_type The post type the field belongs to. |
|
| 222 | + */ |
|
| 223 | + do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | + |
|
| 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`");
|
|
| 235 | + } else {
|
|
| 236 | + if ($field->field_type != 'fieldset') {
|
|
| 237 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + return $field_id; |
|
| 242 | + } else |
|
| 243 | + return 0; |
|
| 244 | + } else |
|
| 245 | + return 0; |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if (!function_exists('geodir_custom_field_save')) {
|
| 250 | - /** |
|
| 251 | - * Save or Update custom fields into the database. |
|
| 252 | - * |
|
| 253 | - * @since 1.0.0 |
|
| 254 | - * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | - * @package GeoDirectory |
|
| 256 | - * @global object $wpdb WordPress Database object. |
|
| 257 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | - * @param array $request_field {
|
|
| 259 | - * Attributes of the request field array. |
|
| 260 | - * |
|
| 261 | - * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | - * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | - * @type string $create_field Create field Default "true". |
|
| 264 | - * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | - * @type string $_wpnonce WP nonce value. |
|
| 266 | - * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | - * @type string $field_type Field type Example "radio". |
|
| 268 | - * @type string $field_id Field id Example "12". |
|
| 269 | - * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | - * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | - * @type array $show_on_pkg Package list to display this field. |
|
| 272 | - * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | - * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | - * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | - * @type string $clabels Section Title which will appear in backend. |
|
| 277 | - * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | - * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | - * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | - * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | - * @type string $is_required Use "1" to set field as required. |
|
| 282 | - * @type string $required_msg Enter text for error message if field required and have not full fill requirment. |
|
| 283 | - * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | - * @type string $show_in What locations to show the custom field in. |
|
| 285 | - * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | - * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | - * @type string $option_values Option Values should be separated by comma. |
|
| 288 | - * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | - * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | - * |
|
| 291 | - * } |
|
| 292 | - * @param bool $default Not yet implemented. |
|
| 293 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 294 | - */ |
|
| 295 | - function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 296 | - {
|
|
| 297 | - |
|
| 298 | - global $wpdb, $plugin_prefix; |
|
| 299 | - |
|
| 300 | - $old_html_variable = ''; |
|
| 301 | - |
|
| 302 | - $data_type = trim($request_field['data_type']); |
|
| 303 | - |
|
| 304 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 305 | - |
|
| 306 | - // some servers fail if a POST value is VARCHAR so we change it. |
|
| 307 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | - $request_field['data_type'] = 'VARCHAR'; |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - $cf = trim($result_str, '_'); |
|
| 312 | - |
|
| 313 | - |
|
| 314 | - /*-------- check dublicate validation --------*/ |
|
| 315 | - |
|
| 316 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 317 | - $post_type = $request_field['listing_type']; |
|
| 318 | - |
|
| 319 | - if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - $check_html_variable = $wpdb->get_var( |
|
| 324 | - $wpdb->prepare( |
|
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | - array($cf, $cehhtmlvar_name, $post_type) |
|
| 327 | - ) |
|
| 328 | - ); |
|
| 329 | - |
|
| 330 | - |
|
| 331 | - if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 332 | - |
|
| 333 | - if ($cf != '') {
|
|
| 334 | - |
|
| 335 | - $post_meta_info = $wpdb->get_row( |
|
| 336 | - $wpdb->prepare( |
|
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | - array($cf) |
|
| 339 | - ) |
|
| 340 | - ); |
|
| 341 | - |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - if (!empty($post_meta_info)) {
|
|
| 345 | - $post_val = $post_meta_info; |
|
| 346 | - $old_html_variable = $post_val->htmlvar_name; |
|
| 347 | - |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - |
|
| 351 | - |
|
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 353 | - |
|
| 354 | - |
|
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | - |
|
| 357 | - $admin_title = $request_field['admin_title']; |
|
| 358 | - $site_title = $request_field['site_title']; |
|
| 359 | - $data_type = $request_field['data_type']; |
|
| 360 | - $field_type = $request_field['field_type']; |
|
| 361 | - $field_type_key = $request_field['field_type_key']; |
|
| 362 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 363 | - $admin_desc = $request_field['admin_desc']; |
|
| 364 | - $clabels = $request_field['clabels']; |
|
| 365 | - $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 366 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 367 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 368 | - $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 369 | - $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 370 | - $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 371 | - $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 372 | - $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 373 | - $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 374 | - $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 375 | - $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 376 | - $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 377 | - $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 378 | - $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 379 | - $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 380 | - $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 250 | + /** |
|
| 251 | + * Save or Update custom fields into the database. |
|
| 252 | + * |
|
| 253 | + * @since 1.0.0 |
|
| 254 | + * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | + * @package GeoDirectory |
|
| 256 | + * @global object $wpdb WordPress Database object. |
|
| 257 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | + * @param array $request_field {
|
|
| 259 | + * Attributes of the request field array. |
|
| 260 | + * |
|
| 261 | + * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | + * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | + * @type string $create_field Create field Default "true". |
|
| 264 | + * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | + * @type string $_wpnonce WP nonce value. |
|
| 266 | + * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | + * @type string $field_type Field type Example "radio". |
|
| 268 | + * @type string $field_id Field id Example "12". |
|
| 269 | + * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | + * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | + * @type array $show_on_pkg Package list to display this field. |
|
| 272 | + * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | + * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | + * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | + * @type string $clabels Section Title which will appear in backend. |
|
| 277 | + * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | + * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | + * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | + * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | + * @type string $is_required Use "1" to set field as required. |
|
| 282 | + * @type string $required_msg Enter text for error message if field required and have not full fill requirment. |
|
| 283 | + * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | + * @type string $show_in What locations to show the custom field in. |
|
| 285 | + * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | + * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | + * @type string $option_values Option Values should be separated by comma. |
|
| 288 | + * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | + * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | + * |
|
| 291 | + * } |
|
| 292 | + * @param bool $default Not yet implemented. |
|
| 293 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 294 | + */ |
|
| 295 | + function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 296 | + {
|
|
| 297 | + |
|
| 298 | + global $wpdb, $plugin_prefix; |
|
| 299 | + |
|
| 300 | + $old_html_variable = ''; |
|
| 301 | + |
|
| 302 | + $data_type = trim($request_field['data_type']); |
|
| 303 | + |
|
| 304 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 305 | + |
|
| 306 | + // some servers fail if a POST value is VARCHAR so we change it. |
|
| 307 | + if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + $request_field['data_type'] = 'VARCHAR'; |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + $cf = trim($result_str, '_'); |
|
| 312 | + |
|
| 313 | + |
|
| 314 | + /*-------- check dublicate validation --------*/ |
|
| 315 | + |
|
| 316 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 317 | + $post_type = $request_field['listing_type']; |
|
| 318 | + |
|
| 319 | + if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 320 | + $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + $check_html_variable = $wpdb->get_var( |
|
| 324 | + $wpdb->prepare( |
|
| 325 | + "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + array($cf, $cehhtmlvar_name, $post_type) |
|
| 327 | + ) |
|
| 328 | + ); |
|
| 329 | + |
|
| 330 | + |
|
| 331 | + if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 332 | + |
|
| 333 | + if ($cf != '') {
|
|
| 334 | + |
|
| 335 | + $post_meta_info = $wpdb->get_row( |
|
| 336 | + $wpdb->prepare( |
|
| 337 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + array($cf) |
|
| 339 | + ) |
|
| 340 | + ); |
|
| 341 | + |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + if (!empty($post_meta_info)) {
|
|
| 345 | + $post_val = $post_meta_info; |
|
| 346 | + $old_html_variable = $post_val->htmlvar_name; |
|
| 347 | + |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + |
|
| 351 | + |
|
| 352 | + if ($post_type == '') $post_type = 'gd_place'; |
|
| 353 | + |
|
| 354 | + |
|
| 355 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | + |
|
| 357 | + $admin_title = $request_field['admin_title']; |
|
| 358 | + $site_title = $request_field['site_title']; |
|
| 359 | + $data_type = $request_field['data_type']; |
|
| 360 | + $field_type = $request_field['field_type']; |
|
| 361 | + $field_type_key = $request_field['field_type_key']; |
|
| 362 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 363 | + $admin_desc = $request_field['admin_desc']; |
|
| 364 | + $clabels = $request_field['clabels']; |
|
| 365 | + $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 366 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 367 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 368 | + $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 369 | + $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 370 | + $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 371 | + $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 372 | + $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 373 | + $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 374 | + $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 375 | + $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 376 | + $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 377 | + $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 378 | + $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 379 | + $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 380 | + $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 381 | 381 | |
| 382 | 382 | |
| 383 | - if(is_array($show_in)){
|
|
| 384 | - $show_in = implode(",", $request_field['show_in']);
|
|
| 385 | - } |
|
| 383 | + if(is_array($show_in)){
|
|
| 384 | + $show_in = implode(",", $request_field['show_in']);
|
|
| 385 | + } |
|
| 386 | 386 | |
| 387 | - if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 388 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | - } |
|
| 387 | + if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 388 | + $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | + } |
|
| 390 | 390 | |
| 391 | - $option_values = ''; |
|
| 392 | - if (isset($request_field['option_values'])) |
|
| 393 | - $option_values = $request_field['option_values']; |
|
| 391 | + $option_values = ''; |
|
| 392 | + if (isset($request_field['option_values'])) |
|
| 393 | + $option_values = $request_field['option_values']; |
|
| 394 | 394 | |
| 395 | - $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 395 | + $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 396 | 396 | |
| 397 | - $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 397 | + $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 398 | 398 | |
| 399 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 400 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 401 | - else {
|
|
| 402 | - $package_info = array(); |
|
| 399 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 400 | + $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 401 | + else {
|
|
| 402 | + $package_info = array(); |
|
| 403 | 403 | |
| 404 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 405 | - $price_pkg = $package_info->pid; |
|
| 406 | - } |
|
| 404 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 405 | + $price_pkg = $package_info->pid; |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | 408 | |
| 409 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 410 | - $extra_fields = $request_field['extra']; |
|
| 409 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 410 | + $extra_fields = $request_field['extra']; |
|
| 411 | 411 | |
| 412 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 413 | - $is_default = $request_field['is_default']; |
|
| 414 | - else |
|
| 415 | - $is_default = '0'; |
|
| 412 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 413 | + $is_default = $request_field['is_default']; |
|
| 414 | + else |
|
| 415 | + $is_default = '0'; |
|
| 416 | 416 | |
| 417 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 418 | - $is_admin = $request_field['is_admin']; |
|
| 419 | - else |
|
| 420 | - $is_admin = '0'; |
|
| 417 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 418 | + $is_admin = $request_field['is_admin']; |
|
| 419 | + else |
|
| 420 | + $is_admin = '0'; |
|
| 421 | 421 | |
| 422 | 422 | |
| 423 | - if ($is_active == '') $is_active = 1; |
|
| 424 | - if ($is_required == '') $is_required = 0; |
|
| 423 | + if ($is_active == '') $is_active = 1; |
|
| 424 | + if ($is_required == '') $is_required = 0; |
|
| 425 | 425 | |
| 426 | 426 | |
| 427 | - if ($sort_order == '') {
|
|
| 427 | + if ($sort_order == '') {
|
|
| 428 | 428 | |
| 429 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 429 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | 430 | |
| 431 | - $sort_order = (int)$last_order + 1; |
|
| 432 | - } |
|
| 431 | + $sort_order = (int)$last_order + 1; |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | - $default_value_add = ''; |
|
| 434 | + $default_value_add = ''; |
|
| 435 | 435 | |
| 436 | 436 | |
| 437 | - if (!empty($post_meta_info)) {
|
|
| 438 | - switch ($field_type): |
|
| 437 | + if (!empty($post_meta_info)) {
|
|
| 438 | + switch ($field_type): |
|
| 439 | 439 | |
| 440 | - case 'address': |
|
| 440 | + case 'address': |
|
| 441 | 441 | |
| 442 | - if ($htmlvar_name != '') {
|
|
| 443 | - $prefix = $htmlvar_name . '_'; |
|
| 444 | - } |
|
| 445 | - $old_prefix = $old_html_variable . '_'; |
|
| 442 | + if ($htmlvar_name != '') {
|
|
| 443 | + $prefix = $htmlvar_name . '_'; |
|
| 444 | + } |
|
| 445 | + $old_prefix = $old_html_variable . '_'; |
|
| 446 | 446 | |
| 447 | 447 | |
| 448 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 448 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | 449 | |
| 450 | - if ($default_value != '') {
|
|
| 451 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | - } |
|
| 450 | + if ($default_value != '') {
|
|
| 451 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - $wpdb->query($meta_field_add); |
|
| 454 | + $wpdb->query($meta_field_add); |
|
| 455 | 455 | |
| 456 | - if ($extra_fields != '') {
|
|
| 456 | + if ($extra_fields != '') {
|
|
| 457 | 457 | |
| 458 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 458 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 459 | 459 | |
| 460 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | - if ($is_column) {
|
|
| 462 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 460 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | + if ($is_column) {
|
|
| 462 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 463 | 463 | |
| 464 | - if ($default_value != '') {
|
|
| 465 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | - } |
|
| 464 | + if ($default_value != '') {
|
|
| 465 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - $wpdb->query($meta_field_add); |
|
| 469 | - } else {
|
|
| 468 | + $wpdb->query($meta_field_add); |
|
| 469 | + } else {
|
|
| 470 | 470 | |
| 471 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 472 | - if ($default_value != '') {
|
|
| 473 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | - } |
|
| 475 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 471 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 472 | + if ($default_value != '') {
|
|
| 473 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | + } |
|
| 475 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 476 | 476 | |
| 477 | - } |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | 479 | |
| 480 | - } |
|
| 480 | + } |
|
| 481 | 481 | |
| 482 | 482 | |
| 483 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 483 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 484 | 484 | |
| 485 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 485 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | 486 | |
| 487 | - if ($is_column) {
|
|
| 488 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 487 | + if ($is_column) {
|
|
| 488 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 489 | 489 | |
| 490 | - if ($default_value != '') {
|
|
| 491 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | - } |
|
| 490 | + if ($default_value != '') {
|
|
| 491 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | + } |
|
| 493 | 493 | |
| 494 | - $wpdb->query($meta_field_add); |
|
| 495 | - } else {
|
|
| 496 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 497 | - if ($default_value != '') {
|
|
| 498 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | - } |
|
| 494 | + $wpdb->query($meta_field_add); |
|
| 495 | + } else {
|
|
| 496 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 497 | + if ($default_value != '') {
|
|
| 498 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | - } |
|
| 501 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | - } |
|
| 505 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 504 | + } |
|
| 505 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 506 | 506 | |
| 507 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 507 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | 508 | |
| 509 | - if ($is_column) {
|
|
| 509 | + if ($is_column) {
|
|
| 510 | 510 | |
| 511 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 511 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | 512 | |
| 513 | - if ($default_value != '') {
|
|
| 514 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | - } |
|
| 513 | + if ($default_value != '') {
|
|
| 514 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | - $wpdb->query($meta_field_add); |
|
| 518 | - } else {
|
|
| 517 | + $wpdb->query($meta_field_add); |
|
| 518 | + } else {
|
|
| 519 | 519 | |
| 520 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 521 | - if ($default_value != '') {
|
|
| 522 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | - } |
|
| 520 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 521 | + if ($default_value != '') {
|
|
| 522 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | + } |
|
| 524 | 524 | |
| 525 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 525 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | 526 | |
| 527 | - } |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | - } |
|
| 530 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 529 | + } |
|
| 530 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 531 | 531 | |
| 532 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 532 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | 533 | |
| 534 | - if ($is_column) {
|
|
| 534 | + if ($is_column) {
|
|
| 535 | 535 | |
| 536 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 536 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | 537 | |
| 538 | - if ($default_value != '') {
|
|
| 539 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | - } |
|
| 538 | + if ($default_value != '') {
|
|
| 539 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | + } |
|
| 541 | 541 | |
| 542 | - $wpdb->query($meta_field_add); |
|
| 543 | - } else {
|
|
| 542 | + $wpdb->query($meta_field_add); |
|
| 543 | + } else {
|
|
| 544 | 544 | |
| 545 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 546 | - if ($default_value != '') {
|
|
| 547 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | - } |
|
| 545 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 546 | + if ($default_value != '') {
|
|
| 547 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | + } |
|
| 549 | 549 | |
| 550 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 550 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | 551 | |
| 552 | - } |
|
| 552 | + } |
|
| 553 | 553 | |
| 554 | - } |
|
| 555 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 554 | + } |
|
| 555 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 556 | 556 | |
| 557 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | - if ($is_column) {
|
|
| 557 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | + if ($is_column) {
|
|
| 559 | 559 | |
| 560 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 560 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | 561 | |
| 562 | - if ($default_value != '') {
|
|
| 563 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | - } |
|
| 562 | + if ($default_value != '') {
|
|
| 563 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | - $wpdb->query($meta_field_add); |
|
| 567 | - } else {
|
|
| 566 | + $wpdb->query($meta_field_add); |
|
| 567 | + } else {
|
|
| 568 | 568 | |
| 569 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 571 | - if ($default_value != '') {
|
|
| 572 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | - } |
|
| 569 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 571 | + if ($default_value != '') {
|
|
| 572 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 575 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | 576 | |
| 577 | - } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | 579 | |
| 580 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 580 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | 581 | |
| 582 | - if ($is_column) {
|
|
| 583 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 582 | + if ($is_column) {
|
|
| 583 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | 584 | |
| 585 | - if ($default_value != '') {
|
|
| 586 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | - } |
|
| 585 | + if ($default_value != '') {
|
|
| 586 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | - $wpdb->query($meta_field_add); |
|
| 590 | - } else {
|
|
| 589 | + $wpdb->query($meta_field_add); |
|
| 590 | + } else {
|
|
| 591 | 591 | |
| 592 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 594 | - if ($default_value != '') {
|
|
| 595 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | - } |
|
| 592 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 594 | + if ($default_value != '') {
|
|
| 595 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | - } |
|
| 598 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | + } |
|
| 600 | 600 | |
| 601 | - } |
|
| 602 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 601 | + } |
|
| 602 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 603 | 603 | |
| 604 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 604 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | 605 | |
| 606 | - if ($is_column) {
|
|
| 607 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 606 | + if ($is_column) {
|
|
| 607 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | 608 | |
| 609 | - if ($default_value != '') {
|
|
| 610 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | - } |
|
| 609 | + if ($default_value != '') {
|
|
| 610 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | + } |
|
| 612 | 612 | |
| 613 | - $wpdb->query($meta_field_add); |
|
| 614 | - } else {
|
|
| 613 | + $wpdb->query($meta_field_add); |
|
| 614 | + } else {
|
|
| 615 | 615 | |
| 616 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 616 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | 617 | |
| 618 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 619 | - if ($default_value != '') {
|
|
| 620 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | - } |
|
| 618 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 619 | + if ($default_value != '') {
|
|
| 620 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | + } |
|
| 622 | 622 | |
| 623 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | - } |
|
| 623 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | + } |
|
| 625 | 625 | |
| 626 | 626 | |
| 627 | - } |
|
| 628 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 627 | + } |
|
| 628 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 629 | 629 | |
| 630 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | - if ($is_column) {
|
|
| 632 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 630 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | + if ($is_column) {
|
|
| 632 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | 633 | |
| 634 | - if ($default_value != '') {
|
|
| 635 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | - } |
|
| 634 | + if ($default_value != '') {
|
|
| 635 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | + } |
|
| 637 | 637 | |
| 638 | - $wpdb->query($meta_field_add); |
|
| 638 | + $wpdb->query($meta_field_add); |
|
| 639 | 639 | |
| 640 | - } else {
|
|
| 640 | + } else {
|
|
| 641 | 641 | |
| 642 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 642 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | 643 | |
| 644 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 645 | - if ($default_value != '') {
|
|
| 646 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | - } |
|
| 644 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 645 | + if ($default_value != '') {
|
|
| 646 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | + } |
|
| 648 | 648 | |
| 649 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | - } |
|
| 649 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | + } |
|
| 651 | 651 | |
| 652 | - } |
|
| 653 | - // show lat lng |
|
| 654 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 655 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 652 | + } |
|
| 653 | + // show lat lng |
|
| 654 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 655 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 656 | 656 | |
| 657 | - if ($is_column) {
|
|
| 658 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 657 | + if ($is_column) {
|
|
| 658 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 660 | 660 | |
| 661 | - $wpdb->query($meta_field_add); |
|
| 662 | - } else {
|
|
| 663 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 661 | + $wpdb->query($meta_field_add); |
|
| 662 | + } else {
|
|
| 663 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | 664 | |
| 665 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 666 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 665 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 666 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 667 | 667 | |
| 668 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | - } |
|
| 668 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | + } |
|
| 670 | 670 | |
| 671 | - } |
|
| 672 | - }// end extra |
|
| 671 | + } |
|
| 672 | + }// end extra |
|
| 673 | 673 | |
| 674 | - break; |
|
| 674 | + break; |
|
| 675 | 675 | |
| 676 | - case 'checkbox': |
|
| 677 | - case 'multiselect': |
|
| 678 | - case 'select': |
|
| 679 | - case 'taxonomy': |
|
| 676 | + case 'checkbox': |
|
| 677 | + case 'multiselect': |
|
| 678 | + case 'select': |
|
| 679 | + case 'taxonomy': |
|
| 680 | 680 | |
| 681 | - $op_size = '500'; |
|
| 681 | + $op_size = '500'; |
|
| 682 | 682 | |
| 683 | - // only make the field as big as it needs to be. |
|
| 684 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 685 | - $option_values_arr = explode(',',$option_values);
|
|
| 686 | - if(is_array($option_values_arr)){
|
|
| 687 | - $op_max = 0; |
|
| 688 | - foreach($option_values_arr as $op_val){
|
|
| 689 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 690 | - } |
|
| 691 | - if($op_max){$op_size =$op_max; }
|
|
| 692 | - } |
|
| 693 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 694 | - if(strlen($option_values)){
|
|
| 695 | - $op_size = strlen($option_values); |
|
| 696 | - } |
|
| 697 | - } |
|
| 683 | + // only make the field as big as it needs to be. |
|
| 684 | + if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 685 | + $option_values_arr = explode(',',$option_values);
|
|
| 686 | + if(is_array($option_values_arr)){
|
|
| 687 | + $op_max = 0; |
|
| 688 | + foreach($option_values_arr as $op_val){
|
|
| 689 | + if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 690 | + } |
|
| 691 | + if($op_max){$op_size =$op_max; }
|
|
| 692 | + } |
|
| 693 | + }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 694 | + if(strlen($option_values)){
|
|
| 695 | + $op_size = strlen($option_values); |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | 698 | |
| 699 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 699 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | 700 | |
| 701 | - if ($default_value != '') {
|
|
| 702 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 703 | - } |
|
| 701 | + if ($default_value != '') {
|
|
| 702 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 703 | + } |
|
| 704 | 704 | |
| 705 | - $alter_result = $wpdb->query($meta_field_add); |
|
| 706 | - if($alter_result===false){
|
|
| 707 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 708 | - } |
|
| 705 | + $alter_result = $wpdb->query($meta_field_add); |
|
| 706 | + if($alter_result===false){
|
|
| 707 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 708 | + } |
|
| 709 | 709 | |
| 710 | - if (isset($request_field['cat_display_type'])) |
|
| 711 | - $extra_fields = $request_field['cat_display_type']; |
|
| 710 | + if (isset($request_field['cat_display_type'])) |
|
| 711 | + $extra_fields = $request_field['cat_display_type']; |
|
| 712 | 712 | |
| 713 | - if (isset($request_field['multi_display_type'])) |
|
| 714 | - $extra_fields = $request_field['multi_display_type']; |
|
| 713 | + if (isset($request_field['multi_display_type'])) |
|
| 714 | + $extra_fields = $request_field['multi_display_type']; |
|
| 715 | 715 | |
| 716 | 716 | |
| 717 | - break; |
|
| 717 | + break; |
|
| 718 | 718 | |
| 719 | - case 'textarea': |
|
| 720 | - case 'html': |
|
| 721 | - case 'url': |
|
| 722 | - case 'file': |
|
| 719 | + case 'textarea': |
|
| 720 | + case 'html': |
|
| 721 | + case 'url': |
|
| 722 | + case 'file': |
|
| 723 | 723 | |
| 724 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 725 | - if($alter_result===false){
|
|
| 726 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 727 | - } |
|
| 728 | - if (isset($request_field['advanced_editor'])) |
|
| 729 | - $extra_fields = $request_field['advanced_editor']; |
|
| 730 | - |
|
| 731 | - break; |
|
| 724 | + $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 725 | + if($alter_result===false){
|
|
| 726 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 727 | + } |
|
| 728 | + if (isset($request_field['advanced_editor'])) |
|
| 729 | + $extra_fields = $request_field['advanced_editor']; |
|
| 730 | + |
|
| 731 | + break; |
|
| 732 | 732 | |
| 733 | - case 'fieldset': |
|
| 734 | - // Nothig happend for fieldset |
|
| 735 | - break; |
|
| 733 | + case 'fieldset': |
|
| 734 | + // Nothig happend for fieldset |
|
| 735 | + break; |
|
| 736 | 736 | |
| 737 | - default: |
|
| 738 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 739 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 740 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 741 | - } else {
|
|
| 742 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 743 | - } |
|
| 744 | - |
|
| 745 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 746 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | - } |
|
| 748 | - } else {
|
|
| 749 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 750 | - if ($default_value != '') {
|
|
| 751 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 752 | - } |
|
| 753 | - } |
|
| 754 | - |
|
| 755 | - $alter_result = $wpdb->query($default_value_add); |
|
| 756 | - if($alter_result===false){
|
|
| 757 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 758 | - } |
|
| 759 | - break; |
|
| 760 | - endswitch; |
|
| 761 | - |
|
| 762 | - $extra_field_query = ''; |
|
| 763 | - if (!empty($extra_fields)) {
|
|
| 764 | - $extra_field_query = serialize($extra_fields); |
|
| 765 | - } |
|
| 766 | - |
|
| 767 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 768 | - |
|
| 769 | - $wpdb->query( |
|
| 770 | - |
|
| 771 | - $wpdb->prepare( |
|
| 772 | - |
|
| 773 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 737 | + default: |
|
| 738 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 739 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 740 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 741 | + } else {
|
|
| 742 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 743 | + } |
|
| 744 | + |
|
| 745 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 746 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | + } |
|
| 748 | + } else {
|
|
| 749 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 750 | + if ($default_value != '') {
|
|
| 751 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 752 | + } |
|
| 753 | + } |
|
| 754 | + |
|
| 755 | + $alter_result = $wpdb->query($default_value_add); |
|
| 756 | + if($alter_result===false){
|
|
| 757 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 758 | + } |
|
| 759 | + break; |
|
| 760 | + endswitch; |
|
| 761 | + |
|
| 762 | + $extra_field_query = ''; |
|
| 763 | + if (!empty($extra_fields)) {
|
|
| 764 | + $extra_field_query = serialize($extra_fields); |
|
| 765 | + } |
|
| 766 | + |
|
| 767 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 768 | + |
|
| 769 | + $wpdb->query( |
|
| 770 | + |
|
| 771 | + $wpdb->prepare( |
|
| 772 | + |
|
| 773 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 774 | 774 | post_type = %s, |
| 775 | 775 | admin_title = %s, |
| 776 | 776 | site_title = %s, |
@@ -804,308 +804,308 @@ discard block |
||
| 804 | 804 | for_admin_use = %s |
| 805 | 805 | where id = %d", |
| 806 | 806 | |
| 807 | - 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) |
|
| 808 | - ) |
|
| 807 | + 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) |
|
| 808 | + ) |
|
| 809 | 809 | |
| 810 | - ); |
|
| 810 | + ); |
|
| 811 | 811 | |
| 812 | - $lastid = trim($cf); |
|
| 812 | + $lastid = trim($cf); |
|
| 813 | 813 | |
| 814 | 814 | |
| 815 | - $wpdb->query( |
|
| 816 | - $wpdb->prepare( |
|
| 817 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 815 | + $wpdb->query( |
|
| 816 | + $wpdb->prepare( |
|
| 817 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 818 | 818 | site_title=%s |
| 819 | 819 | where post_type = %s and htmlvar_name = %s", |
| 820 | - array($site_title, $post_type, $htmlvar_name) |
|
| 821 | - ) |
|
| 822 | - ); |
|
| 823 | - |
|
| 824 | - |
|
| 825 | - if ($cat_sort == '') |
|
| 826 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | - |
|
| 828 | - |
|
| 829 | - /** |
|
| 830 | - * Called after all custom fields are saved for a post. |
|
| 831 | - * |
|
| 832 | - * @since 1.0.0 |
|
| 833 | - * @param int $lastid The post ID. |
|
| 834 | - */ |
|
| 835 | - do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 836 | - |
|
| 837 | - } else {
|
|
| 838 | - |
|
| 839 | - switch ($field_type): |
|
| 840 | - |
|
| 841 | - case 'address': |
|
| 842 | - |
|
| 843 | - $data_type = ''; |
|
| 844 | - |
|
| 845 | - if ($htmlvar_name != '') {
|
|
| 846 | - $prefix = $htmlvar_name . '_'; |
|
| 847 | - } |
|
| 848 | - $old_prefix = $old_html_variable; |
|
| 849 | - |
|
| 850 | - //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 851 | - |
|
| 852 | - $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 853 | - if ($default_value != '') {
|
|
| 854 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 855 | - } |
|
| 856 | - |
|
| 857 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 858 | - //$wpdb->query($meta_field_add); |
|
| 859 | - |
|
| 860 | - |
|
| 861 | - if (!empty($extra_fields)) {
|
|
| 820 | + array($site_title, $post_type, $htmlvar_name) |
|
| 821 | + ) |
|
| 822 | + ); |
|
| 823 | + |
|
| 824 | + |
|
| 825 | + if ($cat_sort == '') |
|
| 826 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | + |
|
| 828 | + |
|
| 829 | + /** |
|
| 830 | + * Called after all custom fields are saved for a post. |
|
| 831 | + * |
|
| 832 | + * @since 1.0.0 |
|
| 833 | + * @param int $lastid The post ID. |
|
| 834 | + */ |
|
| 835 | + do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 836 | + |
|
| 837 | + } else {
|
|
| 838 | + |
|
| 839 | + switch ($field_type): |
|
| 840 | + |
|
| 841 | + case 'address': |
|
| 842 | + |
|
| 843 | + $data_type = ''; |
|
| 844 | + |
|
| 845 | + if ($htmlvar_name != '') {
|
|
| 846 | + $prefix = $htmlvar_name . '_'; |
|
| 847 | + } |
|
| 848 | + $old_prefix = $old_html_variable; |
|
| 849 | + |
|
| 850 | + //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 851 | + |
|
| 852 | + $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 853 | + if ($default_value != '') {
|
|
| 854 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 858 | + //$wpdb->query($meta_field_add); |
|
| 859 | + |
|
| 860 | + |
|
| 861 | + if (!empty($extra_fields)) {
|
|
| 862 | 862 | |
| 863 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 864 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 865 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 866 | - if ($default_value != '') {
|
|
| 867 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 868 | - } |
|
| 869 | - |
|
| 870 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 871 | - //$wpdb->query($meta_field_add); |
|
| 872 | - } |
|
| 873 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 874 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 875 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 876 | - if ($default_value != '') {
|
|
| 877 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | - } |
|
| 879 | - |
|
| 880 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 881 | - //$wpdb->query($meta_field_add); |
|
| 882 | - } |
|
| 883 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 884 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 885 | - |
|
| 886 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 887 | - if ($default_value != '') {
|
|
| 888 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 889 | - } |
|
| 890 | - |
|
| 891 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 892 | - //$wpdb->query($meta_field_add); |
|
| 893 | - } |
|
| 894 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 895 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 896 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 897 | - if ($default_value != '') {
|
|
| 898 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | - } |
|
| 900 | - |
|
| 901 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 902 | - //$wpdb->query($meta_field_add); |
|
| 903 | - } |
|
| 904 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 905 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 907 | - if ($default_value != '') {
|
|
| 908 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | - } |
|
| 910 | - |
|
| 911 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 912 | - //$wpdb->query($meta_field_add); |
|
| 913 | - |
|
| 914 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | - |
|
| 916 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 917 | - if ($default_value != '') {
|
|
| 918 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | - } |
|
| 920 | - |
|
| 921 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 922 | - |
|
| 923 | - //$wpdb->query($meta_field_add); |
|
| 924 | - } |
|
| 925 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 926 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | - |
|
| 928 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 929 | - if ($default_value != '') {
|
|
| 930 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 931 | - } |
|
| 932 | - |
|
| 933 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 934 | - |
|
| 935 | - //$wpdb->query($meta_field_add); |
|
| 936 | - } |
|
| 937 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 938 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | - |
|
| 940 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 941 | - if ($default_value != '') {
|
|
| 942 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 943 | - } |
|
| 944 | - |
|
| 945 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 946 | - |
|
| 947 | - //$wpdb->query($meta_field_add); |
|
| 948 | - } |
|
| 949 | - // show lat lng |
|
| 950 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 951 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | - |
|
| 953 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 954 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 955 | - |
|
| 956 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 957 | - //$wpdb->query($meta_field_add); |
|
| 958 | - } |
|
| 959 | - } |
|
| 960 | - |
|
| 961 | - break; |
|
| 962 | - |
|
| 963 | - case 'checkbox': |
|
| 964 | - $data_type = 'TINYINT'; |
|
| 965 | - |
|
| 966 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 967 | - if ((int)$default_value === 1) {
|
|
| 968 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 969 | - } |
|
| 970 | - |
|
| 971 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 972 | - if ($add_result === false) {
|
|
| 973 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 974 | - } |
|
| 975 | - break; |
|
| 976 | - case 'multiselect': |
|
| 977 | - case 'select': |
|
| 978 | - $data_type = 'VARCHAR'; |
|
| 979 | - $op_size = '500'; |
|
| 980 | - |
|
| 981 | - // only make the field as big as it needs to be. |
|
| 982 | - if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 983 | - $option_values_arr = explode(',', $option_values);
|
|
| 984 | - |
|
| 985 | - if (is_array($option_values_arr)) {
|
|
| 986 | - $op_max = 0; |
|
| 987 | - |
|
| 988 | - foreach ($option_values_arr as $op_val) {
|
|
| 989 | - if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 990 | - $op_max = strlen($op_val); |
|
| 991 | - } |
|
| 992 | - } |
|
| 993 | - |
|
| 994 | - if ($op_max) {
|
|
| 995 | - $op_size = $op_max; |
|
| 996 | - } |
|
| 997 | - } |
|
| 998 | - } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 999 | - if (strlen($option_values)) {
|
|
| 1000 | - $op_size = strlen($option_values); |
|
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - if (isset($request_field['multi_display_type'])) {
|
|
| 1004 | - $extra_fields = $request_field['multi_display_type']; |
|
| 1005 | - } |
|
| 1006 | - } |
|
| 1007 | - |
|
| 1008 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1009 | - if ($default_value != '') {
|
|
| 1010 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1011 | - } |
|
| 1012 | - |
|
| 1013 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1014 | - if ($add_result === false) {
|
|
| 1015 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1016 | - } |
|
| 1017 | - break; |
|
| 1018 | - case 'textarea': |
|
| 1019 | - case 'html': |
|
| 1020 | - case 'url': |
|
| 1021 | - case 'file': |
|
| 1022 | - |
|
| 1023 | - $data_type = 'TEXT'; |
|
| 1024 | - |
|
| 1025 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1026 | - |
|
| 1027 | - $meta_field_add = $data_type . " NULL "; |
|
| 1028 | - /*if($default_value != '') |
|
| 863 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 864 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 865 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 866 | + if ($default_value != '') {
|
|
| 867 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 868 | + } |
|
| 869 | + |
|
| 870 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 871 | + //$wpdb->query($meta_field_add); |
|
| 872 | + } |
|
| 873 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 874 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 875 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 876 | + if ($default_value != '') {
|
|
| 877 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | + } |
|
| 879 | + |
|
| 880 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 881 | + //$wpdb->query($meta_field_add); |
|
| 882 | + } |
|
| 883 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 884 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 885 | + |
|
| 886 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 887 | + if ($default_value != '') {
|
|
| 888 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 889 | + } |
|
| 890 | + |
|
| 891 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 892 | + //$wpdb->query($meta_field_add); |
|
| 893 | + } |
|
| 894 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 895 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 896 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 897 | + if ($default_value != '') {
|
|
| 898 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | + } |
|
| 900 | + |
|
| 901 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 902 | + //$wpdb->query($meta_field_add); |
|
| 903 | + } |
|
| 904 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 905 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 907 | + if ($default_value != '') {
|
|
| 908 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | + } |
|
| 910 | + |
|
| 911 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 912 | + //$wpdb->query($meta_field_add); |
|
| 913 | + |
|
| 914 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | + |
|
| 916 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 917 | + if ($default_value != '') {
|
|
| 918 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | + } |
|
| 920 | + |
|
| 921 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 922 | + |
|
| 923 | + //$wpdb->query($meta_field_add); |
|
| 924 | + } |
|
| 925 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 926 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | + |
|
| 928 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 929 | + if ($default_value != '') {
|
|
| 930 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 931 | + } |
|
| 932 | + |
|
| 933 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 934 | + |
|
| 935 | + //$wpdb->query($meta_field_add); |
|
| 936 | + } |
|
| 937 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 938 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | + |
|
| 940 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 941 | + if ($default_value != '') {
|
|
| 942 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 943 | + } |
|
| 944 | + |
|
| 945 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 946 | + |
|
| 947 | + //$wpdb->query($meta_field_add); |
|
| 948 | + } |
|
| 949 | + // show lat lng |
|
| 950 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 951 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | + |
|
| 953 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 954 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 955 | + |
|
| 956 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 957 | + //$wpdb->query($meta_field_add); |
|
| 958 | + } |
|
| 959 | + } |
|
| 960 | + |
|
| 961 | + break; |
|
| 962 | + |
|
| 963 | + case 'checkbox': |
|
| 964 | + $data_type = 'TINYINT'; |
|
| 965 | + |
|
| 966 | + $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 967 | + if ((int)$default_value === 1) {
|
|
| 968 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 969 | + } |
|
| 970 | + |
|
| 971 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 972 | + if ($add_result === false) {
|
|
| 973 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 974 | + } |
|
| 975 | + break; |
|
| 976 | + case 'multiselect': |
|
| 977 | + case 'select': |
|
| 978 | + $data_type = 'VARCHAR'; |
|
| 979 | + $op_size = '500'; |
|
| 980 | + |
|
| 981 | + // only make the field as big as it needs to be. |
|
| 982 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 983 | + $option_values_arr = explode(',', $option_values);
|
|
| 984 | + |
|
| 985 | + if (is_array($option_values_arr)) {
|
|
| 986 | + $op_max = 0; |
|
| 987 | + |
|
| 988 | + foreach ($option_values_arr as $op_val) {
|
|
| 989 | + if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 990 | + $op_max = strlen($op_val); |
|
| 991 | + } |
|
| 992 | + } |
|
| 993 | + |
|
| 994 | + if ($op_max) {
|
|
| 995 | + $op_size = $op_max; |
|
| 996 | + } |
|
| 997 | + } |
|
| 998 | + } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 999 | + if (strlen($option_values)) {
|
|
| 1000 | + $op_size = strlen($option_values); |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + if (isset($request_field['multi_display_type'])) {
|
|
| 1004 | + $extra_fields = $request_field['multi_display_type']; |
|
| 1005 | + } |
|
| 1006 | + } |
|
| 1007 | + |
|
| 1008 | + $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1009 | + if ($default_value != '') {
|
|
| 1010 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1011 | + } |
|
| 1012 | + |
|
| 1013 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1014 | + if ($add_result === false) {
|
|
| 1015 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1016 | + } |
|
| 1017 | + break; |
|
| 1018 | + case 'textarea': |
|
| 1019 | + case 'html': |
|
| 1020 | + case 'url': |
|
| 1021 | + case 'file': |
|
| 1022 | + |
|
| 1023 | + $data_type = 'TEXT'; |
|
| 1024 | + |
|
| 1025 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1026 | + |
|
| 1027 | + $meta_field_add = $data_type . " NULL "; |
|
| 1028 | + /*if($default_value != '') |
|
| 1029 | 1029 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1030 | 1030 | |
| 1031 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1032 | - if ($add_result === false) {
|
|
| 1033 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1034 | - } |
|
| 1031 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1032 | + if ($add_result === false) {
|
|
| 1033 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1034 | + } |
|
| 1035 | 1035 | |
| 1036 | - break; |
|
| 1036 | + break; |
|
| 1037 | 1037 | |
| 1038 | - case 'datepicker': |
|
| 1038 | + case 'datepicker': |
|
| 1039 | 1039 | |
| 1040 | - $data_type = 'DATE'; |
|
| 1040 | + $data_type = 'DATE'; |
|
| 1041 | 1041 | |
| 1042 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1042 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | 1043 | |
| 1044 | - $meta_field_add = $data_type . " NULL "; |
|
| 1044 | + $meta_field_add = $data_type . " NULL "; |
|
| 1045 | 1045 | |
| 1046 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1047 | - if ($add_result === false) {
|
|
| 1048 | - return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1049 | - } |
|
| 1046 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1047 | + if ($add_result === false) {
|
|
| 1048 | + return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1049 | + } |
|
| 1050 | 1050 | |
| 1051 | - break; |
|
| 1051 | + break; |
|
| 1052 | 1052 | |
| 1053 | - case 'time': |
|
| 1053 | + case 'time': |
|
| 1054 | 1054 | |
| 1055 | - $data_type = 'TIME'; |
|
| 1055 | + $data_type = 'TIME'; |
|
| 1056 | 1056 | |
| 1057 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1057 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | 1058 | |
| 1059 | - $meta_field_add = $data_type . " NULL "; |
|
| 1059 | + $meta_field_add = $data_type . " NULL "; |
|
| 1060 | 1060 | |
| 1061 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1062 | - if ($add_result === false) {
|
|
| 1063 | - return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1064 | - } |
|
| 1061 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1062 | + if ($add_result === false) {
|
|
| 1063 | + return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1064 | + } |
|
| 1065 | 1065 | |
| 1066 | - break; |
|
| 1066 | + break; |
|
| 1067 | 1067 | |
| 1068 | - default: |
|
| 1068 | + default: |
|
| 1069 | 1069 | |
| 1070 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1071 | - $meta_field_add = $data_type . " NULL "; |
|
| 1070 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1071 | + $meta_field_add = $data_type . " NULL "; |
|
| 1072 | 1072 | |
| 1073 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1074 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1075 | - } |
|
| 1073 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1074 | + $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1075 | + } |
|
| 1076 | 1076 | |
| 1077 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 1078 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - } |
|
| 1081 | - } else {
|
|
| 1082 | - $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1077 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 1078 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | + } |
|
| 1081 | + } else {
|
|
| 1082 | + $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1083 | 1083 | |
| 1084 | - if ($default_value != '') {
|
|
| 1085 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - } |
|
| 1088 | - } |
|
| 1084 | + if ($default_value != '') {
|
|
| 1085 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | + } |
|
| 1088 | + } |
|
| 1089 | 1089 | |
| 1090 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1091 | - if ($add_result === false) {
|
|
| 1092 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1093 | - } |
|
| 1094 | - break; |
|
| 1095 | - endswitch; |
|
| 1090 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1091 | + if ($add_result === false) {
|
|
| 1092 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1093 | + } |
|
| 1094 | + break; |
|
| 1095 | + endswitch; |
|
| 1096 | 1096 | |
| 1097 | - $extra_field_query = ''; |
|
| 1098 | - if (!empty($extra_fields)) {
|
|
| 1099 | - $extra_field_query = serialize($extra_fields); |
|
| 1100 | - } |
|
| 1097 | + $extra_field_query = ''; |
|
| 1098 | + if (!empty($extra_fields)) {
|
|
| 1099 | + $extra_field_query = serialize($extra_fields); |
|
| 1100 | + } |
|
| 1101 | 1101 | |
| 1102 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1102 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1103 | 1103 | |
| 1104 | - $wpdb->query( |
|
| 1104 | + $wpdb->query( |
|
| 1105 | 1105 | |
| 1106 | - $wpdb->prepare( |
|
| 1106 | + $wpdb->prepare( |
|
| 1107 | 1107 | |
| 1108 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1108 | + "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | 1109 | post_type = %s, |
| 1110 | 1110 | admin_title = %s, |
| 1111 | 1111 | site_title = %s, |
@@ -1138,26 +1138,26 @@ discard block |
||
| 1138 | 1138 | validation_msg = %s, |
| 1139 | 1139 | for_admin_use = %s ", |
| 1140 | 1140 | |
| 1141 | - 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) |
|
| 1141 | + 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) |
|
| 1142 | 1142 | |
| 1143 | - ) |
|
| 1143 | + ) |
|
| 1144 | 1144 | |
| 1145 | - ); |
|
| 1145 | + ); |
|
| 1146 | 1146 | |
| 1147 | - $lastid = $wpdb->insert_id; |
|
| 1147 | + $lastid = $wpdb->insert_id; |
|
| 1148 | 1148 | |
| 1149 | - $lastid = trim($lastid); |
|
| 1149 | + $lastid = trim($lastid); |
|
| 1150 | 1150 | |
| 1151 | - } |
|
| 1151 | + } |
|
| 1152 | 1152 | |
| 1153 | - return (int)$lastid; |
|
| 1153 | + return (int)$lastid; |
|
| 1154 | 1154 | |
| 1155 | 1155 | |
| 1156 | - } else {
|
|
| 1157 | - return 'HTML Variable Name should be a unique name'; |
|
| 1158 | - } |
|
| 1156 | + } else {
|
|
| 1157 | + return 'HTML Variable Name should be a unique name'; |
|
| 1158 | + } |
|
| 1159 | 1159 | |
| 1160 | - } |
|
| 1160 | + } |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | /** |
@@ -1172,53 +1172,53 @@ discard block |
||
| 1172 | 1172 | function godir_set_field_order($field_ids = array()) |
| 1173 | 1173 | {
|
| 1174 | 1174 | |
| 1175 | - global $wpdb; |
|
| 1175 | + global $wpdb; |
|
| 1176 | 1176 | |
| 1177 | - $count = 0; |
|
| 1178 | - if (!empty($field_ids)): |
|
| 1179 | - $post_meta_info = false; |
|
| 1180 | - foreach ($field_ids as $id) {
|
|
| 1177 | + $count = 0; |
|
| 1178 | + if (!empty($field_ids)): |
|
| 1179 | + $post_meta_info = false; |
|
| 1180 | + foreach ($field_ids as $id) {
|
|
| 1181 | 1181 | |
| 1182 | - $cf = trim($id, '_'); |
|
| 1182 | + $cf = trim($id, '_'); |
|
| 1183 | 1183 | |
| 1184 | - $post_meta_info = $wpdb->query( |
|
| 1185 | - $wpdb->prepare( |
|
| 1186 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1184 | + $post_meta_info = $wpdb->query( |
|
| 1185 | + $wpdb->prepare( |
|
| 1186 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1187 | 1187 | sort_order=%d |
| 1188 | 1188 | where id= %d", |
| 1189 | - array($count, $cf) |
|
| 1190 | - ) |
|
| 1191 | - ); |
|
| 1192 | - $count++; |
|
| 1193 | - } |
|
| 1194 | - |
|
| 1195 | - return $post_meta_info; |
|
| 1196 | - else: |
|
| 1197 | - return false; |
|
| 1198 | - endif; |
|
| 1189 | + array($count, $cf) |
|
| 1190 | + ) |
|
| 1191 | + ); |
|
| 1192 | + $count++; |
|
| 1193 | + } |
|
| 1194 | + |
|
| 1195 | + return $post_meta_info; |
|
| 1196 | + else: |
|
| 1197 | + return false; |
|
| 1198 | + endif; |
|
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | |
| 1202 | 1202 | function geodir_get_cf_value($cf){
|
| 1203 | - $value = ''; |
|
| 1204 | - if (is_admin()) {
|
|
| 1205 | - global $post,$gd_session; |
|
| 1206 | - |
|
| 1207 | - if (isset($_REQUEST['post'])) |
|
| 1208 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1209 | - } |
|
| 1210 | - |
|
| 1211 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1212 | - $post = $gd_ses_listing; |
|
| 1213 | - $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1214 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1215 | - $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1216 | - } else {
|
|
| 1217 | - if ($value == '') {
|
|
| 1218 | - $value = $cf['default']; |
|
| 1219 | - } |
|
| 1220 | - } |
|
| 1221 | - return $value; |
|
| 1203 | + $value = ''; |
|
| 1204 | + if (is_admin()) {
|
|
| 1205 | + global $post,$gd_session; |
|
| 1206 | + |
|
| 1207 | + if (isset($_REQUEST['post'])) |
|
| 1208 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1209 | + } |
|
| 1210 | + |
|
| 1211 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1212 | + $post = $gd_ses_listing; |
|
| 1213 | + $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1214 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1215 | + $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1216 | + } else {
|
|
| 1217 | + if ($value == '') {
|
|
| 1218 | + $value = $cf['default']; |
|
| 1219 | + } |
|
| 1220 | + } |
|
| 1221 | + return $value; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /** |
@@ -1237,412 +1237,412 @@ discard block |
||
| 1237 | 1237 | * @param string $post_type Optional. The wordpress post type. |
| 1238 | 1238 | */ |
| 1239 | 1239 | function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
|
| 1240 | - global $is_default, $mapzoom, $gd_session; |
|
| 1240 | + global $is_default, $mapzoom, $gd_session; |
|
| 1241 | 1241 | |
| 1242 | - $listing_type = $post_type; |
|
| 1242 | + $listing_type = $post_type; |
|
| 1243 | 1243 | |
| 1244 | - $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1244 | + $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1245 | 1245 | |
| 1246 | - foreach ($custom_fields as $key => $val) {
|
|
| 1247 | - $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1248 | - $name = $val['name']; |
|
| 1249 | - $type = $val['type']; |
|
| 1250 | - $is_default = $val['is_default']; |
|
| 1246 | + foreach ($custom_fields as $key => $val) {
|
|
| 1247 | + $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1248 | + $name = $val['name']; |
|
| 1249 | + $type = $val['type']; |
|
| 1250 | + $is_default = $val['is_default']; |
|
| 1251 | 1251 | |
| 1252 | - /* field available to site admin only for edit */ |
|
| 1253 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1254 | - if ($for_admin_use && !is_super_admin()) {
|
|
| 1255 | - continue; |
|
| 1256 | - } |
|
| 1252 | + /* field available to site admin only for edit */ |
|
| 1253 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1254 | + if ($for_admin_use && !is_super_admin()) {
|
|
| 1255 | + continue; |
|
| 1256 | + } |
|
| 1257 | 1257 | |
| 1258 | - if (is_admin()) {
|
|
| 1259 | - global $post; |
|
| 1258 | + if (is_admin()) {
|
|
| 1259 | + global $post; |
|
| 1260 | 1260 | |
| 1261 | - if (isset($_REQUEST['post'])) |
|
| 1262 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1263 | - } |
|
| 1261 | + if (isset($_REQUEST['post'])) |
|
| 1262 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1263 | + } |
|
| 1264 | 1264 | |
| 1265 | 1265 | |
| 1266 | 1266 | |
| 1267 | - /** |
|
| 1268 | - * Called before the custom fields info is output for submitting a post. |
|
| 1269 | - * |
|
| 1270 | - * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1271 | - * |
|
| 1272 | - * @since 1.0.0 |
|
| 1273 | - * @param string $listing_type The post post type. |
|
| 1274 | - * @param int $package_id The price package ID for the post. |
|
| 1275 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1276 | - * @see 'geodir_after_custom_form_field_$name' |
|
| 1277 | - */ |
|
| 1278 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1279 | - |
|
| 1280 | - |
|
| 1281 | - $custom_field = $val; |
|
| 1282 | - $html =''; |
|
| 1283 | - /** |
|
| 1284 | - * Filter the output for custom fields. |
|
| 1285 | - * |
|
| 1286 | - * Here we can remove or add new functions depending on the field type. |
|
| 1287 | - * |
|
| 1288 | - * @param string $html The html to be filtered (blank). |
|
| 1289 | - * @param array $custom_field The custom field array values. |
|
| 1290 | - */ |
|
| 1291 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1292 | - |
|
| 1293 | - |
|
| 1294 | - |
|
| 1295 | - /** |
|
| 1296 | - * Called after the custom fields info is output for submitting a post. |
|
| 1297 | - * |
|
| 1298 | - * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1299 | - * |
|
| 1300 | - * @since 1.0.0 |
|
| 1301 | - * @param string $listing_type The post post type. |
|
| 1302 | - * @param int $package_id The price package ID for the post. |
|
| 1303 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1304 | - * @see 'geodir_before_custom_form_field_$name' |
|
| 1305 | - */ |
|
| 1306 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1307 | - |
|
| 1308 | - } |
|
| 1267 | + /** |
|
| 1268 | + * Called before the custom fields info is output for submitting a post. |
|
| 1269 | + * |
|
| 1270 | + * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1271 | + * |
|
| 1272 | + * @since 1.0.0 |
|
| 1273 | + * @param string $listing_type The post post type. |
|
| 1274 | + * @param int $package_id The price package ID for the post. |
|
| 1275 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1276 | + * @see 'geodir_after_custom_form_field_$name' |
|
| 1277 | + */ |
|
| 1278 | + do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1279 | + |
|
| 1280 | + |
|
| 1281 | + $custom_field = $val; |
|
| 1282 | + $html =''; |
|
| 1283 | + /** |
|
| 1284 | + * Filter the output for custom fields. |
|
| 1285 | + * |
|
| 1286 | + * Here we can remove or add new functions depending on the field type. |
|
| 1287 | + * |
|
| 1288 | + * @param string $html The html to be filtered (blank). |
|
| 1289 | + * @param array $custom_field The custom field array values. |
|
| 1290 | + */ |
|
| 1291 | + echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1292 | + |
|
| 1293 | + |
|
| 1294 | + |
|
| 1295 | + /** |
|
| 1296 | + * Called after the custom fields info is output for submitting a post. |
|
| 1297 | + * |
|
| 1298 | + * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1299 | + * |
|
| 1300 | + * @since 1.0.0 |
|
| 1301 | + * @param string $listing_type The post post type. |
|
| 1302 | + * @param int $package_id The price package ID for the post. |
|
| 1303 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1304 | + * @see 'geodir_before_custom_form_field_$name' |
|
| 1305 | + */ |
|
| 1306 | + do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1307 | + |
|
| 1308 | + } |
|
| 1309 | 1309 | |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | |
| 1313 | 1313 | if (!function_exists('geodir_get_field_infoby')) {
|
| 1314 | - /** |
|
| 1315 | - * Get custom field using key and value. |
|
| 1316 | - * |
|
| 1317 | - * @since 1.0.0 |
|
| 1318 | - * @package GeoDirectory |
|
| 1319 | - * @global object $wpdb WordPress Database object. |
|
| 1320 | - * @param string $key The key you want to look for. |
|
| 1321 | - * @param string $value The value of the key you want to look for. |
|
| 1322 | - * @param string $geodir_post_type The post type. |
|
| 1323 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1324 | - */ |
|
| 1325 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1326 | - {
|
|
| 1327 | - |
|
| 1328 | - global $wpdb; |
|
| 1329 | - |
|
| 1330 | - $filter = $wpdb->get_row( |
|
| 1331 | - $wpdb->prepare( |
|
| 1332 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1333 | - array($geodir_post_type) |
|
| 1334 | - ) |
|
| 1335 | - ); |
|
| 1336 | - |
|
| 1337 | - if ($filter) {
|
|
| 1338 | - return $filter; |
|
| 1339 | - } else {
|
|
| 1340 | - return false; |
|
| 1341 | - } |
|
| 1342 | - |
|
| 1343 | - } |
|
| 1314 | + /** |
|
| 1315 | + * Get custom field using key and value. |
|
| 1316 | + * |
|
| 1317 | + * @since 1.0.0 |
|
| 1318 | + * @package GeoDirectory |
|
| 1319 | + * @global object $wpdb WordPress Database object. |
|
| 1320 | + * @param string $key The key you want to look for. |
|
| 1321 | + * @param string $value The value of the key you want to look for. |
|
| 1322 | + * @param string $geodir_post_type The post type. |
|
| 1323 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1324 | + */ |
|
| 1325 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1326 | + {
|
|
| 1327 | + |
|
| 1328 | + global $wpdb; |
|
| 1329 | + |
|
| 1330 | + $filter = $wpdb->get_row( |
|
| 1331 | + $wpdb->prepare( |
|
| 1332 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1333 | + array($geodir_post_type) |
|
| 1334 | + ) |
|
| 1335 | + ); |
|
| 1336 | + |
|
| 1337 | + if ($filter) {
|
|
| 1338 | + return $filter; |
|
| 1339 | + } else {
|
|
| 1340 | + return false; |
|
| 1341 | + } |
|
| 1342 | + |
|
| 1343 | + } |
|
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | 1346 | |
| 1347 | 1347 | function geodir_field_icon_proccess($cf){
|
| 1348 | 1348 | |
| 1349 | 1349 | |
| 1350 | - if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1351 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1352 | - } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1353 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1354 | - }else{
|
|
| 1355 | - $field_icon = $cf['field_icon']; |
|
| 1356 | - } |
|
| 1350 | + if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1351 | + $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1352 | + } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1353 | + $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1354 | + }else{
|
|
| 1355 | + $field_icon = $cf['field_icon']; |
|
| 1356 | + } |
|
| 1357 | 1357 | |
| 1358 | - return $field_icon; |
|
| 1358 | + return $field_icon; |
|
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | if (!function_exists('geodir_show_listing_info')) {
|
| 1362 | - /** |
|
| 1363 | - * Show listing info depending on field location. |
|
| 1364 | - * |
|
| 1365 | - * @since 1.0.0 |
|
| 1366 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1367 | - * Changes to display url fields title. |
|
| 1368 | - * @package GeoDirectory |
|
| 1369 | - * @global object $wpdb WordPress Database object. |
|
| 1370 | - * @global object $post The current post object. |
|
| 1371 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1372 | - * |
|
| 1373 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1374 | - * @return string Returns listing info html. |
|
| 1375 | - */ |
|
| 1376 | - function geodir_show_listing_info($fields_location = '') {
|
|
| 1377 | - global $post, $preview, $wpdb, $send_to_friend; |
|
| 1378 | - |
|
| 1379 | - $payment_info = array(); |
|
| 1380 | - $package_info = array(); |
|
| 1381 | - |
|
| 1382 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 1383 | - $post_package_id = $package_info->pid; |
|
| 1384 | - $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1385 | - $send_to_friend = false; |
|
| 1386 | - |
|
| 1387 | - ob_start(); |
|
| 1388 | - $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1389 | - |
|
| 1390 | - if (!empty($fields_info)) {
|
|
| 1391 | - $post = stripslashes_deep($post); // strip slashes |
|
| 1362 | + /** |
|
| 1363 | + * Show listing info depending on field location. |
|
| 1364 | + * |
|
| 1365 | + * @since 1.0.0 |
|
| 1366 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1367 | + * Changes to display url fields title. |
|
| 1368 | + * @package GeoDirectory |
|
| 1369 | + * @global object $wpdb WordPress Database object. |
|
| 1370 | + * @global object $post The current post object. |
|
| 1371 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1372 | + * |
|
| 1373 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1374 | + * @return string Returns listing info html. |
|
| 1375 | + */ |
|
| 1376 | + function geodir_show_listing_info($fields_location = '') {
|
|
| 1377 | + global $post, $preview, $wpdb, $send_to_friend; |
|
| 1378 | + |
|
| 1379 | + $payment_info = array(); |
|
| 1380 | + $package_info = array(); |
|
| 1381 | + |
|
| 1382 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 1383 | + $post_package_id = $package_info->pid; |
|
| 1384 | + $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1385 | + $send_to_friend = false; |
|
| 1386 | + |
|
| 1387 | + ob_start(); |
|
| 1388 | + $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1389 | + |
|
| 1390 | + if (!empty($fields_info)) {
|
|
| 1391 | + $post = stripslashes_deep($post); // strip slashes |
|
| 1392 | 1392 | |
| 1393 | - //echo '<div class="geodir-company_info field-group">'; |
|
| 1394 | - global $field_set_start; |
|
| 1395 | - $field_set_start = 0; |
|
| 1396 | - |
|
| 1397 | - |
|
| 1398 | - |
|
| 1399 | - foreach ($fields_info as $type) {
|
|
| 1400 | - $type = stripslashes_deep($type); // strip slashes |
|
| 1401 | - $html = ''; |
|
| 1402 | - $html_var = ''; |
|
| 1403 | - $field_icon = geodir_field_icon_proccess($type); |
|
| 1404 | - $filed_type = $type['type']; |
|
| 1405 | - |
|
| 1406 | - /** |
|
| 1407 | - * Filter the output for custom fields. |
|
| 1408 | - * |
|
| 1409 | - * Here we can remove or add new functions depending on the field type. |
|
| 1410 | - * |
|
| 1411 | - * @param string $html The html to be filtered (blank). |
|
| 1412 | - * @param string $fields_location The location the field is to be show. |
|
| 1413 | - * @param array $type The array of field values. |
|
| 1414 | - */ |
|
| 1415 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1416 | - |
|
| 1417 | - $variables_array = array(); |
|
| 1418 | - |
|
| 1419 | - if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 1420 | - continue; |
|
| 1421 | - } |
|
| 1422 | - |
|
| 1423 | - if ($type['type'] != 'fieldset'): |
|
| 1424 | - $variables_array['post_id'] = $post->ID; |
|
| 1425 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1426 | - $variables_array['value'] = ''; |
|
| 1427 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1428 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1429 | - endif; |
|
| 1430 | - |
|
| 1431 | - |
|
| 1432 | - |
|
| 1433 | - if ($html): |
|
| 1434 | - |
|
| 1435 | - /** |
|
| 1436 | - * Called before a custom fields is output on the frontend. |
|
| 1437 | - * |
|
| 1438 | - * @since 1.0.0 |
|
| 1439 | - * @param string $html_var The HTML variable name for the field. |
|
| 1440 | - */ |
|
| 1441 | - do_action("geodir_before_show_{$html_var}");
|
|
| 1442 | - /** |
|
| 1443 | - * Filter custom field output. |
|
| 1444 | - * |
|
| 1445 | - * @since 1.0.0 |
|
| 1446 | - * |
|
| 1447 | - * @param string $html_var The HTML variable name for the field. |
|
| 1448 | - * @param string $html Custom field unfiltered HTML. |
|
| 1449 | - * @param array $variables_array Custom field variables array. |
|
| 1450 | - */ |
|
| 1451 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1452 | - |
|
| 1453 | - /** |
|
| 1454 | - * Called after a custom fields is output on the frontend. |
|
| 1455 | - * |
|
| 1456 | - * @since 1.0.0 |
|
| 1457 | - * @param string $html_var The HTML variable name for the field. |
|
| 1458 | - */ |
|
| 1459 | - do_action("geodir_after_show_{$html_var}");
|
|
| 1460 | - |
|
| 1461 | - endif; |
|
| 1462 | - |
|
| 1463 | - } |
|
| 1464 | - |
|
| 1465 | - //echo '</div>'; |
|
| 1466 | - |
|
| 1467 | - } |
|
| 1468 | - |
|
| 1469 | - |
|
| 1470 | - return $html = ob_get_clean(); |
|
| 1471 | - |
|
| 1472 | - } |
|
| 1393 | + //echo '<div class="geodir-company_info field-group">'; |
|
| 1394 | + global $field_set_start; |
|
| 1395 | + $field_set_start = 0; |
|
| 1396 | + |
|
| 1397 | + |
|
| 1398 | + |
|
| 1399 | + foreach ($fields_info as $type) {
|
|
| 1400 | + $type = stripslashes_deep($type); // strip slashes |
|
| 1401 | + $html = ''; |
|
| 1402 | + $html_var = ''; |
|
| 1403 | + $field_icon = geodir_field_icon_proccess($type); |
|
| 1404 | + $filed_type = $type['type']; |
|
| 1405 | + |
|
| 1406 | + /** |
|
| 1407 | + * Filter the output for custom fields. |
|
| 1408 | + * |
|
| 1409 | + * Here we can remove or add new functions depending on the field type. |
|
| 1410 | + * |
|
| 1411 | + * @param string $html The html to be filtered (blank). |
|
| 1412 | + * @param string $fields_location The location the field is to be show. |
|
| 1413 | + * @param array $type The array of field values. |
|
| 1414 | + */ |
|
| 1415 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1416 | + |
|
| 1417 | + $variables_array = array(); |
|
| 1418 | + |
|
| 1419 | + if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 1420 | + continue; |
|
| 1421 | + } |
|
| 1422 | + |
|
| 1423 | + if ($type['type'] != 'fieldset'): |
|
| 1424 | + $variables_array['post_id'] = $post->ID; |
|
| 1425 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1426 | + $variables_array['value'] = ''; |
|
| 1427 | + if (isset($post->{$type['htmlvar_name']}))
|
|
| 1428 | + $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1429 | + endif; |
|
| 1430 | + |
|
| 1431 | + |
|
| 1432 | + |
|
| 1433 | + if ($html): |
|
| 1434 | + |
|
| 1435 | + /** |
|
| 1436 | + * Called before a custom fields is output on the frontend. |
|
| 1437 | + * |
|
| 1438 | + * @since 1.0.0 |
|
| 1439 | + * @param string $html_var The HTML variable name for the field. |
|
| 1440 | + */ |
|
| 1441 | + do_action("geodir_before_show_{$html_var}");
|
|
| 1442 | + /** |
|
| 1443 | + * Filter custom field output. |
|
| 1444 | + * |
|
| 1445 | + * @since 1.0.0 |
|
| 1446 | + * |
|
| 1447 | + * @param string $html_var The HTML variable name for the field. |
|
| 1448 | + * @param string $html Custom field unfiltered HTML. |
|
| 1449 | + * @param array $variables_array Custom field variables array. |
|
| 1450 | + */ |
|
| 1451 | + if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1452 | + |
|
| 1453 | + /** |
|
| 1454 | + * Called after a custom fields is output on the frontend. |
|
| 1455 | + * |
|
| 1456 | + * @since 1.0.0 |
|
| 1457 | + * @param string $html_var The HTML variable name for the field. |
|
| 1458 | + */ |
|
| 1459 | + do_action("geodir_after_show_{$html_var}");
|
|
| 1460 | + |
|
| 1461 | + endif; |
|
| 1462 | + |
|
| 1463 | + } |
|
| 1464 | + |
|
| 1465 | + //echo '</div>'; |
|
| 1466 | + |
|
| 1467 | + } |
|
| 1468 | + |
|
| 1469 | + |
|
| 1470 | + return $html = ob_get_clean(); |
|
| 1471 | + |
|
| 1472 | + } |
|
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | if (!function_exists('geodir_default_date_format')) {
|
| 1476 | - /** |
|
| 1477 | - * Returns default date format. |
|
| 1478 | - * |
|
| 1479 | - * @since 1.0.0 |
|
| 1480 | - * @package GeoDirectory |
|
| 1481 | - * @return mixed|string|void Returns default date format. |
|
| 1482 | - */ |
|
| 1483 | - function geodir_default_date_format() |
|
| 1484 | - {
|
|
| 1485 | - if ($format = get_option('date_format'))
|
|
| 1486 | - return $format; |
|
| 1487 | - else |
|
| 1488 | - return 'dd-mm-yy'; |
|
| 1489 | - } |
|
| 1476 | + /** |
|
| 1477 | + * Returns default date format. |
|
| 1478 | + * |
|
| 1479 | + * @since 1.0.0 |
|
| 1480 | + * @package GeoDirectory |
|
| 1481 | + * @return mixed|string|void Returns default date format. |
|
| 1482 | + */ |
|
| 1483 | + function geodir_default_date_format() |
|
| 1484 | + {
|
|
| 1485 | + if ($format = get_option('date_format'))
|
|
| 1486 | + return $format; |
|
| 1487 | + else |
|
| 1488 | + return 'dd-mm-yy'; |
|
| 1489 | + } |
|
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | if (!function_exists('geodir_get_formated_date')) {
|
| 1493 | - /** |
|
| 1494 | - * Returns formatted date. |
|
| 1495 | - * |
|
| 1496 | - * @since 1.0.0 |
|
| 1497 | - * @package GeoDirectory |
|
| 1498 | - * @param string $date Date string to convert. |
|
| 1499 | - * @return bool|int|string Returns formatted date. |
|
| 1500 | - */ |
|
| 1501 | - function geodir_get_formated_date($date) |
|
| 1502 | - {
|
|
| 1503 | - return mysql2date(get_option('date_format'), $date);
|
|
| 1504 | - } |
|
| 1493 | + /** |
|
| 1494 | + * Returns formatted date. |
|
| 1495 | + * |
|
| 1496 | + * @since 1.0.0 |
|
| 1497 | + * @package GeoDirectory |
|
| 1498 | + * @param string $date Date string to convert. |
|
| 1499 | + * @return bool|int|string Returns formatted date. |
|
| 1500 | + */ |
|
| 1501 | + function geodir_get_formated_date($date) |
|
| 1502 | + {
|
|
| 1503 | + return mysql2date(get_option('date_format'), $date);
|
|
| 1504 | + } |
|
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | if (!function_exists('geodir_get_formated_time')) {
|
| 1508 | - /** |
|
| 1509 | - * Returns formatted time. |
|
| 1510 | - * |
|
| 1511 | - * @since 1.0.0 |
|
| 1512 | - * @package GeoDirectory |
|
| 1513 | - * @param string $time Time string to convert. |
|
| 1514 | - * @return bool|int|string Returns formatted time. |
|
| 1515 | - */ |
|
| 1516 | - function geodir_get_formated_time($time) |
|
| 1517 | - {
|
|
| 1518 | - return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1519 | - } |
|
| 1508 | + /** |
|
| 1509 | + * Returns formatted time. |
|
| 1510 | + * |
|
| 1511 | + * @since 1.0.0 |
|
| 1512 | + * @package GeoDirectory |
|
| 1513 | + * @param string $time Time string to convert. |
|
| 1514 | + * @return bool|int|string Returns formatted time. |
|
| 1515 | + */ |
|
| 1516 | + function geodir_get_formated_time($time) |
|
| 1517 | + {
|
|
| 1518 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1519 | + } |
|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | |
| 1523 | 1523 | if (!function_exists('geodir_save_post_file_fields')) {
|
| 1524 | - /** |
|
| 1525 | - * Save post file fields |
|
| 1526 | - * |
|
| 1527 | - * @since 1.0.0 |
|
| 1528 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1529 | - * @package GeoDirectory |
|
| 1530 | - * @global object $wpdb WordPress Database object. |
|
| 1531 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1532 | - * @global object $current_user Current user object. |
|
| 1533 | - * @param int $post_id |
|
| 1534 | - * @param string $field_id |
|
| 1535 | - * @param array $post_image |
|
| 1536 | - * @param array $extra_fields Array of extra fields. |
|
| 1537 | - */ |
|
| 1538 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1539 | - {
|
|
| 1524 | + /** |
|
| 1525 | + * Save post file fields |
|
| 1526 | + * |
|
| 1527 | + * @since 1.0.0 |
|
| 1528 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1529 | + * @package GeoDirectory |
|
| 1530 | + * @global object $wpdb WordPress Database object. |
|
| 1531 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1532 | + * @global object $current_user Current user object. |
|
| 1533 | + * @param int $post_id |
|
| 1534 | + * @param string $field_id |
|
| 1535 | + * @param array $post_image |
|
| 1536 | + * @param array $extra_fields Array of extra fields. |
|
| 1537 | + */ |
|
| 1538 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1539 | + {
|
|
| 1540 | 1540 | |
| 1541 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1541 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1542 | 1542 | |
| 1543 | - $post_type = get_post_type($post_id); |
|
| 1544 | - //echo $field_id; exit; |
|
| 1545 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1543 | + $post_type = get_post_type($post_id); |
|
| 1544 | + //echo $field_id; exit; |
|
| 1545 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1546 | 1546 | |
| 1547 | - $postcurr_images = array(); |
|
| 1548 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1549 | - $file_urls = ''; |
|
| 1547 | + $postcurr_images = array(); |
|
| 1548 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1549 | + $file_urls = ''; |
|
| 1550 | 1550 | |
| 1551 | - if (!empty($post_image)) {
|
|
| 1551 | + if (!empty($post_image)) {
|
|
| 1552 | 1552 | |
| 1553 | - $invalid_files = array(); |
|
| 1553 | + $invalid_files = array(); |
|
| 1554 | 1554 | |
| 1555 | - //Get and remove all old images of post from database to set by new order |
|
| 1556 | - $geodir_uploaddir = ''; |
|
| 1557 | - $uploads = wp_upload_dir(); |
|
| 1558 | - $uploads_dir = $uploads['path']; |
|
| 1555 | + //Get and remove all old images of post from database to set by new order |
|
| 1556 | + $geodir_uploaddir = ''; |
|
| 1557 | + $uploads = wp_upload_dir(); |
|
| 1558 | + $uploads_dir = $uploads['path']; |
|
| 1559 | 1559 | |
| 1560 | - $geodir_uploadpath = $uploads['path']; |
|
| 1561 | - $geodir_uploadurl = $uploads['url']; |
|
| 1562 | - $sub_dir = $uploads['subdir']; |
|
| 1560 | + $geodir_uploadpath = $uploads['path']; |
|
| 1561 | + $geodir_uploadurl = $uploads['url']; |
|
| 1562 | + $sub_dir = $uploads['subdir']; |
|
| 1563 | 1563 | |
| 1564 | - $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'] : '';
|
|
| 1564 | + $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'] : '';
|
|
| 1565 | 1565 | |
| 1566 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1566 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1567 | 1567 | |
| 1568 | - /* --------- start ------- */ |
|
| 1568 | + /* --------- start ------- */ |
|
| 1569 | 1569 | |
| 1570 | - 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)))) {
|
|
| 1570 | + 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)))) {
|
|
| 1571 | 1571 | |
| 1572 | 1572 | |
| 1573 | - $curr_img_url = $post_image[$m]; |
|
| 1574 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 1575 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1576 | - $filename = end($image_name_arr); |
|
| 1577 | - $img_name_arr = explode('.', $filename);
|
|
| 1573 | + $curr_img_url = $post_image[$m]; |
|
| 1574 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 1575 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1576 | + $filename = end($image_name_arr); |
|
| 1577 | + $img_name_arr = explode('.', $filename);
|
|
| 1578 | 1578 | |
| 1579 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1579 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1580 | 1580 | |
| 1581 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1582 | - continue; |
|
| 1583 | - } |
|
| 1581 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1582 | + continue; |
|
| 1583 | + } |
|
| 1584 | 1584 | |
| 1585 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1586 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1585 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1586 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1587 | 1587 | |
| 1588 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1589 | - continue; // Invalid file type. |
|
| 1590 | - } |
|
| 1588 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1589 | + continue; // Invalid file type. |
|
| 1590 | + } |
|
| 1591 | 1591 | |
| 1592 | - // Set an array containing a list of acceptable formats |
|
| 1593 | - //$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');
|
|
| 1592 | + // Set an array containing a list of acceptable formats |
|
| 1593 | + //$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');
|
|
| 1594 | 1594 | |
| 1595 | - if (!function_exists('wp_handle_upload'))
|
|
| 1596 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1595 | + if (!function_exists('wp_handle_upload'))
|
|
| 1596 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1597 | 1597 | |
| 1598 | - if (!is_dir($geodir_uploadpath)) |
|
| 1599 | - mkdir($geodir_uploadpath); |
|
| 1598 | + if (!is_dir($geodir_uploadpath)) |
|
| 1599 | + mkdir($geodir_uploadpath); |
|
| 1600 | 1600 | |
| 1601 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1602 | - $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1603 | - if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1604 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1605 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1606 | - } else {
|
|
| 1607 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1608 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1609 | - } |
|
| 1601 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1602 | + $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1603 | + if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1604 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1605 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1606 | + } else {
|
|
| 1607 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1608 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1609 | + } |
|
| 1610 | 1610 | |
| 1611 | - $uploaded_file = ''; |
|
| 1612 | - if (file_exists($img_path)) |
|
| 1613 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1611 | + $uploaded_file = ''; |
|
| 1612 | + if (file_exists($img_path)) |
|
| 1613 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1614 | 1614 | |
| 1615 | - if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1616 | - if (file_exists($img_path)) |
|
| 1617 | - unlink($img_path); |
|
| 1618 | - } |
|
| 1615 | + if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1616 | + if (file_exists($img_path)) |
|
| 1617 | + unlink($img_path); |
|
| 1618 | + } |
|
| 1619 | 1619 | |
| 1620 | - if (!empty($uploaded_file)) |
|
| 1621 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1620 | + if (!empty($uploaded_file)) |
|
| 1621 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1622 | 1622 | |
| 1623 | - } else {
|
|
| 1624 | - $file_urls = $post_image[$m]; |
|
| 1625 | - } |
|
| 1626 | - } |
|
| 1623 | + } else {
|
|
| 1624 | + $file_urls = $post_image[$m]; |
|
| 1625 | + } |
|
| 1626 | + } |
|
| 1627 | 1627 | |
| 1628 | 1628 | |
| 1629 | - } |
|
| 1629 | + } |
|
| 1630 | 1630 | |
| 1631 | - //Remove all old attachments and temp images |
|
| 1632 | - if (!empty($postcurr_images)) {
|
|
| 1631 | + //Remove all old attachments and temp images |
|
| 1632 | + if (!empty($postcurr_images)) {
|
|
| 1633 | 1633 | |
| 1634 | - if ($file_urls != $postcurr_images) {
|
|
| 1635 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1636 | - $invalid_files = (object)$invalid_files; |
|
| 1637 | - } |
|
| 1638 | - } |
|
| 1634 | + if ($file_urls != $postcurr_images) {
|
|
| 1635 | + $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1636 | + $invalid_files = (object)$invalid_files; |
|
| 1637 | + } |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | - geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1640 | + geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1641 | 1641 | |
| 1642 | - if (!empty($invalid_files)) |
|
| 1643 | - geodir_remove_attachments($invalid_files); |
|
| 1642 | + if (!empty($invalid_files)) |
|
| 1643 | + geodir_remove_attachments($invalid_files); |
|
| 1644 | 1644 | |
| 1645 | - } |
|
| 1645 | + } |
|
| 1646 | 1646 | } |
| 1647 | 1647 | |
| 1648 | 1648 | |
@@ -1657,76 +1657,76 @@ discard block |
||
| 1657 | 1657 | */ |
| 1658 | 1658 | function geodir_custom_upload_mimes($existing_mimes = array()) |
| 1659 | 1659 | {
|
| 1660 | - $existing_mimes['wif'] = 'text/plain'; |
|
| 1661 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1662 | - $existing_mimes['gif'] = 'image/gif'; |
|
| 1663 | - $existing_mimes['png'] = 'image/png'; |
|
| 1664 | - $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1665 | - $existing_mimes['txt'] = 'text/text'; |
|
| 1666 | - $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1667 | - $existing_mimes['doc'] = 'application/msword'; |
|
| 1668 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1669 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1670 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1671 | - return $existing_mimes; |
|
| 1660 | + $existing_mimes['wif'] = 'text/plain'; |
|
| 1661 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1662 | + $existing_mimes['gif'] = 'image/gif'; |
|
| 1663 | + $existing_mimes['png'] = 'image/png'; |
|
| 1664 | + $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1665 | + $existing_mimes['txt'] = 'text/text'; |
|
| 1666 | + $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1667 | + $existing_mimes['doc'] = 'application/msword'; |
|
| 1668 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1669 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1670 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1671 | + return $existing_mimes; |
|
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | 1674 | if (!function_exists('geodir_plupload_action')) {
|
| 1675 | 1675 | |
| 1676 | - /** |
|
| 1677 | - * Get upload directory path details |
|
| 1678 | - * |
|
| 1679 | - * @since 1.0.0 |
|
| 1680 | - * @package GeoDirectory |
|
| 1681 | - * @global object $current_user Current user object. |
|
| 1682 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1683 | - * @return mixed Returns upload directory details as an array. |
|
| 1684 | - */ |
|
| 1685 | - function geodir_upload_dir($upload) |
|
| 1686 | - {
|
|
| 1687 | - global $current_user; |
|
| 1688 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1689 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1690 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1691 | - return $upload; |
|
| 1692 | - } |
|
| 1693 | - |
|
| 1694 | - /** |
|
| 1695 | - * Handles place file and image upload. |
|
| 1696 | - * |
|
| 1697 | - * @since 1.0.0 |
|
| 1698 | - * @package GeoDirectory |
|
| 1699 | - */ |
|
| 1700 | - function geodir_plupload_action() |
|
| 1701 | - {
|
|
| 1702 | - // check ajax noonce |
|
| 1703 | - $imgid = $_POST["imgid"]; |
|
| 1704 | - |
|
| 1705 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1706 | - |
|
| 1707 | - // handle custom file uploaddir |
|
| 1708 | - add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1709 | - |
|
| 1710 | - // change file orinetation if needed |
|
| 1711 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1712 | - |
|
| 1713 | - // handle file upload |
|
| 1714 | - $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1715 | - // remove handle custom file uploaddir |
|
| 1716 | - remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1717 | - |
|
| 1718 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1719 | - print_r($status); |
|
| 1720 | - } |
|
| 1721 | - |
|
| 1722 | - // send the uploaded file url in response |
|
| 1723 | - if (isset($status['url'])) {
|
|
| 1724 | - echo $status['url']; |
|
| 1725 | - } else {
|
|
| 1726 | - echo 'x'; |
|
| 1727 | - } |
|
| 1728 | - exit; |
|
| 1729 | - } |
|
| 1676 | + /** |
|
| 1677 | + * Get upload directory path details |
|
| 1678 | + * |
|
| 1679 | + * @since 1.0.0 |
|
| 1680 | + * @package GeoDirectory |
|
| 1681 | + * @global object $current_user Current user object. |
|
| 1682 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1683 | + * @return mixed Returns upload directory details as an array. |
|
| 1684 | + */ |
|
| 1685 | + function geodir_upload_dir($upload) |
|
| 1686 | + {
|
|
| 1687 | + global $current_user; |
|
| 1688 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1689 | + $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1690 | + $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1691 | + return $upload; |
|
| 1692 | + } |
|
| 1693 | + |
|
| 1694 | + /** |
|
| 1695 | + * Handles place file and image upload. |
|
| 1696 | + * |
|
| 1697 | + * @since 1.0.0 |
|
| 1698 | + * @package GeoDirectory |
|
| 1699 | + */ |
|
| 1700 | + function geodir_plupload_action() |
|
| 1701 | + {
|
|
| 1702 | + // check ajax noonce |
|
| 1703 | + $imgid = $_POST["imgid"]; |
|
| 1704 | + |
|
| 1705 | + check_ajax_referer($imgid . 'pluploadan'); |
|
| 1706 | + |
|
| 1707 | + // handle custom file uploaddir |
|
| 1708 | + add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1709 | + |
|
| 1710 | + // change file orinetation if needed |
|
| 1711 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1712 | + |
|
| 1713 | + // handle file upload |
|
| 1714 | + $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1715 | + // remove handle custom file uploaddir |
|
| 1716 | + remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1717 | + |
|
| 1718 | + if(!isset($status['url']) && isset($status['error'])){
|
|
| 1719 | + print_r($status); |
|
| 1720 | + } |
|
| 1721 | + |
|
| 1722 | + // send the uploaded file url in response |
|
| 1723 | + if (isset($status['url'])) {
|
|
| 1724 | + echo $status['url']; |
|
| 1725 | + } else {
|
|
| 1726 | + echo 'x'; |
|
| 1727 | + } |
|
| 1728 | + exit; |
|
| 1729 | + } |
|
| 1730 | 1730 | } |
| 1731 | 1731 | |
| 1732 | 1732 | /** |
@@ -1741,17 +1741,17 @@ discard block |
||
| 1741 | 1741 | */ |
| 1742 | 1742 | function geodir_get_video($post_id) |
| 1743 | 1743 | {
|
| 1744 | - global $wpdb, $plugin_prefix; |
|
| 1744 | + global $wpdb, $plugin_prefix; |
|
| 1745 | 1745 | |
| 1746 | - $post_type = get_post_type($post_id); |
|
| 1746 | + $post_type = get_post_type($post_id); |
|
| 1747 | 1747 | |
| 1748 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1748 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1749 | 1749 | |
| 1750 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1750 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1751 | 1751 | |
| 1752 | - if ($results) {
|
|
| 1753 | - return $results[0]->geodir_video; |
|
| 1754 | - } |
|
| 1752 | + if ($results) {
|
|
| 1753 | + return $results[0]->geodir_video; |
|
| 1754 | + } |
|
| 1755 | 1755 | |
| 1756 | 1756 | } |
| 1757 | 1757 | |
@@ -1767,40 +1767,40 @@ discard block |
||
| 1767 | 1767 | */ |
| 1768 | 1768 | function geodir_get_special_offers($post_id) |
| 1769 | 1769 | {
|
| 1770 | - global $wpdb, $plugin_prefix; |
|
| 1770 | + global $wpdb, $plugin_prefix; |
|
| 1771 | 1771 | |
| 1772 | - $post_type = get_post_type($post_id); |
|
| 1772 | + $post_type = get_post_type($post_id); |
|
| 1773 | 1773 | |
| 1774 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1774 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1775 | 1775 | |
| 1776 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1776 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1777 | 1777 | |
| 1778 | - if ($results) {
|
|
| 1779 | - return $results[0]->geodir_special_offers; |
|
| 1780 | - } |
|
| 1778 | + if ($results) {
|
|
| 1779 | + return $results[0]->geodir_special_offers; |
|
| 1780 | + } |
|
| 1781 | 1781 | |
| 1782 | 1782 | } |
| 1783 | 1783 | |
| 1784 | 1784 | if (!function_exists('geodir_max_upload_size')) {
|
| 1785 | - /** |
|
| 1786 | - * Get max upload file size |
|
| 1787 | - * |
|
| 1788 | - * @since 1.0.0 |
|
| 1789 | - * @package GeoDirectory |
|
| 1790 | - * @return mixed|void Returns max upload file size. |
|
| 1791 | - */ |
|
| 1792 | - function geodir_max_upload_size() |
|
| 1793 | - {
|
|
| 1794 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1795 | - |
|
| 1796 | - if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1797 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1798 | - } else {
|
|
| 1799 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1800 | - } |
|
| 1801 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1802 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1803 | - } |
|
| 1785 | + /** |
|
| 1786 | + * Get max upload file size |
|
| 1787 | + * |
|
| 1788 | + * @since 1.0.0 |
|
| 1789 | + * @package GeoDirectory |
|
| 1790 | + * @return mixed|void Returns max upload file size. |
|
| 1791 | + */ |
|
| 1792 | + function geodir_max_upload_size() |
|
| 1793 | + {
|
|
| 1794 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1795 | + |
|
| 1796 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1797 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1798 | + } else {
|
|
| 1799 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1800 | + } |
|
| 1801 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1802 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1803 | + } |
|
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | 1806 | |
@@ -1818,33 +1818,33 @@ discard block |
||
| 1818 | 1818 | */ |
| 1819 | 1819 | function geodir_add_custom_sort_options($fields, $post_type) |
| 1820 | 1820 | {
|
| 1821 | - global $wpdb; |
|
| 1821 | + global $wpdb; |
|
| 1822 | 1822 | |
| 1823 | - if ($post_type != '') {
|
|
| 1823 | + if ($post_type != '') {
|
|
| 1824 | 1824 | |
| 1825 | - $all_postypes = geodir_get_posttypes(); |
|
| 1825 | + $all_postypes = geodir_get_posttypes(); |
|
| 1826 | 1826 | |
| 1827 | - if (in_array($post_type, $all_postypes)) {
|
|
| 1827 | + if (in_array($post_type, $all_postypes)) {
|
|
| 1828 | 1828 | |
| 1829 | - $custom_fields = $wpdb->get_results( |
|
| 1830 | - $wpdb->prepare( |
|
| 1831 | - "select post_type,data_type,field_type,site_title,htmlvar_name 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", |
|
| 1832 | - array($post_type) |
|
| 1833 | - ), 'ARRAY_A' |
|
| 1834 | - ); |
|
| 1829 | + $custom_fields = $wpdb->get_results( |
|
| 1830 | + $wpdb->prepare( |
|
| 1831 | + "select post_type,data_type,field_type,site_title,htmlvar_name 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", |
|
| 1832 | + array($post_type) |
|
| 1833 | + ), 'ARRAY_A' |
|
| 1834 | + ); |
|
| 1835 | 1835 | |
| 1836 | - if (!empty($custom_fields)) {
|
|
| 1836 | + if (!empty($custom_fields)) {
|
|
| 1837 | 1837 | |
| 1838 | - foreach ($custom_fields as $val) {
|
|
| 1839 | - $fields[] = $val; |
|
| 1840 | - } |
|
| 1841 | - } |
|
| 1838 | + foreach ($custom_fields as $val) {
|
|
| 1839 | + $fields[] = $val; |
|
| 1840 | + } |
|
| 1841 | + } |
|
| 1842 | 1842 | |
| 1843 | - } |
|
| 1843 | + } |
|
| 1844 | 1844 | |
| 1845 | - } |
|
| 1845 | + } |
|
| 1846 | 1846 | |
| 1847 | - return $fields; |
|
| 1847 | + return $fields; |
|
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | |
@@ -1860,66 +1860,66 @@ discard block |
||
| 1860 | 1860 | function geodir_get_custom_sort_options($post_type = '') |
| 1861 | 1861 | {
|
| 1862 | 1862 | |
| 1863 | - global $wpdb; |
|
| 1864 | - |
|
| 1865 | - if ($post_type != '') {
|
|
| 1866 | - |
|
| 1867 | - $all_postypes = geodir_get_posttypes(); |
|
| 1868 | - |
|
| 1869 | - if (!in_array($post_type, $all_postypes)) |
|
| 1870 | - return false; |
|
| 1871 | - |
|
| 1872 | - $fields = array(); |
|
| 1873 | - |
|
| 1874 | - $fields[] = array( |
|
| 1875 | - 'post_type' => $post_type, |
|
| 1876 | - 'data_type' => '', |
|
| 1877 | - 'field_type' => 'random', |
|
| 1878 | - 'site_title' => 'Random', |
|
| 1879 | - 'htmlvar_name' => 'post_title' |
|
| 1880 | - ); |
|
| 1881 | - |
|
| 1882 | - $fields[] = array( |
|
| 1883 | - 'post_type' => $post_type, |
|
| 1884 | - 'data_type' => '', |
|
| 1885 | - 'field_type' => 'datetime', |
|
| 1886 | - 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1887 | - 'htmlvar_name' => 'post_date' |
|
| 1888 | - ); |
|
| 1889 | - $fields[] = array( |
|
| 1890 | - 'post_type' => $post_type, |
|
| 1891 | - 'data_type' => '', |
|
| 1892 | - 'field_type' => 'bigint', |
|
| 1893 | - 'site_title' => __('Review', 'geodirectory'),
|
|
| 1894 | - 'htmlvar_name' => 'comment_count' |
|
| 1895 | - ); |
|
| 1896 | - $fields[] = array( |
|
| 1897 | - 'post_type' => $post_type, |
|
| 1898 | - 'data_type' => '', |
|
| 1899 | - 'field_type' => 'float', |
|
| 1900 | - 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1901 | - 'htmlvar_name' => 'overall_rating' |
|
| 1902 | - ); |
|
| 1903 | - $fields[] = array( |
|
| 1904 | - 'post_type' => $post_type, |
|
| 1905 | - 'data_type' => '', |
|
| 1906 | - 'field_type' => 'text', |
|
| 1907 | - 'site_title' => __('Title', 'geodirectory'),
|
|
| 1908 | - 'htmlvar_name' => 'post_title' |
|
| 1909 | - ); |
|
| 1910 | - |
|
| 1911 | - /** |
|
| 1912 | - * Hook to add custom sort options. |
|
| 1913 | - * |
|
| 1914 | - * @since 1.0.0 |
|
| 1915 | - * @param array $fields Unmodified sort options array. |
|
| 1916 | - * @param string $post_type Post type. |
|
| 1917 | - */ |
|
| 1918 | - return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1919 | - |
|
| 1920 | - } |
|
| 1921 | - |
|
| 1922 | - return false; |
|
| 1863 | + global $wpdb; |
|
| 1864 | + |
|
| 1865 | + if ($post_type != '') {
|
|
| 1866 | + |
|
| 1867 | + $all_postypes = geodir_get_posttypes(); |
|
| 1868 | + |
|
| 1869 | + if (!in_array($post_type, $all_postypes)) |
|
| 1870 | + return false; |
|
| 1871 | + |
|
| 1872 | + $fields = array(); |
|
| 1873 | + |
|
| 1874 | + $fields[] = array( |
|
| 1875 | + 'post_type' => $post_type, |
|
| 1876 | + 'data_type' => '', |
|
| 1877 | + 'field_type' => 'random', |
|
| 1878 | + 'site_title' => 'Random', |
|
| 1879 | + 'htmlvar_name' => 'post_title' |
|
| 1880 | + ); |
|
| 1881 | + |
|
| 1882 | + $fields[] = array( |
|
| 1883 | + 'post_type' => $post_type, |
|
| 1884 | + 'data_type' => '', |
|
| 1885 | + 'field_type' => 'datetime', |
|
| 1886 | + 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1887 | + 'htmlvar_name' => 'post_date' |
|
| 1888 | + ); |
|
| 1889 | + $fields[] = array( |
|
| 1890 | + 'post_type' => $post_type, |
|
| 1891 | + 'data_type' => '', |
|
| 1892 | + 'field_type' => 'bigint', |
|
| 1893 | + 'site_title' => __('Review', 'geodirectory'),
|
|
| 1894 | + 'htmlvar_name' => 'comment_count' |
|
| 1895 | + ); |
|
| 1896 | + $fields[] = array( |
|
| 1897 | + 'post_type' => $post_type, |
|
| 1898 | + 'data_type' => '', |
|
| 1899 | + 'field_type' => 'float', |
|
| 1900 | + 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1901 | + 'htmlvar_name' => 'overall_rating' |
|
| 1902 | + ); |
|
| 1903 | + $fields[] = array( |
|
| 1904 | + 'post_type' => $post_type, |
|
| 1905 | + 'data_type' => '', |
|
| 1906 | + 'field_type' => 'text', |
|
| 1907 | + 'site_title' => __('Title', 'geodirectory'),
|
|
| 1908 | + 'htmlvar_name' => 'post_title' |
|
| 1909 | + ); |
|
| 1910 | + |
|
| 1911 | + /** |
|
| 1912 | + * Hook to add custom sort options. |
|
| 1913 | + * |
|
| 1914 | + * @since 1.0.0 |
|
| 1915 | + * @param array $fields Unmodified sort options array. |
|
| 1916 | + * @param string $post_type Post type. |
|
| 1917 | + */ |
|
| 1918 | + return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1919 | + |
|
| 1920 | + } |
|
| 1921 | + |
|
| 1922 | + return false; |
|
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | 1925 | |
@@ -1935,117 +1935,117 @@ discard block |
||
| 1935 | 1935 | function godir_set_sort_field_order($field_ids = array()) |
| 1936 | 1936 | {
|
| 1937 | 1937 | |
| 1938 | - global $wpdb; |
|
| 1938 | + global $wpdb; |
|
| 1939 | 1939 | |
| 1940 | - $count = 0; |
|
| 1941 | - if (!empty($field_ids)): |
|
| 1942 | - foreach ($field_ids as $id) {
|
|
| 1940 | + $count = 0; |
|
| 1941 | + if (!empty($field_ids)): |
|
| 1942 | + foreach ($field_ids as $id) {
|
|
| 1943 | 1943 | |
| 1944 | - $cf = trim($id, '_'); |
|
| 1944 | + $cf = trim($id, '_'); |
|
| 1945 | 1945 | |
| 1946 | - $post_meta_info = $wpdb->query( |
|
| 1947 | - $wpdb->prepare( |
|
| 1948 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1946 | + $post_meta_info = $wpdb->query( |
|
| 1947 | + $wpdb->prepare( |
|
| 1948 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1949 | 1949 | sort_order=%d |
| 1950 | 1950 | where id= %d", |
| 1951 | - array($count, $cf) |
|
| 1952 | - ) |
|
| 1953 | - ); |
|
| 1954 | - $count++; |
|
| 1955 | - } |
|
| 1956 | - |
|
| 1957 | - return $field_ids; |
|
| 1958 | - else: |
|
| 1959 | - return false; |
|
| 1960 | - endif; |
|
| 1951 | + array($count, $cf) |
|
| 1952 | + ) |
|
| 1953 | + ); |
|
| 1954 | + $count++; |
|
| 1955 | + } |
|
| 1956 | + |
|
| 1957 | + return $field_ids; |
|
| 1958 | + else: |
|
| 1959 | + return false; |
|
| 1960 | + endif; |
|
| 1961 | 1961 | } |
| 1962 | 1962 | |
| 1963 | 1963 | |
| 1964 | 1964 | if (!function_exists('geodir_custom_sort_field_save')) {
|
| 1965 | - /** |
|
| 1966 | - * Save or Update custom sort fields into the database. |
|
| 1967 | - * |
|
| 1968 | - * @since 1.0.0 |
|
| 1969 | - * @package GeoDirectory |
|
| 1970 | - * @global object $wpdb WordPress Database object. |
|
| 1971 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1972 | - * @param array $request_field {
|
|
| 1973 | - * Attributes of the Request field. |
|
| 1974 | - * |
|
| 1975 | - * @type string $action Ajax action name. |
|
| 1976 | - * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1977 | - * @type string $create_field Do you want to create this field?. |
|
| 1978 | - * @type string $field_ins_upd Field created or updated?. |
|
| 1979 | - * @type string $_wpnonce Nonce value. |
|
| 1980 | - * @type string $listing_type The Post type. |
|
| 1981 | - * @type string $field_type Field Type. |
|
| 1982 | - * @type string $field_id Field ID. |
|
| 1983 | - * @type string $data_type Data Type. |
|
| 1984 | - * @type string $htmlvar_name HTML variable name. |
|
| 1985 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 1986 | - * @type string $is_default Is this default sorting?. |
|
| 1987 | - * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 1988 | - * @type string $sort_order Sort Order. |
|
| 1989 | - * |
|
| 1990 | - * } |
|
| 1991 | - * @param bool $default Not yet implemented. |
|
| 1992 | - * @return int Returns the last affected db table row id. |
|
| 1993 | - */ |
|
| 1994 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 1995 | - {
|
|
| 1996 | - |
|
| 1997 | - global $wpdb, $plugin_prefix; |
|
| 1998 | - |
|
| 1999 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2000 | - |
|
| 2001 | - $cf = trim($result_str, '_'); |
|
| 2002 | - |
|
| 2003 | - /*-------- check dublicate validation --------*/ |
|
| 2004 | - |
|
| 2005 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2006 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2007 | - |
|
| 2008 | - $post_type = $request_field['listing_type']; |
|
| 2009 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2010 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2011 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2012 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2013 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2014 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2015 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2016 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2017 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2018 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2019 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2020 | - |
|
| 2021 | - $default_order = ''; |
|
| 2022 | - if ($is_default != '') {
|
|
| 2023 | - $default_order = $is_default; |
|
| 2024 | - $is_default = '1'; |
|
| 2025 | - } |
|
| 2026 | - |
|
| 2027 | - |
|
| 2028 | - $check_html_variable = $wpdb->get_var( |
|
| 2029 | - $wpdb->prepare( |
|
| 2030 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2031 | - array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2032 | - ) |
|
| 2033 | - ); |
|
| 2034 | - |
|
| 2035 | - if ($is_default == 1) {
|
|
| 2036 | - |
|
| 2037 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2038 | - |
|
| 2039 | - } |
|
| 2040 | - |
|
| 2041 | - |
|
| 2042 | - if (!$check_html_variable) {
|
|
| 2043 | - |
|
| 2044 | - $wpdb->query( |
|
| 2045 | - |
|
| 2046 | - $wpdb->prepare( |
|
| 2047 | - |
|
| 2048 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1965 | + /** |
|
| 1966 | + * Save or Update custom sort fields into the database. |
|
| 1967 | + * |
|
| 1968 | + * @since 1.0.0 |
|
| 1969 | + * @package GeoDirectory |
|
| 1970 | + * @global object $wpdb WordPress Database object. |
|
| 1971 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1972 | + * @param array $request_field {
|
|
| 1973 | + * Attributes of the Request field. |
|
| 1974 | + * |
|
| 1975 | + * @type string $action Ajax action name. |
|
| 1976 | + * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1977 | + * @type string $create_field Do you want to create this field?. |
|
| 1978 | + * @type string $field_ins_upd Field created or updated?. |
|
| 1979 | + * @type string $_wpnonce Nonce value. |
|
| 1980 | + * @type string $listing_type The Post type. |
|
| 1981 | + * @type string $field_type Field Type. |
|
| 1982 | + * @type string $field_id Field ID. |
|
| 1983 | + * @type string $data_type Data Type. |
|
| 1984 | + * @type string $htmlvar_name HTML variable name. |
|
| 1985 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 1986 | + * @type string $is_default Is this default sorting?. |
|
| 1987 | + * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 1988 | + * @type string $sort_order Sort Order. |
|
| 1989 | + * |
|
| 1990 | + * } |
|
| 1991 | + * @param bool $default Not yet implemented. |
|
| 1992 | + * @return int Returns the last affected db table row id. |
|
| 1993 | + */ |
|
| 1994 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 1995 | + {
|
|
| 1996 | + |
|
| 1997 | + global $wpdb, $plugin_prefix; |
|
| 1998 | + |
|
| 1999 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2000 | + |
|
| 2001 | + $cf = trim($result_str, '_'); |
|
| 2002 | + |
|
| 2003 | + /*-------- check dublicate validation --------*/ |
|
| 2004 | + |
|
| 2005 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2006 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2007 | + |
|
| 2008 | + $post_type = $request_field['listing_type']; |
|
| 2009 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2010 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2011 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2012 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2013 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2014 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2015 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2016 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2017 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2018 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2019 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2020 | + |
|
| 2021 | + $default_order = ''; |
|
| 2022 | + if ($is_default != '') {
|
|
| 2023 | + $default_order = $is_default; |
|
| 2024 | + $is_default = '1'; |
|
| 2025 | + } |
|
| 2026 | + |
|
| 2027 | + |
|
| 2028 | + $check_html_variable = $wpdb->get_var( |
|
| 2029 | + $wpdb->prepare( |
|
| 2030 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2031 | + array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2032 | + ) |
|
| 2033 | + ); |
|
| 2034 | + |
|
| 2035 | + if ($is_default == 1) {
|
|
| 2036 | + |
|
| 2037 | + $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2038 | + |
|
| 2039 | + } |
|
| 2040 | + |
|
| 2041 | + |
|
| 2042 | + if (!$check_html_variable) {
|
|
| 2043 | + |
|
| 2044 | + $wpdb->query( |
|
| 2045 | + |
|
| 2046 | + $wpdb->prepare( |
|
| 2047 | + |
|
| 2048 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2049 | 2049 | post_type = %s, |
| 2050 | 2050 | data_type = %s, |
| 2051 | 2051 | field_type = %s, |
@@ -2060,23 +2060,23 @@ discard block |
||
| 2060 | 2060 | asc_title = %s, |
| 2061 | 2061 | desc_title = %s", |
| 2062 | 2062 | |
| 2063 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2064 | - ) |
|
| 2063 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2064 | + ) |
|
| 2065 | 2065 | |
| 2066 | - ); |
|
| 2066 | + ); |
|
| 2067 | 2067 | |
| 2068 | 2068 | |
| 2069 | - $lastid = $wpdb->insert_id; |
|
| 2069 | + $lastid = $wpdb->insert_id; |
|
| 2070 | 2070 | |
| 2071 | - $lastid = trim($lastid); |
|
| 2071 | + $lastid = trim($lastid); |
|
| 2072 | 2072 | |
| 2073 | - } else {
|
|
| 2073 | + } else {
|
|
| 2074 | 2074 | |
| 2075 | - $wpdb->query( |
|
| 2075 | + $wpdb->query( |
|
| 2076 | 2076 | |
| 2077 | - $wpdb->prepare( |
|
| 2077 | + $wpdb->prepare( |
|
| 2078 | 2078 | |
| 2079 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2079 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2080 | 2080 | post_type = %s, |
| 2081 | 2081 | data_type = %s, |
| 2082 | 2082 | field_type = %s, |
@@ -2092,115 +2092,115 @@ discard block |
||
| 2092 | 2092 | desc_title = %s |
| 2093 | 2093 | where id = %d", |
| 2094 | 2094 | |
| 2095 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2096 | - ) |
|
| 2095 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2096 | + ) |
|
| 2097 | 2097 | |
| 2098 | - ); |
|
| 2098 | + ); |
|
| 2099 | 2099 | |
| 2100 | - $lastid = trim($cf); |
|
| 2100 | + $lastid = trim($cf); |
|
| 2101 | 2101 | |
| 2102 | - } |
|
| 2102 | + } |
|
| 2103 | 2103 | |
| 2104 | 2104 | |
| 2105 | - return (int)$lastid; |
|
| 2105 | + return (int)$lastid; |
|
| 2106 | 2106 | |
| 2107 | - } |
|
| 2107 | + } |
|
| 2108 | 2108 | } |
| 2109 | 2109 | |
| 2110 | 2110 | |
| 2111 | 2111 | if (!function_exists('geodir_custom_sort_field_delete')) {
|
| 2112 | - /** |
|
| 2113 | - * Delete a custom sort field using field id. |
|
| 2114 | - * @since 1.0.0 |
|
| 2115 | - * @package GeoDirectory |
|
| 2116 | - * @global object $wpdb WordPress Database object. |
|
| 2117 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2118 | - * @param string $field_id The field ID. |
|
| 2119 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2120 | - */ |
|
| 2121 | - function geodir_custom_sort_field_delete($field_id = '') |
|
| 2122 | - {
|
|
| 2123 | - |
|
| 2124 | - global $wpdb, $plugin_prefix; |
|
| 2125 | - if ($field_id != '') {
|
|
| 2126 | - $cf = trim($field_id, '_'); |
|
| 2127 | - |
|
| 2128 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2129 | - |
|
| 2130 | - return $field_id; |
|
| 2131 | - |
|
| 2132 | - } else |
|
| 2133 | - return 0; |
|
| 2134 | - |
|
| 2135 | - } |
|
| 2112 | + /** |
|
| 2113 | + * Delete a custom sort field using field id. |
|
| 2114 | + * @since 1.0.0 |
|
| 2115 | + * @package GeoDirectory |
|
| 2116 | + * @global object $wpdb WordPress Database object. |
|
| 2117 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2118 | + * @param string $field_id The field ID. |
|
| 2119 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2120 | + */ |
|
| 2121 | + function geodir_custom_sort_field_delete($field_id = '') |
|
| 2122 | + {
|
|
| 2123 | + |
|
| 2124 | + global $wpdb, $plugin_prefix; |
|
| 2125 | + if ($field_id != '') {
|
|
| 2126 | + $cf = trim($field_id, '_'); |
|
| 2127 | + |
|
| 2128 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2129 | + |
|
| 2130 | + return $field_id; |
|
| 2131 | + |
|
| 2132 | + } else |
|
| 2133 | + return 0; |
|
| 2134 | + |
|
| 2135 | + } |
|
| 2136 | 2136 | } |
| 2137 | 2137 | |
| 2138 | 2138 | |
| 2139 | 2139 | if (!function_exists('geodir_custom_sort_field_adminhtml')) {
|
| 2140 | - /** |
|
| 2141 | - * Custom sort field admin html. |
|
| 2142 | - * |
|
| 2143 | - * @since 1.0.0 |
|
| 2144 | - * @package GeoDirectory |
|
| 2145 | - * @global object $wpdb WordPress Database object. |
|
| 2146 | - * @param string $field_type The form field type. |
|
| 2147 | - * @param object|int $result_str The custom field results object or row id. |
|
| 2148 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2149 | - * @param bool $default when set to true field will be for admin use only. |
|
| 2150 | - */ |
|
| 2151 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 2152 | - {
|
|
| 2153 | - global $wpdb; |
|
| 2154 | - $cf = $result_str; |
|
| 2155 | - if (!is_object($cf)) {
|
|
| 2156 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2157 | - } else {
|
|
| 2158 | - $field_info = $cf; |
|
| 2159 | - $result_str = $cf->id; |
|
| 2160 | - } |
|
| 2161 | - |
|
| 2162 | - $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2163 | - |
|
| 2164 | - if (!isset($field_info->post_type)) {
|
|
| 2165 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2166 | - } else {
|
|
| 2167 | - $post_type = $field_info->post_type; |
|
| 2168 | - } |
|
| 2169 | - |
|
| 2170 | - $field_types = explode('-_-', $field_type);
|
|
| 2171 | - $field_type = $field_types[0]; |
|
| 2172 | - $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
|
| 2173 | - |
|
| 2174 | - $site_title = ''; |
|
| 2175 | - if ($site_title == '') |
|
| 2176 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2177 | - |
|
| 2178 | - if ($site_title == '') {
|
|
| 2179 | - $fields = geodir_get_custom_sort_options($post_type); |
|
| 2180 | - |
|
| 2181 | - foreach ($fields as $val) {
|
|
| 2182 | - $val = stripslashes_deep($val); // strip slashes |
|
| 2183 | - |
|
| 2184 | - if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2185 | - $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2186 | - } |
|
| 2187 | - } |
|
| 2188 | - } |
|
| 2189 | - |
|
| 2190 | - if ($htmlvar_name == '') |
|
| 2191 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2192 | - |
|
| 2193 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2194 | - |
|
| 2195 | - ?> |
|
| 2140 | + /** |
|
| 2141 | + * Custom sort field admin html. |
|
| 2142 | + * |
|
| 2143 | + * @since 1.0.0 |
|
| 2144 | + * @package GeoDirectory |
|
| 2145 | + * @global object $wpdb WordPress Database object. |
|
| 2146 | + * @param string $field_type The form field type. |
|
| 2147 | + * @param object|int $result_str The custom field results object or row id. |
|
| 2148 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2149 | + * @param bool $default when set to true field will be for admin use only. |
|
| 2150 | + */ |
|
| 2151 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false) |
|
| 2152 | + {
|
|
| 2153 | + global $wpdb; |
|
| 2154 | + $cf = $result_str; |
|
| 2155 | + if (!is_object($cf)) {
|
|
| 2156 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2157 | + } else {
|
|
| 2158 | + $field_info = $cf; |
|
| 2159 | + $result_str = $cf->id; |
|
| 2160 | + } |
|
| 2161 | + |
|
| 2162 | + $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2163 | + |
|
| 2164 | + if (!isset($field_info->post_type)) {
|
|
| 2165 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2166 | + } else {
|
|
| 2167 | + $post_type = $field_info->post_type; |
|
| 2168 | + } |
|
| 2169 | + |
|
| 2170 | + $field_types = explode('-_-', $field_type);
|
|
| 2171 | + $field_type = $field_types[0]; |
|
| 2172 | + $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
|
| 2173 | + |
|
| 2174 | + $site_title = ''; |
|
| 2175 | + if ($site_title == '') |
|
| 2176 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2177 | + |
|
| 2178 | + if ($site_title == '') {
|
|
| 2179 | + $fields = geodir_get_custom_sort_options($post_type); |
|
| 2180 | + |
|
| 2181 | + foreach ($fields as $val) {
|
|
| 2182 | + $val = stripslashes_deep($val); // strip slashes |
|
| 2183 | + |
|
| 2184 | + if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2185 | + $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2186 | + } |
|
| 2187 | + } |
|
| 2188 | + } |
|
| 2189 | + |
|
| 2190 | + if ($htmlvar_name == '') |
|
| 2191 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2192 | + |
|
| 2193 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2194 | + |
|
| 2195 | + ?> |
|
| 2196 | 2196 | <li class="text" id="licontainer_<?php echo $result_str;?>"> |
| 2197 | 2197 | <div class="title title<?php echo $result_str;?> gt-fieldset" |
| 2198 | 2198 | title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
| 2199 | 2199 | ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
| 2200 | 2200 | <?php |
| 2201 | 2201 | |
| 2202 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2203 | - ?> |
|
| 2202 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2203 | + ?> |
|
| 2204 | 2204 | |
| 2205 | 2205 | <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
| 2206 | 2206 | onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
@@ -2213,17 +2213,17 @@ discard block |
||
| 2213 | 2213 | |
| 2214 | 2214 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
| 2215 | 2215 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2216 | - echo 'block;'; |
|
| 2217 | - } else {
|
|
| 2218 | - echo 'none;'; |
|
| 2219 | - } ?>"> |
|
| 2216 | + echo 'block;'; |
|
| 2217 | + } else {
|
|
| 2218 | + echo 'none;'; |
|
| 2219 | + } ?>"> |
|
| 2220 | 2220 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2221 | 2221 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
| 2222 | 2222 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
| 2223 | 2223 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
| 2224 | 2224 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2225 | - echo $field_info->data_type; |
|
| 2226 | - }?>"/> |
|
| 2225 | + echo $field_info->data_type; |
|
| 2226 | + }?>"/> |
|
| 2227 | 2227 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
| 2228 | 2228 | |
| 2229 | 2229 | |
@@ -2238,19 +2238,19 @@ discard block |
||
| 2238 | 2238 | <td> |
| 2239 | 2239 | <input type="checkbox" name="asc" id="asc" |
| 2240 | 2240 | value="1" <?php if (isset($field_info->sort_asc) && $field_info->sort_asc == '1') {
|
| 2241 | - echo 'checked="checked"'; |
|
| 2242 | - } ?>/> |
|
| 2241 | + echo 'checked="checked"'; |
|
| 2242 | + } ?>/> |
|
| 2243 | 2243 | |
| 2244 | 2244 | <input type="text" name="asc_title" id="asc_title" |
| 2245 | 2245 | placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
|
| 2246 | 2246 | value="<?php if (isset($field_info->asc_title)) {
|
| 2247 | - echo esc_attr($field_info->asc_title); |
|
| 2248 | - } ?>" style="width:45%;"/> |
|
| 2247 | + echo esc_attr($field_info->asc_title); |
|
| 2248 | + } ?>" style="width:45%;"/> |
|
| 2249 | 2249 | |
| 2250 | 2250 | <input type="radio" name="is_default" |
| 2251 | 2251 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
| 2252 | - echo 'checked="checked"'; |
|
| 2253 | - } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 2252 | + echo 'checked="checked"'; |
|
| 2253 | + } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 2254 | 2254 | |
| 2255 | 2255 | <br/> |
| 2256 | 2256 | <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
|
@@ -2262,18 +2262,18 @@ discard block |
||
| 2262 | 2262 | <td> |
| 2263 | 2263 | <input type="checkbox" name="desc" id="desc" |
| 2264 | 2264 | value="1" <?php if (isset($field_info->sort_desc) && $field_info->sort_desc == '1') {
|
| 2265 | - echo 'checked="checked"'; |
|
| 2266 | - } ?>/> |
|
| 2265 | + echo 'checked="checked"'; |
|
| 2266 | + } ?>/> |
|
| 2267 | 2267 | |
| 2268 | 2268 | <input type="text" name="desc_title" id="desc_title" |
| 2269 | 2269 | placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
|
| 2270 | 2270 | value="<?php if (isset($field_info->desc_title)) {
|
| 2271 | - echo esc_attr($field_info->desc_title); |
|
| 2272 | - } ?>" style="width:45%;"/> |
|
| 2271 | + echo esc_attr($field_info->desc_title); |
|
| 2272 | + } ?>" style="width:45%;"/> |
|
| 2273 | 2273 | <input type="radio" name="is_default" |
| 2274 | 2274 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
| 2275 | - echo 'checked="checked"'; |
|
| 2276 | - } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 2275 | + echo 'checked="checked"'; |
|
| 2276 | + } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
|
| 2277 | 2277 | <br/> |
| 2278 | 2278 | <span><?php _e('Select if you want to show option in sort.', 'geodirectory'); ?></span>
|
| 2279 | 2279 | </td> |
@@ -2296,8 +2296,8 @@ discard block |
||
| 2296 | 2296 | <td align="left"> |
| 2297 | 2297 | <input type="checkbox" name="is_default" |
| 2298 | 2298 | value="<?php echo $field_type; ?>" <?php if (isset($field_info->is_default) && $field_info->is_default == '1') {
|
| 2299 | - echo 'checked="checked"'; |
|
| 2300 | - } ?>/> |
|
| 2299 | + echo 'checked="checked"'; |
|
| 2300 | + } ?>/> |
|
| 2301 | 2301 | <br/> |
| 2302 | 2302 | <span><?php _e('If field is checked then the field will be use as default sort.', 'geodirectory'); ?></span>
|
| 2303 | 2303 | </td> |
@@ -2311,12 +2311,12 @@ discard block |
||
| 2311 | 2311 | <select name="is_active" id="is_active"> |
| 2312 | 2312 | <option |
| 2313 | 2313 | value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
|
| 2314 | - echo 'selected="selected"'; |
|
| 2315 | - }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 2314 | + echo 'selected="selected"'; |
|
| 2315 | + }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 2316 | 2316 | <option |
| 2317 | 2317 | value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
|
| 2318 | - echo 'selected="selected"'; |
|
| 2319 | - }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 2318 | + echo 'selected="selected"'; |
|
| 2319 | + }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 2320 | 2320 | </select> |
| 2321 | 2321 | <br/> |
| 2322 | 2322 | <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
|
@@ -2327,8 +2327,8 @@ discard block |
||
| 2327 | 2327 | <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
|
| 2328 | 2328 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order" |
| 2329 | 2329 | value="<?php if (isset($field_info->sort_order)) {
|
| 2330 | - echo esc_attr($field_info->sort_order); |
|
| 2331 | - }?>" size="50"/> |
|
| 2330 | + echo esc_attr($field_info->sort_order); |
|
| 2331 | + }?>" size="50"/> |
|
| 2332 | 2332 | <br/> |
| 2333 | 2333 | <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
|
| 2334 | 2334 | </td> |
@@ -2351,38 +2351,38 @@ discard block |
||
| 2351 | 2351 | </div> |
| 2352 | 2352 | </li> <?php |
| 2353 | 2353 | |
| 2354 | - } |
|
| 2354 | + } |
|
| 2355 | 2355 | } |
| 2356 | 2356 | |
| 2357 | 2357 | if (!function_exists('check_field_visibility')) {
|
| 2358 | - /** |
|
| 2359 | - * Check field visibility as per price package. |
|
| 2360 | - * |
|
| 2361 | - * @since 1.0.0 |
|
| 2362 | - * @package GeoDirectory |
|
| 2363 | - * @global object $wpdb WordPress Database object. |
|
| 2364 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2365 | - * @param int|string $package_id The package ID. |
|
| 2366 | - * @param string $field_name The field name. |
|
| 2367 | - * @param string $post_type Optional. The wordpress post type. |
|
| 2368 | - * @return bool Returns true when field visible, otherwise false. |
|
| 2369 | - */ |
|
| 2370 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2371 | - {
|
|
| 2372 | - global $wpdb, $geodir_addon_list; |
|
| 2373 | - if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2374 | - return true; |
|
| 2375 | - } |
|
| 2376 | - if (!$package_id || !$field_name || !$post_type) {
|
|
| 2377 | - return true; |
|
| 2378 | - } |
|
| 2379 | - $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));
|
|
| 2380 | - |
|
| 2381 | - if ($wpdb->get_var($sql)) {
|
|
| 2382 | - return true; |
|
| 2383 | - } |
|
| 2384 | - return false; |
|
| 2385 | - } |
|
| 2358 | + /** |
|
| 2359 | + * Check field visibility as per price package. |
|
| 2360 | + * |
|
| 2361 | + * @since 1.0.0 |
|
| 2362 | + * @package GeoDirectory |
|
| 2363 | + * @global object $wpdb WordPress Database object. |
|
| 2364 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2365 | + * @param int|string $package_id The package ID. |
|
| 2366 | + * @param string $field_name The field name. |
|
| 2367 | + * @param string $post_type Optional. The wordpress post type. |
|
| 2368 | + * @return bool Returns true when field visible, otherwise false. |
|
| 2369 | + */ |
|
| 2370 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2371 | + {
|
|
| 2372 | + global $wpdb, $geodir_addon_list; |
|
| 2373 | + if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2374 | + return true; |
|
| 2375 | + } |
|
| 2376 | + if (!$package_id || !$field_name || !$post_type) {
|
|
| 2377 | + return true; |
|
| 2378 | + } |
|
| 2379 | + $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));
|
|
| 2380 | + |
|
| 2381 | + if ($wpdb->get_var($sql)) {
|
|
| 2382 | + return true; |
|
| 2383 | + } |
|
| 2384 | + return false; |
|
| 2385 | + } |
|
| 2386 | 2386 | } |
| 2387 | 2387 | |
| 2388 | 2388 | /** |
@@ -2397,43 +2397,43 @@ discard block |
||
| 2397 | 2397 | */ |
| 2398 | 2398 | function geodir_string_to_options($input = '', $translated = false) |
| 2399 | 2399 | {
|
| 2400 | - $return = array(); |
|
| 2401 | - if ($input != '') {
|
|
| 2402 | - $input = trim($input); |
|
| 2403 | - $input = rtrim($input, ","); |
|
| 2404 | - $input = ltrim($input, ","); |
|
| 2405 | - $input = trim($input); |
|
| 2406 | - } |
|
| 2407 | - |
|
| 2408 | - $input_arr = explode(',', $input);
|
|
| 2409 | - |
|
| 2410 | - if (!empty($input_arr)) {
|
|
| 2411 | - foreach ($input_arr as $input_str) {
|
|
| 2412 | - $input_str = trim($input_str); |
|
| 2413 | - |
|
| 2414 | - if (strpos($input_str, "/") !== false) {
|
|
| 2415 | - $input_str = explode("/", $input_str, 2);
|
|
| 2416 | - $label = trim($input_str[0]); |
|
| 2417 | - if ($translated && $label != '') {
|
|
| 2418 | - $label = __($label, 'geodirectory'); |
|
| 2419 | - } |
|
| 2420 | - $label = ucfirst($label); |
|
| 2421 | - $value = trim($input_str[1]); |
|
| 2422 | - } else {
|
|
| 2423 | - if ($translated && $input_str != '') {
|
|
| 2424 | - $input_str = __($input_str, 'geodirectory'); |
|
| 2425 | - } |
|
| 2426 | - $label = ucfirst($input_str); |
|
| 2427 | - $value = $input_str; |
|
| 2428 | - } |
|
| 2429 | - |
|
| 2430 | - if ($label != '') {
|
|
| 2431 | - $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2432 | - } |
|
| 2433 | - } |
|
| 2434 | - } |
|
| 2435 | - |
|
| 2436 | - return $return; |
|
| 2400 | + $return = array(); |
|
| 2401 | + if ($input != '') {
|
|
| 2402 | + $input = trim($input); |
|
| 2403 | + $input = rtrim($input, ","); |
|
| 2404 | + $input = ltrim($input, ","); |
|
| 2405 | + $input = trim($input); |
|
| 2406 | + } |
|
| 2407 | + |
|
| 2408 | + $input_arr = explode(',', $input);
|
|
| 2409 | + |
|
| 2410 | + if (!empty($input_arr)) {
|
|
| 2411 | + foreach ($input_arr as $input_str) {
|
|
| 2412 | + $input_str = trim($input_str); |
|
| 2413 | + |
|
| 2414 | + if (strpos($input_str, "/") !== false) {
|
|
| 2415 | + $input_str = explode("/", $input_str, 2);
|
|
| 2416 | + $label = trim($input_str[0]); |
|
| 2417 | + if ($translated && $label != '') {
|
|
| 2418 | + $label = __($label, 'geodirectory'); |
|
| 2419 | + } |
|
| 2420 | + $label = ucfirst($label); |
|
| 2421 | + $value = trim($input_str[1]); |
|
| 2422 | + } else {
|
|
| 2423 | + if ($translated && $input_str != '') {
|
|
| 2424 | + $input_str = __($input_str, 'geodirectory'); |
|
| 2425 | + } |
|
| 2426 | + $label = ucfirst($input_str); |
|
| 2427 | + $value = $input_str; |
|
| 2428 | + } |
|
| 2429 | + |
|
| 2430 | + if ($label != '') {
|
|
| 2431 | + $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2432 | + } |
|
| 2433 | + } |
|
| 2434 | + } |
|
| 2435 | + |
|
| 2436 | + return $return; |
|
| 2437 | 2437 | } |
| 2438 | 2438 | |
| 2439 | 2439 | /** |
@@ -2448,59 +2448,59 @@ discard block |
||
| 2448 | 2448 | */ |
| 2449 | 2449 | function geodir_string_values_to_options($option_values = '', $translated = false) |
| 2450 | 2450 | {
|
| 2451 | - $options = array(); |
|
| 2452 | - if ($option_values == '') {
|
|
| 2453 | - return NULL; |
|
| 2454 | - } |
|
| 2455 | - |
|
| 2456 | - if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2457 | - $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2458 | - |
|
| 2459 | - foreach ($option_values_arr as $optgroup) {
|
|
| 2460 | - if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2461 | - $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2462 | - |
|
| 2463 | - $count = 0; |
|
| 2464 | - foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2465 | - $count++; |
|
| 2466 | - $optgroup_str = trim($optgroup_str); |
|
| 2467 | - |
|
| 2468 | - $optgroup_label = ''; |
|
| 2469 | - if (strpos($optgroup_str, "|") !== false) {
|
|
| 2470 | - $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2471 | - $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2472 | - if ($translated && $optgroup_label != '') {
|
|
| 2473 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2474 | - } |
|
| 2475 | - $optgroup_label = ucfirst($optgroup_label); |
|
| 2476 | - $optgroup_str = $optgroup_str_arr[1]; |
|
| 2477 | - } |
|
| 2478 | - |
|
| 2479 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2480 | - |
|
| 2481 | - if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2482 | - $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2483 | - $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2484 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2485 | - } |
|
| 2486 | - $options = array_merge($options, $optgroup3); |
|
| 2487 | - } |
|
| 2488 | - } else {
|
|
| 2489 | - $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2490 | - $options = array_merge($options, $optgroup1); |
|
| 2491 | - } |
|
| 2492 | - } |
|
| 2493 | - } else {
|
|
| 2494 | - $options = geodir_string_to_options($option_values, $translated); |
|
| 2495 | - } |
|
| 2496 | - |
|
| 2497 | - return $options; |
|
| 2451 | + $options = array(); |
|
| 2452 | + if ($option_values == '') {
|
|
| 2453 | + return NULL; |
|
| 2454 | + } |
|
| 2455 | + |
|
| 2456 | + if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2457 | + $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2458 | + |
|
| 2459 | + foreach ($option_values_arr as $optgroup) {
|
|
| 2460 | + if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2461 | + $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2462 | + |
|
| 2463 | + $count = 0; |
|
| 2464 | + foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2465 | + $count++; |
|
| 2466 | + $optgroup_str = trim($optgroup_str); |
|
| 2467 | + |
|
| 2468 | + $optgroup_label = ''; |
|
| 2469 | + if (strpos($optgroup_str, "|") !== false) {
|
|
| 2470 | + $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2471 | + $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2472 | + if ($translated && $optgroup_label != '') {
|
|
| 2473 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2474 | + } |
|
| 2475 | + $optgroup_label = ucfirst($optgroup_label); |
|
| 2476 | + $optgroup_str = $optgroup_str_arr[1]; |
|
| 2477 | + } |
|
| 2478 | + |
|
| 2479 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2480 | + |
|
| 2481 | + if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2482 | + $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2483 | + $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2484 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2485 | + } |
|
| 2486 | + $options = array_merge($options, $optgroup3); |
|
| 2487 | + } |
|
| 2488 | + } else {
|
|
| 2489 | + $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2490 | + $options = array_merge($options, $optgroup1); |
|
| 2491 | + } |
|
| 2492 | + } |
|
| 2493 | + } else {
|
|
| 2494 | + $options = geodir_string_to_options($option_values, $translated); |
|
| 2495 | + } |
|
| 2496 | + |
|
| 2497 | + return $options; |
|
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | 2500 | |
| 2501 | 2501 | function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
| 2502 | - ob_start(); |
|
| 2503 | - ?> |
|
| 2502 | + ob_start(); |
|
| 2503 | + ?> |
|
| 2504 | 2504 | <li> |
| 2505 | 2505 | <label for="data_type""><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
|
| 2506 | 2506 | <div class="gd-cf-input-wrap"> |
@@ -2509,16 +2509,16 @@ discard block |
||
| 2509 | 2509 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2510 | 2510 | <option |
| 2511 | 2511 | value="XVARCHAR" <?php if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
|
| 2512 | - echo 'selected="selected"'; |
|
| 2513 | - } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2512 | + echo 'selected="selected"'; |
|
| 2513 | + } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2514 | 2514 | <option |
| 2515 | 2515 | value="INT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'INT') {
|
| 2516 | - echo 'selected="selected"'; |
|
| 2517 | - } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2516 | + echo 'selected="selected"'; |
|
| 2517 | + } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2518 | 2518 | <option |
| 2519 | 2519 | value="FLOAT" <?php if (isset($field_info->data_type) && $field_info->data_type == 'FLOAT') {
|
| 2520 | - echo 'selected="selected"'; |
|
| 2521 | - } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2520 | + echo 'selected="selected"'; |
|
| 2521 | + } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2522 | 2522 | </select> |
| 2523 | 2523 | <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
|
| 2524 | 2524 | |
@@ -2531,8 +2531,8 @@ discard block |
||
| 2531 | 2531 | <select name="decimal_point" id="decimal_point"> |
| 2532 | 2532 | <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
|
| 2533 | 2533 | <?php for ($i = 1; $i <= 10; $i++) {
|
| 2534 | - $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : ''; |
|
| 2535 | - $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?> |
|
| 2534 | + $decimal_point = isset($field_info->decimal_point) ? $field_info->decimal_point : ''; |
|
| 2535 | + $selected = $i == $decimal_point ? 'selected="selected"' : ''; ?> |
|
| 2536 | 2536 | <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option> |
| 2537 | 2537 | <?php } ?> |
| 2538 | 2538 | </select> |
@@ -2541,8 +2541,8 @@ discard block |
||
| 2541 | 2541 | </li> |
| 2542 | 2542 | <?php |
| 2543 | 2543 | |
| 2544 | - $output = ob_get_clean(); |
|
| 2545 | - return $output; |
|
| 2544 | + $output = ob_get_clean(); |
|
| 2545 | + return $output; |
|
| 2546 | 2546 | } |
| 2547 | 2547 | add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
| 2548 | 2548 | |
@@ -2580,9 +2580,9 @@ discard block |
||
| 2580 | 2580 | |
| 2581 | 2581 | |
| 2582 | 2582 | function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
| 2583 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2584 | - ob_start(); |
|
| 2585 | - ?> |
|
| 2583 | + if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2584 | + ob_start(); |
|
| 2585 | + ?> |
|
| 2586 | 2586 | <li> |
| 2587 | 2587 | <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
|
| 2588 | 2588 | <div class="gdcf-tooltip"> |
@@ -2593,13 +2593,13 @@ discard block |
||
| 2593 | 2593 | <div class="gd-cf-input-wrap"> |
| 2594 | 2594 | |
| 2595 | 2595 | <?php |
| 2596 | - $selected = ''; |
|
| 2597 | - if (isset($field_info->extra_fields)) |
|
| 2598 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2596 | + $selected = ''; |
|
| 2597 | + if (isset($field_info->extra_fields)) |
|
| 2598 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2599 | 2599 | |
| 2600 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2601 | - $selected = 'checked="checked"'; |
|
| 2602 | - ?> |
|
| 2600 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2601 | + $selected = 'checked="checked"'; |
|
| 2602 | + ?> |
|
| 2603 | 2603 | |
| 2604 | 2604 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
| 2605 | 2605 | value="1" <?php echo $selected; ?>/> |
@@ -2608,15 +2608,15 @@ discard block |
||
| 2608 | 2608 | </li> |
| 2609 | 2609 | <?php |
| 2610 | 2610 | |
| 2611 | - $output = ob_get_clean(); |
|
| 2612 | - return $output; |
|
| 2611 | + $output = ob_get_clean(); |
|
| 2612 | + return $output; |
|
| 2613 | 2613 | } |
| 2614 | 2614 | add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
| 2615 | 2615 | |
| 2616 | 2616 | |
| 2617 | 2617 | function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
| 2618 | - ob_start(); |
|
| 2619 | - ?> |
|
| 2618 | + ob_start(); |
|
| 2619 | + ?> |
|
| 2620 | 2620 | <li> |
| 2621 | 2621 | <label for="validation_pattern" class="gd-cf-tooltip-wrap"> |
| 2622 | 2622 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
|
@@ -2627,8 +2627,8 @@ discard block |
||
| 2627 | 2627 | <div class="gd-cf-input-wrap"> |
| 2628 | 2628 | <input type="text" name="validation_pattern" id="validation_pattern" |
| 2629 | 2629 | value="<?php if (isset($field_info->validation_pattern)) {
|
| 2630 | - echo esc_attr($field_info->validation_pattern); |
|
| 2631 | - } ?>"/> |
|
| 2630 | + echo esc_attr($field_info->validation_pattern); |
|
| 2631 | + } ?>"/> |
|
| 2632 | 2632 | </div> |
| 2633 | 2633 | </li> |
| 2634 | 2634 | |
@@ -2642,27 +2642,27 @@ discard block |
||
| 2642 | 2642 | <div class="gd-cf-input-wrap"> |
| 2643 | 2643 | <input type="text" name="validation_msg" id="validation_msg" |
| 2644 | 2644 | value="<?php if (isset($field_info->validation_msg)) {
|
| 2645 | - echo esc_attr($field_info->validation_msg); |
|
| 2646 | - } ?>"/> |
|
| 2645 | + echo esc_attr($field_info->validation_msg); |
|
| 2646 | + } ?>"/> |
|
| 2647 | 2647 | </div> |
| 2648 | 2648 | </li> |
| 2649 | 2649 | <?php |
| 2650 | 2650 | |
| 2651 | - $output = ob_get_clean(); |
|
| 2652 | - return $output; |
|
| 2651 | + $output = ob_get_clean(); |
|
| 2652 | + return $output; |
|
| 2653 | 2653 | } |
| 2654 | 2654 | add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
| 2655 | 2655 | |
| 2656 | 2656 | |
| 2657 | 2657 | function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
| 2658 | - ob_start(); |
|
| 2659 | - global $post_type; |
|
| 2660 | - |
|
| 2661 | - if (!isset($field_info->post_type)) {
|
|
| 2662 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2663 | - } else |
|
| 2664 | - $post_type = $field_info->post_type; |
|
| 2665 | - ?> |
|
| 2658 | + ob_start(); |
|
| 2659 | + global $post_type; |
|
| 2660 | + |
|
| 2661 | + if (!isset($field_info->post_type)) {
|
|
| 2662 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2663 | + } else |
|
| 2664 | + $post_type = $field_info->post_type; |
|
| 2665 | + ?> |
|
| 2666 | 2666 | <li style="display: none;"> |
| 2667 | 2667 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
| 2668 | 2668 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
|
@@ -2673,15 +2673,15 @@ discard block |
||
| 2673 | 2673 | <div class="gd-cf-input-wrap"> |
| 2674 | 2674 | <select name="htmlvar_name" id="htmlvar_name"> |
| 2675 | 2675 | <?php |
| 2676 | - $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2676 | + $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2677 | 2677 | |
| 2678 | - foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2679 | - ?> |
|
| 2678 | + foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2679 | + ?> |
|
| 2680 | 2680 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2681 | - echo 'selected="selected"'; |
|
| 2682 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2683 | - } |
|
| 2684 | - ?> |
|
| 2681 | + echo 'selected="selected"'; |
|
| 2682 | + }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2683 | + } |
|
| 2684 | + ?> |
|
| 2685 | 2685 | </select> |
| 2686 | 2686 | </div> |
| 2687 | 2687 | </li> |
@@ -2697,47 +2697,47 @@ discard block |
||
| 2697 | 2697 | |
| 2698 | 2698 | <select name="cat_display_type" id="cat_display_type"> |
| 2699 | 2699 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2700 | - echo 'selected="selected"'; |
|
| 2701 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2700 | + echo 'selected="selected"'; |
|
| 2701 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2702 | 2702 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2703 | - echo 'selected="selected"'; |
|
| 2704 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2703 | + echo 'selected="selected"'; |
|
| 2704 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2705 | 2705 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2706 | - echo 'selected="selected"'; |
|
| 2707 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2706 | + echo 'selected="selected"'; |
|
| 2707 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2708 | 2708 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2709 | - echo 'selected="selected"'; |
|
| 2710 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2709 | + echo 'selected="selected"'; |
|
| 2710 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2711 | 2711 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2712 | - echo 'selected="selected"'; |
|
| 2713 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2712 | + echo 'selected="selected"'; |
|
| 2713 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2714 | 2714 | </select> |
| 2715 | 2715 | </div> |
| 2716 | 2716 | </li> |
| 2717 | 2717 | <?php |
| 2718 | 2718 | |
| 2719 | - $output = ob_get_clean(); |
|
| 2720 | - return $output; |
|
| 2719 | + $output = ob_get_clean(); |
|
| 2720 | + return $output; |
|
| 2721 | 2721 | } |
| 2722 | 2722 | add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
| 2723 | 2723 | |
| 2724 | 2724 | |
| 2725 | 2725 | function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
| 2726 | 2726 | |
| 2727 | - ob_start(); |
|
| 2728 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2729 | - $address = unserialize($field_info->extra_fields); |
|
| 2730 | - } |
|
| 2731 | - ?> |
|
| 2727 | + ob_start(); |
|
| 2728 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2729 | + $address = unserialize($field_info->extra_fields); |
|
| 2730 | + } |
|
| 2731 | + ?> |
|
| 2732 | 2732 | <?php |
| 2733 | - /** |
|
| 2734 | - * Called on the add custom fields settings page before the address field is output. |
|
| 2735 | - * |
|
| 2736 | - * @since 1.0.0 |
|
| 2737 | - * @param array $address The address settings array. |
|
| 2738 | - * @param object $field_info Extra fields info. |
|
| 2739 | - */ |
|
| 2740 | - do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2733 | + /** |
|
| 2734 | + * Called on the add custom fields settings page before the address field is output. |
|
| 2735 | + * |
|
| 2736 | + * @since 1.0.0 |
|
| 2737 | + * @param array $address The address settings array. |
|
| 2738 | + * @param object $field_info Extra fields info. |
|
| 2739 | + */ |
|
| 2740 | + do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2741 | 2741 | |
| 2742 | 2742 | <li> |
| 2743 | 2743 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
@@ -2750,14 +2750,14 @@ discard block |
||
| 2750 | 2750 | |
| 2751 | 2751 | <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
| 2752 | 2752 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2753 | - echo 'checked'; |
|
| 2754 | - } ?>/> |
|
| 2753 | + echo 'checked'; |
|
| 2754 | + } ?>/> |
|
| 2755 | 2755 | <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>
|
| 2756 | 2756 | |
| 2757 | 2757 | <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
| 2758 | 2758 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2759 | - echo 'checked'; |
|
| 2760 | - } ?>/> |
|
| 2759 | + echo 'checked'; |
|
| 2760 | + } ?>/> |
|
| 2761 | 2761 | <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>
|
| 2762 | 2762 | |
| 2763 | 2763 | |
@@ -2774,8 +2774,8 @@ discard block |
||
| 2774 | 2774 | <div class="gd-cf-input-wrap"> |
| 2775 | 2775 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
| 2776 | 2776 | value="<?php if (isset($address['zip_lable'])) {
|
| 2777 | - echo esc_attr($address['zip_lable']); |
|
| 2778 | - }?>"/> |
|
| 2777 | + echo esc_attr($address['zip_lable']); |
|
| 2778 | + }?>"/> |
|
| 2779 | 2779 | </div> |
| 2780 | 2780 | </li> |
| 2781 | 2781 | |
@@ -2792,8 +2792,8 @@ discard block |
||
| 2792 | 2792 | <div class="gd-cf-input-wrap"> |
| 2793 | 2793 | <input type="text" name="extra[map_lable]" id="map_lable" |
| 2794 | 2794 | value="<?php if (isset($address['map_lable'])) {
|
| 2795 | - echo esc_attr($address['map_lable']); |
|
| 2796 | - }?>"/> |
|
| 2795 | + echo esc_attr($address['map_lable']); |
|
| 2796 | + }?>"/> |
|
| 2797 | 2797 | </div> |
| 2798 | 2798 | </li> |
| 2799 | 2799 | |
@@ -2808,14 +2808,14 @@ discard block |
||
| 2808 | 2808 | |
| 2809 | 2809 | <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
| 2810 | 2810 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2811 | - echo 'checked'; |
|
| 2812 | - } ?>/> |
|
| 2811 | + echo 'checked'; |
|
| 2812 | + } ?>/> |
|
| 2813 | 2813 | <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2814 | 2814 | |
| 2815 | 2815 | <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
| 2816 | 2816 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2817 | - echo 'checked'; |
|
| 2818 | - } ?>/> |
|
| 2817 | + echo 'checked'; |
|
| 2818 | + } ?>/> |
|
| 2819 | 2819 | <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2820 | 2820 | |
| 2821 | 2821 | </div> |
@@ -2832,14 +2832,14 @@ discard block |
||
| 2832 | 2832 | |
| 2833 | 2833 | <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
| 2834 | 2834 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 2835 | - echo 'checked'; |
|
| 2836 | - } ?>/> |
|
| 2835 | + echo 'checked'; |
|
| 2836 | + } ?>/> |
|
| 2837 | 2837 | <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2838 | 2838 | |
| 2839 | 2839 | <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
| 2840 | 2840 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 2841 | - echo 'checked'; |
|
| 2842 | - } ?>/> |
|
| 2841 | + echo 'checked'; |
|
| 2842 | + } ?>/> |
|
| 2843 | 2843 | <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2844 | 2844 | |
| 2845 | 2845 | </div> |
@@ -2856,8 +2856,8 @@ discard block |
||
| 2856 | 2856 | <div class="gd-cf-input-wrap"> |
| 2857 | 2857 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
| 2858 | 2858 | value="<?php if (isset($address['mapview_lable'])) {
|
| 2859 | - echo esc_attr($address['mapview_lable']); |
|
| 2860 | - }?>"/> |
|
| 2859 | + echo esc_attr($address['mapview_lable']); |
|
| 2860 | + }?>"/> |
|
| 2861 | 2861 | </div> |
| 2862 | 2862 | </li> |
| 2863 | 2863 | <li> |
@@ -2871,29 +2871,29 @@ discard block |
||
| 2871 | 2871 | |
| 2872 | 2872 | <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
| 2873 | 2873 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 2874 | - echo 'checked'; |
|
| 2875 | - } ?>/> |
|
| 2874 | + echo 'checked'; |
|
| 2875 | + } ?>/> |
|
| 2876 | 2876 | <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2877 | 2877 | |
| 2878 | 2878 | <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
| 2879 | 2879 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 2880 | - echo 'checked'; |
|
| 2881 | - } ?>/> |
|
| 2880 | + echo 'checked'; |
|
| 2881 | + } ?>/> |
|
| 2882 | 2882 | <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2883 | 2883 | |
| 2884 | 2884 | </div> |
| 2885 | 2885 | </li> |
| 2886 | 2886 | <?php |
| 2887 | 2887 | |
| 2888 | - $output = ob_get_clean(); |
|
| 2889 | - return $output; |
|
| 2888 | + $output = ob_get_clean(); |
|
| 2889 | + return $output; |
|
| 2890 | 2890 | } |
| 2891 | 2891 | add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
| 2892 | 2892 | |
| 2893 | 2893 | |
| 2894 | 2894 | function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
| 2895 | - ob_start(); |
|
| 2896 | - ?> |
|
| 2895 | + ob_start(); |
|
| 2896 | + ?> |
|
| 2897 | 2897 | <li> |
| 2898 | 2898 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 2899 | 2899 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
@@ -2905,14 +2905,14 @@ discard block |
||
| 2905 | 2905 | |
| 2906 | 2906 | <select name="multi_display_type" id="multi_display_type"> |
| 2907 | 2907 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2908 | - echo 'selected="selected"'; |
|
| 2909 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2908 | + echo 'selected="selected"'; |
|
| 2909 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2910 | 2910 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2911 | - echo 'selected="selected"'; |
|
| 2912 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2911 | + echo 'selected="selected"'; |
|
| 2912 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2913 | 2913 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2914 | - echo 'selected="selected"'; |
|
| 2915 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2914 | + echo 'selected="selected"'; |
|
| 2915 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2916 | 2916 | </select> |
| 2917 | 2917 | |
| 2918 | 2918 | <br/> |
@@ -2920,15 +2920,15 @@ discard block |
||
| 2920 | 2920 | </li> |
| 2921 | 2921 | <?php |
| 2922 | 2922 | |
| 2923 | - $output = ob_get_clean(); |
|
| 2924 | - return $output; |
|
| 2923 | + $output = ob_get_clean(); |
|
| 2924 | + return $output; |
|
| 2925 | 2925 | } |
| 2926 | 2926 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
| 2927 | 2927 | |
| 2928 | 2928 | |
| 2929 | 2929 | function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
| 2930 | - ob_start(); |
|
| 2931 | - ?> |
|
| 2930 | + ob_start(); |
|
| 2931 | + ?> |
|
| 2932 | 2932 | <li> |
| 2933 | 2933 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 2934 | 2934 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
@@ -2949,16 +2949,16 @@ discard block |
||
| 2949 | 2949 | <div class="gd-cf-input-wrap"> |
| 2950 | 2950 | <input type="text" name="option_values" id="option_values" |
| 2951 | 2951 | value="<?php if (isset($field_info->option_values)) {
|
| 2952 | - echo esc_attr($field_info->option_values); |
|
| 2953 | - }?>"/> |
|
| 2952 | + echo esc_attr($field_info->option_values); |
|
| 2953 | + }?>"/> |
|
| 2954 | 2954 | <br/> |
| 2955 | 2955 | |
| 2956 | 2956 | </div> |
| 2957 | 2957 | </li> |
| 2958 | 2958 | <?php |
| 2959 | 2959 | |
| 2960 | - $output = ob_get_clean(); |
|
| 2961 | - return $output; |
|
| 2960 | + $output = ob_get_clean(); |
|
| 2961 | + return $output; |
|
| 2962 | 2962 | } |
| 2963 | 2963 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
| 2964 | 2964 | add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
@@ -2966,11 +2966,11 @@ discard block |
||
| 2966 | 2966 | |
| 2967 | 2967 | |
| 2968 | 2968 | function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
| 2969 | - ob_start(); |
|
| 2970 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2971 | - $extra = unserialize($field_info->extra_fields); |
|
| 2972 | - } |
|
| 2973 | - ?> |
|
| 2969 | + ob_start(); |
|
| 2970 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2971 | + $extra = unserialize($field_info->extra_fields); |
|
| 2972 | + } |
|
| 2973 | + ?> |
|
| 2974 | 2974 | <li> |
| 2975 | 2975 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 2976 | 2976 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
@@ -2980,52 +2980,52 @@ discard block |
||
| 2980 | 2980 | </label> |
| 2981 | 2981 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
| 2982 | 2982 | <?php |
| 2983 | - $date_formats = array( |
|
| 2984 | - 'm/d/Y', |
|
| 2985 | - 'd/m/Y', |
|
| 2986 | - 'Y/m/d', |
|
| 2987 | - 'm-d-Y', |
|
| 2988 | - 'd-m-Y', |
|
| 2989 | - 'Y-m-d', |
|
| 2990 | - 'F j, Y', |
|
| 2991 | - ); |
|
| 2992 | - /** |
|
| 2993 | - * Filter the custom field date format options. |
|
| 2994 | - * |
|
| 2995 | - * @since 1.6.5 |
|
| 2996 | - * @param array $date_formats The PHP date format array. |
|
| 2997 | - */ |
|
| 2998 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 2999 | - ?> |
|
| 2983 | + $date_formats = array( |
|
| 2984 | + 'm/d/Y', |
|
| 2985 | + 'd/m/Y', |
|
| 2986 | + 'Y/m/d', |
|
| 2987 | + 'm-d-Y', |
|
| 2988 | + 'd-m-Y', |
|
| 2989 | + 'Y-m-d', |
|
| 2990 | + 'F j, Y', |
|
| 2991 | + ); |
|
| 2992 | + /** |
|
| 2993 | + * Filter the custom field date format options. |
|
| 2994 | + * |
|
| 2995 | + * @since 1.6.5 |
|
| 2996 | + * @param array $date_formats The PHP date format array. |
|
| 2997 | + */ |
|
| 2998 | + $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 2999 | + ?> |
|
| 3000 | 3000 | <select name="extra[date_format]" id="date_format"> |
| 3001 | 3001 | <?php |
| 3002 | - foreach($date_formats as $format){
|
|
| 3003 | - $selected = ''; |
|
| 3004 | - if(esc_attr($extra['date_format'])==$format){
|
|
| 3005 | - $selected = "selected='selected'"; |
|
| 3006 | - } |
|
| 3007 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3008 | - } |
|
| 3009 | - ?> |
|
| 3002 | + foreach($date_formats as $format){
|
|
| 3003 | + $selected = ''; |
|
| 3004 | + if(esc_attr($extra['date_format'])==$format){
|
|
| 3005 | + $selected = "selected='selected'"; |
|
| 3006 | + } |
|
| 3007 | + echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3008 | + } |
|
| 3009 | + ?> |
|
| 3010 | 3010 | </select> |
| 3011 | 3011 | |
| 3012 | 3012 | </div> |
| 3013 | 3013 | </li> |
| 3014 | 3014 | <?php |
| 3015 | 3015 | |
| 3016 | - $output = ob_get_clean(); |
|
| 3017 | - return $output; |
|
| 3016 | + $output = ob_get_clean(); |
|
| 3017 | + return $output; |
|
| 3018 | 3018 | } |
| 3019 | 3019 | add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
| 3020 | 3020 | |
| 3021 | 3021 | |
| 3022 | 3022 | function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
| 3023 | - ob_start(); |
|
| 3024 | - $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3023 | + ob_start(); |
|
| 3024 | + $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3025 | 3025 | |
| 3026 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3027 | - $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3028 | - ?> |
|
| 3026 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3027 | + $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3028 | + ?> |
|
| 3029 | 3029 | <li> |
| 3030 | 3030 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3031 | 3031 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
@@ -3048,7 +3048,7 @@ discard block |
||
| 3048 | 3048 | </li> |
| 3049 | 3049 | <?php |
| 3050 | 3050 | |
| 3051 | - $output = ob_get_clean(); |
|
| 3052 | - return $output; |
|
| 3051 | + $output = ob_get_clean(); |
|
| 3052 | + return $output; |
|
| 3053 | 3053 | } |
| 3054 | 3054 | add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4); |
| 3055 | 3055 | \ No newline at end of file |
@@ -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 | |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 305 | 305 | |
| 306 | 306 | // some servers fail if a POST value is VARCHAR so we change it. |
| 307 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 307 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 308 | 308 | $request_field['data_type'] = 'VARCHAR'; |
| 309 | 309 | } |
| 310 | 310 | |
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | $post_type = $request_field['listing_type']; |
| 318 | 318 | |
| 319 | 319 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 320 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 320 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $check_html_variable = $wpdb->get_var( |
| 324 | 324 | $wpdb->prepare( |
| 325 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 325 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | 326 | array($cf, $cehhtmlvar_name, $post_type) |
| 327 | 327 | ) |
| 328 | 328 | ); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $post_meta_info = $wpdb->get_row( |
| 336 | 336 | $wpdb->prepare( |
| 337 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 337 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 338 | 338 | array($cf) |
| 339 | 339 | ) |
| 340 | 340 | ); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | if ($post_type == '') $post_type = 'gd_place'; |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 355 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 356 | 356 | |
| 357 | 357 | $admin_title = $request_field['admin_title']; |
| 358 | 358 | $site_title = $request_field['site_title']; |
@@ -380,12 +380,12 @@ discard block |
||
| 380 | 380 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 381 | 381 | |
| 382 | 382 | |
| 383 | - if(is_array($show_in)){
|
|
| 383 | + if (is_array($show_in)) {
|
|
| 384 | 384 | $show_in = implode(",", $request_field['show_in']);
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 388 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 388 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $option_values = ''; |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | if ($sort_order == '') {
|
| 428 | 428 | |
| 429 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 429 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | 430 | |
| 431 | - $sort_order = (int)$last_order + 1; |
|
| 431 | + $sort_order = (int) $last_order + 1; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $default_value_add = ''; |
@@ -440,15 +440,15 @@ discard block |
||
| 440 | 440 | case 'address': |
| 441 | 441 | |
| 442 | 442 | if ($htmlvar_name != '') {
|
| 443 | - $prefix = $htmlvar_name . '_'; |
|
| 443 | + $prefix = $htmlvar_name.'_'; |
|
| 444 | 444 | } |
| 445 | - $old_prefix = $old_html_variable . '_'; |
|
| 445 | + $old_prefix = $old_html_variable.'_'; |
|
| 446 | 446 | |
| 447 | 447 | |
| 448 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 448 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 449 | 449 | |
| 450 | 450 | if ($default_value != '') {
|
| 451 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 451 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | $wpdb->query($meta_field_add); |
@@ -457,12 +457,12 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 459 | 459 | |
| 460 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 460 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 461 | 461 | if ($is_column) {
|
| 462 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 462 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 463 | 463 | |
| 464 | 464 | if ($default_value != '') {
|
| 465 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 465 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | $wpdb->query($meta_field_add); |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | |
| 471 | 471 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 472 | 472 | if ($default_value != '') {
|
| 473 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 473 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 474 | 474 | } |
| 475 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 475 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 476 | 476 | |
| 477 | 477 | } |
| 478 | 478 | |
@@ -482,36 +482,36 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 484 | 484 | |
| 485 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 485 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 486 | 486 | |
| 487 | 487 | if ($is_column) {
|
| 488 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 488 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 489 | 489 | |
| 490 | 490 | if ($default_value != '') {
|
| 491 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 491 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $wpdb->query($meta_field_add); |
| 495 | 495 | } else {
|
| 496 | 496 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 497 | 497 | if ($default_value != '') {
|
| 498 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 498 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 501 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | } |
| 505 | 505 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 506 | 506 | |
| 507 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 507 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 508 | 508 | |
| 509 | 509 | if ($is_column) {
|
| 510 | 510 | |
| 511 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 511 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 512 | 512 | |
| 513 | 513 | if ($default_value != '') {
|
| 514 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 514 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | $wpdb->query($meta_field_add); |
@@ -519,24 +519,24 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 521 | 521 | if ($default_value != '') {
|
| 522 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 522 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 525 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 526 | 526 | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | } |
| 530 | 530 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 531 | 531 | |
| 532 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 532 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 533 | 533 | |
| 534 | 534 | if ($is_column) {
|
| 535 | 535 | |
| 536 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 536 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 537 | 537 | |
| 538 | 538 | if ($default_value != '') {
|
| 539 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 539 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | $wpdb->query($meta_field_add); |
@@ -544,128 +544,128 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 546 | 546 | if ($default_value != '') {
|
| 547 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 547 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 550 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 551 | 551 | |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | } |
| 555 | 555 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 556 | 556 | |
| 557 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 557 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 558 | 558 | if ($is_column) {
|
| 559 | 559 | |
| 560 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 560 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | 561 | |
| 562 | 562 | if ($default_value != '') {
|
| 563 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 563 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $wpdb->query($meta_field_add); |
| 567 | 567 | } else {
|
| 568 | 568 | |
| 569 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 569 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | 570 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 571 | 571 | if ($default_value != '') {
|
| 572 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 572 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 575 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 576 | 576 | |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | |
| 580 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 580 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 581 | 581 | |
| 582 | 582 | if ($is_column) {
|
| 583 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 583 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | 584 | |
| 585 | 585 | if ($default_value != '') {
|
| 586 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 586 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | $wpdb->query($meta_field_add); |
| 590 | 590 | } else {
|
| 591 | 591 | |
| 592 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 592 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | 593 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 594 | 594 | if ($default_value != '') {
|
| 595 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 595 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 598 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | } |
| 602 | 602 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 603 | 603 | |
| 604 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 604 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 605 | 605 | |
| 606 | 606 | if ($is_column) {
|
| 607 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 607 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | 608 | |
| 609 | 609 | if ($default_value != '') {
|
| 610 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 610 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | $wpdb->query($meta_field_add); |
| 614 | 614 | } else {
|
| 615 | 615 | |
| 616 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 616 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | 617 | |
| 618 | 618 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 619 | 619 | if ($default_value != '') {
|
| 620 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 620 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 623 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
| 627 | 627 | } |
| 628 | 628 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 629 | 629 | |
| 630 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 630 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 631 | 631 | if ($is_column) {
|
| 632 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 632 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | 633 | |
| 634 | 634 | if ($default_value != '') {
|
| 635 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 635 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | $wpdb->query($meta_field_add); |
| 639 | 639 | |
| 640 | 640 | } else {
|
| 641 | 641 | |
| 642 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 642 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | 643 | |
| 644 | 644 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 645 | 645 | if ($default_value != '') {
|
| 646 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 646 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 649 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | } |
| 653 | 653 | // show lat lng |
| 654 | 654 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 655 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 655 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 656 | 656 | |
| 657 | 657 | if ($is_column) {
|
| 658 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 658 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | 659 | $meta_field_add .= " DEFAULT '1'"; |
| 660 | 660 | |
| 661 | 661 | $wpdb->query($meta_field_add); |
| 662 | 662 | } else {
|
| 663 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 663 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | 664 | |
| 665 | 665 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 666 | 666 | $meta_field_add .= " DEFAULT '1'"; |
| 667 | 667 | |
| 668 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 668 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | } |
@@ -681,30 +681,30 @@ discard block |
||
| 681 | 681 | $op_size = '500'; |
| 682 | 682 | |
| 683 | 683 | // only make the field as big as it needs to be. |
| 684 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 685 | - $option_values_arr = explode(',',$option_values);
|
|
| 686 | - if(is_array($option_values_arr)){
|
|
| 684 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 685 | + $option_values_arr = explode(',', $option_values);
|
|
| 686 | + if (is_array($option_values_arr)) {
|
|
| 687 | 687 | $op_max = 0; |
| 688 | - foreach($option_values_arr as $op_val){
|
|
| 689 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 688 | + foreach ($option_values_arr as $op_val) {
|
|
| 689 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 690 | 690 | } |
| 691 | - if($op_max){$op_size =$op_max; }
|
|
| 691 | + if ($op_max) {$op_size = $op_max; }
|
|
| 692 | 692 | } |
| 693 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 694 | - if(strlen($option_values)){
|
|
| 695 | - $op_size = strlen($option_values); |
|
| 693 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 694 | + if (strlen($option_values)) {
|
|
| 695 | + $op_size = strlen($option_values); |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 699 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 700 | 700 | |
| 701 | 701 | if ($default_value != '') {
|
| 702 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 702 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | $alter_result = $wpdb->query($meta_field_add); |
| 706 | - if($alter_result===false){
|
|
| 707 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 706 | + if ($alter_result === false) {
|
|
| 707 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | if (isset($request_field['cat_display_type'])) |
@@ -721,9 +721,9 @@ discard block |
||
| 721 | 721 | case 'url': |
| 722 | 722 | case 'file': |
| 723 | 723 | |
| 724 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 725 | - if($alter_result===false){
|
|
| 726 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 724 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 725 | + if ($alter_result === false) {
|
|
| 726 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 727 | 727 | } |
| 728 | 728 | if (isset($request_field['advanced_editor'])) |
| 729 | 729 | $extra_fields = $request_field['advanced_editor']; |
@@ -737,24 +737,24 @@ discard block |
||
| 737 | 737 | default: |
| 738 | 738 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 739 | 739 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 740 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 740 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 741 | 741 | } else {
|
| 742 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 742 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | if (is_numeric($default_value) && $default_value != '') {
|
| 746 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 746 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 747 | 747 | } |
| 748 | 748 | } else {
|
| 749 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 749 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 750 | 750 | if ($default_value != '') {
|
| 751 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 751 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | $alter_result = $wpdb->query($default_value_add); |
| 756 | - if($alter_result===false){
|
|
| 757 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 756 | + if ($alter_result === false) {
|
|
| 757 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 758 | 758 | } |
| 759 | 759 | break; |
| 760 | 760 | endswitch; |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | |
| 771 | 771 | $wpdb->prepare( |
| 772 | 772 | |
| 773 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 773 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 774 | 774 | post_type = %s, |
| 775 | 775 | admin_title = %s, |
| 776 | 776 | site_title = %s, |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | for_admin_use = %s |
| 805 | 805 | where id = %d", |
| 806 | 806 | |
| 807 | - 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) |
|
| 807 | + 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) |
|
| 808 | 808 | ) |
| 809 | 809 | |
| 810 | 810 | ); |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | $wpdb->query( |
| 816 | 816 | $wpdb->prepare( |
| 817 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 817 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 818 | 818 | site_title=%s |
| 819 | 819 | where post_type = %s and htmlvar_name = %s", |
| 820 | 820 | array($site_title, $post_type, $htmlvar_name) |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | |
| 825 | 825 | if ($cat_sort == '') |
| 826 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 826 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | 827 | |
| 828 | 828 | |
| 829 | 829 | /** |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $data_type = ''; |
| 844 | 844 | |
| 845 | 845 | if ($htmlvar_name != '') {
|
| 846 | - $prefix = $htmlvar_name . '_'; |
|
| 846 | + $prefix = $htmlvar_name.'_'; |
|
| 847 | 847 | } |
| 848 | 848 | $old_prefix = $old_html_variable; |
| 849 | 849 | |
@@ -851,109 +851,109 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 853 | 853 | if ($default_value != '') {
|
| 854 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 854 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 857 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 858 | 858 | //$wpdb->query($meta_field_add); |
| 859 | 859 | |
| 860 | 860 | |
| 861 | 861 | if (!empty($extra_fields)) {
|
| 862 | 862 | |
| 863 | 863 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 864 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 864 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 865 | 865 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 866 | 866 | if ($default_value != '') {
|
| 867 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 867 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 870 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 871 | 871 | //$wpdb->query($meta_field_add); |
| 872 | 872 | } |
| 873 | 873 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 874 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 874 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 875 | 875 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 876 | 876 | if ($default_value != '') {
|
| 877 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 877 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 880 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 881 | 881 | //$wpdb->query($meta_field_add); |
| 882 | 882 | } |
| 883 | 883 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 884 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 884 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 885 | 885 | |
| 886 | 886 | $meta_field_add = "VARCHAR( 30 ) 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 . "country", $meta_field_add); |
|
| 891 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 892 | 892 | //$wpdb->query($meta_field_add); |
| 893 | 893 | } |
| 894 | 894 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 895 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 895 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 896 | 896 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 897 | 897 | if ($default_value != '') {
|
| 898 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 898 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 901 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 902 | 902 | //$wpdb->query($meta_field_add); |
| 903 | 903 | } |
| 904 | 904 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 905 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 905 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | 906 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 907 | 907 | if ($default_value != '') {
|
| 908 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 908 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 911 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 912 | 912 | //$wpdb->query($meta_field_add); |
| 913 | 913 | |
| 914 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 914 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | 915 | |
| 916 | 916 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 917 | 917 | if ($default_value != '') {
|
| 918 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 918 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 921 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 922 | 922 | |
| 923 | 923 | //$wpdb->query($meta_field_add); |
| 924 | 924 | } |
| 925 | 925 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 926 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 926 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | 927 | |
| 928 | 928 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 929 | 929 | if ($default_value != '') {
|
| 930 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 930 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 933 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 934 | 934 | |
| 935 | 935 | //$wpdb->query($meta_field_add); |
| 936 | 936 | } |
| 937 | 937 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 938 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 938 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | 939 | |
| 940 | 940 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 941 | 941 | if ($default_value != '') {
|
| 942 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 942 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 943 | 943 | } |
| 944 | 944 | |
| 945 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 945 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 946 | 946 | |
| 947 | 947 | //$wpdb->query($meta_field_add); |
| 948 | 948 | } |
| 949 | 949 | // show lat lng |
| 950 | 950 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 951 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 951 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | 952 | |
| 953 | 953 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 954 | 954 | $meta_field_add .= " DEFAULT '1'"; |
| 955 | 955 | |
| 956 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 956 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 957 | 957 | //$wpdb->query($meta_field_add); |
| 958 | 958 | } |
| 959 | 959 | } |
@@ -963,8 +963,8 @@ discard block |
||
| 963 | 963 | case 'checkbox': |
| 964 | 964 | $data_type = 'TINYINT'; |
| 965 | 965 | |
| 966 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 967 | - if ((int)$default_value === 1) {
|
|
| 966 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 967 | + if ((int) $default_value === 1) {
|
|
| 968 | 968 | $meta_field_add .= " DEFAULT '1'"; |
| 969 | 969 | } |
| 970 | 970 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | } |
| 998 | 998 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 999 | 999 | if (strlen($option_values)) {
|
| 1000 | - $op_size = strlen($option_values); |
|
| 1000 | + $op_size = strlen($option_values); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | if (isset($request_field['multi_display_type'])) {
|
@@ -1005,9 +1005,9 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1008 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1009 | 1009 | if ($default_value != '') {
|
| 1010 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1010 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1022,9 +1022,9 @@ discard block |
||
| 1022 | 1022 | |
| 1023 | 1023 | $data_type = 'TEXT'; |
| 1024 | 1024 | |
| 1025 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1025 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1026 | 1026 | |
| 1027 | - $meta_field_add = $data_type . " NULL "; |
|
| 1027 | + $meta_field_add = $data_type." NULL "; |
|
| 1028 | 1028 | /*if($default_value != '') |
| 1029 | 1029 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1030 | 1030 | |
@@ -1039,9 +1039,9 @@ discard block |
||
| 1039 | 1039 | |
| 1040 | 1040 | $data_type = 'DATE'; |
| 1041 | 1041 | |
| 1042 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1042 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1043 | 1043 | |
| 1044 | - $meta_field_add = $data_type . " NULL "; |
|
| 1044 | + $meta_field_add = $data_type." NULL "; |
|
| 1045 | 1045 | |
| 1046 | 1046 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1047 | 1047 | if ($add_result === false) {
|
@@ -1054,9 +1054,9 @@ discard block |
||
| 1054 | 1054 | |
| 1055 | 1055 | $data_type = 'TIME'; |
| 1056 | 1056 | |
| 1057 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1057 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1058 | 1058 | |
| 1059 | - $meta_field_add = $data_type . " NULL "; |
|
| 1059 | + $meta_field_add = $data_type." NULL "; |
|
| 1060 | 1060 | |
| 1061 | 1061 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1062 | 1062 | if ($add_result === false) {
|
@@ -1068,22 +1068,22 @@ discard block |
||
| 1068 | 1068 | default: |
| 1069 | 1069 | |
| 1070 | 1070 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1071 | - $meta_field_add = $data_type . " NULL "; |
|
| 1071 | + $meta_field_add = $data_type." NULL "; |
|
| 1072 | 1072 | |
| 1073 | 1073 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1074 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1074 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | 1077 | if (is_numeric($default_value) && $default_value != '') {
|
| 1078 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1078 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1079 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1080 | 1080 | } |
| 1081 | 1081 | } else {
|
| 1082 | 1082 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1083 | 1083 | |
| 1084 | 1084 | if ($default_value != '') {
|
| 1085 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1085 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1086 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| 1089 | 1089 | |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | |
| 1106 | 1106 | $wpdb->prepare( |
| 1107 | 1107 | |
| 1108 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1108 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1109 | 1109 | post_type = %s, |
| 1110 | 1110 | admin_title = %s, |
| 1111 | 1111 | site_title = %s, |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | validation_msg = %s, |
| 1139 | 1139 | for_admin_use = %s ", |
| 1140 | 1140 | |
| 1141 | - 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) |
|
| 1141 | + 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) |
|
| 1142 | 1142 | |
| 1143 | 1143 | ) |
| 1144 | 1144 | |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | - return (int)$lastid; |
|
| 1153 | + return (int) $lastid; |
|
| 1154 | 1154 | |
| 1155 | 1155 | |
| 1156 | 1156 | } else {
|
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | |
| 1184 | 1184 | $post_meta_info = $wpdb->query( |
| 1185 | 1185 | $wpdb->prepare( |
| 1186 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1186 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1187 | 1187 | sort_order=%d |
| 1188 | 1188 | where id= %d", |
| 1189 | 1189 | array($count, $cf) |
@@ -1199,10 +1199,10 @@ discard block |
||
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | |
| 1202 | -function geodir_get_cf_value($cf){
|
|
| 1202 | +function geodir_get_cf_value($cf) {
|
|
| 1203 | 1203 | $value = ''; |
| 1204 | 1204 | if (is_admin()) {
|
| 1205 | - global $post,$gd_session; |
|
| 1205 | + global $post, $gd_session; |
|
| 1206 | 1206 | |
| 1207 | 1207 | if (isset($_REQUEST['post'])) |
| 1208 | 1208 | $_REQUEST['pid'] = $_REQUEST['post']; |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | $is_default = $val['is_default']; |
| 1251 | 1251 | |
| 1252 | 1252 | /* field available to site admin only for edit */ |
| 1253 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1253 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1254 | 1254 | if ($for_admin_use && !is_super_admin()) {
|
| 1255 | 1255 | continue; |
| 1256 | 1256 | } |
@@ -1275,11 +1275,11 @@ discard block |
||
| 1275 | 1275 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1276 | 1276 | * @see 'geodir_after_custom_form_field_$name' |
| 1277 | 1277 | */ |
| 1278 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1278 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | 1281 | $custom_field = $val; |
| 1282 | - $html =''; |
|
| 1282 | + $html = ''; |
|
| 1283 | 1283 | /** |
| 1284 | 1284 | * Filter the output for custom fields. |
| 1285 | 1285 | * |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | * @param string $html The html to be filtered (blank). |
| 1289 | 1289 | * @param array $custom_field The custom field array values. |
| 1290 | 1290 | */ |
| 1291 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1291 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1292 | 1292 | |
| 1293 | 1293 | |
| 1294 | 1294 | |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1304 | 1304 | * @see 'geodir_before_custom_form_field_$name' |
| 1305 | 1305 | */ |
| 1306 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1306 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1307 | 1307 | |
| 1308 | 1308 | } |
| 1309 | 1309 | |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | |
| 1330 | 1330 | $filter = $wpdb->get_row( |
| 1331 | 1331 | $wpdb->prepare( |
| 1332 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1332 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1333 | 1333 | array($geodir_post_type) |
| 1334 | 1334 | ) |
| 1335 | 1335 | ); |
@@ -1344,14 +1344,14 @@ discard block |
||
| 1344 | 1344 | } |
| 1345 | 1345 | |
| 1346 | 1346 | |
| 1347 | -function geodir_field_icon_proccess($cf){
|
|
| 1347 | +function geodir_field_icon_proccess($cf) {
|
|
| 1348 | 1348 | |
| 1349 | 1349 | |
| 1350 | 1350 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1351 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1351 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1352 | 1352 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1353 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1354 | - }else{
|
|
| 1353 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1354 | + } else {
|
|
| 1355 | 1355 | $field_icon = $cf['field_icon']; |
| 1356 | 1356 | } |
| 1357 | 1357 | |
@@ -1412,11 +1412,11 @@ discard block |
||
| 1412 | 1412 | * @param string $fields_location The location the field is to be show. |
| 1413 | 1413 | * @param array $type The array of field values. |
| 1414 | 1414 | */ |
| 1415 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1415 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1416 | 1416 | |
| 1417 | 1417 | $variables_array = array(); |
| 1418 | 1418 | |
| 1419 | - if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 1419 | + if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 1420 | 1420 | continue; |
| 1421 | 1421 | } |
| 1422 | 1422 | |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | |
| 1543 | 1543 | $post_type = get_post_type($post_id); |
| 1544 | 1544 | //echo $field_id; exit; |
| 1545 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1545 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1546 | 1546 | |
| 1547 | 1547 | $postcurr_images = array(); |
| 1548 | 1548 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1561,13 +1561,13 @@ discard block |
||
| 1561 | 1561 | $geodir_uploadurl = $uploads['url']; |
| 1562 | 1562 | $sub_dir = $uploads['subdir']; |
| 1563 | 1563 | |
| 1564 | - $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'] : '';
|
|
| 1564 | + $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'] : '';
|
|
| 1565 | 1565 | |
| 1566 | 1566 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1567 | 1567 | |
| 1568 | 1568 | /* --------- start ------- */ |
| 1569 | 1569 | |
| 1570 | - 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)))) {
|
|
| 1570 | + 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)))) {
|
|
| 1571 | 1571 | |
| 1572 | 1572 | |
| 1573 | 1573 | $curr_img_url = $post_image[$m]; |
@@ -1593,24 +1593,24 @@ discard block |
||
| 1593 | 1593 | //$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');
|
| 1594 | 1594 | |
| 1595 | 1595 | if (!function_exists('wp_handle_upload'))
|
| 1596 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1596 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1597 | 1597 | |
| 1598 | 1598 | if (!is_dir($geodir_uploadpath)) |
| 1599 | 1599 | mkdir($geodir_uploadpath); |
| 1600 | 1600 | |
| 1601 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1601 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1602 | 1602 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1603 | 1603 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1604 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1605 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1604 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1605 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1606 | 1606 | } else {
|
| 1607 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1608 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1607 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1608 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1609 | 1609 | } |
| 1610 | 1610 | |
| 1611 | 1611 | $uploaded_file = ''; |
| 1612 | 1612 | if (file_exists($img_path)) |
| 1613 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1613 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1614 | 1614 | |
| 1615 | 1615 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1616 | 1616 | if (file_exists($img_path)) |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | 1620 | if (!empty($uploaded_file)) |
| 1621 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1621 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1622 | 1622 | |
| 1623 | 1623 | } else {
|
| 1624 | 1624 | $file_urls = $post_image[$m]; |
@@ -1632,8 +1632,8 @@ discard block |
||
| 1632 | 1632 | if (!empty($postcurr_images)) {
|
| 1633 | 1633 | |
| 1634 | 1634 | if ($file_urls != $postcurr_images) {
|
| 1635 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1636 | - $invalid_files = (object)$invalid_files; |
|
| 1635 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1636 | + $invalid_files = (object) $invalid_files; |
|
| 1637 | 1637 | } |
| 1638 | 1638 | } |
| 1639 | 1639 | |
@@ -1685,9 +1685,9 @@ discard block |
||
| 1685 | 1685 | function geodir_upload_dir($upload) |
| 1686 | 1686 | {
|
| 1687 | 1687 | global $current_user; |
| 1688 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1689 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1690 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1688 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1689 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1690 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1691 | 1691 | return $upload; |
| 1692 | 1692 | } |
| 1693 | 1693 | |
@@ -1702,20 +1702,20 @@ discard block |
||
| 1702 | 1702 | // check ajax noonce |
| 1703 | 1703 | $imgid = $_POST["imgid"]; |
| 1704 | 1704 | |
| 1705 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1705 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1706 | 1706 | |
| 1707 | 1707 | // handle custom file uploaddir |
| 1708 | 1708 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1709 | 1709 | |
| 1710 | 1710 | // change file orinetation if needed |
| 1711 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1711 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1712 | 1712 | |
| 1713 | 1713 | // handle file upload |
| 1714 | 1714 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1715 | 1715 | // remove handle custom file uploaddir |
| 1716 | 1716 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1717 | 1717 | |
| 1718 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1718 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1719 | 1719 | print_r($status); |
| 1720 | 1720 | } |
| 1721 | 1721 | |
@@ -1745,9 +1745,9 @@ discard block |
||
| 1745 | 1745 | |
| 1746 | 1746 | $post_type = get_post_type($post_id); |
| 1747 | 1747 | |
| 1748 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1748 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1749 | 1749 | |
| 1750 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1750 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1751 | 1751 | |
| 1752 | 1752 | if ($results) {
|
| 1753 | 1753 | return $results[0]->geodir_video; |
@@ -1771,9 +1771,9 @@ discard block |
||
| 1771 | 1771 | |
| 1772 | 1772 | $post_type = get_post_type($post_id); |
| 1773 | 1773 | |
| 1774 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1774 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1775 | 1775 | |
| 1776 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1776 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1777 | 1777 | |
| 1778 | 1778 | if ($results) {
|
| 1779 | 1779 | return $results[0]->geodir_special_offers; |
@@ -1791,12 +1791,12 @@ discard block |
||
| 1791 | 1791 | */ |
| 1792 | 1792 | function geodir_max_upload_size() |
| 1793 | 1793 | {
|
| 1794 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1794 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1795 | 1795 | |
| 1796 | 1796 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1797 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1797 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1798 | 1798 | } else {
|
| 1799 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1799 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1800 | 1800 | } |
| 1801 | 1801 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1802 | 1802 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1828,7 +1828,7 @@ discard block |
||
| 1828 | 1828 | |
| 1829 | 1829 | $custom_fields = $wpdb->get_results( |
| 1830 | 1830 | $wpdb->prepare( |
| 1831 | - "select post_type,data_type,field_type,site_title,htmlvar_name 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", |
|
| 1831 | + "select post_type,data_type,field_type,site_title,htmlvar_name 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", |
|
| 1832 | 1832 | array($post_type) |
| 1833 | 1833 | ), 'ARRAY_A' |
| 1834 | 1834 | ); |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | |
| 1946 | 1946 | $post_meta_info = $wpdb->query( |
| 1947 | 1947 | $wpdb->prepare( |
| 1948 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1948 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1949 | 1949 | sort_order=%d |
| 1950 | 1950 | where id= %d", |
| 1951 | 1951 | array($count, $cf) |
@@ -2027,14 +2027,14 @@ discard block |
||
| 2027 | 2027 | |
| 2028 | 2028 | $check_html_variable = $wpdb->get_var( |
| 2029 | 2029 | $wpdb->prepare( |
| 2030 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2030 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2031 | 2031 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2032 | 2032 | ) |
| 2033 | 2033 | ); |
| 2034 | 2034 | |
| 2035 | 2035 | if ($is_default == 1) {
|
| 2036 | 2036 | |
| 2037 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2037 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2038 | 2038 | |
| 2039 | 2039 | } |
| 2040 | 2040 | |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | |
| 2046 | 2046 | $wpdb->prepare( |
| 2047 | 2047 | |
| 2048 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2048 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2049 | 2049 | post_type = %s, |
| 2050 | 2050 | data_type = %s, |
| 2051 | 2051 | field_type = %s, |
@@ -2076,7 +2076,7 @@ discard block |
||
| 2076 | 2076 | |
| 2077 | 2077 | $wpdb->prepare( |
| 2078 | 2078 | |
| 2079 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2079 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2080 | 2080 | post_type = %s, |
| 2081 | 2081 | data_type = %s, |
| 2082 | 2082 | field_type = %s, |
@@ -2102,7 +2102,7 @@ discard block |
||
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | 2104 | |
| 2105 | - return (int)$lastid; |
|
| 2105 | + return (int) $lastid; |
|
| 2106 | 2106 | |
| 2107 | 2107 | } |
| 2108 | 2108 | } |
@@ -2125,7 +2125,7 @@ discard block |
||
| 2125 | 2125 | if ($field_id != '') {
|
| 2126 | 2126 | $cf = trim($field_id, '_'); |
| 2127 | 2127 | |
| 2128 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2128 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2129 | 2129 | |
| 2130 | 2130 | return $field_id; |
| 2131 | 2131 | |
@@ -2153,7 +2153,7 @@ discard block |
||
| 2153 | 2153 | global $wpdb; |
| 2154 | 2154 | $cf = $result_str; |
| 2155 | 2155 | if (!is_object($cf)) {
|
| 2156 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2156 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2157 | 2157 | } else {
|
| 2158 | 2158 | $field_info = $cf; |
| 2159 | 2159 | $result_str = $cf->id; |
@@ -2190,41 +2190,41 @@ discard block |
||
| 2190 | 2190 | if ($htmlvar_name == '') |
| 2191 | 2191 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2192 | 2192 | |
| 2193 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2193 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2194 | 2194 | |
| 2195 | 2195 | ?> |
| 2196 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2197 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2198 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2199 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2196 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2197 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2198 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2199 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2200 | 2200 | <?php |
| 2201 | 2201 | |
| 2202 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2202 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2203 | 2203 | ?> |
| 2204 | 2204 | |
| 2205 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2206 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2205 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2206 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2207 | 2207 | class="handlediv close"></div> |
| 2208 | 2208 | |
| 2209 | 2209 | <b style="cursor:pointer;" |
| 2210 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2210 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2211 | 2211 | |
| 2212 | 2212 | </div> |
| 2213 | 2213 | |
| 2214 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2214 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2215 | 2215 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2216 | 2216 | echo 'block;'; |
| 2217 | 2217 | } else {
|
| 2218 | 2218 | echo 'none;'; |
| 2219 | 2219 | } ?>"> |
| 2220 | 2220 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2221 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2222 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2223 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2221 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2222 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2223 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2224 | 2224 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2225 | 2225 | echo $field_info->data_type; |
| 2226 | 2226 | }?>"/> |
| 2227 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2227 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2228 | 2228 | |
| 2229 | 2229 | |
| 2230 | 2230 | <table class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2248,7 +2248,7 @@ discard block |
||
| 2248 | 2248 | } ?>" style="width:45%;"/> |
| 2249 | 2249 | |
| 2250 | 2250 | <input type="radio" name="is_default" |
| 2251 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2251 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2252 | 2252 | echo 'checked="checked"'; |
| 2253 | 2253 | } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
| 2254 | 2254 | |
@@ -2271,7 +2271,7 @@ discard block |
||
| 2271 | 2271 | echo esc_attr($field_info->desc_title); |
| 2272 | 2272 | } ?>" style="width:45%;"/> |
| 2273 | 2273 | <input type="radio" name="is_default" |
| 2274 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2274 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2275 | 2275 | echo 'checked="checked"'; |
| 2276 | 2276 | } ?>/><span><?php _e('Set as default sort.', 'geodirectory'); ?></span>
|
| 2277 | 2277 | <br/> |
@@ -2306,42 +2306,42 @@ discard block |
||
| 2306 | 2306 | <?php } ?> |
| 2307 | 2307 | |
| 2308 | 2308 | <tr> |
| 2309 | - <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
|
|
| 2309 | + <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
|
|
| 2310 | 2310 | <td align="left"> |
| 2311 | 2311 | <select name="is_active" id="is_active"> |
| 2312 | 2312 | <option |
| 2313 | 2313 | value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
|
| 2314 | 2314 | echo 'selected="selected"'; |
| 2315 | - }?>><?php _e('Yes', 'geodirectory');?></option>
|
|
| 2315 | + }?>><?php _e('Yes', 'geodirectory'); ?></option>
|
|
| 2316 | 2316 | <option |
| 2317 | 2317 | value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
|
| 2318 | 2318 | echo 'selected="selected"'; |
| 2319 | - }?>><?php _e('No', 'geodirectory');?></option>
|
|
| 2319 | + }?>><?php _e('No', 'geodirectory'); ?></option>
|
|
| 2320 | 2320 | </select> |
| 2321 | 2321 | <br/> |
| 2322 | - <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
|
|
| 2322 | + <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
|
|
| 2323 | 2323 | </td> |
| 2324 | 2324 | </tr> |
| 2325 | 2325 | |
| 2326 | 2326 | <tr> |
| 2327 | - <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
|
|
| 2327 | + <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
|
|
| 2328 | 2328 | <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order" |
| 2329 | 2329 | value="<?php if (isset($field_info->sort_order)) {
|
| 2330 | 2330 | echo esc_attr($field_info->sort_order); |
| 2331 | 2331 | }?>" size="50"/> |
| 2332 | 2332 | <br/> |
| 2333 | - <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
|
|
| 2333 | + <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
|
|
| 2334 | 2334 | </td> |
| 2335 | 2335 | </tr> |
| 2336 | 2336 | |
| 2337 | 2337 | <tr> |
| 2338 | 2338 | <td> </td> |
| 2339 | 2339 | <td align="left"> |
| 2340 | - <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
|
|
| 2341 | - onclick="save_sort_field('<?php echo $result_str;?>')"/>
|
|
| 2340 | + <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
|
|
| 2341 | + onclick="save_sort_field('<?php echo $result_str; ?>')"/>
|
|
| 2342 | 2342 | |
| 2343 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
|
|
| 2344 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2343 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
|
|
| 2344 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2345 | 2345 | class="button_n"/></a> |
| 2346 | 2346 | |
| 2347 | 2347 | </td> |
@@ -2376,7 +2376,7 @@ discard block |
||
| 2376 | 2376 | if (!$package_id || !$field_name || !$post_type) {
|
| 2377 | 2377 | return true; |
| 2378 | 2378 | } |
| 2379 | - $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));
|
|
| 2379 | + $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));
|
|
| 2380 | 2380 | |
| 2381 | 2381 | if ($wpdb->get_var($sql)) {
|
| 2382 | 2382 | return true; |
@@ -2498,7 +2498,7 @@ discard block |
||
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | 2500 | |
| 2501 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2501 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2502 | 2502 | ob_start(); |
| 2503 | 2503 | ?> |
| 2504 | 2504 | <li> |
@@ -2544,43 +2544,43 @@ discard block |
||
| 2544 | 2544 | $output = ob_get_clean(); |
| 2545 | 2545 | return $output; |
| 2546 | 2546 | } |
| 2547 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2547 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2548 | 2548 | |
| 2549 | 2549 | // htmlvar not needed for fieldset and taxonomy |
| 2550 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2551 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2550 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2551 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2552 | 2552 | |
| 2553 | 2553 | |
| 2554 | 2554 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2555 | -add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
|
|
| 2556 | -add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
|
|
| 2557 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2558 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2559 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2560 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2555 | +add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
|
|
| 2556 | +add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
|
|
| 2557 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2558 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2559 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2560 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2561 | 2561 | |
| 2562 | 2562 | // is_required not needed for fieldset |
| 2563 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2564 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2563 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2564 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2565 | 2565 | |
| 2566 | 2566 | // field_icon not needed for fieldset |
| 2567 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2568 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2567 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2568 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2569 | 2569 | |
| 2570 | 2570 | // cat_sort not needed for some fields |
| 2571 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2572 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2573 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2574 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2575 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2576 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2577 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2578 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2571 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2572 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2573 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2574 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2575 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2576 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2577 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2578 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2579 | 2579 | |
| 2580 | 2580 | |
| 2581 | 2581 | |
| 2582 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2583 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2582 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2583 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2584 | 2584 | ob_start(); |
| 2585 | 2585 | ?> |
| 2586 | 2586 | <li> |
@@ -2611,10 +2611,10 @@ discard block |
||
| 2611 | 2611 | $output = ob_get_clean(); |
| 2612 | 2612 | return $output; |
| 2613 | 2613 | } |
| 2614 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2614 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2615 | 2615 | |
| 2616 | 2616 | |
| 2617 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2617 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2618 | 2618 | ob_start(); |
| 2619 | 2619 | ?> |
| 2620 | 2620 | <li> |
@@ -2651,10 +2651,10 @@ discard block |
||
| 2651 | 2651 | $output = ob_get_clean(); |
| 2652 | 2652 | return $output; |
| 2653 | 2653 | } |
| 2654 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2654 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2655 | 2655 | |
| 2656 | 2656 | |
| 2657 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2657 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2658 | 2658 | ob_start(); |
| 2659 | 2659 | global $post_type; |
| 2660 | 2660 | |
@@ -2679,7 +2679,7 @@ discard block |
||
| 2679 | 2679 | ?> |
| 2680 | 2680 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2681 | 2681 | echo 'selected="selected"'; |
| 2682 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2682 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2683 | 2683 | } |
| 2684 | 2684 | ?> |
| 2685 | 2685 | </select> |
@@ -2690,7 +2690,7 @@ discard block |
||
| 2690 | 2690 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2691 | 2691 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2692 | 2692 | <div class="gdcf-tooltip"> |
| 2693 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2693 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2694 | 2694 | </div> |
| 2695 | 2695 | </label> |
| 2696 | 2696 | <div class="gd-cf-input-wrap"> |
@@ -2698,19 +2698,19 @@ discard block |
||
| 2698 | 2698 | <select name="cat_display_type" id="cat_display_type"> |
| 2699 | 2699 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2700 | 2700 | echo 'selected="selected"'; |
| 2701 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2701 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2702 | 2702 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2703 | 2703 | echo 'selected="selected"'; |
| 2704 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2704 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2705 | 2705 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2706 | 2706 | echo 'selected="selected"'; |
| 2707 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2707 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2708 | 2708 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2709 | 2709 | echo 'selected="selected"'; |
| 2710 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2710 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2711 | 2711 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2712 | 2712 | echo 'selected="selected"'; |
| 2713 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2713 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2714 | 2714 | </select> |
| 2715 | 2715 | </div> |
| 2716 | 2716 | </li> |
@@ -2719,10 +2719,10 @@ discard block |
||
| 2719 | 2719 | $output = ob_get_clean(); |
| 2720 | 2720 | return $output; |
| 2721 | 2721 | } |
| 2722 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2722 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2723 | 2723 | |
| 2724 | 2724 | |
| 2725 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2725 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2726 | 2726 | |
| 2727 | 2727 | ob_start(); |
| 2728 | 2728 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2743,32 +2743,32 @@ discard block |
||
| 2743 | 2743 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2744 | 2744 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2745 | 2745 | <div class="gdcf-tooltip"> |
| 2746 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2746 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2747 | 2747 | </div> |
| 2748 | 2748 | </label> |
| 2749 | 2749 | <div class="gd-cf-input-wrap gd-switch"> |
| 2750 | 2750 | |
| 2751 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2751 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2752 | 2752 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2753 | 2753 | echo 'checked'; |
| 2754 | 2754 | } ?>/> |
| 2755 | - <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>
|
|
| 2755 | + <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>
|
|
| 2756 | 2756 | |
| 2757 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2757 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2758 | 2758 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2759 | 2759 | echo 'checked'; |
| 2760 | 2760 | } ?>/> |
| 2761 | - <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>
|
|
| 2761 | + <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>
|
|
| 2762 | 2762 | |
| 2763 | 2763 | |
| 2764 | 2764 | </div> |
| 2765 | 2765 | </li> |
| 2766 | 2766 | |
| 2767 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2767 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2768 | 2768 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2769 | 2769 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2770 | 2770 | <div class="gdcf-tooltip"> |
| 2771 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2771 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2772 | 2772 | </div> |
| 2773 | 2773 | </label> |
| 2774 | 2774 | <div class="gd-cf-input-wrap"> |
@@ -2786,7 +2786,7 @@ discard block |
||
| 2786 | 2786 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2787 | 2787 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2788 | 2788 | <div class="gdcf-tooltip"> |
| 2789 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2789 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2790 | 2790 | </div> |
| 2791 | 2791 | </label> |
| 2792 | 2792 | <div class="gd-cf-input-wrap"> |
@@ -2801,22 +2801,22 @@ discard block |
||
| 2801 | 2801 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 2802 | 2802 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 2803 | 2803 | <div class="gdcf-tooltip"> |
| 2804 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 2804 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 2805 | 2805 | </div> |
| 2806 | 2806 | </label> |
| 2807 | 2807 | <div class="gd-cf-input-wrap gd-switch"> |
| 2808 | 2808 | |
| 2809 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2809 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2810 | 2810 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2811 | 2811 | echo 'checked'; |
| 2812 | 2812 | } ?>/> |
| 2813 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2813 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2814 | 2814 | |
| 2815 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2815 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2816 | 2816 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2817 | 2817 | echo 'checked'; |
| 2818 | 2818 | } ?>/> |
| 2819 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2819 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2820 | 2820 | |
| 2821 | 2821 | </div> |
| 2822 | 2822 | </li> |
@@ -2825,22 +2825,22 @@ discard block |
||
| 2825 | 2825 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 2826 | 2826 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 2827 | 2827 | <div class="gdcf-tooltip"> |
| 2828 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 2828 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 2829 | 2829 | </div> |
| 2830 | 2830 | </label> |
| 2831 | 2831 | <div class="gd-cf-input-wrap gd-switch"> |
| 2832 | 2832 | |
| 2833 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 2833 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 2834 | 2834 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 2835 | 2835 | echo 'checked'; |
| 2836 | 2836 | } ?>/> |
| 2837 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2837 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2838 | 2838 | |
| 2839 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 2839 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 2840 | 2840 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 2841 | 2841 | echo 'checked'; |
| 2842 | 2842 | } ?>/> |
| 2843 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2843 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2844 | 2844 | |
| 2845 | 2845 | </div> |
| 2846 | 2846 | </li> |
@@ -2850,7 +2850,7 @@ discard block |
||
| 2850 | 2850 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 2851 | 2851 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 2852 | 2852 | <div class="gdcf-tooltip"> |
| 2853 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 2853 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 2854 | 2854 | </div> |
| 2855 | 2855 | </label> |
| 2856 | 2856 | <div class="gd-cf-input-wrap"> |
@@ -2864,22 +2864,22 @@ discard block |
||
| 2864 | 2864 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 2865 | 2865 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 2866 | 2866 | <div class="gdcf-tooltip"> |
| 2867 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 2867 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 2868 | 2868 | </div> |
| 2869 | 2869 | </label> |
| 2870 | 2870 | <div class="gd-cf-input-wrap gd-switch"> |
| 2871 | 2871 | |
| 2872 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 2872 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 2873 | 2873 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 2874 | 2874 | echo 'checked'; |
| 2875 | 2875 | } ?>/> |
| 2876 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2876 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2877 | 2877 | |
| 2878 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 2878 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 2879 | 2879 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 2880 | 2880 | echo 'checked'; |
| 2881 | 2881 | } ?>/> |
| 2882 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2882 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2883 | 2883 | |
| 2884 | 2884 | </div> |
| 2885 | 2885 | </li> |
@@ -2888,17 +2888,17 @@ discard block |
||
| 2888 | 2888 | $output = ob_get_clean(); |
| 2889 | 2889 | return $output; |
| 2890 | 2890 | } |
| 2891 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 2891 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 2892 | 2892 | |
| 2893 | 2893 | |
| 2894 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 2894 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 2895 | 2895 | ob_start(); |
| 2896 | 2896 | ?> |
| 2897 | 2897 | <li> |
| 2898 | 2898 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 2899 | 2899 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 2900 | 2900 | <div class="gdcf-tooltip"> |
| 2901 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 2901 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 2902 | 2902 | </div> |
| 2903 | 2903 | </label> |
| 2904 | 2904 | <div class="gd-cf-input-wrap"> |
@@ -2906,13 +2906,13 @@ discard block |
||
| 2906 | 2906 | <select name="multi_display_type" id="multi_display_type"> |
| 2907 | 2907 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2908 | 2908 | echo 'selected="selected"'; |
| 2909 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2909 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2910 | 2910 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2911 | 2911 | echo 'selected="selected"'; |
| 2912 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2912 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2913 | 2913 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2914 | 2914 | echo 'selected="selected"'; |
| 2915 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2915 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2916 | 2916 | </select> |
| 2917 | 2917 | |
| 2918 | 2918 | <br/> |
@@ -2923,21 +2923,21 @@ discard block |
||
| 2923 | 2923 | $output = ob_get_clean(); |
| 2924 | 2924 | return $output; |
| 2925 | 2925 | } |
| 2926 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 2926 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 2927 | 2927 | |
| 2928 | 2928 | |
| 2929 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 2929 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 2930 | 2930 | ob_start(); |
| 2931 | 2931 | ?> |
| 2932 | 2932 | <li> |
| 2933 | 2933 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 2934 | 2934 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 2935 | 2935 | <div class="gdcf-tooltip"> |
| 2936 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 2936 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 2937 | 2937 | <br/> |
| 2938 | - <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>
|
|
| 2938 | + <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>
|
|
| 2939 | 2939 | <br/> |
| 2940 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 2940 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 2941 | 2941 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 2942 | 2942 | <br/> |
| 2943 | 2943 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -2960,12 +2960,12 @@ discard block |
||
| 2960 | 2960 | $output = ob_get_clean(); |
| 2961 | 2961 | return $output; |
| 2962 | 2962 | } |
| 2963 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 2964 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 2965 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 2963 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 2964 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 2965 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 2966 | 2966 | |
| 2967 | 2967 | |
| 2968 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 2968 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 2969 | 2969 | ob_start(); |
| 2970 | 2970 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
| 2971 | 2971 | $extra = unserialize($field_info->extra_fields); |
@@ -2975,7 +2975,7 @@ discard block |
||
| 2975 | 2975 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 2976 | 2976 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 2977 | 2977 | <div class="gdcf-tooltip"> |
| 2978 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 2978 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 2979 | 2979 | </div> |
| 2980 | 2980 | </label> |
| 2981 | 2981 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -2995,16 +2995,16 @@ discard block |
||
| 2995 | 2995 | * @since 1.6.5 |
| 2996 | 2996 | * @param array $date_formats The PHP date format array. |
| 2997 | 2997 | */ |
| 2998 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 2998 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 2999 | 2999 | ?> |
| 3000 | 3000 | <select name="extra[date_format]" id="date_format"> |
| 3001 | 3001 | <?php |
| 3002 | - foreach($date_formats as $format){
|
|
| 3002 | + foreach ($date_formats as $format) {
|
|
| 3003 | 3003 | $selected = ''; |
| 3004 | - if(esc_attr($extra['date_format'])==$format){
|
|
| 3004 | + if (esc_attr($extra['date_format']) == $format) {
|
|
| 3005 | 3005 | $selected = "selected='selected'"; |
| 3006 | 3006 | } |
| 3007 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3007 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3008 | 3008 | } |
| 3009 | 3009 | ?> |
| 3010 | 3010 | </select> |
@@ -3016,10 +3016,10 @@ discard block |
||
| 3016 | 3016 | $output = ob_get_clean(); |
| 3017 | 3017 | return $output; |
| 3018 | 3018 | } |
| 3019 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3019 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3020 | 3020 | |
| 3021 | 3021 | |
| 3022 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3022 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3023 | 3023 | ob_start(); |
| 3024 | 3024 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3025 | 3025 | |
@@ -3030,16 +3030,16 @@ discard block |
||
| 3030 | 3030 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3031 | 3031 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3032 | 3032 | <div class="gdcf-tooltip"> |
| 3033 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3033 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3034 | 3034 | </div> |
| 3035 | 3035 | </label> |
| 3036 | 3036 | <div class="gd-cf-input-wrap"> |
| 3037 | 3037 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3038 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3039 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3040 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3041 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3042 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3038 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3039 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3040 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3041 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3042 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3043 | 3043 | <?php } ?> |
| 3044 | 3044 | </optgroup> |
| 3045 | 3045 | <?php } ?> |
@@ -3051,4 +3051,4 @@ discard block |
||
| 3051 | 3051 | $output = ob_get_clean(); |
| 3052 | 3052 | return $output; |
| 3053 | 3053 | } |
| 3054 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4); |
|
| 3055 | 3054 | \ No newline at end of file |
| 3055 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4); |
|
| 3056 | 3056 | \ No newline at end of file |
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | global $wpdb; |
| 52 | 52 | $result = 0;// no rows affected |
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 54 | + if (!empty($db) && !empty($column)) { |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr"); |
|
| 56 | + } |
|
| 56 | 57 | } |
| 57 | 58 | return $result; |
| 58 | 59 | } |
@@ -82,10 +83,11 @@ discard block |
||
| 82 | 83 | |
| 83 | 84 | $default_query = ''; |
| 84 | 85 | |
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query .= " and is_admin = '0' "; |
|
| 86 | + if ($default == 'default') { |
|
| 87 | + $default_query .= " and is_admin IN ('1') "; |
|
| 88 | + } elseif ($default == 'custom') { |
|
| 89 | + $default_query .= " and is_admin = '0' "; |
|
| 90 | + } |
|
| 89 | 91 | |
| 90 | 92 | if ($fields_location == 'none') {
|
| 91 | 93 | } else{
|
@@ -239,10 +241,12 @@ discard block |
||
| 239 | 241 | } |
| 240 | 242 | |
| 241 | 243 | return $field_id; |
| 242 | - } else |
|
| 243 | - return 0; |
|
| 244 | - } else |
|
| 245 | - return 0; |
|
| 244 | + } else { |
|
| 245 | + return 0; |
|
| 246 | + } |
|
| 247 | + } else { |
|
| 248 | + return 0; |
|
| 249 | + } |
|
| 246 | 250 | } |
| 247 | 251 | } |
| 248 | 252 | |
@@ -349,7 +353,9 @@ discard block |
||
| 349 | 353 | |
| 350 | 354 | |
| 351 | 355 | |
| 352 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 356 | + if ($post_type == '') { |
|
| 357 | + $post_type = 'gd_place'; |
|
| 358 | + } |
|
| 353 | 359 | |
| 354 | 360 | |
| 355 | 361 | $detail_table = $plugin_prefix . $post_type . '_detail'; |
@@ -389,16 +395,17 @@ discard block |
||
| 389 | 395 | } |
| 390 | 396 | |
| 391 | 397 | $option_values = ''; |
| 392 | - if (isset($request_field['option_values'])) |
|
| 393 | - $option_values = $request_field['option_values']; |
|
| 398 | + if (isset($request_field['option_values'])) { |
|
| 399 | + $option_values = $request_field['option_values']; |
|
| 400 | + } |
|
| 394 | 401 | |
| 395 | 402 | $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
| 396 | 403 | |
| 397 | 404 | $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
| 398 | 405 | |
| 399 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 400 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 401 | - else {
|
|
| 406 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) { |
|
| 407 | + $price_pkg = implode(",", $request_field['show_on_pkg']); |
|
| 408 | + } else {
|
|
| 402 | 409 | $package_info = array(); |
| 403 | 410 | |
| 404 | 411 | $package_info = geodir_post_package_info($package_info, '', $post_type); |
@@ -406,22 +413,29 @@ discard block |
||
| 406 | 413 | } |
| 407 | 414 | |
| 408 | 415 | |
| 409 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 410 | - $extra_fields = $request_field['extra']; |
|
| 416 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) { |
|
| 417 | + $extra_fields = $request_field['extra']; |
|
| 418 | + } |
|
| 411 | 419 | |
| 412 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 413 | - $is_default = $request_field['is_default']; |
|
| 414 | - else |
|
| 415 | - $is_default = '0'; |
|
| 420 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') { |
|
| 421 | + $is_default = $request_field['is_default']; |
|
| 422 | + } else { |
|
| 423 | + $is_default = '0'; |
|
| 424 | + } |
|
| 416 | 425 | |
| 417 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 418 | - $is_admin = $request_field['is_admin']; |
|
| 419 | - else |
|
| 420 | - $is_admin = '0'; |
|
| 426 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') { |
|
| 427 | + $is_admin = $request_field['is_admin']; |
|
| 428 | + } else { |
|
| 429 | + $is_admin = '0'; |
|
| 430 | + } |
|
| 421 | 431 | |
| 422 | 432 | |
| 423 | - if ($is_active == '') $is_active = 1; |
|
| 424 | - if ($is_required == '') $is_required = 0; |
|
| 433 | + if ($is_active == '') { |
|
| 434 | + $is_active = 1; |
|
| 435 | + } |
|
| 436 | + if ($is_required == '') { |
|
| 437 | + $is_required = 0; |
|
| 438 | + } |
|
| 425 | 439 | |
| 426 | 440 | |
| 427 | 441 | if ($sort_order == '') {
|
@@ -690,7 +704,7 @@ discard block |
||
| 690 | 704 | } |
| 691 | 705 | if($op_max){$op_size =$op_max; }
|
| 692 | 706 | } |
| 693 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 707 | + } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 694 | 708 | if(strlen($option_values)){
|
| 695 | 709 | $op_size = strlen($option_values); |
| 696 | 710 | } |
@@ -707,11 +721,13 @@ discard block |
||
| 707 | 721 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 708 | 722 | } |
| 709 | 723 | |
| 710 | - if (isset($request_field['cat_display_type'])) |
|
| 711 | - $extra_fields = $request_field['cat_display_type']; |
|
| 724 | + if (isset($request_field['cat_display_type'])) { |
|
| 725 | + $extra_fields = $request_field['cat_display_type']; |
|
| 726 | + } |
|
| 712 | 727 | |
| 713 | - if (isset($request_field['multi_display_type'])) |
|
| 714 | - $extra_fields = $request_field['multi_display_type']; |
|
| 728 | + if (isset($request_field['multi_display_type'])) { |
|
| 729 | + $extra_fields = $request_field['multi_display_type']; |
|
| 730 | + } |
|
| 715 | 731 | |
| 716 | 732 | |
| 717 | 733 | break; |
@@ -725,8 +741,9 @@ discard block |
||
| 725 | 741 | if($alter_result===false){
|
| 726 | 742 | return __('Column change failed, you may have too many columns.','geodirectory');
|
| 727 | 743 | } |
| 728 | - if (isset($request_field['advanced_editor'])) |
|
| 729 | - $extra_fields = $request_field['advanced_editor']; |
|
| 744 | + if (isset($request_field['advanced_editor'])) { |
|
| 745 | + $extra_fields = $request_field['advanced_editor']; |
|
| 746 | + } |
|
| 730 | 747 | |
| 731 | 748 | break; |
| 732 | 749 | |
@@ -822,8 +839,9 @@ discard block |
||
| 822 | 839 | ); |
| 823 | 840 | |
| 824 | 841 | |
| 825 | - if ($cat_sort == '') |
|
| 826 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 842 | + if ($cat_sort == '') { |
|
| 843 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name))); |
|
| 844 | + } |
|
| 827 | 845 | |
| 828 | 846 | |
| 829 | 847 | /** |
@@ -1193,8 +1211,10 @@ discard block |
||
| 1193 | 1211 | } |
| 1194 | 1212 | |
| 1195 | 1213 | return $post_meta_info; |
| 1196 | - else: |
|
| 1197 | - return false; |
|
| 1214 | + else { |
|
| 1215 | + : |
|
| 1216 | + return false; |
|
| 1217 | + } |
|
| 1198 | 1218 | endif; |
| 1199 | 1219 | } |
| 1200 | 1220 | |
@@ -1204,8 +1224,9 @@ discard block |
||
| 1204 | 1224 | if (is_admin()) {
|
| 1205 | 1225 | global $post,$gd_session; |
| 1206 | 1226 | |
| 1207 | - if (isset($_REQUEST['post'])) |
|
| 1208 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1227 | + if (isset($_REQUEST['post'])) { |
|
| 1228 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1229 | + } |
|
| 1209 | 1230 | } |
| 1210 | 1231 | |
| 1211 | 1232 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
@@ -1258,8 +1279,9 @@ discard block |
||
| 1258 | 1279 | if (is_admin()) {
|
| 1259 | 1280 | global $post; |
| 1260 | 1281 | |
| 1261 | - if (isset($_REQUEST['post'])) |
|
| 1262 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1282 | + if (isset($_REQUEST['post'])) { |
|
| 1283 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1284 | + } |
|
| 1263 | 1285 | } |
| 1264 | 1286 | |
| 1265 | 1287 | |
@@ -1351,7 +1373,7 @@ discard block |
||
| 1351 | 1373 | $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
| 1352 | 1374 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1353 | 1375 | $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
| 1354 | - }else{
|
|
| 1376 | + } else{
|
|
| 1355 | 1377 | $field_icon = $cf['field_icon']; |
| 1356 | 1378 | } |
| 1357 | 1379 | |
@@ -1424,8 +1446,9 @@ discard block |
||
| 1424 | 1446 | $variables_array['post_id'] = $post->ID; |
| 1425 | 1447 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
| 1426 | 1448 | $variables_array['value'] = ''; |
| 1427 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1428 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1449 | + if (isset($post->{$type['htmlvar_name']})) { |
|
| 1450 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
| 1451 | + } |
|
| 1429 | 1452 | endif; |
| 1430 | 1453 | |
| 1431 | 1454 | |
@@ -1448,7 +1471,9 @@ discard block |
||
| 1448 | 1471 | * @param string $html Custom field unfiltered HTML. |
| 1449 | 1472 | * @param array $variables_array Custom field variables array. |
| 1450 | 1473 | */ |
| 1451 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1474 | + if ($html) { |
|
| 1475 | + echo apply_filters("geodir_show_{$html_var}", $html, $variables_array); |
|
| 1476 | + } |
|
| 1452 | 1477 | |
| 1453 | 1478 | /** |
| 1454 | 1479 | * Called after a custom fields is output on the frontend. |
@@ -1482,10 +1507,11 @@ discard block |
||
| 1482 | 1507 | */ |
| 1483 | 1508 | function geodir_default_date_format() |
| 1484 | 1509 | {
|
| 1485 | - if ($format = get_option('date_format'))
|
|
| 1486 | - return $format; |
|
| 1487 | - else |
|
| 1488 | - return 'dd-mm-yy'; |
|
| 1510 | + if ($format = get_option('date_format')) { |
|
| 1511 | + return $format; |
|
| 1512 | + } else { |
|
| 1513 | + return 'dd-mm-yy'; |
|
| 1514 | + } |
|
| 1489 | 1515 | } |
| 1490 | 1516 | } |
| 1491 | 1517 | |
@@ -1592,11 +1618,13 @@ discard block |
||
| 1592 | 1618 | // Set an array containing a list of acceptable formats |
| 1593 | 1619 | //$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');
|
| 1594 | 1620 | |
| 1595 | - if (!function_exists('wp_handle_upload'))
|
|
| 1596 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1621 | + if (!function_exists('wp_handle_upload')) { |
|
| 1622 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1623 | + } |
|
| 1597 | 1624 | |
| 1598 | - if (!is_dir($geodir_uploadpath)) |
|
| 1599 | - mkdir($geodir_uploadpath); |
|
| 1625 | + if (!is_dir($geodir_uploadpath)) { |
|
| 1626 | + mkdir($geodir_uploadpath); |
|
| 1627 | + } |
|
| 1600 | 1628 | |
| 1601 | 1629 | $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
| 1602 | 1630 | $explode_sub_dir = explode("/", $sub_dir);
|
@@ -1609,16 +1637,19 @@ discard block |
||
| 1609 | 1637 | } |
| 1610 | 1638 | |
| 1611 | 1639 | $uploaded_file = ''; |
| 1612 | - if (file_exists($img_path)) |
|
| 1613 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1640 | + if (file_exists($img_path)) { |
|
| 1641 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1642 | + } |
|
| 1614 | 1643 | |
| 1615 | 1644 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1616 | - if (file_exists($img_path)) |
|
| 1617 | - unlink($img_path); |
|
| 1645 | + if (file_exists($img_path)) { |
|
| 1646 | + unlink($img_path); |
|
| 1647 | + } |
|
| 1618 | 1648 | } |
| 1619 | 1649 | |
| 1620 | - if (!empty($uploaded_file)) |
|
| 1621 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1650 | + if (!empty($uploaded_file)) { |
|
| 1651 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1652 | + } |
|
| 1622 | 1653 | |
| 1623 | 1654 | } else {
|
| 1624 | 1655 | $file_urls = $post_image[$m]; |
@@ -1639,8 +1670,9 @@ discard block |
||
| 1639 | 1670 | |
| 1640 | 1671 | geodir_save_post_meta($post_id, $field_id, $file_urls); |
| 1641 | 1672 | |
| 1642 | - if (!empty($invalid_files)) |
|
| 1643 | - geodir_remove_attachments($invalid_files); |
|
| 1673 | + if (!empty($invalid_files)) { |
|
| 1674 | + geodir_remove_attachments($invalid_files); |
|
| 1675 | + } |
|
| 1644 | 1676 | |
| 1645 | 1677 | } |
| 1646 | 1678 | } |
@@ -1866,8 +1898,9 @@ discard block |
||
| 1866 | 1898 | |
| 1867 | 1899 | $all_postypes = geodir_get_posttypes(); |
| 1868 | 1900 | |
| 1869 | - if (!in_array($post_type, $all_postypes)) |
|
| 1870 | - return false; |
|
| 1901 | + if (!in_array($post_type, $all_postypes)) { |
|
| 1902 | + return false; |
|
| 1903 | + } |
|
| 1871 | 1904 | |
| 1872 | 1905 | $fields = array(); |
| 1873 | 1906 | |
@@ -1955,8 +1988,10 @@ discard block |
||
| 1955 | 1988 | } |
| 1956 | 1989 | |
| 1957 | 1990 | return $field_ids; |
| 1958 | - else: |
|
| 1959 | - return false; |
|
| 1991 | + else { |
|
| 1992 | + : |
|
| 1993 | + return false; |
|
| 1994 | + } |
|
| 1960 | 1995 | endif; |
| 1961 | 1996 | } |
| 1962 | 1997 | |
@@ -2129,8 +2164,9 @@ discard block |
||
| 2129 | 2164 | |
| 2130 | 2165 | return $field_id; |
| 2131 | 2166 | |
| 2132 | - } else |
|
| 2133 | - return 0; |
|
| 2167 | + } else { |
|
| 2168 | + return 0; |
|
| 2169 | + } |
|
| 2134 | 2170 | |
| 2135 | 2171 | } |
| 2136 | 2172 | } |
@@ -2172,8 +2208,9 @@ discard block |
||
| 2172 | 2208 | $htmlvar_name = isset($field_types[1]) ? $field_types[1] : ''; |
| 2173 | 2209 | |
| 2174 | 2210 | $site_title = ''; |
| 2175 | - if ($site_title == '') |
|
| 2176 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2211 | + if ($site_title == '') { |
|
| 2212 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2213 | + } |
|
| 2177 | 2214 | |
| 2178 | 2215 | if ($site_title == '') {
|
| 2179 | 2216 | $fields = geodir_get_custom_sort_options($post_type); |
@@ -2187,8 +2224,9 @@ discard block |
||
| 2187 | 2224 | } |
| 2188 | 2225 | } |
| 2189 | 2226 | |
| 2190 | - if ($htmlvar_name == '') |
|
| 2191 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2227 | + if ($htmlvar_name == '') { |
|
| 2228 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2229 | + } |
|
| 2192 | 2230 | |
| 2193 | 2231 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 2194 | 2232 | |
@@ -2594,11 +2632,13 @@ discard block |
||
| 2594 | 2632 | |
| 2595 | 2633 | <?php |
| 2596 | 2634 | $selected = ''; |
| 2597 | - if (isset($field_info->extra_fields)) |
|
| 2598 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2635 | + if (isset($field_info->extra_fields)) { |
|
| 2636 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2637 | + } |
|
| 2599 | 2638 | |
| 2600 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2601 | - $selected = 'checked="checked"'; |
|
| 2639 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor)) { |
|
| 2640 | + $selected = 'checked="checked"'; |
|
| 2641 | + } |
|
| 2602 | 2642 | ?> |
| 2603 | 2643 | |
| 2604 | 2644 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
@@ -2660,8 +2700,9 @@ discard block |
||
| 2660 | 2700 | |
| 2661 | 2701 | if (!isset($field_info->post_type)) {
|
| 2662 | 2702 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 2663 | - } else |
|
| 2664 | - $post_type = $field_info->post_type; |
|
| 2703 | + } else { |
|
| 2704 | + $post_type = $field_info->post_type; |
|
| 2705 | + } |
|
| 2665 | 2706 | ?> |
| 2666 | 2707 | <li style="display: none;"> |
| 2667 | 2708 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | global $post_type; |
| 19 | 19 | |
| 20 | 20 | if (!isset($field_info->post_type)) {
|
| 21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 22 | 22 | } else |
| 23 | - $post_type = $field_info->post_type; |
|
| 23 | + $post_type = $field_info->post_type; |
|
| 24 | 24 | |
| 25 | 25 | $cf_arr = geodir_custom_fields($post_type); |
| 26 | 26 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $field_admin_title = ''; |
| 33 | 33 | if (isset($field_info->admin_title)) |
| 34 | - $field_admin_title = $field_info->admin_title; |
|
| 34 | + $field_admin_title = $field_info->admin_title; |
|
| 35 | 35 | |
| 36 | 36 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
| 37 | 37 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | //print_r($field_info); |
| 52 | 52 | |
| 53 | 53 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 54 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 54 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 55 | 55 | }elseif(isset($cf['icon']) && $cf['icon']){
|
| 56 | - $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 56 | + $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 57 | 57 | }else{
|
| 58 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 58 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | ?> |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
| 66 | 66 | <?php |
| 67 | 67 | |
| 68 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 69 | - ?> |
|
| 68 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 69 | + ?> |
|
| 70 | 70 | |
| 71 | 71 | <?php if ($default): ?> |
| 72 | 72 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
|
@@ -75,37 +75,37 @@ discard block |
||
| 75 | 75 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 76 | 76 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 77 | 77 | <?php endif; |
| 78 | - if ($field_type == 'fieldset') {
|
|
| 79 | - ?> |
|
| 78 | + if ($field_type == 'fieldset') {
|
|
| 79 | + ?> |
|
| 80 | 80 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 81 | 81 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 82 | 82 | <b style="cursor:pointer;" |
| 83 | 83 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
| 84 | 84 | <?php |
| 85 | - } else {echo $field_icon;
|
|
| 86 | - ?> |
|
| 85 | + } else {echo $field_icon;
|
|
| 86 | + ?> |
|
| 87 | 87 | <b style="cursor:pointer;" |
| 88 | 88 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
|
| 89 | 89 | <?php |
| 90 | - } |
|
| 91 | - ?> |
|
| 90 | + } |
|
| 91 | + ?> |
|
| 92 | 92 | </div> |
| 93 | 93 | |
| 94 | 94 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
| 95 | 95 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
| 96 | 96 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 97 | - echo 'block;'; |
|
| 98 | - } else {
|
|
| 99 | - echo 'none;'; |
|
| 100 | - } ?>"> |
|
| 97 | + echo 'block;'; |
|
| 98 | + } else {
|
|
| 99 | + echo 'none;'; |
|
| 100 | + } ?>"> |
|
| 101 | 101 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
| 102 | 102 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
| 103 | 103 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
| 104 | 104 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
| 105 | 105 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
| 106 | 106 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 107 | - echo $field_info->data_type; |
|
| 108 | - } ?>"/> |
|
| 107 | + echo $field_info->data_type; |
|
| 108 | + } ?>"/> |
|
| 109 | 109 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 110 | 110 | |
| 111 | 111 | <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?> |
@@ -117,37 +117,37 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | 119 | |
| 120 | - // data_type |
|
| 121 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 120 | + // data_type |
|
| 121 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 122 | 122 | |
| 123 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 123 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 124 | 124 | |
| 125 | - }else{
|
|
| 126 | - $value = ''; |
|
| 127 | - if (isset($field_info->data_type)) {
|
|
| 128 | - $value = esc_attr($field_info->data_type); |
|
| 129 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 130 | - $value = $cf['defaults']['data_type']; |
|
| 131 | - } |
|
| 132 | - ?> |
|
| 125 | + }else{
|
|
| 126 | + $value = ''; |
|
| 127 | + if (isset($field_info->data_type)) {
|
|
| 128 | + $value = esc_attr($field_info->data_type); |
|
| 129 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 130 | + $value = $cf['defaults']['data_type']; |
|
| 131 | + } |
|
| 132 | + ?> |
|
| 133 | 133 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
| 134 | 134 | <?php |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | 137 | |
| 138 | - // admin_title |
|
| 139 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 138 | + // admin_title |
|
| 139 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 140 | 140 | |
| 141 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 141 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 142 | 142 | |
| 143 | - }else{
|
|
| 144 | - $value = ''; |
|
| 145 | - if (isset($field_info->admin_title)) {
|
|
| 146 | - $value = esc_attr($field_info->admin_title); |
|
| 147 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 148 | - $value = $cf['defaults']['admin_title']; |
|
| 149 | - } |
|
| 150 | - ?> |
|
| 143 | + }else{
|
|
| 144 | + $value = ''; |
|
| 145 | + if (isset($field_info->admin_title)) {
|
|
| 146 | + $value = esc_attr($field_info->admin_title); |
|
| 147 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 148 | + $value = $cf['defaults']['admin_title']; |
|
| 149 | + } |
|
| 150 | + ?> |
|
| 151 | 151 | <li> |
| 152 | 152 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
| 153 | 153 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
|
@@ -161,22 +161,22 @@ discard block |
||
| 161 | 161 | </div> |
| 162 | 162 | </li> |
| 163 | 163 | <?php |
| 164 | - } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | |
| 167 | - // site_title |
|
| 168 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 167 | + // site_title |
|
| 168 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 169 | 169 | |
| 170 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 170 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 171 | 171 | |
| 172 | - }else{
|
|
| 173 | - $value = ''; |
|
| 174 | - if (isset($field_info->site_title)) {
|
|
| 175 | - $value = esc_attr($field_info->site_title); |
|
| 176 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 177 | - $value = $cf['defaults']['site_title']; |
|
| 178 | - } |
|
| 179 | - ?> |
|
| 172 | + }else{
|
|
| 173 | + $value = ''; |
|
| 174 | + if (isset($field_info->site_title)) {
|
|
| 175 | + $value = esc_attr($field_info->site_title); |
|
| 176 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 177 | + $value = $cf['defaults']['site_title']; |
|
| 178 | + } |
|
| 179 | + ?> |
|
| 180 | 180 | <li> |
| 181 | 181 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
|
| 182 | 182 | <div class="gdcf-tooltip"> |
@@ -189,22 +189,22 @@ discard block |
||
| 189 | 189 | </div> |
| 190 | 190 | </li> |
| 191 | 191 | <?php |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | |
| 195 | - // admin_desc |
|
| 196 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 195 | + // admin_desc |
|
| 196 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 197 | 197 | |
| 198 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 198 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 199 | 199 | |
| 200 | - }else{
|
|
| 201 | - $value = ''; |
|
| 202 | - if (isset($field_info->admin_desc)) {
|
|
| 203 | - $value = esc_attr($field_info->admin_desc); |
|
| 204 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 205 | - $value = $cf['defaults']['admin_desc']; |
|
| 206 | - } |
|
| 207 | - ?> |
|
| 200 | + }else{
|
|
| 201 | + $value = ''; |
|
| 202 | + if (isset($field_info->admin_desc)) {
|
|
| 203 | + $value = esc_attr($field_info->admin_desc); |
|
| 204 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 205 | + $value = $cf['defaults']['admin_desc']; |
|
| 206 | + } |
|
| 207 | + ?> |
|
| 208 | 208 | <li> |
| 209 | 209 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
|
| 210 | 210 | <div class="gdcf-tooltip"> |
@@ -217,23 +217,23 @@ discard block |
||
| 217 | 217 | </div> |
| 218 | 218 | </li> |
| 219 | 219 | <?php |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | |
| 224 | - // htmlvar_name |
|
| 225 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 224 | + // htmlvar_name |
|
| 225 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 226 | 226 | |
| 227 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 227 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 228 | 228 | |
| 229 | - }else{
|
|
| 230 | - $value = ''; |
|
| 231 | - if (isset($field_info->htmlvar_name)) {
|
|
| 232 | - $value = esc_attr($field_info->htmlvar_name); |
|
| 233 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 234 | - $value = $cf['defaults']['htmlvar_name']; |
|
| 235 | - } |
|
| 236 | - ?> |
|
| 229 | + }else{
|
|
| 230 | + $value = ''; |
|
| 231 | + if (isset($field_info->htmlvar_name)) {
|
|
| 232 | + $value = esc_attr($field_info->htmlvar_name); |
|
| 233 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 234 | + $value = $cf['defaults']['htmlvar_name']; |
|
| 235 | + } |
|
| 236 | + ?> |
|
| 237 | 237 | <li> |
| 238 | 238 | <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');?>
|
| 239 | 239 | <div class="gdcf-tooltip"> |
@@ -243,29 +243,29 @@ discard block |
||
| 243 | 243 | <div class="gd-cf-input-wrap"> |
| 244 | 244 | <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');?>"
|
| 245 | 245 | value="<?php if ($value) {
|
| 246 | - echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 247 | - }?>" <?php if ($default) {
|
|
| 248 | - echo 'readonly="readonly"'; |
|
| 249 | - }?> /> |
|
| 246 | + echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 247 | + }?>" <?php if ($default) {
|
|
| 248 | + echo 'readonly="readonly"'; |
|
| 249 | + }?> /> |
|
| 250 | 250 | </div> |
| 251 | 251 | </li> |
| 252 | 252 | <?php |
| 253 | - } |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | 255 | |
| 256 | - // is_active |
|
| 257 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 256 | + // is_active |
|
| 257 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 258 | 258 | |
| 259 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 259 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 260 | 260 | |
| 261 | - }else{
|
|
| 262 | - $value = ''; |
|
| 263 | - if (isset($field_info->is_active)) {
|
|
| 264 | - $value = esc_attr($field_info->is_active); |
|
| 265 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 266 | - $value = $cf['defaults']['is_active']; |
|
| 267 | - } |
|
| 268 | - ?> |
|
| 261 | + }else{
|
|
| 262 | + $value = ''; |
|
| 263 | + if (isset($field_info->is_active)) {
|
|
| 264 | + $value = esc_attr($field_info->is_active); |
|
| 265 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 266 | + $value = $cf['defaults']['is_active']; |
|
| 267 | + } |
|
| 268 | + ?> |
|
| 269 | 269 | <li <?php echo $field_display; ?>> |
| 270 | 270 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
|
| 271 | 271 | <div class="gdcf-tooltip"> |
@@ -276,35 +276,35 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 278 | 278 | <?php if ($value == '1') {
|
| 279 | - echo 'checked'; |
|
| 280 | - } ?>/> |
|
| 279 | + echo 'checked'; |
|
| 280 | + } ?>/> |
|
| 281 | 281 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 282 | 282 | |
| 283 | 283 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 284 | 284 | <?php if ($value == '0' || !$value) {
|
| 285 | - echo 'checked'; |
|
| 286 | - } ?>/> |
|
| 285 | + echo 'checked'; |
|
| 286 | + } ?>/> |
|
| 287 | 287 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 288 | 288 | |
| 289 | 289 | </div> |
| 290 | 290 | </li> |
| 291 | 291 | <?php |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | 294 | |
| 295 | - // for_admin_use |
|
| 296 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 295 | + // for_admin_use |
|
| 296 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 297 | 297 | |
| 298 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 298 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 299 | 299 | |
| 300 | - }else{
|
|
| 301 | - $value = ''; |
|
| 302 | - if (isset($field_info->for_admin_use)) {
|
|
| 303 | - $value = esc_attr($field_info->for_admin_use); |
|
| 304 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 305 | - $value = $cf['defaults']['for_admin_use']; |
|
| 306 | - } |
|
| 307 | - ?> |
|
| 300 | + }else{
|
|
| 301 | + $value = ''; |
|
| 302 | + if (isset($field_info->for_admin_use)) {
|
|
| 303 | + $value = esc_attr($field_info->for_admin_use); |
|
| 304 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 305 | + $value = $cf['defaults']['for_admin_use']; |
|
| 306 | + } |
|
| 307 | + ?> |
|
| 308 | 308 | <li> |
| 309 | 309 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
|
| 310 | 310 | <div class="gdcf-tooltip"> |
@@ -315,47 +315,47 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
| 317 | 317 | <?php if ($value == '1') {
|
| 318 | - echo 'checked'; |
|
| 319 | - } ?>/> |
|
| 318 | + echo 'checked'; |
|
| 319 | + } ?>/> |
|
| 320 | 320 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 321 | 321 | |
| 322 | 322 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
| 323 | 323 | <?php if ($value == '0' || !$value) {
|
| 324 | - echo 'checked'; |
|
| 325 | - } ?>/> |
|
| 324 | + echo 'checked'; |
|
| 325 | + } ?>/> |
|
| 326 | 326 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 327 | 327 | |
| 328 | 328 | </div> |
| 329 | 329 | </li> |
| 330 | 330 | <?php |
| 331 | - } |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | 333 | |
| 334 | - // default_value |
|
| 335 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 334 | + // default_value |
|
| 335 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 336 | 336 | |
| 337 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 337 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 338 | 338 | |
| 339 | - }else{
|
|
| 340 | - $value = ''; |
|
| 341 | - if (isset($field_info->default_value)) {
|
|
| 342 | - $value = esc_attr($field_info->default_value); |
|
| 343 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 344 | - $value = $cf['defaults']['default_value']; |
|
| 345 | - } |
|
| 346 | - ?> |
|
| 339 | + }else{
|
|
| 340 | + $value = ''; |
|
| 341 | + if (isset($field_info->default_value)) {
|
|
| 342 | + $value = esc_attr($field_info->default_value); |
|
| 343 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 344 | + $value = $cf['defaults']['default_value']; |
|
| 345 | + } |
|
| 346 | + ?> |
|
| 347 | 347 | <li> |
| 348 | 348 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
| 349 | 349 | <div class="gdcf-tooltip"> |
| 350 | 350 | <?php |
| 351 | - if ($field_type == 'checkbox') {
|
|
| 352 | - _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 353 | - } else if ($field_type == 'email') {
|
|
| 354 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 355 | - } else {
|
|
| 356 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 357 | - } |
|
| 358 | - ?> |
|
| 351 | + if ($field_type == 'checkbox') {
|
|
| 352 | + _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 353 | + } else if ($field_type == 'email') {
|
|
| 354 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 355 | + } else {
|
|
| 356 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 357 | + } |
|
| 358 | + ?> |
|
| 359 | 359 | </div> |
| 360 | 360 | </label> |
| 361 | 361 | <div class="gd-cf-input-wrap"> |
@@ -372,17 +372,17 @@ discard block |
||
| 372 | 372 | </div> |
| 373 | 373 | </li> |
| 374 | 374 | <?php |
| 375 | - } |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | 377 | |
| 378 | - // show_in |
|
| 379 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 378 | + // show_in |
|
| 379 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 380 | 380 | |
| 381 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 381 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 382 | 382 | |
| 383 | - }else{
|
|
| 384 | - $value = ''; |
|
| 385 | - ?> |
|
| 383 | + }else{
|
|
| 384 | + $value = ''; |
|
| 385 | + ?> |
|
| 386 | 386 | <li> |
| 387 | 387 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
|
| 388 | 388 | <div class="gdcf-tooltip"> |
@@ -393,42 +393,42 @@ discard block |
||
| 393 | 393 | |
| 394 | 394 | <?php |
| 395 | 395 | |
| 396 | - /* |
|
| 396 | + /* |
|
| 397 | 397 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
| 398 | 398 | */ |
| 399 | - $show_in_locations = array( |
|
| 400 | - "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 401 | - "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 402 | - "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 403 | - "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 404 | - "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 405 | - ); |
|
| 406 | - |
|
| 407 | - /** |
|
| 408 | - * Filter the locations array for where to display custom fields. |
|
| 409 | - * |
|
| 410 | - * @since 1.6.6 |
|
| 411 | - * @param array $show_in_locations The array of locations and descriptions. |
|
| 412 | - * @param object $field_info The field being displayed info. |
|
| 413 | - * @param string $field_info The type of field. |
|
| 414 | - */ |
|
| 415 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 399 | + $show_in_locations = array( |
|
| 400 | + "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 401 | + "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 402 | + "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 403 | + "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 404 | + "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 405 | + ); |
|
| 406 | + |
|
| 407 | + /** |
|
| 408 | + * Filter the locations array for where to display custom fields. |
|
| 409 | + * |
|
| 410 | + * @since 1.6.6 |
|
| 411 | + * @param array $show_in_locations The array of locations and descriptions. |
|
| 412 | + * @param object $field_info The field being displayed info. |
|
| 413 | + * @param string $field_info The type of field. |
|
| 414 | + */ |
|
| 415 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 416 | 416 | |
| 417 | 417 | |
| 418 | - // remove some locations for some field types |
|
| 418 | + // remove some locations for some field types |
|
| 419 | 419 | |
| 420 | - // don't show new tab option for some types |
|
| 420 | + // don't show new tab option for some types |
|
| 421 | 421 | |
| 422 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 423 | - }else{
|
|
| 424 | - unset($show_in_locations['[owntab]']); |
|
| 425 | - } |
|
| 422 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
|
| 423 | + }else{
|
|
| 424 | + unset($show_in_locations['[owntab]']); |
|
| 425 | + } |
|
| 426 | 426 | |
| 427 | - if(!$display_on_listing){
|
|
| 428 | - unset($show_in_locations['[listings]']); |
|
| 429 | - } |
|
| 427 | + if(!$display_on_listing){
|
|
| 428 | + unset($show_in_locations['[listings]']); |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - ?> |
|
| 431 | + ?> |
|
| 432 | 432 | |
| 433 | 433 | <select multiple="multiple" name="show_in[]" |
| 434 | 434 | id="show_in" |
@@ -438,38 +438,38 @@ discard block |
||
| 438 | 438 | option-ajaxchosen="false"> |
| 439 | 439 | <?php |
| 440 | 440 | |
| 441 | - $show_in_values = explode(',',$field_info->show_in);
|
|
| 441 | + $show_in_values = explode(',',$field_info->show_in);
|
|
| 442 | 442 | |
| 443 | - foreach( $show_in_locations as $key => $val){
|
|
| 444 | - $selected = ''; |
|
| 443 | + foreach( $show_in_locations as $key => $val){
|
|
| 444 | + $selected = ''; |
|
| 445 | 445 | |
| 446 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 447 | - $selected = 'selected'; |
|
| 448 | - } |
|
| 446 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 447 | + $selected = 'selected'; |
|
| 448 | + } |
|
| 449 | 449 | |
| 450 | - ?> |
|
| 450 | + ?> |
|
| 451 | 451 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
| 452 | 452 | <?php |
| 453 | - } |
|
| 454 | - ?> |
|
| 453 | + } |
|
| 454 | + ?> |
|
| 455 | 455 | </select> |
| 456 | 456 | </div> |
| 457 | 457 | </li> |
| 458 | 458 | <?php |
| 459 | - } |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | 461 | |
| 462 | - // advanced_editor |
|
| 463 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 462 | + // advanced_editor |
|
| 463 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 464 | 464 | |
| 465 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 465 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 466 | 466 | |
| 467 | - } |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | 469 | |
| 470 | 470 | |
| 471 | 471 | |
| 472 | - ?> |
|
| 472 | + ?> |
|
| 473 | 473 | |
| 474 | 474 | |
| 475 | 475 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -482,38 +482,38 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | <?php |
| 484 | 484 | |
| 485 | - $pricearr = array(); |
|
| 486 | - if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 487 | - $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 488 | - } else {
|
|
| 489 | - $package_info = array(); |
|
| 485 | + $pricearr = array(); |
|
| 486 | + if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 487 | + $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 488 | + } else {
|
|
| 489 | + $package_info = array(); |
|
| 490 | 490 | |
| 491 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 492 | - $pricearr[] = $package_info->pid; |
|
| 493 | - } |
|
| 491 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 492 | + $pricearr[] = $package_info->pid; |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | - ob_start() |
|
| 496 | - ?> |
|
| 495 | + ob_start() |
|
| 496 | + ?> |
|
| 497 | 497 | |
| 498 | 498 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
| 499 | 499 | <?php |
| 500 | - if (!empty($pricearr)) {
|
|
| 501 | - foreach ($pricearr as $val) {
|
|
| 502 | - ?> |
|
| 500 | + if (!empty($pricearr)) {
|
|
| 501 | + foreach ($pricearr as $val) {
|
|
| 502 | + ?> |
|
| 503 | 503 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
| 504 | - } |
|
| 505 | - } |
|
| 506 | - ?> |
|
| 504 | + } |
|
| 505 | + } |
|
| 506 | + ?> |
|
| 507 | 507 | </select> |
| 508 | 508 | |
| 509 | 509 | <?php |
| 510 | - $html = ob_get_clean(); |
|
| 510 | + $html = ob_get_clean(); |
|
| 511 | 511 | |
| 512 | 512 | /** |
| 513 | 513 | * Filter the price packages list. |
| 514 | 514 | * |
| 515 | 515 | * Filter the price packages list in custom field form in admin |
| 516 | - * custom fields settings. |
|
| 516 | + * custom fields settings. |
|
| 517 | 517 | * |
| 518 | 518 | * @since 1.0.0 |
| 519 | 519 | * |
@@ -522,25 +522,25 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
|
| 524 | 524 | |
| 525 | - ?> |
|
| 525 | + ?> |
|
| 526 | 526 | |
| 527 | 527 | |
| 528 | 528 | |
| 529 | 529 | <?php |
| 530 | 530 | |
| 531 | - // is_required |
|
| 532 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 531 | + // is_required |
|
| 532 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 533 | 533 | |
| 534 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 534 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 535 | 535 | |
| 536 | - }else{
|
|
| 537 | - $value = ''; |
|
| 538 | - if (isset($field_info->is_required)) {
|
|
| 539 | - $value = esc_attr($field_info->is_required); |
|
| 540 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 541 | - $value = $cf['defaults']['is_required']; |
|
| 542 | - } |
|
| 543 | - ?> |
|
| 536 | + }else{
|
|
| 537 | + $value = ''; |
|
| 538 | + if (isset($field_info->is_required)) {
|
|
| 539 | + $value = esc_attr($field_info->is_required); |
|
| 540 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 541 | + $value = $cf['defaults']['is_required']; |
|
| 542 | + } |
|
| 543 | + ?> |
|
| 544 | 544 | <li> |
| 545 | 545 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
|
| 546 | 546 | <div class="gdcf-tooltip"> |
@@ -552,14 +552,14 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
| 554 | 554 | <?php if ($value == '1') {
|
| 555 | - echo 'checked'; |
|
| 556 | - } ?>/> |
|
| 555 | + echo 'checked'; |
|
| 556 | + } ?>/> |
|
| 557 | 557 | <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>
|
| 558 | 558 | |
| 559 | 559 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
| 560 | 560 | <?php if ($value == '0' || !$value) {
|
| 561 | - echo 'checked'; |
|
| 562 | - } ?>/> |
|
| 561 | + echo 'checked'; |
|
| 562 | + } ?>/> |
|
| 563 | 563 | <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>
|
| 564 | 564 | |
| 565 | 565 | </div> |
@@ -567,21 +567,21 @@ discard block |
||
| 567 | 567 | </li> |
| 568 | 568 | |
| 569 | 569 | <?php |
| 570 | - } |
|
| 570 | + } |
|
| 571 | 571 | |
| 572 | - // required_msg |
|
| 573 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 572 | + // required_msg |
|
| 573 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 574 | 574 | |
| 575 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 575 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 576 | 576 | |
| 577 | - }else{
|
|
| 578 | - $value = ''; |
|
| 579 | - if (isset($field_info->required_msg)) {
|
|
| 580 | - $value = esc_attr($field_info->required_msg); |
|
| 581 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 582 | - $value = $cf['defaults']['required_msg']; |
|
| 583 | - } |
|
| 584 | - ?> |
|
| 577 | + }else{
|
|
| 578 | + $value = ''; |
|
| 579 | + if (isset($field_info->required_msg)) {
|
|
| 580 | + $value = esc_attr($field_info->required_msg); |
|
| 581 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 582 | + $value = $cf['defaults']['required_msg']; |
|
| 583 | + } |
|
| 584 | + ?> |
|
| 585 | 585 | <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;'";}?>>
|
| 586 | 586 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 587 | 587 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
@@ -595,38 +595,38 @@ discard block |
||
| 595 | 595 | </div> |
| 596 | 596 | </li> |
| 597 | 597 | <?php |
| 598 | - } |
|
| 598 | + } |
|
| 599 | 599 | |
| 600 | 600 | |
| 601 | - // required_msg |
|
| 602 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 601 | + // required_msg |
|
| 602 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 603 | 603 | |
| 604 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 604 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 605 | 605 | |
| 606 | - } |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | 608 | |
| 609 | - // extra_fields |
|
| 610 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 609 | + // extra_fields |
|
| 610 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 611 | 611 | |
| 612 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 612 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 613 | 613 | |
| 614 | - } |
|
| 614 | + } |
|
| 615 | 615 | |
| 616 | 616 | |
| 617 | - // field_icon |
|
| 618 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 617 | + // field_icon |
|
| 618 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 619 | 619 | |
| 620 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 620 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 621 | 621 | |
| 622 | - }else{
|
|
| 623 | - $value = ''; |
|
| 624 | - if (isset($field_info->field_icon)) {
|
|
| 625 | - $value = esc_attr($field_info->field_icon); |
|
| 626 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 627 | - $value = $cf['defaults']['field_icon']; |
|
| 628 | - } |
|
| 629 | - ?> |
|
| 622 | + }else{
|
|
| 623 | + $value = ''; |
|
| 624 | + if (isset($field_info->field_icon)) {
|
|
| 625 | + $value = esc_attr($field_info->field_icon); |
|
| 626 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 627 | + $value = $cf['defaults']['field_icon']; |
|
| 628 | + } |
|
| 629 | + ?> |
|
| 630 | 630 | <li> |
| 631 | 631 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
|
| 632 | 632 | |
@@ -644,22 +644,22 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | </li> |
| 646 | 646 | <?php |
| 647 | - } |
|
| 647 | + } |
|
| 648 | 648 | |
| 649 | 649 | |
| 650 | - // css_class |
|
| 651 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 650 | + // css_class |
|
| 651 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 652 | 652 | |
| 653 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 653 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 654 | 654 | |
| 655 | - }else{
|
|
| 656 | - $value = ''; |
|
| 657 | - if (isset($field_info->css_class)) {
|
|
| 658 | - $value = esc_attr($field_info->css_class); |
|
| 659 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 660 | - $value = $cf['defaults']['css_class']; |
|
| 661 | - } |
|
| 662 | - ?> |
|
| 655 | + }else{
|
|
| 656 | + $value = ''; |
|
| 657 | + if (isset($field_info->css_class)) {
|
|
| 658 | + $value = esc_attr($field_info->css_class); |
|
| 659 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 660 | + $value = $cf['defaults']['css_class']; |
|
| 661 | + } |
|
| 662 | + ?> |
|
| 663 | 663 | <li> |
| 664 | 664 | |
| 665 | 665 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -671,43 +671,43 @@ discard block |
||
| 671 | 671 | <div class="gd-cf-input-wrap"> |
| 672 | 672 | <input type="text" name="css_class" id="css_class" |
| 673 | 673 | value="<?php if (isset($field_info->css_class)) {
|
| 674 | - echo esc_attr($field_info->css_class); |
|
| 675 | - }?>"/> |
|
| 674 | + echo esc_attr($field_info->css_class); |
|
| 675 | + }?>"/> |
|
| 676 | 676 | </div> |
| 677 | 677 | </li> |
| 678 | 678 | <?php |
| 679 | - } |
|
| 679 | + } |
|
| 680 | 680 | |
| 681 | 681 | |
| 682 | - // cat_sort |
|
| 683 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 682 | + // cat_sort |
|
| 683 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 684 | 684 | |
| 685 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 685 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 686 | 686 | |
| 687 | - }else{
|
|
| 688 | - $value = ''; |
|
| 689 | - if (isset($field_info->cat_sort)) {
|
|
| 690 | - $value = esc_attr($field_info->cat_sort); |
|
| 691 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 692 | - $value = $cf['defaults']['cat_sort']; |
|
| 693 | - } |
|
| 694 | - ?> |
|
| 687 | + }else{
|
|
| 688 | + $value = ''; |
|
| 689 | + if (isset($field_info->cat_sort)) {
|
|
| 690 | + $value = esc_attr($field_info->cat_sort); |
|
| 691 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 692 | + $value = $cf['defaults']['cat_sort']; |
|
| 693 | + } |
|
| 694 | + ?> |
|
| 695 | 695 | <li> |
| 696 | 696 | <h3><?php |
| 697 | - /** |
|
| 698 | - * Filter the section title. |
|
| 699 | - * |
|
| 700 | - * Filter the section title in custom field form in admin |
|
| 701 | - * custom fields settings. |
|
| 702 | - * |
|
| 703 | - * @since 1.0.0 |
|
| 704 | - * |
|
| 705 | - * @param string $title Title of the section. |
|
| 706 | - * @param string $field_type Current field type. |
|
| 707 | - */ |
|
| 708 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 709 | - |
|
| 710 | - ?></h3> |
|
| 697 | + /** |
|
| 698 | + * Filter the section title. |
|
| 699 | + * |
|
| 700 | + * Filter the section title in custom field form in admin |
|
| 701 | + * custom fields settings. |
|
| 702 | + * |
|
| 703 | + * @since 1.0.0 |
|
| 704 | + * |
|
| 705 | + * @param string $title Title of the section. |
|
| 706 | + * @param string $field_type Current field type. |
|
| 707 | + */ |
|
| 708 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 709 | + |
|
| 710 | + ?></h3> |
|
| 711 | 711 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 712 | 712 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 713 | 713 | <div class="gdcf-tooltip"> |
@@ -719,40 +719,40 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
| 721 | 721 | <?php if ($value == '1') {
|
| 722 | - echo 'checked'; |
|
| 723 | - } ?>/> |
|
| 722 | + echo 'checked'; |
|
| 723 | + } ?>/> |
|
| 724 | 724 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 725 | 725 | |
| 726 | 726 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
| 727 | 727 | <?php if (!$value) {
|
| 728 | - echo 'checked'; |
|
| 729 | - } ?>/> |
|
| 728 | + echo 'checked'; |
|
| 729 | + } ?>/> |
|
| 730 | 730 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 731 | 731 | |
| 732 | 732 | </div> |
| 733 | 733 | </li> |
| 734 | 734 | <?php |
| 735 | - } |
|
| 736 | - |
|
| 737 | - |
|
| 738 | - |
|
| 739 | - switch ($field_type): |
|
| 740 | - case 'html': |
|
| 741 | - case 'file': |
|
| 742 | - case 'url': |
|
| 743 | - case 'fieldset': |
|
| 744 | - break; |
|
| 745 | - default: |
|
| 746 | - |
|
| 747 | - /** |
|
| 748 | - * Called at the end of the advanced custom fields settings page loop. |
|
| 749 | - * |
|
| 750 | - * Can be used to add or deal with different settings types. |
|
| 751 | - * |
|
| 752 | - * @since 1.0.0 |
|
| 753 | - * @param object $field_info The current fields info. |
|
| 754 | - */ |
|
| 755 | - do_action('geodir_advance_custom_fields', $field_info);?>
|
|
| 735 | + } |
|
| 736 | + |
|
| 737 | + |
|
| 738 | + |
|
| 739 | + switch ($field_type): |
|
| 740 | + case 'html': |
|
| 741 | + case 'file': |
|
| 742 | + case 'url': |
|
| 743 | + case 'fieldset': |
|
| 744 | + break; |
|
| 745 | + default: |
|
| 746 | + |
|
| 747 | + /** |
|
| 748 | + * Called at the end of the advanced custom fields settings page loop. |
|
| 749 | + * |
|
| 750 | + * Can be used to add or deal with different settings types. |
|
| 751 | + * |
|
| 752 | + * @since 1.0.0 |
|
| 753 | + * @param object $field_info The current fields info. |
|
| 754 | + */ |
|
| 755 | + do_action('geodir_advance_custom_fields', $field_info);?>
|
|
| 756 | 756 | |
| 757 | 757 | |
| 758 | 758 | <?php endswitch; ?> |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
| 29 | 29 | |
| 30 | -$nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 30 | +$nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 31 | 31 | |
| 32 | 32 | $field_admin_title = ''; |
| 33 | 33 | if (isset($field_info->admin_title)) |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 54 | 54 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 55 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 55 | +}elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 56 | 56 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 57 | -}else{
|
|
| 57 | +} else {
|
|
| 58 | 58 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
| 66 | 66 | <?php |
| 67 | 67 | |
| 68 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 68 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 69 | 69 | ?> |
| 70 | 70 | |
| 71 | 71 | <?php if ($default): ?> |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 81 | 81 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 82 | 82 | <b style="cursor:pointer;" |
| 83 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
|
| 83 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
|
|
| 84 | 84 | <?php |
| 85 | 85 | } else {echo $field_icon;
|
| 86 | 86 | ?> |
| 87 | 87 | <b style="cursor:pointer;" |
| 88 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type . ')');?></b>
|
|
| 88 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type.')'); ?></b>
|
|
| 89 | 89 | <?php |
| 90 | 90 | } |
| 91 | 91 | ?> |
@@ -108,43 +108,43 @@ discard block |
||
| 108 | 108 | } ?>"/> |
| 109 | 109 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 110 | 110 | |
| 111 | - <input type="hidden" name="is_default" value="<?php echo $field_info->is_default;?>" /><?php // show in sidebar value?> |
|
| 112 | - <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing;?>" /> |
|
| 113 | - <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing;?>" /> |
|
| 114 | - <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab;?>" /> |
|
| 111 | + <input type="hidden" name="is_default" value="<?php echo $field_info->is_default; ?>" /><?php // show in sidebar value?> |
|
| 112 | + <input type="hidden" name="show_on_listing" value="<?php echo $field_info->show_on_listing; ?>" /> |
|
| 113 | + <input type="hidden" name="show_on_detail" value="<?php echo $field_info->show_on_listing; ?>" /> |
|
| 114 | + <input type="hidden" name="show_as_tab" value="<?php echo $field_info->show_as_tab; ?>" /> |
|
| 115 | 115 | |
| 116 | 116 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | 119 | |
| 120 | 120 | // data_type |
| 121 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 121 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) {
|
|
| 122 | 122 | |
| 123 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 123 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 124 | 124 | |
| 125 | - }else{
|
|
| 125 | + } else {
|
|
| 126 | 126 | $value = ''; |
| 127 | 127 | if (isset($field_info->data_type)) {
|
| 128 | 128 | $value = esc_attr($field_info->data_type); |
| 129 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 129 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 130 | 130 | $value = $cf['defaults']['data_type']; |
| 131 | 131 | } |
| 132 | 132 | ?> |
| 133 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
| 133 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
| 134 | 134 | <?php |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | // admin_title |
| 139 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 139 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
|
|
| 140 | 140 | |
| 141 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 141 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 142 | 142 | |
| 143 | - }else{
|
|
| 143 | + } else {
|
|
| 144 | 144 | $value = ''; |
| 145 | 145 | if (isset($field_info->admin_title)) {
|
| 146 | 146 | $value = esc_attr($field_info->admin_title); |
| 147 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 147 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
|
|
| 148 | 148 | $value = $cf['defaults']['admin_title']; |
| 149 | 149 | } |
| 150 | 150 | ?> |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | </label> |
| 158 | 158 | <div class="gd-cf-input-wrap"> |
| 159 | 159 | <input type="text" name="admin_title" id="admin_title" |
| 160 | - value="<?php echo $value;?>"/> |
|
| 160 | + value="<?php echo $value; ?>"/> |
|
| 161 | 161 | </div> |
| 162 | 162 | </li> |
| 163 | 163 | <?php |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | // site_title |
| 168 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 168 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) {
|
|
| 169 | 169 | |
| 170 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 170 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 171 | 171 | |
| 172 | - }else{
|
|
| 172 | + } else {
|
|
| 173 | 173 | $value = ''; |
| 174 | 174 | if (isset($field_info->site_title)) {
|
| 175 | 175 | $value = esc_attr($field_info->site_title); |
| 176 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 176 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
|
|
| 177 | 177 | $value = $cf['defaults']['site_title']; |
| 178 | 178 | } |
| 179 | 179 | ?> |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | // admin_desc |
| 196 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 196 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
|
|
| 197 | 197 | |
| 198 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 198 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 199 | 199 | |
| 200 | - }else{
|
|
| 200 | + } else {
|
|
| 201 | 201 | $value = ''; |
| 202 | 202 | if (isset($field_info->admin_desc)) {
|
| 203 | 203 | $value = esc_attr($field_info->admin_desc); |
| 204 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 204 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
|
|
| 205 | 205 | $value = $cf['defaults']['admin_desc']; |
| 206 | 206 | } |
| 207 | 207 | ?> |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | </label> |
| 214 | 214 | <div class="gd-cf-input-wrap"> |
| 215 | 215 | <input type="text" name="admin_desc" id="admin_desc" |
| 216 | - value="<?php echo $value;?>"/> |
|
| 216 | + value="<?php echo $value; ?>"/> |
|
| 217 | 217 | </div> |
| 218 | 218 | </li> |
| 219 | 219 | <?php |
@@ -222,26 +222,26 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | // htmlvar_name |
| 225 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 225 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
|
|
| 226 | 226 | |
| 227 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 227 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 228 | 228 | |
| 229 | - }else{
|
|
| 229 | + } else {
|
|
| 230 | 230 | $value = ''; |
| 231 | 231 | if (isset($field_info->htmlvar_name)) {
|
| 232 | 232 | $value = esc_attr($field_info->htmlvar_name); |
| 233 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 233 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
|
|
| 234 | 234 | $value = $cf['defaults']['htmlvar_name']; |
| 235 | 235 | } |
| 236 | 236 | ?> |
| 237 | 237 | <li> |
| 238 | - <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');?>
|
|
| 238 | + <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'); ?>
|
|
| 239 | 239 | <div class="gdcf-tooltip"> |
| 240 | 240 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
|
| 241 | 241 | </div> |
| 242 | 242 | </label> |
| 243 | 243 | <div class="gd-cf-input-wrap"> |
| 244 | - <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');?>"
|
|
| 244 | + <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'); ?>"
|
|
| 245 | 245 | value="<?php if ($value) {
|
| 246 | 246 | echo preg_replace('/geodir_/', '', $value, 1);
|
| 247 | 247 | }?>" <?php if ($default) {
|
@@ -254,15 +254,15 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | |
| 256 | 256 | // is_active |
| 257 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 257 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) {
|
|
| 258 | 258 | |
| 259 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 259 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 260 | 260 | |
| 261 | - }else{
|
|
| 261 | + } else {
|
|
| 262 | 262 | $value = ''; |
| 263 | 263 | if (isset($field_info->is_active)) {
|
| 264 | 264 | $value = esc_attr($field_info->is_active); |
| 265 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 265 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
|
|
| 266 | 266 | $value = $cf['defaults']['is_active']; |
| 267 | 267 | } |
| 268 | 268 | ?> |
@@ -274,17 +274,17 @@ discard block |
||
| 274 | 274 | </label> |
| 275 | 275 | <div class="gd-cf-input-wrap gd-switch"> |
| 276 | 276 | |
| 277 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 277 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 278 | 278 | <?php if ($value == '1') {
|
| 279 | 279 | echo 'checked'; |
| 280 | 280 | } ?>/> |
| 281 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 281 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 282 | 282 | |
| 283 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 283 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 284 | 284 | <?php if ($value == '0' || !$value) {
|
| 285 | 285 | echo 'checked'; |
| 286 | 286 | } ?>/> |
| 287 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 287 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 288 | 288 | |
| 289 | 289 | </div> |
| 290 | 290 | </li> |
@@ -293,15 +293,15 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | // for_admin_use |
| 296 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 296 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
|
|
| 297 | 297 | |
| 298 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 298 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 299 | 299 | |
| 300 | - }else{
|
|
| 300 | + } else {
|
|
| 301 | 301 | $value = ''; |
| 302 | 302 | if (isset($field_info->for_admin_use)) {
|
| 303 | 303 | $value = esc_attr($field_info->for_admin_use); |
| 304 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 304 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
|
|
| 305 | 305 | $value = $cf['defaults']['for_admin_use']; |
| 306 | 306 | } |
| 307 | 307 | ?> |
@@ -313,17 +313,17 @@ discard block |
||
| 313 | 313 | </label> |
| 314 | 314 | <div class="gd-cf-input-wrap gd-switch"> |
| 315 | 315 | |
| 316 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 316 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 317 | 317 | <?php if ($value == '1') {
|
| 318 | 318 | echo 'checked'; |
| 319 | 319 | } ?>/> |
| 320 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 320 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 321 | 321 | |
| 322 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 322 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 323 | 323 | <?php if ($value == '0' || !$value) {
|
| 324 | 324 | echo 'checked'; |
| 325 | 325 | } ?>/> |
| 326 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 326 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 327 | 327 | |
| 328 | 328 | </div> |
| 329 | 329 | </li> |
@@ -332,20 +332,20 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | |
| 334 | 334 | // default_value |
| 335 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 335 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) {
|
|
| 336 | 336 | |
| 337 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 337 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 338 | 338 | |
| 339 | - }else{
|
|
| 339 | + } else {
|
|
| 340 | 340 | $value = ''; |
| 341 | 341 | if (isset($field_info->default_value)) {
|
| 342 | 342 | $value = esc_attr($field_info->default_value); |
| 343 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 343 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
|
|
| 344 | 344 | $value = $cf['defaults']['default_value']; |
| 345 | 345 | } |
| 346 | 346 | ?> |
| 347 | 347 | <li> |
| 348 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
|
| 348 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
|
|
| 349 | 349 | <div class="gdcf-tooltip"> |
| 350 | 350 | <?php |
| 351 | 351 | if ($field_type == 'checkbox') {
|
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | <?php if ($field_type == 'checkbox') { ?>
|
| 363 | 363 | <select name="default_value" id="default_value"> |
| 364 | 364 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
|
| 365 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 365 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 366 | 366 | </select> |
| 367 | 367 | <?php } else if ($field_type == 'email') { ?>
|
| 368 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
|
|
| 368 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
|
|
| 369 | 369 | <?php } else { ?>
|
| 370 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
| 370 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
| 371 | 371 | <?php } ?> |
| 372 | 372 | </div> |
| 373 | 373 | </li> |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | |
| 378 | 378 | // show_in |
| 379 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 379 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) {
|
|
| 380 | 380 | |
| 381 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 381 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 382 | 382 | |
| 383 | - }else{
|
|
| 383 | + } else {
|
|
| 384 | 384 | $value = ''; |
| 385 | 385 | ?> |
| 386 | 386 | <li> |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @param object $field_info The field being displayed info. |
| 413 | 413 | * @param string $field_info The type of field. |
| 414 | 414 | */ |
| 415 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 415 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
|
|
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | // remove some locations for some field types |
@@ -420,11 +420,11 @@ discard block |
||
| 420 | 420 | // don't show new tab option for some types |
| 421 | 421 | |
| 422 | 422 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
| 423 | - }else{
|
|
| 423 | + } else {
|
|
| 424 | 424 | unset($show_in_locations['[owntab]']); |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - if(!$display_on_listing){
|
|
| 427 | + if (!$display_on_listing) {
|
|
| 428 | 428 | unset($show_in_locations['[listings]']); |
| 429 | 429 | } |
| 430 | 430 | |
@@ -438,17 +438,17 @@ discard block |
||
| 438 | 438 | option-ajaxchosen="false"> |
| 439 | 439 | <?php |
| 440 | 440 | |
| 441 | - $show_in_values = explode(',',$field_info->show_in);
|
|
| 441 | + $show_in_values = explode(',', $field_info->show_in);
|
|
| 442 | 442 | |
| 443 | - foreach( $show_in_locations as $key => $val){
|
|
| 443 | + foreach ($show_in_locations as $key => $val) {
|
|
| 444 | 444 | $selected = ''; |
| 445 | 445 | |
| 446 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 446 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) {
|
|
| 447 | 447 | $selected = 'selected'; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | ?> |
| 451 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
| 451 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
| 452 | 452 | <?php |
| 453 | 453 | } |
| 454 | 454 | ?> |
@@ -460,9 +460,9 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | |
| 462 | 462 | // advanced_editor |
| 463 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 463 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
|
|
| 464 | 464 | |
| 465 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 465 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 466 | 466 | |
| 467 | 467 | } |
| 468 | 468 | |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | |
| 475 | 475 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
| 476 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
|
|
| 476 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
|
|
| 477 | 477 | |
| 478 | 478 | <?php // we dont need to show the sort order ?> |
| 479 | - <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);} ?>"/>
|
|
| 479 | + <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); } ?>"/>
|
|
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | |
@@ -529,15 +529,15 @@ discard block |
||
| 529 | 529 | <?php |
| 530 | 530 | |
| 531 | 531 | // is_required |
| 532 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 532 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) {
|
|
| 533 | 533 | |
| 534 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 534 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 535 | 535 | |
| 536 | - }else{
|
|
| 536 | + } else {
|
|
| 537 | 537 | $value = ''; |
| 538 | 538 | if (isset($field_info->is_required)) {
|
| 539 | 539 | $value = esc_attr($field_info->is_required); |
| 540 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 540 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
|
|
| 541 | 541 | $value = $cf['defaults']['is_required']; |
| 542 | 542 | } |
| 543 | 543 | ?> |
@@ -550,17 +550,17 @@ discard block |
||
| 550 | 550 | |
| 551 | 551 | <div class="gd-cf-input-wrap gd-switch"> |
| 552 | 552 | |
| 553 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
| 553 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
| 554 | 554 | <?php if ($value == '1') {
|
| 555 | 555 | echo 'checked'; |
| 556 | 556 | } ?>/> |
| 557 | - <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>
|
|
| 557 | + <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>
|
|
| 558 | 558 | |
| 559 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
| 559 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
| 560 | 560 | <?php if ($value == '0' || !$value) {
|
| 561 | 561 | echo 'checked'; |
| 562 | 562 | } ?>/> |
| 563 | - <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>
|
|
| 563 | + <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>
|
|
| 564 | 564 | |
| 565 | 565 | </div> |
| 566 | 566 | |
@@ -570,19 +570,19 @@ discard block |
||
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | // required_msg |
| 573 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 573 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
|
|
| 574 | 574 | |
| 575 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 575 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 576 | 576 | |
| 577 | - }else{
|
|
| 577 | + } else {
|
|
| 578 | 578 | $value = ''; |
| 579 | 579 | if (isset($field_info->required_msg)) {
|
| 580 | 580 | $value = esc_attr($field_info->required_msg); |
| 581 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 581 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
|
|
| 582 | 582 | $value = $cf['defaults']['required_msg']; |
| 583 | 583 | } |
| 584 | 584 | ?> |
| 585 | - <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;'";}?>>
|
|
| 585 | + <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;'"; }?>>
|
|
| 586 | 586 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 587 | 587 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
| 588 | 588 | <div class="gdcf-tooltip"> |
@@ -599,31 +599,31 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | |
| 601 | 601 | // required_msg |
| 602 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 602 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
|
|
| 603 | 603 | |
| 604 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 604 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 605 | 605 | |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | |
| 609 | 609 | // extra_fields |
| 610 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 610 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
|
|
| 611 | 611 | |
| 612 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 612 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 613 | 613 | |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | |
| 617 | 617 | // field_icon |
| 618 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 618 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
|
|
| 619 | 619 | |
| 620 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 620 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 621 | 621 | |
| 622 | - }else{
|
|
| 622 | + } else {
|
|
| 623 | 623 | $value = ''; |
| 624 | 624 | if (isset($field_info->field_icon)) {
|
| 625 | 625 | $value = esc_attr($field_info->field_icon); |
| 626 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 626 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
|
|
| 627 | 627 | $value = $cf['defaults']['field_icon']; |
| 628 | 628 | } |
| 629 | 629 | ?> |
@@ -634,12 +634,12 @@ discard block |
||
| 634 | 634 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
| 635 | 635 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
|
| 636 | 636 | <div class="gdcf-tooltip"> |
| 637 | - <?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');?>
|
|
| 637 | + <?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'); ?>
|
|
| 638 | 638 | </div> |
| 639 | 639 | </label> |
| 640 | 640 | <div class="gd-cf-input-wrap"> |
| 641 | 641 | <input type="text" name="field_icon" id="field_icon" |
| 642 | - value="<?php echo $value;?>"/> |
|
| 642 | + value="<?php echo $value; ?>"/> |
|
| 643 | 643 | </div> |
| 644 | 644 | |
| 645 | 645 | </li> |
@@ -648,15 +648,15 @@ discard block |
||
| 648 | 648 | |
| 649 | 649 | |
| 650 | 650 | // css_class |
| 651 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 651 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) {
|
|
| 652 | 652 | |
| 653 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 653 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 654 | 654 | |
| 655 | - }else{
|
|
| 655 | + } else {
|
|
| 656 | 656 | $value = ''; |
| 657 | 657 | if (isset($field_info->css_class)) {
|
| 658 | 658 | $value = esc_attr($field_info->css_class); |
| 659 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 659 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
|
|
| 660 | 660 | $value = $cf['defaults']['css_class']; |
| 661 | 661 | } |
| 662 | 662 | ?> |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
| 666 | 666 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
|
| 667 | 667 | <div class="gdcf-tooltip"> |
| 668 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
|
|
| 668 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
|
|
| 669 | 669 | </div> |
| 670 | 670 | </label> |
| 671 | 671 | <div class="gd-cf-input-wrap"> |
@@ -680,15 +680,15 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | |
| 682 | 682 | // cat_sort |
| 683 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 683 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
|
|
| 684 | 684 | |
| 685 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 685 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 686 | 686 | |
| 687 | - }else{
|
|
| 687 | + } else {
|
|
| 688 | 688 | $value = ''; |
| 689 | 689 | if (isset($field_info->cat_sort)) {
|
| 690 | 690 | $value = esc_attr($field_info->cat_sort); |
| 691 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 691 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
|
|
| 692 | 692 | $value = $cf['defaults']['cat_sort']; |
| 693 | 693 | } |
| 694 | 694 | ?> |
@@ -711,23 +711,23 @@ discard block |
||
| 711 | 711 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 712 | 712 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 713 | 713 | <div class="gdcf-tooltip"> |
| 714 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
|
|
| 714 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
|
|
| 715 | 715 | </div> |
| 716 | 716 | </label> |
| 717 | 717 | |
| 718 | 718 | <div class="gd-cf-input-wrap gd-switch"> |
| 719 | 719 | |
| 720 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 720 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 721 | 721 | <?php if ($value == '1') {
|
| 722 | 722 | echo 'checked'; |
| 723 | 723 | } ?>/> |
| 724 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 724 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 725 | 725 | |
| 726 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 726 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 727 | 727 | <?php if (!$value) {
|
| 728 | 728 | echo 'checked'; |
| 729 | 729 | } ?>/> |
| 730 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 730 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 731 | 731 | |
| 732 | 732 | </div> |
| 733 | 733 | </li> |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | * @since 1.0.0 |
| 753 | 753 | * @param object $field_info The current fields info. |
| 754 | 754 | */ |
| 755 | - do_action('geodir_advance_custom_fields', $field_info);?>
|
|
| 755 | + do_action('geodir_advance_custom_fields', $field_info); ?>
|
|
| 756 | 756 | |
| 757 | 757 | |
| 758 | 758 | <?php endswitch; ?> |
@@ -764,10 +764,10 @@ discard block |
||
| 764 | 764 | <h3></h3> |
| 765 | 765 | </label> |
| 766 | 766 | <div class="gd-cf-input-wrap"> |
| 767 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 767 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 768 | 768 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 769 | 769 | <?php if (!$default): ?> |
| 770 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 770 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 771 | 771 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
|
| 772 | 772 | class="button"/></a> |
| 773 | 773 | <?php endif; ?> |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | if (!isset($field_info->post_type)) {
|
| 21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 22 | -} else |
|
| 23 | - $post_type = $field_info->post_type; |
|
| 22 | +} else { |
|
| 23 | + $post_type = $field_info->post_type; |
|
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | $cf_arr = geodir_custom_fields($post_type); |
| 26 | 27 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
@@ -30,8 +31,9 @@ discard block |
||
| 30 | 31 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 31 | 32 | |
| 32 | 33 | $field_admin_title = ''; |
| 33 | -if (isset($field_info->admin_title)) |
|
| 34 | - $field_admin_title = $field_info->admin_title; |
|
| 34 | +if (isset($field_info->admin_title)) { |
|
| 35 | + $field_admin_title = $field_info->admin_title; |
|
| 36 | +} |
|
| 35 | 37 | |
| 36 | 38 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
| 37 | 39 | |
@@ -52,9 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 54 | 56 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 55 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 57 | +} elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 56 | 58 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 57 | -}else{
|
|
| 59 | +} else{
|
|
| 58 | 60 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 59 | 61 | } |
| 60 | 62 | |
@@ -70,8 +72,11 @@ discard block |
||
| 70 | 72 | |
| 71 | 73 | <?php if ($default): ?> |
| 72 | 74 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
|
| 73 | - <?php else: ?> |
|
| 74 | - <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 75 | + <?php else { |
|
| 76 | + : ?> |
|
| 77 | + <div title="<?php _e('Click to remove field', 'geodirectory'); |
|
| 78 | +} |
|
| 79 | +?>" |
|
| 75 | 80 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 76 | 81 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 77 | 82 | <?php endif; |
@@ -122,11 +127,11 @@ discard block |
||
| 122 | 127 | |
| 123 | 128 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
| 124 | 129 | |
| 125 | - }else{
|
|
| 130 | + } else{
|
|
| 126 | 131 | $value = ''; |
| 127 | 132 | if (isset($field_info->data_type)) {
|
| 128 | 133 | $value = esc_attr($field_info->data_type); |
| 129 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 134 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 130 | 135 | $value = $cf['defaults']['data_type']; |
| 131 | 136 | } |
| 132 | 137 | ?> |
@@ -140,11 +145,11 @@ discard block |
||
| 140 | 145 | |
| 141 | 146 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
| 142 | 147 | |
| 143 | - }else{
|
|
| 148 | + } else{
|
|
| 144 | 149 | $value = ''; |
| 145 | 150 | if (isset($field_info->admin_title)) {
|
| 146 | 151 | $value = esc_attr($field_info->admin_title); |
| 147 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 152 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 148 | 153 | $value = $cf['defaults']['admin_title']; |
| 149 | 154 | } |
| 150 | 155 | ?> |
@@ -169,11 +174,11 @@ discard block |
||
| 169 | 174 | |
| 170 | 175 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
| 171 | 176 | |
| 172 | - }else{
|
|
| 177 | + } else{
|
|
| 173 | 178 | $value = ''; |
| 174 | 179 | if (isset($field_info->site_title)) {
|
| 175 | 180 | $value = esc_attr($field_info->site_title); |
| 176 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 181 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 177 | 182 | $value = $cf['defaults']['site_title']; |
| 178 | 183 | } |
| 179 | 184 | ?> |
@@ -197,11 +202,11 @@ discard block |
||
| 197 | 202 | |
| 198 | 203 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
| 199 | 204 | |
| 200 | - }else{
|
|
| 205 | + } else{
|
|
| 201 | 206 | $value = ''; |
| 202 | 207 | if (isset($field_info->admin_desc)) {
|
| 203 | 208 | $value = esc_attr($field_info->admin_desc); |
| 204 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 209 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 205 | 210 | $value = $cf['defaults']['admin_desc']; |
| 206 | 211 | } |
| 207 | 212 | ?> |
@@ -226,11 +231,11 @@ discard block |
||
| 226 | 231 | |
| 227 | 232 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
| 228 | 233 | |
| 229 | - }else{
|
|
| 234 | + } else{
|
|
| 230 | 235 | $value = ''; |
| 231 | 236 | if (isset($field_info->htmlvar_name)) {
|
| 232 | 237 | $value = esc_attr($field_info->htmlvar_name); |
| 233 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 238 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 234 | 239 | $value = $cf['defaults']['htmlvar_name']; |
| 235 | 240 | } |
| 236 | 241 | ?> |
@@ -258,11 +263,11 @@ discard block |
||
| 258 | 263 | |
| 259 | 264 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
| 260 | 265 | |
| 261 | - }else{
|
|
| 266 | + } else{
|
|
| 262 | 267 | $value = ''; |
| 263 | 268 | if (isset($field_info->is_active)) {
|
| 264 | 269 | $value = esc_attr($field_info->is_active); |
| 265 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 270 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 266 | 271 | $value = $cf['defaults']['is_active']; |
| 267 | 272 | } |
| 268 | 273 | ?> |
@@ -297,11 +302,11 @@ discard block |
||
| 297 | 302 | |
| 298 | 303 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
| 299 | 304 | |
| 300 | - }else{
|
|
| 305 | + } else{
|
|
| 301 | 306 | $value = ''; |
| 302 | 307 | if (isset($field_info->for_admin_use)) {
|
| 303 | 308 | $value = esc_attr($field_info->for_admin_use); |
| 304 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 309 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 305 | 310 | $value = $cf['defaults']['for_admin_use']; |
| 306 | 311 | } |
| 307 | 312 | ?> |
@@ -336,11 +341,11 @@ discard block |
||
| 336 | 341 | |
| 337 | 342 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
| 338 | 343 | |
| 339 | - }else{
|
|
| 344 | + } else{
|
|
| 340 | 345 | $value = ''; |
| 341 | 346 | if (isset($field_info->default_value)) {
|
| 342 | 347 | $value = esc_attr($field_info->default_value); |
| 343 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 348 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 344 | 349 | $value = $cf['defaults']['default_value']; |
| 345 | 350 | } |
| 346 | 351 | ?> |
@@ -380,7 +385,7 @@ discard block |
||
| 380 | 385 | |
| 381 | 386 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
| 382 | 387 | |
| 383 | - }else{
|
|
| 388 | + } else{
|
|
| 384 | 389 | $value = ''; |
| 385 | 390 | ?> |
| 386 | 391 | <li> |
@@ -420,7 +425,7 @@ discard block |
||
| 420 | 425 | // don't show new tab option for some types |
| 421 | 426 | |
| 422 | 427 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
| 423 | - }else{
|
|
| 428 | + } else{
|
|
| 424 | 429 | unset($show_in_locations['[owntab]']); |
| 425 | 430 | } |
| 426 | 431 | |
@@ -533,11 +538,11 @@ discard block |
||
| 533 | 538 | |
| 534 | 539 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
| 535 | 540 | |
| 536 | - }else{
|
|
| 541 | + } else{
|
|
| 537 | 542 | $value = ''; |
| 538 | 543 | if (isset($field_info->is_required)) {
|
| 539 | 544 | $value = esc_attr($field_info->is_required); |
| 540 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 545 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 541 | 546 | $value = $cf['defaults']['is_required']; |
| 542 | 547 | } |
| 543 | 548 | ?> |
@@ -574,11 +579,11 @@ discard block |
||
| 574 | 579 | |
| 575 | 580 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
| 576 | 581 | |
| 577 | - }else{
|
|
| 582 | + } else{
|
|
| 578 | 583 | $value = ''; |
| 579 | 584 | if (isset($field_info->required_msg)) {
|
| 580 | 585 | $value = esc_attr($field_info->required_msg); |
| 581 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 586 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 582 | 587 | $value = $cf['defaults']['required_msg']; |
| 583 | 588 | } |
| 584 | 589 | ?> |
@@ -619,11 +624,11 @@ discard block |
||
| 619 | 624 | |
| 620 | 625 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
| 621 | 626 | |
| 622 | - }else{
|
|
| 627 | + } else{
|
|
| 623 | 628 | $value = ''; |
| 624 | 629 | if (isset($field_info->field_icon)) {
|
| 625 | 630 | $value = esc_attr($field_info->field_icon); |
| 626 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 631 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 627 | 632 | $value = $cf['defaults']['field_icon']; |
| 628 | 633 | } |
| 629 | 634 | ?> |
@@ -652,11 +657,11 @@ discard block |
||
| 652 | 657 | |
| 653 | 658 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
| 654 | 659 | |
| 655 | - }else{
|
|
| 660 | + } else{
|
|
| 656 | 661 | $value = ''; |
| 657 | 662 | if (isset($field_info->css_class)) {
|
| 658 | 663 | $value = esc_attr($field_info->css_class); |
| 659 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 664 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 660 | 665 | $value = $cf['defaults']['css_class']; |
| 661 | 666 | } |
| 662 | 667 | ?> |
@@ -684,11 +689,11 @@ discard block |
||
| 684 | 689 | |
| 685 | 690 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
| 686 | 691 | |
| 687 | - }else{
|
|
| 692 | + } else{
|
|
| 688 | 693 | $value = ''; |
| 689 | 694 | if (isset($field_info->cat_sort)) {
|
| 690 | 695 | $value = esc_attr($field_info->cat_sort); |
| 691 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 696 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 692 | 697 | $value = $cf['defaults']['cat_sort']; |
| 693 | 698 | } |
| 694 | 699 | ?> |
@@ -16,100 +16,100 @@ |
||
| 16 | 16 | |
| 17 | 17 | $field_ids = array(); |
| 18 | 18 | if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) { |
| 19 | - foreach ($_REQUEST['licontainer'] as $lic_id) { |
|
| 20 | - $field_ids[] = sanitize_text_field($lic_id); |
|
| 21 | - } |
|
| 19 | + foreach ($_REQUEST['licontainer'] as $lic_id) { |
|
| 20 | + $field_ids[] = sanitize_text_field($lic_id); |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /* ------- check nonce field ------- */ |
| 25 | 25 | if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 26 | - echo godir_set_field_order($field_ids); |
|
| 26 | + echo godir_set_field_order($field_ids); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 30 | - $response = godir_set_sort_field_order($field_ids); |
|
| 31 | - if (is_array($response)) { |
|
| 32 | - wp_send_json($response); |
|
| 33 | - } else { |
|
| 34 | - echo $response; |
|
| 35 | - } |
|
| 30 | + $response = godir_set_sort_field_order($field_ids); |
|
| 31 | + if (is_array($response)) { |
|
| 32 | + wp_send_json($response); |
|
| 33 | + } else { |
|
| 34 | + echo $response; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /* ---- Show field form in admin ---- */ |
| 39 | 39 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 40 | - geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 40 | + geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 44 | - geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action); |
|
| 44 | + geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /* ---- Delete field ---- */ |
| 48 | 48 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 49 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 50 | - return; |
|
| 49 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 50 | + return; |
|
| 51 | 51 | |
| 52 | - echo geodir_custom_field_delete($field_id); |
|
| 52 | + echo geodir_custom_field_delete($field_id); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 56 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 57 | - return; |
|
| 56 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 57 | + return; |
|
| 58 | 58 | |
| 59 | - echo geodir_custom_sort_field_delete($field_id); |
|
| 59 | + echo geodir_custom_sort_field_delete($field_id); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /* ---- Save field ---- */ |
| 63 | 63 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 64 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 65 | - return; |
|
| 66 | - |
|
| 67 | - foreach ($_REQUEST as $pkey => $pval) { |
|
| 68 | - if (is_array($_REQUEST[$pkey])) { |
|
| 69 | - $tags = 'skip_field'; |
|
| 70 | - } else { |
|
| 71 | - $tags = ''; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if ($tags != 'skip_field') { |
|
| 75 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $return = geodir_custom_field_save($_REQUEST); |
|
| 80 | - |
|
| 81 | - if (is_int($return)) { |
|
| 82 | - $lastid = $return; |
|
| 83 | - geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 84 | - } else { |
|
| 85 | - echo $return; |
|
| 86 | - } |
|
| 64 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 65 | + return; |
|
| 66 | + |
|
| 67 | + foreach ($_REQUEST as $pkey => $pval) { |
|
| 68 | + if (is_array($_REQUEST[$pkey])) { |
|
| 69 | + $tags = 'skip_field'; |
|
| 70 | + } else { |
|
| 71 | + $tags = ''; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if ($tags != 'skip_field') { |
|
| 75 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $return = geodir_custom_field_save($_REQUEST); |
|
| 80 | + |
|
| 81 | + if (is_int($return)) { |
|
| 82 | + $lastid = $return; |
|
| 83 | + geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 84 | + } else { |
|
| 85 | + echo $return; |
|
| 86 | + } |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /* ---- Save sort field ---- */ |
| 90 | 90 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 91 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 92 | - return; |
|
| 93 | - |
|
| 94 | - foreach ($_REQUEST as $pkey => $pval) { |
|
| 95 | - if (is_array($_REQUEST[$pkey])) { |
|
| 96 | - $tags = 'skip_field'; |
|
| 97 | - } else { |
|
| 98 | - $tags = ''; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - if ($tags != 'skip_field') { |
|
| 102 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $return = geodir_custom_sort_field_save($_REQUEST); |
|
| 107 | - |
|
| 108 | - if (is_int($return)) { |
|
| 109 | - $lastid = $return; |
|
| 110 | - $default = false; |
|
| 111 | - geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default); |
|
| 112 | - } else { |
|
| 113 | - echo $return; |
|
| 114 | - } |
|
| 91 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 92 | + return; |
|
| 93 | + |
|
| 94 | + foreach ($_REQUEST as $pkey => $pval) { |
|
| 95 | + if (is_array($_REQUEST[$pkey])) { |
|
| 96 | + $tags = 'skip_field'; |
|
| 97 | + } else { |
|
| 98 | + $tags = ''; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + if ($tags != 'skip_field') { |
|
| 102 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $return = geodir_custom_sort_field_save($_REQUEST); |
|
| 107 | + |
|
| 108 | + if (is_int($return)) { |
|
| 109 | + $lastid = $return; |
|
| 110 | + $default = false; |
|
| 111 | + geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default); |
|
| 112 | + } else { |
|
| 113 | + echo $return; |
|
| 114 | + } |
|
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | /* ---- Show field form in admin ---- */ |
| 39 | 39 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 40 | - geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key); |
|
| 40 | + geodir_custom_field_adminhtml($field_type, $field_id, $field_action, $field_type_key); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /* ---- Delete field ---- */ |
| 48 | 48 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 49 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 49 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 50 | 50 | return; |
| 51 | 51 | |
| 52 | 52 | echo geodir_custom_field_delete($field_id); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 56 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 56 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 57 | 57 | return; |
| 58 | 58 | |
| 59 | 59 | echo geodir_custom_sort_field_delete($field_id); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | /* ---- Save field ---- */ |
| 63 | 63 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') { |
| 64 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 64 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 65 | 65 | return; |
| 66 | 66 | |
| 67 | 67 | foreach ($_REQUEST as $pkey => $pval) { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | if (is_int($return)) { |
| 82 | 82 | $lastid = $return; |
| 83 | - geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key); |
|
| 83 | + geodir_custom_field_adminhtml($field_type, $lastid, 'submit', $field_type_key); |
|
| 84 | 84 | } else { |
| 85 | 85 | echo $return; |
| 86 | 86 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | /* ---- Save sort field ---- */ |
| 90 | 90 | if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') { |
| 91 | - if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) |
|
| 91 | + if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id)) |
|
| 92 | 92 | return; |
| 93 | 93 | |
| 94 | 94 | foreach ($_REQUEST as $pkey => $pval) { |
@@ -10,33 +10,33 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | add_action('admin_init', 'geodir_admin_init');
|
| 12 | 12 | if (!function_exists('geodir_admin_init')) {
|
| 13 | - /** |
|
| 14 | - * Adds GD setting pages in admin. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global string $current_tab The current settings tab name. |
|
| 19 | - */ |
|
| 20 | - function geodir_admin_init() |
|
| 21 | - {
|
|
| 22 | - |
|
| 23 | - if (is_admin()): |
|
| 24 | - global $current_tab; |
|
| 25 | - geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | - $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | - /** |
|
| 30 | - * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - */ |
|
| 34 | - do_action('admin_panel_init');
|
|
| 35 | - add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | - |
|
| 37 | - |
|
| 38 | - endif; |
|
| 39 | - } |
|
| 13 | + /** |
|
| 14 | + * Adds GD setting pages in admin. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global string $current_tab The current settings tab name. |
|
| 19 | + */ |
|
| 20 | + function geodir_admin_init() |
|
| 21 | + {
|
|
| 22 | + |
|
| 23 | + if (is_admin()): |
|
| 24 | + global $current_tab; |
|
| 25 | + geodir_redirect_to_admin_panel_on_installed(); |
|
| 26 | + $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
|
| 27 | + if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | + geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 29 | + /** |
|
| 30 | + * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + */ |
|
| 34 | + do_action('admin_panel_init');
|
|
| 35 | + add_action('geodir_admin_option_form', 'geodir_get_admin_option_form', 1);
|
|
| 36 | + |
|
| 37 | + |
|
| 38 | + endif; |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_redirect_to_admin_panel_on_installed() |
| 49 | 49 | {
|
| 50 | - if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | - delete_option('geodir_installation_redirect');
|
|
| 52 | - wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | - } |
|
| 50 | + if (get_option('geodir_installation_redirect', false)) {
|
|
| 51 | + delete_option('geodir_installation_redirect');
|
|
| 52 | + wp_redirect(admin_url('admin.php?page=geodirectory&installed=yes'));
|
|
| 53 | + } |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -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 | |
@@ -85,19 +85,19 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function geodir_conditional_admin_script_load() |
| 87 | 87 | {
|
| 88 | - global $pagenow; |
|
| 88 | + global $pagenow; |
|
| 89 | 89 | |
| 90 | 90 | // Get the current post type |
| 91 | 91 | $post_type = geodir_admin_current_post_type(); |
| 92 | 92 | $geodir_post_types = geodir_get_posttypes(); |
| 93 | 93 | |
| 94 | 94 | if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'term.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
|
| 95 | - add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 96 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 97 | - add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 98 | - } |
|
| 95 | + add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
|
|
| 96 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles');
|
|
| 97 | + add_action('admin_enqueue_scripts', 'geodir_admin_dequeue_scripts', 100);
|
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 100 | + add_action('admin_enqueue_scripts', 'geodir_admin_styles_req');
|
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function create_default_admin_main_nav() |
| 133 | 133 | {
|
| 134 | - add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 135 | - add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 136 | - add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 137 | - add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 138 | - add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 139 | - //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 134 | + add_filter('geodir_settings_tabs_array', 'geodir_default_admin_main_tabs', 1);
|
|
| 135 | + add_filter('geodir_settings_tabs_array', 'places_custom_fields_tab', 2);
|
|
| 136 | + add_filter('geodir_settings_tabs_array', 'geodir_compatibility_setting_tab', 90);
|
|
| 137 | + add_filter('geodir_settings_tabs_array', 'geodir_tools_setting_tab', 95);
|
|
| 138 | + add_filter('geodir_settings_tabs_array', 'geodir_extend_geodirectory_setting_tab', 100);
|
|
| 139 | + //add_filter('geodir_settings_tabs_array', 'geodir_hide_set_location_default',3);
|
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
@@ -149,16 +149,16 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | function geodir_admin_list_columns() |
| 151 | 151 | {
|
| 152 | - if ($post_types = geodir_get_posttypes()) {
|
|
| 152 | + if ($post_types = geodir_get_posttypes()) {
|
|
| 153 | 153 | |
| 154 | - foreach ($post_types as $post_type): |
|
| 155 | - add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 156 | - //Filter-Payment-Manager to show Package |
|
| 157 | - add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 154 | + foreach ($post_types as $post_type): |
|
| 155 | + add_filter("manage_edit-{$post_type}_columns", 'geodir_edit_post_columns', 100);
|
|
| 156 | + //Filter-Payment-Manager to show Package |
|
| 157 | + add_action("manage_{$post_type}_posts_custom_column", 'geodir_manage_post_columns', 10, 2);
|
|
| 158 | 158 | |
| 159 | - add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 160 | - endforeach; |
|
| 161 | - } |
|
| 159 | + add_filter("manage_edit-{$post_type}_sortable_columns", 'geodir_post_sortable_columns');
|
|
| 160 | + endforeach; |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -171,15 +171,15 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | function geodir_default_admin_main_tabs($tabs) |
| 173 | 173 | {
|
| 174 | - return $tabs = array( |
|
| 175 | - 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 176 | - 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 177 | - 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 178 | - 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 179 | - 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 180 | - 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 181 | - |
|
| 182 | - ); |
|
| 174 | + return $tabs = array( |
|
| 175 | + 'general_settings' => array('label' => __('General', 'geodirectory')),
|
|
| 176 | + 'design_settings' => array('label' => __('Design', 'geodirectory')),
|
|
| 177 | + 'permalink_settings' => array('label' => __('Permalinks', 'geodirectory')),
|
|
| 178 | + 'title_meta_settings' => array('label' => __('Titles & Metas', 'geodirectory')),
|
|
| 179 | + 'notifications_settings' => array('label' => __('Notifications', 'geodirectory')),
|
|
| 180 | + 'default_location_settings' => array('label' => __('Set Default Location', 'geodirectory')),
|
|
| 181 | + |
|
| 182 | + ); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | add_action('do_meta_boxes', 'geodir_remove_image_box');
|
@@ -192,16 +192,16 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | function geodir_remove_image_box() |
| 194 | 194 | {
|
| 195 | - global $post; |
|
| 195 | + global $post; |
|
| 196 | 196 | |
| 197 | - $geodir_posttypes = geodir_get_posttypes(); |
|
| 197 | + $geodir_posttypes = geodir_get_posttypes(); |
|
| 198 | 198 | |
| 199 | - if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 199 | + if (isset($post) && in_array($post->post_type, $geodir_posttypes)): |
|
| 200 | 200 | |
| 201 | - remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 202 | - remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 201 | + remove_meta_box('postimagediv', $post->post_type, 'side');
|
|
| 202 | + remove_meta_box('revisionsdiv', $post->post_type, 'normal');
|
|
| 203 | 203 | |
| 204 | - endif; |
|
| 204 | + endif; |
|
| 205 | 205 | |
| 206 | 206 | } |
| 207 | 207 | |
@@ -216,26 +216,26 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | function geodir_meta_box_add() |
| 218 | 218 | {
|
| 219 | - global $post; |
|
| 219 | + global $post; |
|
| 220 | 220 | |
| 221 | - $geodir_post_types = geodir_get_posttypes('array');
|
|
| 222 | - $geodir_posttypes = array_keys($geodir_post_types); |
|
| 221 | + $geodir_post_types = geodir_get_posttypes('array');
|
|
| 222 | + $geodir_posttypes = array_keys($geodir_post_types); |
|
| 223 | 223 | |
| 224 | - if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 224 | + if (isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)): |
|
| 225 | 225 | |
| 226 | - $geodir_posttype = $post->post_type; |
|
| 227 | - $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']); |
|
| 226 | + $geodir_posttype = $post->post_type; |
|
| 227 | + $post_typename = geodir_ucwords($geodir_post_types[$geodir_posttype]['labels']['singular_name']); |
|
| 228 | 228 | |
| 229 | - // Filter-Payment-Manager |
|
| 229 | + // Filter-Payment-Manager |
|
| 230 | 230 | |
| 231 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 231 | + add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 232 | 232 | |
| 233 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 233 | + add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 234 | 234 | |
| 235 | - // no need of this box as all fields moved to main information box |
|
| 236 | - //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 235 | + // no need of this box as all fields moved to main information box |
|
| 236 | + //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
|
| 237 | 237 | |
| 238 | - endif; |
|
| 238 | + endif; |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
@@ -259,23 +259,23 @@ discard block |
||
| 259 | 259 | function geodir_hide_post_taxonomy_meta_boxes() |
| 260 | 260 | {
|
| 261 | 261 | |
| 262 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 262 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 263 | 263 | |
| 264 | - if (!empty($geodir_post_types)) {
|
|
| 265 | - foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 264 | + if (!empty($geodir_post_types)) {
|
|
| 265 | + foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info) {
|
|
| 266 | 266 | |
| 267 | - $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 267 | + $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 268 | 268 | |
| 269 | - if(!empty($gd_taxonomy)) {
|
|
| 270 | - foreach ($gd_taxonomy as $tax) {
|
|
| 269 | + if(!empty($gd_taxonomy)) {
|
|
| 270 | + foreach ($gd_taxonomy as $tax) {
|
|
| 271 | 271 | |
| 272 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 272 | + remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 273 | 273 | |
| 274 | - } |
|
| 275 | - } |
|
| 274 | + } |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - } |
|
| 278 | - } |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | add_filter('geodir_add_listing_map_restrict', 'geodir_add_listing_map_restrict');
|
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | function geodir_add_listing_map_restrict($map_restirct) |
| 291 | 291 | {
|
| 292 | - if (is_admin()) {
|
|
| 293 | - if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 294 | - $map_restirct = false; |
|
| 295 | - } |
|
| 296 | - } |
|
| 297 | - return $map_restirct; |
|
| 292 | + if (is_admin()) {
|
|
| 293 | + if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'default_location_settings') {
|
|
| 294 | + $map_restirct = false; |
|
| 295 | + } |
|
| 296 | + } |
|
| 297 | + return $map_restirct; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
@@ -313,16 +313,16 @@ discard block |
||
| 313 | 313 | function geodir_enable_editor_on_notifications($notification) |
| 314 | 314 | {
|
| 315 | 315 | |
| 316 | - if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 316 | + if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
|
| 317 | 317 | |
| 318 | - foreach ($notification as $key => $value) {
|
|
| 319 | - if ($value['type'] == 'textarea') |
|
| 320 | - $notification[$key]['type'] = 'editor'; |
|
| 321 | - } |
|
| 318 | + foreach ($notification as $key => $value) {
|
|
| 319 | + if ($value['type'] == 'textarea') |
|
| 320 | + $notification[$key]['type'] = 'editor'; |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - } |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - return $notification; |
|
| 325 | + return $notification; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | |
@@ -339,16 +339,16 @@ discard block |
||
| 339 | 339 | function geodir_enable_editor_on_design_settings($design_setting) |
| 340 | 340 | {
|
| 341 | 341 | |
| 342 | - if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 342 | + if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
|
| 343 | 343 | |
| 344 | - foreach ($design_setting as $key => $value) {
|
|
| 345 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 346 | - $design_setting[$key]['type'] = 'editor'; |
|
| 347 | - } |
|
| 344 | + foreach ($design_setting as $key => $value) {
|
|
| 345 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 346 | + $design_setting[$key]['type'] = 'editor'; |
|
| 347 | + } |
|
| 348 | 348 | |
| 349 | - } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - return $design_setting; |
|
| 351 | + return $design_setting; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /* ----------- START MANAGE CUSTOM FIELDS ---------------- */ |
@@ -369,16 +369,16 @@ discard block |
||
| 369 | 369 | function geodir_manage_available_fields($sub_tab) |
| 370 | 370 | {
|
| 371 | 371 | |
| 372 | - switch ($sub_tab) {
|
|
| 373 | - case 'custom_fields': |
|
| 374 | - geodir_custom_available_fields(); |
|
| 375 | - break; |
|
| 372 | + switch ($sub_tab) {
|
|
| 373 | + case 'custom_fields': |
|
| 374 | + geodir_custom_available_fields(); |
|
| 375 | + break; |
|
| 376 | 376 | |
| 377 | - case 'sorting_options': |
|
| 378 | - geodir_sorting_options_available_fields(); |
|
| 379 | - break; |
|
| 377 | + case 'sorting_options': |
|
| 378 | + geodir_sorting_options_available_fields(); |
|
| 379 | + break; |
|
| 380 | 380 | |
| 381 | - } |
|
| 381 | + } |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | |
@@ -394,16 +394,16 @@ discard block |
||
| 394 | 394 | function geodir_manage_selected_fields($sub_tab) |
| 395 | 395 | {
|
| 396 | 396 | |
| 397 | - switch ($sub_tab) {
|
|
| 398 | - case 'custom_fields': |
|
| 399 | - geodir_custom_selected_fields(); |
|
| 400 | - break; |
|
| 397 | + switch ($sub_tab) {
|
|
| 398 | + case 'custom_fields': |
|
| 399 | + geodir_custom_selected_fields(); |
|
| 400 | + break; |
|
| 401 | 401 | |
| 402 | - case 'sorting_options': |
|
| 403 | - geodir_sorting_options_selected_fields(); |
|
| 404 | - break; |
|
| 402 | + case 'sorting_options': |
|
| 403 | + geodir_sorting_options_selected_fields(); |
|
| 404 | + break; |
|
| 405 | 405 | |
| 406 | - } |
|
| 406 | + } |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -415,27 +415,27 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | function geodir_sorting_options_available_fields() |
| 417 | 417 | {
|
| 418 | - global $wpdb; |
|
| 419 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 420 | - ?> |
|
| 418 | + global $wpdb; |
|
| 419 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 420 | + ?> |
|
| 421 | 421 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 422 | 422 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 423 | 423 | <ul> |
| 424 | 424 | <?php |
| 425 | - $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 425 | + $sort_options = geodir_get_custom_sort_options($listing_type); |
|
| 426 | 426 | |
| 427 | - foreach ($sort_options as $key => $val) {
|
|
| 428 | - $val = stripslashes_deep($val); // strip slashes |
|
| 429 | - |
|
| 430 | - $check_html_variable = $wpdb->get_var( |
|
| 431 | - $wpdb->prepare( |
|
| 432 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 433 | - array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 434 | - ) |
|
| 435 | - ); |
|
| 427 | + foreach ($sort_options as $key => $val) {
|
|
| 428 | + $val = stripslashes_deep($val); // strip slashes |
|
| 429 | + |
|
| 430 | + $check_html_variable = $wpdb->get_var( |
|
| 431 | + $wpdb->prepare( |
|
| 432 | + "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 433 | + array($val['htmlvar_name'], $listing_type, $val['field_type']) |
|
| 434 | + ) |
|
| 435 | + ); |
|
| 436 | 436 | |
| 437 | - $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 438 | - ?> |
|
| 437 | + $display = $check_html_variable ? ' style="display:none;"' : ''; |
|
| 438 | + ?> |
|
| 439 | 439 | <li <?php echo $display;?>> |
| 440 | 440 | <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" |
| 441 | 441 | title="<?php echo $val['site_title'];?>" |
@@ -443,8 +443,8 @@ discard block |
||
| 443 | 443 | href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a> |
| 444 | 444 | </li> |
| 445 | 445 | <?php |
| 446 | - } |
|
| 447 | - ?> |
|
| 446 | + } |
|
| 447 | + ?> |
|
| 448 | 448 | </ul> |
| 449 | 449 | <?php |
| 450 | 450 | } |
@@ -458,28 +458,28 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_sorting_options_selected_fields() |
| 460 | 460 | {
|
| 461 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 462 | - ?> |
|
| 461 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 462 | + ?> |
|
| 463 | 463 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 464 | 464 | <ul class="core"> |
| 465 | 465 | <?php |
| 466 | - global $wpdb; |
|
| 466 | + global $wpdb; |
|
| 467 | 467 | |
| 468 | - $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)));
|
|
| 468 | + $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)));
|
|
| 469 | 469 | |
| 470 | - if (!empty($fields)) {
|
|
| 471 | - foreach ($fields as $field) {
|
|
| 472 | - //$result_str = $field->id; |
|
| 473 | - $result_str = $field; |
|
| 474 | - $field_type = $field->field_type; |
|
| 475 | - $field_ins_upd = 'display'; |
|
| 470 | + if (!empty($fields)) {
|
|
| 471 | + foreach ($fields as $field) {
|
|
| 472 | + //$result_str = $field->id; |
|
| 473 | + $result_str = $field; |
|
| 474 | + $field_type = $field->field_type; |
|
| 475 | + $field_ins_upd = 'display'; |
|
| 476 | 476 | |
| 477 | - $default = false; |
|
| 477 | + $default = false; |
|
| 478 | 478 | |
| 479 | - geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - ?> |
|
| 479 | + geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd, $default); |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + ?> |
|
| 483 | 483 | </ul> |
| 484 | 484 | <?php |
| 485 | 485 | } |
@@ -493,147 +493,147 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | function geodir_custom_fields($post_type=''){
|
| 495 | 495 | |
| 496 | - $custom_fields = array( |
|
| 497 | - 'text' => array( |
|
| 498 | - 'field_type' => 'text', |
|
| 499 | - 'class' => 'gd-text', |
|
| 500 | - 'icon' => 'fa fa-minus', |
|
| 501 | - 'name' => __('Text', 'geodirectory'),
|
|
| 502 | - 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 503 | - ), |
|
| 504 | - 'datepicker' => array( |
|
| 505 | - 'field_type' => 'datepicker', |
|
| 506 | - 'class' => 'gd-datepicker', |
|
| 507 | - 'icon' => 'fa fa-calendar', |
|
| 508 | - 'name' => __('Date', 'geodirectory'),
|
|
| 509 | - 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 510 | - ), |
|
| 511 | - 'textarea' => array( |
|
| 512 | - 'field_type' => 'textarea', |
|
| 513 | - 'class' => 'gd-textarea', |
|
| 514 | - 'icon' => 'fa fa-bars', |
|
| 515 | - 'name' => __('Textarea', 'geodirectory'),
|
|
| 516 | - 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 517 | - ), |
|
| 518 | - 'time' => array( |
|
| 519 | - 'field_type' => 'time', |
|
| 520 | - 'class' => 'gd-time', |
|
| 521 | - 'icon' => 'fa fa-clock-o', |
|
| 522 | - 'name' => __('Time', 'geodirectory'),
|
|
| 523 | - 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 524 | - ), |
|
| 525 | - 'checkbox' => array( |
|
| 526 | - 'field_type' => 'checkbox', |
|
| 527 | - 'class' => 'gd-checkbox', |
|
| 528 | - 'icon' => 'fa fa-check-square-o', |
|
| 529 | - 'name' => __('Checkbox', 'geodirectory'),
|
|
| 530 | - 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 531 | - ), |
|
| 532 | - 'phone' => array( |
|
| 533 | - 'field_type' => 'phone', |
|
| 534 | - 'class' => 'gd-phone', |
|
| 535 | - 'icon' => 'fa fa-phone', |
|
| 536 | - 'name' => __('Phone', 'geodirectory'),
|
|
| 537 | - 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 538 | - ), |
|
| 539 | - 'radio' => array( |
|
| 540 | - 'field_type' => 'radio', |
|
| 541 | - 'class' => 'gd-radio', |
|
| 542 | - 'icon' => 'fa fa-dot-circle-o', |
|
| 543 | - 'name' => __('Radio', 'geodirectory'),
|
|
| 544 | - 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 545 | - ), |
|
| 546 | - 'email' => array( |
|
| 547 | - 'field_type' => 'email', |
|
| 548 | - 'class' => 'gd-email', |
|
| 549 | - 'icon' => 'fa fa-envelope-o', |
|
| 550 | - 'name' => __('Email', 'geodirectory'),
|
|
| 551 | - 'description' => __('Adds a email input', 'geodirectory')
|
|
| 552 | - ), |
|
| 553 | - 'select' => array( |
|
| 554 | - 'field_type' => 'select', |
|
| 555 | - 'class' => 'gd-select', |
|
| 556 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 557 | - 'name' => __('Select', 'geodirectory'),
|
|
| 558 | - 'description' => __('Adds a select input', 'geodirectory')
|
|
| 559 | - ), |
|
| 560 | - 'multiselect' => array( |
|
| 561 | - 'field_type' => 'multiselect', |
|
| 562 | - 'class' => 'gd-multiselect', |
|
| 563 | - 'icon' => 'fa fa-caret-square-o-down', |
|
| 564 | - 'name' => __('Multi Select', 'geodirectory'),
|
|
| 565 | - 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 566 | - ), |
|
| 567 | - 'url' => array( |
|
| 568 | - 'field_type' => 'url', |
|
| 569 | - 'class' => 'gd-url', |
|
| 570 | - 'icon' => 'fa fa-link', |
|
| 571 | - 'name' => __('URL', 'geodirectory'),
|
|
| 572 | - 'description' => __('Adds a url input', 'geodirectory')
|
|
| 573 | - ), |
|
| 574 | - 'html' => array( |
|
| 575 | - 'field_type' => 'html', |
|
| 576 | - 'class' => 'gd-html', |
|
| 577 | - 'icon' => 'fa fa-code', |
|
| 578 | - 'name' => __('HTML', 'geodirectory'),
|
|
| 579 | - 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 580 | - ), |
|
| 581 | - 'file' => array( |
|
| 582 | - 'field_type' => 'file', |
|
| 583 | - 'class' => 'gd-file', |
|
| 584 | - 'icon' => 'fa fa-file', |
|
| 585 | - 'name' => __('File Upload', 'geodirectory'),
|
|
| 586 | - 'description' => __('Adds a file input', 'geodirectory')
|
|
| 587 | - ), |
|
| 588 | - 'test' => array( |
|
| 589 | - 'field_type' => 'text', |
|
| 590 | - 'class' => 'gd-testing', |
|
| 591 | - 'icon' => 'fa fa-cog', |
|
| 592 | - 'name' => __('Test', 'geodirectory'),
|
|
| 593 | - 'description' => __('Adds a test value bla bla', 'geodirectory'),
|
|
| 594 | - 'defaults' => array( |
|
| 595 | - 'data_type' => '', // true to show options, or define the SQL data type. |
|
| 596 | - 'admin_title' => 'testing yo', // pre-fill value |
|
| 597 | - 'site_title' => '', // pre-fill value |
|
| 598 | - ) |
|
| 599 | - ) |
|
| 496 | + $custom_fields = array( |
|
| 497 | + 'text' => array( |
|
| 498 | + 'field_type' => 'text', |
|
| 499 | + 'class' => 'gd-text', |
|
| 500 | + 'icon' => 'fa fa-minus', |
|
| 501 | + 'name' => __('Text', 'geodirectory'),
|
|
| 502 | + 'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
|
|
| 503 | + ), |
|
| 504 | + 'datepicker' => array( |
|
| 505 | + 'field_type' => 'datepicker', |
|
| 506 | + 'class' => 'gd-datepicker', |
|
| 507 | + 'icon' => 'fa fa-calendar', |
|
| 508 | + 'name' => __('Date', 'geodirectory'),
|
|
| 509 | + 'description' => __('Adds a date picker.', 'geodirectory')
|
|
| 510 | + ), |
|
| 511 | + 'textarea' => array( |
|
| 512 | + 'field_type' => 'textarea', |
|
| 513 | + 'class' => 'gd-textarea', |
|
| 514 | + 'icon' => 'fa fa-bars', |
|
| 515 | + 'name' => __('Textarea', 'geodirectory'),
|
|
| 516 | + 'description' => __('Adds a textarea', 'geodirectory')
|
|
| 517 | + ), |
|
| 518 | + 'time' => array( |
|
| 519 | + 'field_type' => 'time', |
|
| 520 | + 'class' => 'gd-time', |
|
| 521 | + 'icon' => 'fa fa-clock-o', |
|
| 522 | + 'name' => __('Time', 'geodirectory'),
|
|
| 523 | + 'description' => __('Adds a time picker', 'geodirectory')
|
|
| 524 | + ), |
|
| 525 | + 'checkbox' => array( |
|
| 526 | + 'field_type' => 'checkbox', |
|
| 527 | + 'class' => 'gd-checkbox', |
|
| 528 | + 'icon' => 'fa fa-check-square-o', |
|
| 529 | + 'name' => __('Checkbox', 'geodirectory'),
|
|
| 530 | + 'description' => __('Adds a checkbox', 'geodirectory')
|
|
| 531 | + ), |
|
| 532 | + 'phone' => array( |
|
| 533 | + 'field_type' => 'phone', |
|
| 534 | + 'class' => 'gd-phone', |
|
| 535 | + 'icon' => 'fa fa-phone', |
|
| 536 | + 'name' => __('Phone', 'geodirectory'),
|
|
| 537 | + 'description' => __('Adds a phone input', 'geodirectory')
|
|
| 538 | + ), |
|
| 539 | + 'radio' => array( |
|
| 540 | + 'field_type' => 'radio', |
|
| 541 | + 'class' => 'gd-radio', |
|
| 542 | + 'icon' => 'fa fa-dot-circle-o', |
|
| 543 | + 'name' => __('Radio', 'geodirectory'),
|
|
| 544 | + 'description' => __('Adds a radio input', 'geodirectory')
|
|
| 545 | + ), |
|
| 546 | + 'email' => array( |
|
| 547 | + 'field_type' => 'email', |
|
| 548 | + 'class' => 'gd-email', |
|
| 549 | + 'icon' => 'fa fa-envelope-o', |
|
| 550 | + 'name' => __('Email', 'geodirectory'),
|
|
| 551 | + 'description' => __('Adds a email input', 'geodirectory')
|
|
| 552 | + ), |
|
| 553 | + 'select' => array( |
|
| 554 | + 'field_type' => 'select', |
|
| 555 | + 'class' => 'gd-select', |
|
| 556 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 557 | + 'name' => __('Select', 'geodirectory'),
|
|
| 558 | + 'description' => __('Adds a select input', 'geodirectory')
|
|
| 559 | + ), |
|
| 560 | + 'multiselect' => array( |
|
| 561 | + 'field_type' => 'multiselect', |
|
| 562 | + 'class' => 'gd-multiselect', |
|
| 563 | + 'icon' => 'fa fa-caret-square-o-down', |
|
| 564 | + 'name' => __('Multi Select', 'geodirectory'),
|
|
| 565 | + 'description' => __('Adds a multiselect input', 'geodirectory')
|
|
| 566 | + ), |
|
| 567 | + 'url' => array( |
|
| 568 | + 'field_type' => 'url', |
|
| 569 | + 'class' => 'gd-url', |
|
| 570 | + 'icon' => 'fa fa-link', |
|
| 571 | + 'name' => __('URL', 'geodirectory'),
|
|
| 572 | + 'description' => __('Adds a url input', 'geodirectory')
|
|
| 573 | + ), |
|
| 574 | + 'html' => array( |
|
| 575 | + 'field_type' => 'html', |
|
| 576 | + 'class' => 'gd-html', |
|
| 577 | + 'icon' => 'fa fa-code', |
|
| 578 | + 'name' => __('HTML', 'geodirectory'),
|
|
| 579 | + 'description' => __('Adds a html input textarea', 'geodirectory')
|
|
| 580 | + ), |
|
| 581 | + 'file' => array( |
|
| 582 | + 'field_type' => 'file', |
|
| 583 | + 'class' => 'gd-file', |
|
| 584 | + 'icon' => 'fa fa-file', |
|
| 585 | + 'name' => __('File Upload', 'geodirectory'),
|
|
| 586 | + 'description' => __('Adds a file input', 'geodirectory')
|
|
| 587 | + ), |
|
| 588 | + 'test' => array( |
|
| 589 | + 'field_type' => 'text', |
|
| 590 | + 'class' => 'gd-testing', |
|
| 591 | + 'icon' => 'fa fa-cog', |
|
| 592 | + 'name' => __('Test', 'geodirectory'),
|
|
| 593 | + 'description' => __('Adds a test value bla bla', 'geodirectory'),
|
|
| 594 | + 'defaults' => array( |
|
| 595 | + 'data_type' => '', // true to show options, or define the SQL data type. |
|
| 596 | + 'admin_title' => 'testing yo', // pre-fill value |
|
| 597 | + 'site_title' => '', // pre-fill value |
|
| 598 | + ) |
|
| 599 | + ) |
|
| 600 | 600 | |
| 601 | - ); |
|
| 602 | - |
|
| 603 | - /** |
|
| 604 | - * Filter the custom fields array to be able to add or remove items. |
|
| 605 | - * |
|
| 606 | - * @since 1.6.6 |
|
| 607 | - * |
|
| 608 | - * @param array $custom_fields {
|
|
| 609 | - * The custom fields array to be filtered. |
|
| 610 | - * |
|
| 611 | - * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 612 | - * @type string $class The class for the field in backend. |
|
| 613 | - * @type string $icon Can be font-awesome class name or icon image url. |
|
| 614 | - * @type string $name The name of the field. |
|
| 615 | - * @type string $description A short description about the field. |
|
| 616 | - * @type array $defaults {
|
|
| 617 | - * Optional. Used to set the default value of the field. |
|
| 618 | - * |
|
| 619 | - * @type string data_type The SQL data type for the field. |
|
| 620 | - * @type string admin_title The admin title for the field. |
|
| 621 | - * @type string site_title This will be the title for the field on the frontend. |
|
| 622 | - * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 623 | - * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 624 | - * @type bool is_active If false the field will not be displayed anywhere. |
|
| 625 | - * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 626 | - * @type string default_value The default value for the input on the add listing page. |
|
| 627 | - * @type bool is_required If true the field will be required on the add listing page. |
|
| 628 | - * @type string required_msg Required warning message. |
|
| 629 | - * @type string field_icon Icon url or font awesome class. |
|
| 630 | - * @type string css_class Field custom css class for field custom style. |
|
| 631 | - * @type bool cat_sort If true the field will appear in the category sort options. |
|
| 632 | - * } |
|
| 633 | - * } |
|
| 634 | - * @param string $post_type The post type requested. |
|
| 635 | - */ |
|
| 636 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 601 | + ); |
|
| 602 | + |
|
| 603 | + /** |
|
| 604 | + * Filter the custom fields array to be able to add or remove items. |
|
| 605 | + * |
|
| 606 | + * @since 1.6.6 |
|
| 607 | + * |
|
| 608 | + * @param array $custom_fields {
|
|
| 609 | + * The custom fields array to be filtered. |
|
| 610 | + * |
|
| 611 | + * @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file. |
|
| 612 | + * @type string $class The class for the field in backend. |
|
| 613 | + * @type string $icon Can be font-awesome class name or icon image url. |
|
| 614 | + * @type string $name The name of the field. |
|
| 615 | + * @type string $description A short description about the field. |
|
| 616 | + * @type array $defaults {
|
|
| 617 | + * Optional. Used to set the default value of the field. |
|
| 618 | + * |
|
| 619 | + * @type string data_type The SQL data type for the field. |
|
| 620 | + * @type string admin_title The admin title for the field. |
|
| 621 | + * @type string site_title This will be the title for the field on the frontend. |
|
| 622 | + * @type string admin_desc This will be shown below the field on the add listing form. |
|
| 623 | + * @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters. |
|
| 624 | + * @type bool is_active If false the field will not be displayed anywhere. |
|
| 625 | + * @type bool for_admin_use If true then only site admin can see and edit this field. |
|
| 626 | + * @type string default_value The default value for the input on the add listing page. |
|
| 627 | + * @type bool is_required If true the field will be required on the add listing page. |
|
| 628 | + * @type string required_msg Required warning message. |
|
| 629 | + * @type string field_icon Icon url or font awesome class. |
|
| 630 | + * @type string css_class Field custom css class for field custom style. |
|
| 631 | + * @type bool cat_sort If true the field will appear in the category sort options. |
|
| 632 | + * } |
|
| 633 | + * } |
|
| 634 | + * @param string $post_type The post type requested. |
|
| 635 | + */ |
|
| 636 | + return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -644,8 +644,8 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | function geodir_custom_available_fields() |
| 646 | 646 | {
|
| 647 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 648 | - ?> |
|
| 647 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 648 | + ?> |
|
| 649 | 649 | <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
| 650 | 650 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 651 | 651 | <ul class="full gd-cf-tooltip-wrap"> |
@@ -662,30 +662,30 @@ discard block |
||
| 662 | 662 | </ul> |
| 663 | 663 | <ul> |
| 664 | 664 | <?php |
| 665 | - $cfs = geodir_custom_fields($listing_type); |
|
| 665 | + $cfs = geodir_custom_fields($listing_type); |
|
| 666 | 666 | |
| 667 | - foreach($cfs as $id=>$cf){
|
|
| 668 | - ?> |
|
| 667 | + foreach($cfs as $id=>$cf){
|
|
| 668 | + ?> |
|
| 669 | 669 | <li class="gd-cf-tooltip-wrap"> |
| 670 | 670 | <?php |
| 671 | - if(isset($cf['description']) && $cf['description']){
|
|
| 672 | - echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 673 | - }?> |
|
| 671 | + if(isset($cf['description']) && $cf['description']){
|
|
| 672 | + echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
|
| 673 | + }?> |
|
| 674 | 674 | |
| 675 | 675 | <a id="gd-<?php echo $id;?>" data-field-type-key="<?php echo $id;?>" data-field-type="<?php echo $cf['field_type'];?>" class="gd-draggable-form-items <?php echo $cf['class'];?>" href="javascript:void(0);"> |
| 676 | 676 | <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 677 | - echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 678 | - }elseif(isset($cf['icon']) && $cf['icon'] ){
|
|
| 679 | - echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 680 | - }else{
|
|
| 681 | - echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 682 | - }?> |
|
| 677 | + echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 678 | + }elseif(isset($cf['icon']) && $cf['icon'] ){
|
|
| 679 | + echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 680 | + }else{
|
|
| 681 | + echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 682 | + }?> |
|
| 683 | 683 | <?php echo $cf['name'];?> |
| 684 | 684 | </a> |
| 685 | 685 | </li> |
| 686 | 686 | <?php |
| 687 | - } |
|
| 688 | - ?> |
|
| 687 | + } |
|
| 688 | + ?> |
|
| 689 | 689 | |
| 690 | 690 | |
| 691 | 691 | </ul> |
@@ -704,26 +704,26 @@ discard block |
||
| 704 | 704 | */ |
| 705 | 705 | function geodir_custom_selected_fields() |
| 706 | 706 | {
|
| 707 | - $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 708 | - ?> |
|
| 707 | + $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
|
| 708 | + ?> |
|
| 709 | 709 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 710 | 710 | <ul class="core"> |
| 711 | 711 | <?php |
| 712 | - global $wpdb; |
|
| 713 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 714 | - |
|
| 715 | - if (!empty($fields)) {
|
|
| 716 | - foreach ($fields as $field) {
|
|
| 717 | - //$result_str = $field->id; |
|
| 718 | - $result_str = $field; |
|
| 719 | - $field_type = $field->field_type; |
|
| 720 | - $field_type_key = $field->field_type_key; |
|
| 721 | - $field_ins_upd = 'display'; |
|
| 722 | - |
|
| 723 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 724 | - } |
|
| 725 | - } |
|
| 726 | - ?></ul> |
|
| 712 | + global $wpdb; |
|
| 713 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 714 | + |
|
| 715 | + if (!empty($fields)) {
|
|
| 716 | + foreach ($fields as $field) {
|
|
| 717 | + //$result_str = $field->id; |
|
| 718 | + $result_str = $field; |
|
| 719 | + $field_type = $field->field_type; |
|
| 720 | + $field_type_key = $field->field_type_key; |
|
| 721 | + $field_ins_upd = 'display'; |
|
| 722 | + |
|
| 723 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 724 | + } |
|
| 725 | + } |
|
| 726 | + ?></ul> |
|
| 727 | 727 | <?php |
| 728 | 728 | |
| 729 | 729 | } |
@@ -742,16 +742,16 @@ discard block |
||
| 742 | 742 | function geodir_custom_fields_panel_head($heading, $sub_tab, $listing_type) |
| 743 | 743 | {
|
| 744 | 744 | |
| 745 | - switch ($sub_tab) {
|
|
| 746 | - case 'custom_fields': |
|
| 747 | - $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 748 | - break; |
|
| 745 | + switch ($sub_tab) {
|
|
| 746 | + case 'custom_fields': |
|
| 747 | + $heading = sprintf(__('Manage %s Custom Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 748 | + break; |
|
| 749 | 749 | |
| 750 | - case 'sorting_options': |
|
| 751 | - $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 752 | - break; |
|
| 753 | - } |
|
| 754 | - return $heading; |
|
| 750 | + case 'sorting_options': |
|
| 751 | + $heading = sprintf(__('Manage %s Listing Sorting Options Fields', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 752 | + break; |
|
| 753 | + } |
|
| 754 | + return $heading; |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | |
@@ -769,16 +769,16 @@ discard block |
||
| 769 | 769 | function geodir_cf_panel_available_fields_head($heading, $sub_tab, $listing_type) |
| 770 | 770 | {
|
| 771 | 771 | |
| 772 | - switch ($sub_tab) {
|
|
| 773 | - case 'custom_fields': |
|
| 774 | - $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 775 | - break; |
|
| 772 | + switch ($sub_tab) {
|
|
| 773 | + case 'custom_fields': |
|
| 774 | + $heading = sprintf(__('Add new %s form field', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 775 | + break; |
|
| 776 | 776 | |
| 777 | - case 'sorting_options': |
|
| 778 | - $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 779 | - break; |
|
| 780 | - } |
|
| 781 | - return $heading; |
|
| 777 | + case 'sorting_options': |
|
| 778 | + $heading = sprintf(__('Available sorting options for %s listing and search results', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 779 | + break; |
|
| 780 | + } |
|
| 781 | + return $heading; |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | |
@@ -796,16 +796,16 @@ discard block |
||
| 796 | 796 | function geodir_cf_panel_available_fields_note($note, $sub_tab, $listing_type) |
| 797 | 797 | {
|
| 798 | 798 | |
| 799 | - switch ($sub_tab) {
|
|
| 800 | - case 'custom_fields': |
|
| 801 | - $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 802 | - break; |
|
| 799 | + switch ($sub_tab) {
|
|
| 800 | + case 'custom_fields': |
|
| 801 | + $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 802 | + break; |
|
| 803 | 803 | |
| 804 | - case 'sorting_options': |
|
| 805 | - $note = sprintf(__('Click on any box below to make it appear in sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 806 | - break; |
|
| 807 | - } |
|
| 808 | - return $note; |
|
| 804 | + case 'sorting_options': |
|
| 805 | + $note = sprintf(__('Click on any box below to make it appear in sorting option dropdown on %s listing and search results.<br />To make a field available here, go to custom fields tab and expand any field from selected fields panel and tick the checkbox saying \'Include this field in sort option\'.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 806 | + break; |
|
| 807 | + } |
|
| 808 | + return $note; |
|
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | |
@@ -823,16 +823,16 @@ discard block |
||
| 823 | 823 | function geodir_cf_panel_selected_fields_head($heading, $sub_tab, $listing_type) |
| 824 | 824 | {
|
| 825 | 825 | |
| 826 | - switch ($sub_tab) {
|
|
| 827 | - case 'custom_fields': |
|
| 828 | - $heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 829 | - break; |
|
| 826 | + switch ($sub_tab) {
|
|
| 827 | + case 'custom_fields': |
|
| 828 | + $heading = sprintf(__('List of fields those will appear on add new %s listing form', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 829 | + break; |
|
| 830 | 830 | |
| 831 | - case 'sorting_options': |
|
| 832 | - $heading = sprintf(__('List of fields those will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 833 | - break; |
|
| 834 | - } |
|
| 835 | - return $heading; |
|
| 831 | + case 'sorting_options': |
|
| 832 | + $heading = sprintf(__('List of fields those will appear in %s listing and search results sorting option dropdown box.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 833 | + break; |
|
| 834 | + } |
|
| 835 | + return $heading; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | |
@@ -850,16 +850,16 @@ discard block |
||
| 850 | 850 | function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type) |
| 851 | 851 | {
|
| 852 | 852 | |
| 853 | - switch ($sub_tab) {
|
|
| 854 | - case 'custom_fields': |
|
| 855 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 856 | - break; |
|
| 853 | + switch ($sub_tab) {
|
|
| 854 | + case 'custom_fields': |
|
| 855 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 856 | + break; |
|
| 857 | 857 | |
| 858 | - case 'sorting_options': |
|
| 859 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 860 | - break; |
|
| 861 | - } |
|
| 862 | - return $note; |
|
| 858 | + case 'sorting_options': |
|
| 859 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type));
|
|
| 860 | + break; |
|
| 861 | + } |
|
| 862 | + return $note; |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | |
@@ -875,16 +875,16 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | function geodir_remove_unnecessary_fields() |
| 877 | 877 | {
|
| 878 | - global $wpdb, $plugin_prefix; |
|
| 878 | + global $wpdb, $plugin_prefix; |
|
| 879 | 879 | |
| 880 | - if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 880 | + if (!get_option('geodir_remove_unnecessary_fields')) {
|
|
| 881 | 881 | |
| 882 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 883 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 882 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 883 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 884 | 884 | |
| 885 | - update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 885 | + update_option('geodir_remove_unnecessary_fields', '1');
|
|
| 886 | 886 | |
| 887 | - } |
|
| 887 | + } |
|
| 888 | 888 | |
| 889 | 889 | } |
| 890 | 890 | |
@@ -902,25 +902,25 @@ discard block |
||
| 902 | 902 | */ |
| 903 | 903 | function geodir_admin_ajax_handler() |
| 904 | 904 | {
|
| 905 | - if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 906 | - $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 907 | - switch ($geodir_admin_ajax_action) {
|
|
| 908 | - case 'diagnosis' : |
|
| 909 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 910 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 911 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 912 | - exit(); |
|
| 913 | - break; |
|
| 914 | - |
|
| 915 | - case 'diagnosis-fix' : |
|
| 916 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 917 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 918 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 919 | - exit(); |
|
| 920 | - break; |
|
| 921 | - } |
|
| 922 | - } |
|
| 923 | - exit(); |
|
| 905 | + if (isset($_REQUEST['geodir_admin_ajax_action']) && $_REQUEST['geodir_admin_ajax_action'] != '') {
|
|
| 906 | + $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
|
| 907 | + switch ($geodir_admin_ajax_action) {
|
|
| 908 | + case 'diagnosis' : |
|
| 909 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 910 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 911 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 912 | + exit(); |
|
| 913 | + break; |
|
| 914 | + |
|
| 915 | + case 'diagnosis-fix' : |
|
| 916 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 917 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 918 | + call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 919 | + exit(); |
|
| 920 | + break; |
|
| 921 | + } |
|
| 922 | + } |
|
| 923 | + exit(); |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | |
@@ -938,127 +938,127 @@ discard block |
||
| 938 | 938 | */ |
| 939 | 939 | function geodir_diagnose_multisite_table($filter_arr, $table, $tabel_name, $fix) |
| 940 | 940 | {
|
| 941 | - global $wpdb; |
|
| 942 | - //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 943 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 944 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 945 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 946 | - |
|
| 947 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 948 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 949 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 950 | - $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>";
|
|
| 951 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 952 | - |
|
| 953 | - if ($fix) {
|
|
| 954 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 955 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 956 | - |
|
| 957 | - if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 958 | - //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 959 | - |
|
| 960 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 961 | - |
|
| 962 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 963 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 964 | - } else {
|
|
| 965 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 966 | - } |
|
| 967 | - |
|
| 968 | - } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 969 | - |
|
| 970 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 971 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 972 | - |
|
| 973 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 974 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 975 | - } else {
|
|
| 976 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 977 | - } |
|
| 978 | - |
|
| 979 | - } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 980 | - |
|
| 981 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 982 | - |
|
| 983 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 984 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 985 | - } else {
|
|
| 986 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 987 | - } |
|
| 988 | - |
|
| 989 | - } |
|
| 990 | - |
|
| 991 | - } |
|
| 992 | - |
|
| 993 | - |
|
| 994 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 995 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 996 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 997 | - |
|
| 998 | - if ($fix) {
|
|
| 999 | - if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1000 | - if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1001 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1002 | - } else {
|
|
| 1003 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1004 | - } |
|
| 1005 | - |
|
| 1006 | - } 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
|
|
| 1007 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1008 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1009 | - } else {
|
|
| 1010 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1011 | - } |
|
| 1012 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1013 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1014 | - } else {
|
|
| 1015 | - $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>";
|
|
| 1016 | - } |
|
| 1017 | - } else {// else rename the original table to _ms_bak
|
|
| 1018 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1019 | - $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>";
|
|
| 1020 | - } else {
|
|
| 1021 | - $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>";
|
|
| 1022 | - } |
|
| 1023 | - } |
|
| 1024 | - } |
|
| 1025 | - |
|
| 1026 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1027 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1028 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1029 | - |
|
| 1030 | - if ($fix) {
|
|
| 1031 | - // if original table exists but new does not, rename |
|
| 1032 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1033 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1034 | - } else {
|
|
| 1035 | - $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>";
|
|
| 1036 | - } |
|
| 1037 | - |
|
| 1038 | - } |
|
| 1039 | - |
|
| 1040 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1041 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1042 | - $filter_arr['is_error_during_diagnose'] = true; |
|
| 1043 | - |
|
| 1044 | - if ($fix) {
|
|
| 1045 | - // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1046 | - delete_option('geodirlocation_db_version');
|
|
| 1047 | - delete_option('geodirevents_db_version');
|
|
| 1048 | - delete_option('geodir_reviewrating_db_version');
|
|
| 1049 | - delete_option('gdevents_db_version');
|
|
| 1050 | - delete_option('geodirectory_db_version');
|
|
| 1051 | - delete_option('geodirclaim_db_version');
|
|
| 1052 | - delete_option('geodir_custom_posts_db_version');
|
|
| 1053 | - delete_option('geodir_reviewratings_db_version');
|
|
| 1054 | - delete_option('geodiradvancesearch_db_version');
|
|
| 1055 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1056 | - } |
|
| 1057 | - |
|
| 1058 | - } else {
|
|
| 1059 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1060 | - } |
|
| 1061 | - return $filter_arr; |
|
| 941 | + global $wpdb; |
|
| 942 | + //$filter_arr['output_str'] .='###'.$table.'###'; |
|
| 943 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 944 | + $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 945 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 946 | + |
|
| 947 | + } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 948 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 949 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 950 | + $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>";
|
|
| 951 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 952 | + |
|
| 953 | + if ($fix) {
|
|
| 954 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 955 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 956 | + |
|
| 957 | + if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
|
| 958 | + //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
|
| 959 | + |
|
| 960 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 961 | + |
|
| 962 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 963 | + $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 964 | + } else {
|
|
| 965 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 966 | + } |
|
| 967 | + |
|
| 968 | + } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
|
| 969 | + |
|
| 970 | + $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 971 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 972 | + |
|
| 973 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 974 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 975 | + } else {
|
|
| 976 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 977 | + } |
|
| 978 | + |
|
| 979 | + } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
|
| 980 | + |
|
| 981 | + $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 982 | + |
|
| 983 | + if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 984 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 985 | + } else {
|
|
| 986 | + $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 987 | + } |
|
| 988 | + |
|
| 989 | + } |
|
| 990 | + |
|
| 991 | + } |
|
| 992 | + |
|
| 993 | + |
|
| 994 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 995 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 996 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 997 | + |
|
| 998 | + if ($fix) {
|
|
| 999 | + if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
|
| 1000 | + if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
|
| 1001 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1002 | + } else {
|
|
| 1003 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1004 | + } |
|
| 1005 | + |
|
| 1006 | + } 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
|
|
| 1007 | + if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1008 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1009 | + } else {
|
|
| 1010 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1011 | + } |
|
| 1012 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1013 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1014 | + } else {
|
|
| 1015 | + $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>";
|
|
| 1016 | + } |
|
| 1017 | + } else {// else rename the original table to _ms_bak
|
|
| 1018 | + if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1019 | + $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>";
|
|
| 1020 | + } else {
|
|
| 1021 | + $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>";
|
|
| 1022 | + } |
|
| 1023 | + } |
|
| 1024 | + } |
|
| 1025 | + |
|
| 1026 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1027 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1028 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1029 | + |
|
| 1030 | + if ($fix) {
|
|
| 1031 | + // if original table exists but new does not, rename |
|
| 1032 | + if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1033 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1034 | + } else {
|
|
| 1035 | + $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>";
|
|
| 1036 | + } |
|
| 1037 | + |
|
| 1038 | + } |
|
| 1039 | + |
|
| 1040 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1041 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1042 | + $filter_arr['is_error_during_diagnose'] = true; |
|
| 1043 | + |
|
| 1044 | + if ($fix) {
|
|
| 1045 | + // if original table does not exist try deleting db_vers of all addons so the initial db_install scripts run; |
|
| 1046 | + delete_option('geodirlocation_db_version');
|
|
| 1047 | + delete_option('geodirevents_db_version');
|
|
| 1048 | + delete_option('geodir_reviewrating_db_version');
|
|
| 1049 | + delete_option('gdevents_db_version');
|
|
| 1050 | + delete_option('geodirectory_db_version');
|
|
| 1051 | + delete_option('geodirclaim_db_version');
|
|
| 1052 | + delete_option('geodir_custom_posts_db_version');
|
|
| 1053 | + delete_option('geodir_reviewratings_db_version');
|
|
| 1054 | + delete_option('geodiradvancesearch_db_version');
|
|
| 1055 | + $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1056 | + } |
|
| 1057 | + |
|
| 1058 | + } else {
|
|
| 1059 | + $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1060 | + } |
|
| 1061 | + return $filter_arr; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | |
@@ -1072,53 +1072,53 @@ discard block |
||
| 1072 | 1072 | */ |
| 1073 | 1073 | function geodir_diagnose_tags_sync() |
| 1074 | 1074 | {
|
| 1075 | - global $wpdb, $plugin_prefix; |
|
| 1076 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1077 | - |
|
| 1078 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1079 | - $is_error_during_diagnose = false; |
|
| 1080 | - $output_str = ''; |
|
| 1081 | - |
|
| 1082 | - |
|
| 1083 | - $all_postypes = geodir_get_posttypes(); |
|
| 1084 | - |
|
| 1085 | - if (!empty($all_postypes)) {
|
|
| 1086 | - foreach ($all_postypes as $key) {
|
|
| 1087 | - // update each GD CPT |
|
| 1088 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 1089 | - |
|
| 1090 | - if (!empty($posts)) {
|
|
| 1091 | - |
|
| 1092 | - foreach ($posts as $p) {
|
|
| 1093 | - $p->post_type = $key; |
|
| 1094 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1095 | - if (empty($raw_tags)) {
|
|
| 1096 | - $post_tags = ''; |
|
| 1097 | - } else {
|
|
| 1098 | - $post_tags = implode(",", $raw_tags);
|
|
| 1099 | - } |
|
| 1100 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1101 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1102 | - |
|
| 1103 | - } |
|
| 1104 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1105 | - } |
|
| 1106 | - |
|
| 1107 | - } |
|
| 1108 | - |
|
| 1109 | - } |
|
| 1110 | - |
|
| 1111 | - if ($is_error_during_diagnose) {
|
|
| 1112 | - $info_div_class = "geodir_problem_info"; |
|
| 1113 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1114 | - } else {
|
|
| 1115 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1116 | - $fix_button_txt = ''; |
|
| 1117 | - } |
|
| 1118 | - echo "<ul class='$info_div_class'>"; |
|
| 1119 | - echo $output_str; |
|
| 1120 | - echo $fix_button_txt; |
|
| 1121 | - echo "</ul>"; |
|
| 1075 | + global $wpdb, $plugin_prefix; |
|
| 1076 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1077 | + |
|
| 1078 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1079 | + $is_error_during_diagnose = false; |
|
| 1080 | + $output_str = ''; |
|
| 1081 | + |
|
| 1082 | + |
|
| 1083 | + $all_postypes = geodir_get_posttypes(); |
|
| 1084 | + |
|
| 1085 | + if (!empty($all_postypes)) {
|
|
| 1086 | + foreach ($all_postypes as $key) {
|
|
| 1087 | + // update each GD CPT |
|
| 1088 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 1089 | + |
|
| 1090 | + if (!empty($posts)) {
|
|
| 1091 | + |
|
| 1092 | + foreach ($posts as $p) {
|
|
| 1093 | + $p->post_type = $key; |
|
| 1094 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1095 | + if (empty($raw_tags)) {
|
|
| 1096 | + $post_tags = ''; |
|
| 1097 | + } else {
|
|
| 1098 | + $post_tags = implode(",", $raw_tags);
|
|
| 1099 | + } |
|
| 1100 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1101 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1102 | + |
|
| 1103 | + } |
|
| 1104 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1105 | + } |
|
| 1106 | + |
|
| 1107 | + } |
|
| 1108 | + |
|
| 1109 | + } |
|
| 1110 | + |
|
| 1111 | + if ($is_error_during_diagnose) {
|
|
| 1112 | + $info_div_class = "geodir_problem_info"; |
|
| 1113 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1114 | + } else {
|
|
| 1115 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1116 | + $fix_button_txt = ''; |
|
| 1117 | + } |
|
| 1118 | + echo "<ul class='$info_div_class'>"; |
|
| 1119 | + echo $output_str; |
|
| 1120 | + echo $fix_button_txt; |
|
| 1121 | + echo "</ul>"; |
|
| 1122 | 1122 | |
| 1123 | 1123 | } |
| 1124 | 1124 | |
@@ -1134,75 +1134,75 @@ discard block |
||
| 1134 | 1134 | */ |
| 1135 | 1135 | function geodir_diagnose_cats_sync() |
| 1136 | 1136 | {
|
| 1137 | - global $wpdb, $plugin_prefix; |
|
| 1138 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1137 | + global $wpdb, $plugin_prefix; |
|
| 1138 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1139 | 1139 | |
| 1140 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1141 | - $is_error_during_diagnose = false; |
|
| 1142 | - $output_str = ''; |
|
| 1140 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1141 | + $is_error_during_diagnose = false; |
|
| 1142 | + $output_str = ''; |
|
| 1143 | 1143 | |
| 1144 | 1144 | |
| 1145 | - $all_postypes = geodir_get_posttypes(); |
|
| 1145 | + $all_postypes = geodir_get_posttypes(); |
|
| 1146 | 1146 | |
| 1147 | - if (!empty($all_postypes)) {
|
|
| 1148 | - foreach ($all_postypes as $key) {
|
|
| 1149 | - // update each GD CTP |
|
| 1150 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1147 | + if (!empty($all_postypes)) {
|
|
| 1148 | + foreach ($all_postypes as $key) {
|
|
| 1149 | + // update each GD CTP |
|
| 1150 | + $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1151 | 1151 | |
| 1152 | - if (!empty($posts)) {
|
|
| 1152 | + if (!empty($posts)) {
|
|
| 1153 | 1153 | |
| 1154 | - foreach ($posts as $p) {
|
|
| 1155 | - $p->post_type = $key; |
|
| 1156 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1154 | + foreach ($posts as $p) {
|
|
| 1155 | + $p->post_type = $key; |
|
| 1156 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1157 | 1157 | |
| 1158 | - if (empty($raw_cats)) {
|
|
| 1159 | - $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1158 | + if (empty($raw_cats)) {
|
|
| 1159 | + $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
|
| 1160 | 1160 | |
| 1161 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1162 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1163 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1164 | - if (is_numeric($cat_part)) {
|
|
| 1165 | - $raw_cats[] = (int)$cat_part; |
|
| 1166 | - } |
|
| 1167 | - } |
|
| 1161 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1162 | + $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1163 | + foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1164 | + if (is_numeric($cat_part)) {
|
|
| 1165 | + $raw_cats[] = (int)$cat_part; |
|
| 1166 | + } |
|
| 1167 | + } |
|
| 1168 | 1168 | |
| 1169 | - } |
|
| 1169 | + } |
|
| 1170 | 1170 | |
| 1171 | - if (!empty($raw_cats)) {
|
|
| 1172 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1171 | + if (!empty($raw_cats)) {
|
|
| 1172 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1173 | 1173 | |
| 1174 | - } |
|
| 1174 | + } |
|
| 1175 | 1175 | |
| 1176 | - } |
|
| 1176 | + } |
|
| 1177 | 1177 | |
| 1178 | 1178 | |
| 1179 | - if (empty($raw_cats)) {
|
|
| 1180 | - $post_cats = ''; |
|
| 1181 | - } else {
|
|
| 1182 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1183 | - } |
|
| 1184 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1185 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1186 | - } |
|
| 1179 | + if (empty($raw_cats)) {
|
|
| 1180 | + $post_cats = ''; |
|
| 1181 | + } else {
|
|
| 1182 | + $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1183 | + } |
|
| 1184 | + $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1185 | + $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1186 | + } |
|
| 1187 | 1187 | |
| 1188 | - } |
|
| 1189 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1188 | + } |
|
| 1189 | + $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1190 | 1190 | |
| 1191 | - } |
|
| 1191 | + } |
|
| 1192 | 1192 | |
| 1193 | - } |
|
| 1193 | + } |
|
| 1194 | 1194 | |
| 1195 | - if ($is_error_during_diagnose) {
|
|
| 1196 | - $info_div_class = "geodir_problem_info"; |
|
| 1197 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1198 | - } else {
|
|
| 1199 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1200 | - $fix_button_txt = ''; |
|
| 1201 | - } |
|
| 1202 | - echo "<ul class='$info_div_class'>"; |
|
| 1203 | - echo $output_str; |
|
| 1204 | - echo $fix_button_txt; |
|
| 1205 | - echo "</ul>"; |
|
| 1195 | + if ($is_error_during_diagnose) {
|
|
| 1196 | + $info_div_class = "geodir_problem_info"; |
|
| 1197 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1198 | + } else {
|
|
| 1199 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1200 | + $fix_button_txt = ''; |
|
| 1201 | + } |
|
| 1202 | + echo "<ul class='$info_div_class'>"; |
|
| 1203 | + echo $output_str; |
|
| 1204 | + echo $fix_button_txt; |
|
| 1205 | + echo "</ul>"; |
|
| 1206 | 1206 | |
| 1207 | 1207 | } |
| 1208 | 1208 | |
@@ -1216,61 +1216,61 @@ discard block |
||
| 1216 | 1216 | */ |
| 1217 | 1217 | function geodir_diagnose_version_clear() |
| 1218 | 1218 | {
|
| 1219 | - global $wpdb, $plugin_prefix; |
|
| 1220 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1221 | - |
|
| 1222 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1223 | - $is_error_during_diagnose = false; |
|
| 1224 | - $output_str = ''; |
|
| 1225 | - |
|
| 1226 | - |
|
| 1227 | - $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1228 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1229 | - 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1230 | - 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1231 | - 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1232 | - 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1233 | - 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1234 | - 'Location Manager' => 'geodirlocation_db_version', |
|
| 1235 | - 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1236 | - 'Events Manager' => 'geodirevents_db_version', |
|
| 1237 | - ); |
|
| 1238 | - |
|
| 1239 | - /** |
|
| 1240 | - * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1241 | - * |
|
| 1242 | - * @since 1.0.0 |
|
| 1243 | - * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1244 | - */ |
|
| 1245 | - $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1246 | - |
|
| 1247 | - if (!empty($ver_arr)) {
|
|
| 1248 | - foreach ($ver_arr as $key => $val) {
|
|
| 1249 | - if (delete_option($val)) {
|
|
| 1250 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1251 | - } else {
|
|
| 1252 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1253 | - } |
|
| 1254 | - |
|
| 1255 | - } |
|
| 1256 | - |
|
| 1257 | - if ($output_str) {
|
|
| 1258 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1259 | - } |
|
| 1260 | - |
|
| 1261 | - } |
|
| 1262 | - |
|
| 1263 | - if ($is_error_during_diagnose) {
|
|
| 1264 | - $info_div_class = "geodir_problem_info"; |
|
| 1265 | - $fix_button_txt = ""; |
|
| 1266 | - } else {
|
|
| 1267 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1268 | - $fix_button_txt = ''; |
|
| 1269 | - } |
|
| 1270 | - echo "<ul class='$info_div_class'>"; |
|
| 1271 | - echo $output_str; |
|
| 1272 | - echo $fix_button_txt; |
|
| 1273 | - echo "</ul>"; |
|
| 1219 | + global $wpdb, $plugin_prefix; |
|
| 1220 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1221 | + |
|
| 1222 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1223 | + $is_error_during_diagnose = false; |
|
| 1224 | + $output_str = ''; |
|
| 1225 | + |
|
| 1226 | + |
|
| 1227 | + $gd_arr = array('GeoDirectory' => 'geodirectory_db_version',
|
|
| 1228 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1229 | + 'GeoDirectory Framework' => 'gdf_db_version', |
|
| 1230 | + 'Advanced Search' => 'geodiradvancesearch_db_version', |
|
| 1231 | + 'Review Rating Manager' => 'geodir_reviewratings_db_version', |
|
| 1232 | + 'Claim Manager' => 'geodirclaim_db_version', |
|
| 1233 | + 'CPT Manager' => 'geodir_custom_posts_db_version', |
|
| 1234 | + 'Location Manager' => 'geodirlocation_db_version', |
|
| 1235 | + 'Payment Manager' => 'geodir_payments_db_version', |
|
| 1236 | + 'Events Manager' => 'geodirevents_db_version', |
|
| 1237 | + ); |
|
| 1238 | + |
|
| 1239 | + /** |
|
| 1240 | + * Filter the array of plugins to clear the version numbers for in the GD >Tools : clear all version numbers. |
|
| 1241 | + * |
|
| 1242 | + * @since 1.0.0 |
|
| 1243 | + * @param array $gd_arr The array or addons to clear, array('GeoDirectory' => 'geodirectory_db_version',...
|
|
| 1244 | + */ |
|
| 1245 | + $ver_arr = apply_filters('geodir_db_version_name', $gd_arr);
|
|
| 1246 | + |
|
| 1247 | + if (!empty($ver_arr)) {
|
|
| 1248 | + foreach ($ver_arr as $key => $val) {
|
|
| 1249 | + if (delete_option($val)) {
|
|
| 1250 | + $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1251 | + } else {
|
|
| 1252 | + $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1253 | + } |
|
| 1254 | + |
|
| 1255 | + } |
|
| 1256 | + |
|
| 1257 | + if ($output_str) {
|
|
| 1258 | + $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1259 | + } |
|
| 1260 | + |
|
| 1261 | + } |
|
| 1262 | + |
|
| 1263 | + if ($is_error_during_diagnose) {
|
|
| 1264 | + $info_div_class = "geodir_problem_info"; |
|
| 1265 | + $fix_button_txt = ""; |
|
| 1266 | + } else {
|
|
| 1267 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1268 | + $fix_button_txt = ''; |
|
| 1269 | + } |
|
| 1270 | + echo "<ul class='$info_div_class'>"; |
|
| 1271 | + echo $output_str; |
|
| 1272 | + echo $fix_button_txt; |
|
| 1273 | + echo "</ul>"; |
|
| 1274 | 1274 | |
| 1275 | 1275 | } |
| 1276 | 1276 | |
@@ -1284,59 +1284,59 @@ discard block |
||
| 1284 | 1284 | */ |
| 1285 | 1285 | function geodir_diagnose_ratings() |
| 1286 | 1286 | {
|
| 1287 | - global $wpdb; |
|
| 1288 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1289 | - |
|
| 1290 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1291 | - $is_error_during_diagnose = false; |
|
| 1292 | - $output_str = ''; |
|
| 1293 | - |
|
| 1294 | - // check review locations |
|
| 1295 | - 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")) {
|
|
| 1296 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1297 | - $is_error_during_diagnose = true; |
|
| 1298 | - |
|
| 1299 | - if ($fix) {
|
|
| 1300 | - if (geodir_fix_review_location()) {
|
|
| 1301 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1302 | - } else {
|
|
| 1303 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1304 | - } |
|
| 1305 | - } |
|
| 1306 | - |
|
| 1307 | - } else {
|
|
| 1308 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1309 | - } |
|
| 1310 | - |
|
| 1311 | - // check review content |
|
| 1312 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1313 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1314 | - $is_error_during_diagnose = true; |
|
| 1315 | - |
|
| 1316 | - if ($fix) {
|
|
| 1317 | - if (geodir_fix_review_content()) {
|
|
| 1318 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1319 | - } else {
|
|
| 1320 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1321 | - } |
|
| 1322 | - } |
|
| 1323 | - |
|
| 1324 | - } else {
|
|
| 1325 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1326 | - } |
|
| 1327 | - |
|
| 1328 | - |
|
| 1329 | - if ($is_error_during_diagnose) {
|
|
| 1330 | - $info_div_class = "geodir_problem_info"; |
|
| 1331 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1332 | - } else {
|
|
| 1333 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1334 | - $fix_button_txt = ''; |
|
| 1335 | - } |
|
| 1336 | - echo "<ul class='$info_div_class'>"; |
|
| 1337 | - echo $output_str; |
|
| 1338 | - echo $fix_button_txt; |
|
| 1339 | - echo "</ul>"; |
|
| 1287 | + global $wpdb; |
|
| 1288 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1289 | + |
|
| 1290 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1291 | + $is_error_during_diagnose = false; |
|
| 1292 | + $output_str = ''; |
|
| 1293 | + |
|
| 1294 | + // check review locations |
|
| 1295 | + 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")) {
|
|
| 1296 | + $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1297 | + $is_error_during_diagnose = true; |
|
| 1298 | + |
|
| 1299 | + if ($fix) {
|
|
| 1300 | + if (geodir_fix_review_location()) {
|
|
| 1301 | + $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1302 | + } else {
|
|
| 1303 | + $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1304 | + } |
|
| 1305 | + } |
|
| 1306 | + |
|
| 1307 | + } else {
|
|
| 1308 | + $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1309 | + } |
|
| 1310 | + |
|
| 1311 | + // check review content |
|
| 1312 | + if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1313 | + $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1314 | + $is_error_during_diagnose = true; |
|
| 1315 | + |
|
| 1316 | + if ($fix) {
|
|
| 1317 | + if (geodir_fix_review_content()) {
|
|
| 1318 | + $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1319 | + } else {
|
|
| 1320 | + $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1321 | + } |
|
| 1322 | + } |
|
| 1323 | + |
|
| 1324 | + } else {
|
|
| 1325 | + $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1326 | + } |
|
| 1327 | + |
|
| 1328 | + |
|
| 1329 | + if ($is_error_during_diagnose) {
|
|
| 1330 | + $info_div_class = "geodir_problem_info"; |
|
| 1331 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1332 | + } else {
|
|
| 1333 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1334 | + $fix_button_txt = ''; |
|
| 1335 | + } |
|
| 1336 | + echo "<ul class='$info_div_class'>"; |
|
| 1337 | + echo $output_str; |
|
| 1338 | + echo $fix_button_txt; |
|
| 1339 | + echo "</ul>"; |
|
| 1340 | 1340 | |
| 1341 | 1341 | } |
| 1342 | 1342 | |
@@ -1350,57 +1350,57 @@ discard block |
||
| 1350 | 1350 | */ |
| 1351 | 1351 | function geodir_diagnose_multisite_conversion() |
| 1352 | 1352 | {
|
| 1353 | - global $wpdb; |
|
| 1354 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1355 | - //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1356 | - $is_error_during_diagnose = false; |
|
| 1357 | - $output_str = ''; |
|
| 1358 | - |
|
| 1359 | - $filter_arr = array(); |
|
| 1360 | - $filter_arr['output_str'] = $output_str; |
|
| 1361 | - $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1362 | - $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1363 | - 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1364 | - 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1365 | - 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1366 | - 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1367 | - 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1368 | - 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1369 | - ); |
|
| 1370 | - |
|
| 1371 | - // allow other addons to hook in and add their checks |
|
| 1372 | - |
|
| 1373 | - /** |
|
| 1374 | - * Filter the array of tables. |
|
| 1375 | - * |
|
| 1376 | - * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1377 | - * |
|
| 1378 | - * @since 1.0.0 |
|
| 1379 | - * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1380 | - */ |
|
| 1381 | - $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1382 | - |
|
| 1383 | - foreach ($table_arr as $table => $table_name) {
|
|
| 1384 | - // Diagnose table |
|
| 1385 | - $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1386 | - } |
|
| 1387 | - |
|
| 1388 | - |
|
| 1389 | - $output_str = $filter_arr['output_str']; |
|
| 1390 | - $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1391 | - |
|
| 1392 | - |
|
| 1393 | - if ($is_error_during_diagnose) {
|
|
| 1394 | - $info_div_class = "geodir_problem_info"; |
|
| 1395 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1396 | - } else {
|
|
| 1397 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1398 | - $fix_button_txt = ''; |
|
| 1399 | - } |
|
| 1400 | - echo "<ul class='$info_div_class'>"; |
|
| 1401 | - echo $output_str; |
|
| 1402 | - echo $fix_button_txt; |
|
| 1403 | - echo "</ul>"; |
|
| 1353 | + global $wpdb; |
|
| 1354 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1355 | + //if($fix){echo 'true';}else{echo 'false';}
|
|
| 1356 | + $is_error_during_diagnose = false; |
|
| 1357 | + $output_str = ''; |
|
| 1358 | + |
|
| 1359 | + $filter_arr = array(); |
|
| 1360 | + $filter_arr['output_str'] = $output_str; |
|
| 1361 | + $filter_arr['is_error_during_diagnose'] = $is_error_during_diagnose; |
|
| 1362 | + $table_arr = array('geodir_countries' => __('Countries', 'geodirectory'),
|
|
| 1363 | + 'geodir_custom_fields' => __('Custom fields', 'geodirectory'),
|
|
| 1364 | + 'geodir_post_icon' => __('Post icon', 'geodirectory'),
|
|
| 1365 | + 'geodir_attachments' => __('Attachments', 'geodirectory'),
|
|
| 1366 | + 'geodir_post_review' => __('Reviews', 'geodirectory'),
|
|
| 1367 | + 'geodir_custom_sort_fields' => __('Custom sort fields', 'geodirectory'),
|
|
| 1368 | + 'geodir_gd_place_detail' => __('Place detail', 'geodirectory')
|
|
| 1369 | + ); |
|
| 1370 | + |
|
| 1371 | + // allow other addons to hook in and add their checks |
|
| 1372 | + |
|
| 1373 | + /** |
|
| 1374 | + * Filter the array of tables. |
|
| 1375 | + * |
|
| 1376 | + * Filter the array of tables to check during the GD>Tools multisite DB conversion tool check, this allows addons to add their DB tables to the checks. |
|
| 1377 | + * |
|
| 1378 | + * @since 1.0.0 |
|
| 1379 | + * @param array $table_arr The array of tables to check, array('geodir_countries' => __('Countries', 'geodirectory'),...
|
|
| 1380 | + */ |
|
| 1381 | + $table_arr = apply_filters('geodir_diagnose_multisite_conversion', $table_arr);
|
|
| 1382 | + |
|
| 1383 | + foreach ($table_arr as $table => $table_name) {
|
|
| 1384 | + // Diagnose table |
|
| 1385 | + $filter_arr = geodir_diagnose_multisite_table($filter_arr, $table, $table_name, $fix); |
|
| 1386 | + } |
|
| 1387 | + |
|
| 1388 | + |
|
| 1389 | + $output_str = $filter_arr['output_str']; |
|
| 1390 | + $is_error_during_diagnose = $filter_arr['is_error_during_diagnose']; |
|
| 1391 | + |
|
| 1392 | + |
|
| 1393 | + if ($is_error_during_diagnose) {
|
|
| 1394 | + $info_div_class = "geodir_problem_info"; |
|
| 1395 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1396 | + } else {
|
|
| 1397 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1398 | + $fix_button_txt = ''; |
|
| 1399 | + } |
|
| 1400 | + echo "<ul class='$info_div_class'>"; |
|
| 1401 | + echo $output_str; |
|
| 1402 | + echo $fix_button_txt; |
|
| 1403 | + echo "</ul>"; |
|
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | /** |
@@ -1418,39 +1418,39 @@ discard block |
||
| 1418 | 1418 | */ |
| 1419 | 1419 | function geodir_fix_virtual_page($slug, $page_title, $old_id, $option) |
| 1420 | 1420 | {
|
| 1421 | - global $wpdb, $current_user; |
|
| 1422 | - |
|
| 1423 | - if (!empty($old_id)) {
|
|
| 1424 | - wp_delete_post($old_id, true); |
|
| 1425 | - }//delete post if already there |
|
| 1426 | - else {
|
|
| 1427 | - $page_found = $wpdb->get_var( |
|
| 1428 | - $wpdb->prepare( |
|
| 1429 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1430 | - array($slug) |
|
| 1431 | - ) |
|
| 1432 | - ); |
|
| 1433 | - wp_delete_post($page_found, true); |
|
| 1434 | - |
|
| 1435 | - } |
|
| 1436 | - |
|
| 1437 | - $page_data = array( |
|
| 1438 | - 'post_status' => 'publish', |
|
| 1439 | - 'post_type' => 'page', |
|
| 1440 | - 'post_author' => $current_user->ID, |
|
| 1441 | - 'post_name' => $slug, |
|
| 1442 | - 'post_title' => $page_title, |
|
| 1443 | - 'post_content' => '', |
|
| 1444 | - 'post_parent' => 0, |
|
| 1445 | - 'comment_status' => 'closed' |
|
| 1446 | - ); |
|
| 1447 | - $page_id = wp_insert_post($page_data); |
|
| 1448 | - update_option($option, $page_id); |
|
| 1449 | - if ($page_id) {
|
|
| 1450 | - return true; |
|
| 1451 | - } else {
|
|
| 1452 | - return false; |
|
| 1453 | - } |
|
| 1421 | + global $wpdb, $current_user; |
|
| 1422 | + |
|
| 1423 | + if (!empty($old_id)) {
|
|
| 1424 | + wp_delete_post($old_id, true); |
|
| 1425 | + }//delete post if already there |
|
| 1426 | + else {
|
|
| 1427 | + $page_found = $wpdb->get_var( |
|
| 1428 | + $wpdb->prepare( |
|
| 1429 | + "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1430 | + array($slug) |
|
| 1431 | + ) |
|
| 1432 | + ); |
|
| 1433 | + wp_delete_post($page_found, true); |
|
| 1434 | + |
|
| 1435 | + } |
|
| 1436 | + |
|
| 1437 | + $page_data = array( |
|
| 1438 | + 'post_status' => 'publish', |
|
| 1439 | + 'post_type' => 'page', |
|
| 1440 | + 'post_author' => $current_user->ID, |
|
| 1441 | + 'post_name' => $slug, |
|
| 1442 | + 'post_title' => $page_title, |
|
| 1443 | + 'post_content' => '', |
|
| 1444 | + 'post_parent' => 0, |
|
| 1445 | + 'comment_status' => 'closed' |
|
| 1446 | + ); |
|
| 1447 | + $page_id = wp_insert_post($page_data); |
|
| 1448 | + update_option($option, $page_id); |
|
| 1449 | + if ($page_id) {
|
|
| 1450 | + return true; |
|
| 1451 | + } else {
|
|
| 1452 | + return false; |
|
| 1453 | + } |
|
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | 1456 | /** |
@@ -1462,212 +1462,212 @@ discard block |
||
| 1462 | 1462 | */ |
| 1463 | 1463 | function geodir_diagnose_default_pages() |
| 1464 | 1464 | {
|
| 1465 | - global $wpdb; |
|
| 1466 | - $is_error_during_diagnose = false; |
|
| 1467 | - $output_str = ''; |
|
| 1468 | - $fix = isset($_POST['fix']) ? true : false; |
|
| 1469 | - |
|
| 1470 | - ////////////////////////////////// |
|
| 1471 | - /* Diagnose GD Home Page Starts */ |
|
| 1472 | - ////////////////////////////////// |
|
| 1473 | - $option_value = get_option('geodir_home_page');
|
|
| 1474 | - $page = get_post($option_value); |
|
| 1475 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1476 | - |
|
| 1477 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1478 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1479 | - else {
|
|
| 1480 | - $is_error_during_diagnose = true; |
|
| 1481 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1482 | - if ($fix) {
|
|
| 1483 | - if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1484 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1485 | - } else {
|
|
| 1486 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1487 | - } |
|
| 1488 | - } |
|
| 1489 | - } |
|
| 1490 | - |
|
| 1491 | - //////////////////////////////// |
|
| 1492 | - /* Diagnose GD Home Page Ends */ |
|
| 1493 | - //////////////////////////////// |
|
| 1494 | - |
|
| 1495 | - ////////////////////////////////// |
|
| 1496 | - /* Diagnose Add Listing Page Starts */ |
|
| 1497 | - ////////////////////////////////// |
|
| 1498 | - $option_value = get_option('geodir_add_listing_page');
|
|
| 1499 | - $page = get_post($option_value); |
|
| 1500 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1501 | - |
|
| 1502 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1503 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1504 | - else {
|
|
| 1505 | - $is_error_during_diagnose = true; |
|
| 1506 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1507 | - if ($fix) {
|
|
| 1508 | - if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1509 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1510 | - } else {
|
|
| 1511 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1512 | - } |
|
| 1513 | - } |
|
| 1514 | - } |
|
| 1515 | - |
|
| 1516 | - //////////////////////////////// |
|
| 1517 | - /* Diagnose Add Listing Page Ends */ |
|
| 1518 | - //////////////////////////////// |
|
| 1519 | - |
|
| 1520 | - |
|
| 1521 | - ////////////////////////////////// |
|
| 1522 | - /* Diagnose Listing Preview Page Starts */ |
|
| 1523 | - ////////////////////////////////// |
|
| 1524 | - $option_value = get_option('geodir_preview_page');
|
|
| 1525 | - $page = get_post($option_value); |
|
| 1526 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1527 | - |
|
| 1528 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1529 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1530 | - else {
|
|
| 1531 | - $is_error_during_diagnose = true; |
|
| 1532 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1533 | - if ($fix) {
|
|
| 1534 | - if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1535 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1536 | - } else {
|
|
| 1537 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1538 | - } |
|
| 1539 | - } |
|
| 1540 | - } |
|
| 1541 | - |
|
| 1542 | - //////////////////////////////// |
|
| 1543 | - /* Diagnose Listing Preview Page Ends */ |
|
| 1544 | - //////////////////////////////// |
|
| 1545 | - |
|
| 1546 | - ////////////////////////////////// |
|
| 1547 | - /* Diagnose Listing Success Page Starts */ |
|
| 1548 | - ////////////////////////////////// |
|
| 1549 | - $option_value = get_option('geodir_success_page');
|
|
| 1550 | - $page = get_post($option_value); |
|
| 1551 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1552 | - |
|
| 1553 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1554 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1555 | - else {
|
|
| 1556 | - $is_error_during_diagnose = true; |
|
| 1557 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1558 | - if ($fix) {
|
|
| 1559 | - if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1560 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1561 | - } else {
|
|
| 1562 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1563 | - } |
|
| 1564 | - } |
|
| 1565 | - } |
|
| 1566 | - |
|
| 1567 | - //////////////////////////////// |
|
| 1568 | - /* Diagnose Listing Sucess Page Ends */ |
|
| 1569 | - //////////////////////////////// |
|
| 1570 | - |
|
| 1571 | - ////////////////////////////////// |
|
| 1572 | - /* Diagnose Info Page Starts */ |
|
| 1573 | - ////////////////////////////////// |
|
| 1574 | - $option_value = get_option('geodir_info_page');
|
|
| 1575 | - $page = get_post($option_value); |
|
| 1576 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1577 | - |
|
| 1578 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1579 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1580 | - else {
|
|
| 1581 | - $is_error_during_diagnose = true; |
|
| 1582 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1583 | - if ($fix) {
|
|
| 1584 | - if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1585 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1586 | - } else {
|
|
| 1587 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1588 | - } |
|
| 1589 | - } |
|
| 1590 | - } |
|
| 1591 | - |
|
| 1592 | - //////////////////////////////// |
|
| 1593 | - /* Diagnose Info Page Ends */ |
|
| 1594 | - //////////////////////////////// |
|
| 1595 | - |
|
| 1596 | - ////////////////////////////////// |
|
| 1597 | - /* Diagnose Login Page Starts */ |
|
| 1598 | - ////////////////////////////////// |
|
| 1599 | - $option_value = get_option('geodir_login_page');
|
|
| 1600 | - $page = get_post($option_value); |
|
| 1601 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1602 | - |
|
| 1603 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1604 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1605 | - else {
|
|
| 1606 | - $is_error_during_diagnose = true; |
|
| 1607 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1608 | - if ($fix) {
|
|
| 1609 | - if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1610 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1611 | - } else {
|
|
| 1612 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1613 | - } |
|
| 1614 | - } |
|
| 1615 | - } |
|
| 1616 | - |
|
| 1617 | - //////////////////////////////// |
|
| 1618 | - /* Diagnose Info Page Ends */ |
|
| 1619 | - //////////////////////////////// |
|
| 1620 | - |
|
| 1621 | - ////////////////////////////////// |
|
| 1622 | - /* Diagnose Location Page Starts */ |
|
| 1623 | - ////////////////////////////////// |
|
| 1624 | - $option_value = get_option('geodir_location_page');
|
|
| 1625 | - $page = get_post($option_value); |
|
| 1626 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1627 | - |
|
| 1628 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1629 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1630 | - else {
|
|
| 1631 | - $is_error_during_diagnose = true; |
|
| 1632 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1633 | - if ($fix) {
|
|
| 1634 | - if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1635 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1636 | - } else {
|
|
| 1637 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1638 | - } |
|
| 1639 | - } |
|
| 1640 | - } |
|
| 1641 | - |
|
| 1642 | - //////////////////////////////// |
|
| 1643 | - /* Diagnose Location Page Ends */ |
|
| 1644 | - //////////////////////////////// |
|
| 1645 | - |
|
| 1646 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1647 | - /** |
|
| 1648 | - * This action is called at the end of the GD Tools page check function. |
|
| 1649 | - * |
|
| 1650 | - * @since 1.5.2 |
|
| 1651 | - */ |
|
| 1652 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1653 | - |
|
| 1654 | - $output_str = $page_chk_arr['output_str']; |
|
| 1655 | - $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1656 | - |
|
| 1657 | - if ($is_error_during_diagnose) {
|
|
| 1658 | - if ($fix) {
|
|
| 1659 | - flush_rewrite_rules(); |
|
| 1660 | - } |
|
| 1661 | - $info_div_class = "geodir_problem_info"; |
|
| 1662 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1663 | - } else {
|
|
| 1664 | - $info_div_class = "geodir_noproblem_info"; |
|
| 1665 | - $fix_button_txt = ''; |
|
| 1666 | - } |
|
| 1667 | - echo "<ul class='$info_div_class'>"; |
|
| 1668 | - echo $output_str; |
|
| 1669 | - echo $fix_button_txt; |
|
| 1670 | - echo "</ul>"; |
|
| 1465 | + global $wpdb; |
|
| 1466 | + $is_error_during_diagnose = false; |
|
| 1467 | + $output_str = ''; |
|
| 1468 | + $fix = isset($_POST['fix']) ? true : false; |
|
| 1469 | + |
|
| 1470 | + ////////////////////////////////// |
|
| 1471 | + /* Diagnose GD Home Page Starts */ |
|
| 1472 | + ////////////////////////////////// |
|
| 1473 | + $option_value = get_option('geodir_home_page');
|
|
| 1474 | + $page = get_post($option_value); |
|
| 1475 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1476 | + |
|
| 1477 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1478 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1479 | + else {
|
|
| 1480 | + $is_error_during_diagnose = true; |
|
| 1481 | + $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1482 | + if ($fix) {
|
|
| 1483 | + if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
|
| 1484 | + $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1485 | + } else {
|
|
| 1486 | + $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1487 | + } |
|
| 1488 | + } |
|
| 1489 | + } |
|
| 1490 | + |
|
| 1491 | + //////////////////////////////// |
|
| 1492 | + /* Diagnose GD Home Page Ends */ |
|
| 1493 | + //////////////////////////////// |
|
| 1494 | + |
|
| 1495 | + ////////////////////////////////// |
|
| 1496 | + /* Diagnose Add Listing Page Starts */ |
|
| 1497 | + ////////////////////////////////// |
|
| 1498 | + $option_value = get_option('geodir_add_listing_page');
|
|
| 1499 | + $page = get_post($option_value); |
|
| 1500 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1501 | + |
|
| 1502 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1503 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1504 | + else {
|
|
| 1505 | + $is_error_during_diagnose = true; |
|
| 1506 | + $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1507 | + if ($fix) {
|
|
| 1508 | + if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
|
| 1509 | + $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1510 | + } else {
|
|
| 1511 | + $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1512 | + } |
|
| 1513 | + } |
|
| 1514 | + } |
|
| 1515 | + |
|
| 1516 | + //////////////////////////////// |
|
| 1517 | + /* Diagnose Add Listing Page Ends */ |
|
| 1518 | + //////////////////////////////// |
|
| 1519 | + |
|
| 1520 | + |
|
| 1521 | + ////////////////////////////////// |
|
| 1522 | + /* Diagnose Listing Preview Page Starts */ |
|
| 1523 | + ////////////////////////////////// |
|
| 1524 | + $option_value = get_option('geodir_preview_page');
|
|
| 1525 | + $page = get_post($option_value); |
|
| 1526 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1527 | + |
|
| 1528 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1529 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1530 | + else {
|
|
| 1531 | + $is_error_during_diagnose = true; |
|
| 1532 | + $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1533 | + if ($fix) {
|
|
| 1534 | + if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
|
| 1535 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1536 | + } else {
|
|
| 1537 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1538 | + } |
|
| 1539 | + } |
|
| 1540 | + } |
|
| 1541 | + |
|
| 1542 | + //////////////////////////////// |
|
| 1543 | + /* Diagnose Listing Preview Page Ends */ |
|
| 1544 | + //////////////////////////////// |
|
| 1545 | + |
|
| 1546 | + ////////////////////////////////// |
|
| 1547 | + /* Diagnose Listing Success Page Starts */ |
|
| 1548 | + ////////////////////////////////// |
|
| 1549 | + $option_value = get_option('geodir_success_page');
|
|
| 1550 | + $page = get_post($option_value); |
|
| 1551 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1552 | + |
|
| 1553 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1554 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1555 | + else {
|
|
| 1556 | + $is_error_during_diagnose = true; |
|
| 1557 | + $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1558 | + if ($fix) {
|
|
| 1559 | + if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
|
| 1560 | + $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1561 | + } else {
|
|
| 1562 | + $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1563 | + } |
|
| 1564 | + } |
|
| 1565 | + } |
|
| 1566 | + |
|
| 1567 | + //////////////////////////////// |
|
| 1568 | + /* Diagnose Listing Sucess Page Ends */ |
|
| 1569 | + //////////////////////////////// |
|
| 1570 | + |
|
| 1571 | + ////////////////////////////////// |
|
| 1572 | + /* Diagnose Info Page Starts */ |
|
| 1573 | + ////////////////////////////////// |
|
| 1574 | + $option_value = get_option('geodir_info_page');
|
|
| 1575 | + $page = get_post($option_value); |
|
| 1576 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1577 | + |
|
| 1578 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1579 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1580 | + else {
|
|
| 1581 | + $is_error_during_diagnose = true; |
|
| 1582 | + $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1583 | + if ($fix) {
|
|
| 1584 | + if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
|
| 1585 | + $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1586 | + } else {
|
|
| 1587 | + $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1588 | + } |
|
| 1589 | + } |
|
| 1590 | + } |
|
| 1591 | + |
|
| 1592 | + //////////////////////////////// |
|
| 1593 | + /* Diagnose Info Page Ends */ |
|
| 1594 | + //////////////////////////////// |
|
| 1595 | + |
|
| 1596 | + ////////////////////////////////// |
|
| 1597 | + /* Diagnose Login Page Starts */ |
|
| 1598 | + ////////////////////////////////// |
|
| 1599 | + $option_value = get_option('geodir_login_page');
|
|
| 1600 | + $page = get_post($option_value); |
|
| 1601 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1602 | + |
|
| 1603 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1604 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1605 | + else {
|
|
| 1606 | + $is_error_during_diagnose = true; |
|
| 1607 | + $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1608 | + if ($fix) {
|
|
| 1609 | + if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
|
| 1610 | + $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1611 | + } else {
|
|
| 1612 | + $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1613 | + } |
|
| 1614 | + } |
|
| 1615 | + } |
|
| 1616 | + |
|
| 1617 | + //////////////////////////////// |
|
| 1618 | + /* Diagnose Info Page Ends */ |
|
| 1619 | + //////////////////////////////// |
|
| 1620 | + |
|
| 1621 | + ////////////////////////////////// |
|
| 1622 | + /* Diagnose Location Page Starts */ |
|
| 1623 | + ////////////////////////////////// |
|
| 1624 | + $option_value = get_option('geodir_location_page');
|
|
| 1625 | + $page = get_post($option_value); |
|
| 1626 | + if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1627 | + |
|
| 1628 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1629 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1630 | + else {
|
|
| 1631 | + $is_error_during_diagnose = true; |
|
| 1632 | + $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1633 | + if ($fix) {
|
|
| 1634 | + if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
|
| 1635 | + $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1636 | + } else {
|
|
| 1637 | + $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1638 | + } |
|
| 1639 | + } |
|
| 1640 | + } |
|
| 1641 | + |
|
| 1642 | + //////////////////////////////// |
|
| 1643 | + /* Diagnose Location Page Ends */ |
|
| 1644 | + //////////////////////////////// |
|
| 1645 | + |
|
| 1646 | + $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1647 | + /** |
|
| 1648 | + * This action is called at the end of the GD Tools page check function. |
|
| 1649 | + * |
|
| 1650 | + * @since 1.5.2 |
|
| 1651 | + */ |
|
| 1652 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1653 | + |
|
| 1654 | + $output_str = $page_chk_arr['output_str']; |
|
| 1655 | + $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
|
| 1656 | + |
|
| 1657 | + if ($is_error_during_diagnose) {
|
|
| 1658 | + if ($fix) {
|
|
| 1659 | + flush_rewrite_rules(); |
|
| 1660 | + } |
|
| 1661 | + $info_div_class = "geodir_problem_info"; |
|
| 1662 | + $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1663 | + } else {
|
|
| 1664 | + $info_div_class = "geodir_noproblem_info"; |
|
| 1665 | + $fix_button_txt = ''; |
|
| 1666 | + } |
|
| 1667 | + echo "<ul class='$info_div_class'>"; |
|
| 1668 | + echo $output_str; |
|
| 1669 | + echo $fix_button_txt; |
|
| 1670 | + echo "</ul>"; |
|
| 1671 | 1671 | |
| 1672 | 1672 | } |
| 1673 | 1673 | |
@@ -1679,26 +1679,26 @@ discard block |
||
| 1679 | 1679 | * @global object $wpdb WordPress Database object. |
| 1680 | 1680 | */ |
| 1681 | 1681 | function geodir_diagnose_load_db_language() {
|
| 1682 | - global $wpdb; |
|
| 1682 | + global $wpdb; |
|
| 1683 | 1683 | |
| 1684 | 1684 | $is_error_during_diagnose = geodirectory_load_db_language(); |
| 1685 | 1685 | |
| 1686 | - $output_str = ''; |
|
| 1687 | - $fix_button_txt = ''; |
|
| 1686 | + $output_str = ''; |
|
| 1687 | + $fix_button_txt = ''; |
|
| 1688 | 1688 | |
| 1689 | - if ($is_error_during_diagnose) {
|
|
| 1690 | - $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>";
|
|
| 1689 | + if ($is_error_during_diagnose) {
|
|
| 1690 | + $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>";
|
|
| 1691 | 1691 | $info_div_class = "geodir_problem_info"; |
| 1692 | - } else {
|
|
| 1693 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1692 | + } else {
|
|
| 1693 | + $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1694 | 1694 | $info_div_class = "geodir_noproblem_info"; |
| 1695 | - $fix_button_txt = ''; |
|
| 1696 | - } |
|
| 1695 | + $fix_button_txt = ''; |
|
| 1696 | + } |
|
| 1697 | 1697 | |
| 1698 | 1698 | echo "<ul class='$info_div_class'>"; |
| 1699 | - echo $output_str; |
|
| 1700 | - echo $fix_button_txt; |
|
| 1701 | - echo "</ul>"; |
|
| 1699 | + echo $output_str; |
|
| 1700 | + echo $fix_button_txt; |
|
| 1701 | + echo "</ul>"; |
|
| 1702 | 1702 | |
| 1703 | 1703 | } |
| 1704 | 1704 | |
@@ -1729,23 +1729,23 @@ discard block |
||
| 1729 | 1729 | */ |
| 1730 | 1730 | function geodir_posts_clauses_request($clauses) |
| 1731 | 1731 | {
|
| 1732 | - global $wpdb, $wp_query, $plugin_prefix; |
|
| 1732 | + global $wpdb, $wp_query, $plugin_prefix; |
|
| 1733 | 1733 | |
| 1734 | - 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'])) {
|
|
| 1735 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1734 | + 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'])) {
|
|
| 1735 | + $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1736 | 1736 | |
| 1737 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1738 | - $clauses['join'] = $join; |
|
| 1737 | + $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1738 | + $clauses['join'] = $join; |
|
| 1739 | 1739 | |
| 1740 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1741 | - $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'; |
|
| 1742 | - $clauses['fields'] = $fields; |
|
| 1740 | + $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1741 | + $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'; |
|
| 1742 | + $clauses['fields'] = $fields; |
|
| 1743 | 1743 | |
| 1744 | - $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1745 | - $orderby = 'gd_expire ' . $order; |
|
| 1746 | - $clauses['orderby'] = $orderby; |
|
| 1747 | - } |
|
| 1748 | - return $clauses; |
|
| 1744 | + $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
|
| 1745 | + $orderby = 'gd_expire ' . $order; |
|
| 1746 | + $clauses['orderby'] = $orderby; |
|
| 1747 | + } |
|
| 1748 | + return $clauses; |
|
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | 1751 | |
@@ -1766,7 +1766,7 @@ discard block |
||
| 1766 | 1766 | */ |
| 1767 | 1767 | function gd_theme_switch_compat_check() |
| 1768 | 1768 | {
|
| 1769 | - gd_set_theme_compat(); |
|
| 1769 | + gd_set_theme_compat(); |
|
| 1770 | 1770 | } |
| 1771 | 1771 | |
| 1772 | 1772 | /** |
@@ -1779,27 +1779,27 @@ discard block |
||
| 1779 | 1779 | */ |
| 1780 | 1780 | function geodir_str_getcsv($input, $delimiter = ",", $enclosure = '"', $escape = "\\") |
| 1781 | 1781 | {
|
| 1782 | - if (function_exists('str_getcsv')) {
|
|
| 1783 | - $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1784 | - } else {
|
|
| 1785 | - global $current_user; |
|
| 1786 | - $upload_dir = wp_upload_dir(); |
|
| 1787 | - |
|
| 1788 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1789 | - $handle = fopen($file, 'w'); |
|
| 1790 | - |
|
| 1791 | - fwrite($handle, $input); |
|
| 1792 | - fclose($handle); |
|
| 1793 | - |
|
| 1794 | - $handle = fopen($file, 'rt'); |
|
| 1795 | - if (PHP_VERSION >= '5.3.0') {
|
|
| 1796 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1797 | - } else {
|
|
| 1798 | - $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1799 | - } |
|
| 1800 | - fclose($handle); |
|
| 1801 | - } |
|
| 1802 | - return $fgetcsv; |
|
| 1782 | + if (function_exists('str_getcsv')) {
|
|
| 1783 | + $fgetcsv = str_getcsv($input, $delimiter, $enclosure, $escape); |
|
| 1784 | + } else {
|
|
| 1785 | + global $current_user; |
|
| 1786 | + $upload_dir = wp_upload_dir(); |
|
| 1787 | + |
|
| 1788 | + $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1789 | + $handle = fopen($file, 'w'); |
|
| 1790 | + |
|
| 1791 | + fwrite($handle, $input); |
|
| 1792 | + fclose($handle); |
|
| 1793 | + |
|
| 1794 | + $handle = fopen($file, 'rt'); |
|
| 1795 | + if (PHP_VERSION >= '5.3.0') {
|
|
| 1796 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure, $escape); |
|
| 1797 | + } else {
|
|
| 1798 | + $fgetcsv = fgetcsv($handle, 0, $delimiter, $enclosure); |
|
| 1799 | + } |
|
| 1800 | + fclose($handle); |
|
| 1801 | + } |
|
| 1802 | + return $fgetcsv; |
|
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 1805 | add_action('wp_ajax_gdImportCsv', 'geodir_ajax_import_csv');
|
@@ -1814,375 +1814,375 @@ discard block |
||
| 1814 | 1814 | */ |
| 1815 | 1815 | function geodir_ajax_import_csv() |
| 1816 | 1816 | {
|
| 1817 | - error_reporting(0); // hide error to get clean json response |
|
| 1817 | + error_reporting(0); // hide error to get clean json response |
|
| 1818 | 1818 | |
| 1819 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1820 | - $uploads = wp_upload_dir(); |
|
| 1821 | - ini_set('auto_detect_line_endings', true);
|
|
| 1819 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1820 | + $uploads = wp_upload_dir(); |
|
| 1821 | + ini_set('auto_detect_line_endings', true);
|
|
| 1822 | 1822 | |
| 1823 | 1823 | $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses. |
| 1824 | 1824 | |
| 1825 | - $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1826 | - $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1827 | - $filename = $uploadedFile; |
|
| 1828 | - |
|
| 1829 | - $uploads = wp_upload_dir(); |
|
| 1830 | - $uploads_dir = $uploads['path']; |
|
| 1831 | - $image_name_arr = explode('/', $filename);
|
|
| 1832 | - $filename = end($image_name_arr); |
|
| 1833 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1834 | - $return = array(); |
|
| 1835 | - $return['file'] = $uploadedFile; |
|
| 1836 | - $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1837 | - |
|
| 1838 | - if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1839 | - $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1840 | - |
|
| 1841 | - if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1842 | - $return['error'] = NULL; |
|
| 1843 | - |
|
| 1844 | - $return['rows'] = 0; |
|
| 1845 | - |
|
| 1846 | - |
|
| 1847 | - |
|
| 1848 | - if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1849 | - while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1850 | - if(is_array($data) && !empty($data)) {
|
|
| 1851 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1852 | - } |
|
| 1853 | - } |
|
| 1854 | - fclose($handle); |
|
| 1855 | - $file = $file; |
|
| 1856 | - } |
|
| 1857 | - |
|
| 1858 | - |
|
| 1859 | - |
|
| 1860 | - $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1861 | - |
|
| 1862 | - |
|
| 1863 | - if (!$return['rows'] > 0) {
|
|
| 1864 | - $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 1865 | - } |
|
| 1866 | - } |
|
| 1867 | - } |
|
| 1868 | - if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 1869 | - echo json_encode($return); |
|
| 1870 | - exit; |
|
| 1871 | - } |
|
| 1872 | - |
|
| 1873 | - $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 1874 | - $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 1875 | - $count = $importlimit; |
|
| 1876 | - $requested_limit = $importlimit; |
|
| 1877 | - $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 1878 | - |
|
| 1879 | - if ($count < $totRecords) {
|
|
| 1880 | - $count = $tmpCnt + $count; |
|
| 1881 | - if ($count > $totRecords) {
|
|
| 1882 | - $count = $totRecords; |
|
| 1883 | - } |
|
| 1884 | - } else {
|
|
| 1885 | - $count = $totRecords; |
|
| 1886 | - } |
|
| 1887 | - |
|
| 1888 | - $total_records = 0; |
|
| 1889 | - $rowcount = 0; |
|
| 1890 | - $address_invalid = 0; |
|
| 1891 | - $blank_address = 0; |
|
| 1892 | - $upload_files = 0; |
|
| 1893 | - $invalid_post_type = 0; |
|
| 1894 | - $invalid_title = 0; |
|
| 1895 | - $customKeyarray = array(); |
|
| 1896 | - $gd_post_info = array(); |
|
| 1897 | - $post_location = array(); |
|
| 1898 | - $countpost = 0; |
|
| 1899 | - |
|
| 1900 | - if (!empty($file)) {
|
|
| 1901 | - $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 1902 | - $customKeyarray = $columns; |
|
| 1903 | - |
|
| 1904 | - if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 1905 | - $return['error'] = CSV_INVAILD_FILE; |
|
| 1906 | - echo json_encode($return); |
|
| 1907 | - exit; |
|
| 1908 | - } |
|
| 1909 | - |
|
| 1910 | - for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 1911 | - $current_index = $tmpCnt + $i; |
|
| 1912 | - if (isset($file[$current_index])) {
|
|
| 1913 | - $total_records++; |
|
| 1914 | - |
|
| 1915 | - $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 1916 | - $post_title = addslashes($buffer[0]); |
|
| 1917 | - $current_post_author = $buffer[1]; |
|
| 1918 | - $post_desc = addslashes($buffer[2]); |
|
| 1919 | - $post_cat = array(); |
|
| 1920 | - $catids_arr = array(); |
|
| 1921 | - $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 1922 | - |
|
| 1923 | - if ($post_cat) {
|
|
| 1924 | - $post_cat_arr = explode(',', $post_cat);
|
|
| 1925 | - |
|
| 1926 | - for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 1927 | - $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 1928 | - |
|
| 1929 | - if (!empty($buffer[5])) {
|
|
| 1930 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 1931 | - |
|
| 1932 | - $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 1933 | - |
|
| 1934 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 1935 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 1936 | - $catids_arr[] = $cat->slug; |
|
| 1937 | - } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 1938 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 1939 | - $catids_arr[] = $cat->slug; |
|
| 1940 | - } else {
|
|
| 1941 | - $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 1942 | - if ($ret && !is_wp_error($ret)) {
|
|
| 1943 | - if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 1944 | - $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 1945 | - $catids_arr[] = $cat->slug; |
|
| 1946 | - } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 1947 | - $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 1948 | - $catids_arr[] = $cat->slug; |
|
| 1949 | - } |
|
| 1950 | - } |
|
| 1951 | - } |
|
| 1952 | - } |
|
| 1953 | - } |
|
| 1954 | - } |
|
| 1955 | - } |
|
| 1956 | - |
|
| 1957 | - if (!$catids_arr) {
|
|
| 1958 | - $catids_arr[] = 1; |
|
| 1959 | - } |
|
| 1960 | - |
|
| 1961 | - $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 1962 | - |
|
| 1963 | - $tag_arr = ''; |
|
| 1964 | - if ($post_tags) {
|
|
| 1965 | - $tag_arr = explode(',', $post_tags);
|
|
| 1966 | - } |
|
| 1967 | - |
|
| 1968 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 1969 | - |
|
| 1970 | - $error = ''; |
|
| 1971 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 1972 | - $invalid_post_type++; |
|
| 1973 | - continue; |
|
| 1974 | - } |
|
| 1975 | - |
|
| 1976 | - if ($post_title != '') {
|
|
| 1977 | - $menu_order = 0; |
|
| 1978 | - $image_folder_name = 'uplaod/'; |
|
| 1979 | - |
|
| 1980 | - $image_names = array(); |
|
| 1981 | - |
|
| 1982 | - for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 1983 | - $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 1984 | - |
|
| 1985 | - if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 1986 | - $buffer[$c] = trim($buffer[$c]); |
|
| 1987 | - |
|
| 1988 | - if (!empty($buffer[$c])) {
|
|
| 1989 | - $image_names[] = $buffer[$c]; |
|
| 1990 | - } |
|
| 1991 | - } |
|
| 1992 | - |
|
| 1993 | - if ($customKeyarray[$c] == 'alive_days') {
|
|
| 1994 | - if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 1995 | - $submitdata = date('Y-m-d');
|
|
| 1996 | - |
|
| 1997 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 1998 | - } else {
|
|
| 1999 | - $gd_post_info['expire_date'] = 'Never'; |
|
| 2000 | - } |
|
| 2001 | - } |
|
| 2002 | - |
|
| 2003 | - if ($customKeyarray[$c] == 'post_city') {
|
|
| 2004 | - $post_city = addslashes($buffer[$c]); |
|
| 2005 | - } |
|
| 2006 | - |
|
| 2007 | - if ($customKeyarray[$c] == 'post_region') {
|
|
| 2008 | - $post_region = addslashes($buffer[$c]); |
|
| 2009 | - } |
|
| 2010 | - |
|
| 2011 | - if ($customKeyarray[$c] == 'post_country') {
|
|
| 2012 | - $post_country = addslashes($buffer[$c]); |
|
| 2013 | - } |
|
| 2014 | - |
|
| 2015 | - if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2016 | - $post_latitude = addslashes($buffer[$c]); |
|
| 2017 | - } |
|
| 2018 | - |
|
| 2019 | - if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2020 | - $post_longitude = addslashes($buffer[$c]); |
|
| 2021 | - } |
|
| 1825 | + $task = isset($_POST['task']) ? $_POST['task'] : ''; |
|
| 1826 | + $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL; |
|
| 1827 | + $filename = $uploadedFile; |
|
| 1828 | + |
|
| 1829 | + $uploads = wp_upload_dir(); |
|
| 1830 | + $uploads_dir = $uploads['path']; |
|
| 1831 | + $image_name_arr = explode('/', $filename);
|
|
| 1832 | + $filename = end($image_name_arr); |
|
| 1833 | + $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1834 | + $return = array(); |
|
| 1835 | + $return['file'] = $uploadedFile; |
|
| 1836 | + $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
|
| 1837 | + |
|
| 1838 | + if (is_file($target_path) && file_exists($target_path) && $uploadedFile) {
|
|
| 1839 | + $wp_filetype = wp_check_filetype_and_ext($target_path, $filename); |
|
| 1840 | + |
|
| 1841 | + if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
|
|
| 1842 | + $return['error'] = NULL; |
|
| 1843 | + |
|
| 1844 | + $return['rows'] = 0; |
|
| 1845 | + |
|
| 1846 | + |
|
| 1847 | + |
|
| 1848 | + if (($handle = fopen($target_path, "r")) !== FALSE) {
|
|
| 1849 | + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
|
| 1850 | + if(is_array($data) && !empty($data)) {
|
|
| 1851 | + $file[] = '"' . implode('","', $data) . '"';
|
|
| 1852 | + } |
|
| 1853 | + } |
|
| 1854 | + fclose($handle); |
|
| 1855 | + $file = $file; |
|
| 1856 | + } |
|
| 1857 | + |
|
| 1858 | + |
|
| 1859 | + |
|
| 1860 | + $return['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0; |
|
| 1861 | + |
|
| 1862 | + |
|
| 1863 | + if (!$return['rows'] > 0) {
|
|
| 1864 | + $return['error'] = __('No data found in csv file.', 'geodirectory');
|
|
| 1865 | + } |
|
| 1866 | + } |
|
| 1867 | + } |
|
| 1868 | + if ($task == 'prepare' || !empty($return['error'])) {
|
|
| 1869 | + echo json_encode($return); |
|
| 1870 | + exit; |
|
| 1871 | + } |
|
| 1872 | + |
|
| 1873 | + $totRecords = isset($_POST['gddata']['totRecords']) ? $_POST['gddata']['totRecords'] : NULL; |
|
| 1874 | + $importlimit = isset($_POST['gddata']['importlimit']) ? $_POST['gddata']['importlimit'] : 1; |
|
| 1875 | + $count = $importlimit; |
|
| 1876 | + $requested_limit = $importlimit; |
|
| 1877 | + $tmpCnt = isset($_POST['gddata']['tmpcount']) ? $_POST['gddata']['tmpcount'] : 0; |
|
| 1878 | + |
|
| 1879 | + if ($count < $totRecords) {
|
|
| 1880 | + $count = $tmpCnt + $count; |
|
| 1881 | + if ($count > $totRecords) {
|
|
| 1882 | + $count = $totRecords; |
|
| 1883 | + } |
|
| 1884 | + } else {
|
|
| 1885 | + $count = $totRecords; |
|
| 1886 | + } |
|
| 1887 | + |
|
| 1888 | + $total_records = 0; |
|
| 1889 | + $rowcount = 0; |
|
| 1890 | + $address_invalid = 0; |
|
| 1891 | + $blank_address = 0; |
|
| 1892 | + $upload_files = 0; |
|
| 1893 | + $invalid_post_type = 0; |
|
| 1894 | + $invalid_title = 0; |
|
| 1895 | + $customKeyarray = array(); |
|
| 1896 | + $gd_post_info = array(); |
|
| 1897 | + $post_location = array(); |
|
| 1898 | + $countpost = 0; |
|
| 1899 | + |
|
| 1900 | + if (!empty($file)) {
|
|
| 1901 | + $columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL; |
|
| 1902 | + $customKeyarray = $columns; |
|
| 1903 | + |
|
| 1904 | + if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
|
|
| 1905 | + $return['error'] = CSV_INVAILD_FILE; |
|
| 1906 | + echo json_encode($return); |
|
| 1907 | + exit; |
|
| 1908 | + } |
|
| 1909 | + |
|
| 1910 | + for ($i = 1; $i <= $importlimit; $i++) {
|
|
| 1911 | + $current_index = $tmpCnt + $i; |
|
| 1912 | + if (isset($file[$current_index])) {
|
|
| 1913 | + $total_records++; |
|
| 1914 | + |
|
| 1915 | + $buffer = geodir_str_getcsv($file[$current_index]); |
|
| 1916 | + $post_title = addslashes($buffer[0]); |
|
| 1917 | + $current_post_author = $buffer[1]; |
|
| 1918 | + $post_desc = addslashes($buffer[2]); |
|
| 1919 | + $post_cat = array(); |
|
| 1920 | + $catids_arr = array(); |
|
| 1921 | + $post_cat = trim($buffer[3]); // comma seperated category name |
|
| 1922 | + |
|
| 1923 | + if ($post_cat) {
|
|
| 1924 | + $post_cat_arr = explode(',', $post_cat);
|
|
| 1925 | + |
|
| 1926 | + for ($c = 0; $c < count($post_cat_arr); $c++) {
|
|
| 1927 | + $catid = wp_kses_normalize_entities(trim($post_cat_arr[$c])); |
|
| 1928 | + |
|
| 1929 | + if (!empty($buffer[5])) {
|
|
| 1930 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 1931 | + |
|
| 1932 | + $p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5])); |
|
| 1933 | + |
|
| 1934 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 1935 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 1936 | + $catids_arr[] = $cat->slug; |
|
| 1937 | + } else if (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 1938 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 1939 | + $catids_arr[] = $cat->slug; |
|
| 1940 | + } else {
|
|
| 1941 | + $ret = wp_insert_term($catid, $p_taxonomy[0]); |
|
| 1942 | + if ($ret && !is_wp_error($ret)) {
|
|
| 1943 | + if (get_term_by('name', $catid, $p_taxonomy[0])) {
|
|
| 1944 | + $cat = get_term_by('name', $catid, $p_taxonomy[0]);
|
|
| 1945 | + $catids_arr[] = $cat->slug; |
|
| 1946 | + } elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
|
|
| 1947 | + $cat = get_term_by('slug', $catid, $p_taxonomy[0]);
|
|
| 1948 | + $catids_arr[] = $cat->slug; |
|
| 1949 | + } |
|
| 1950 | + } |
|
| 1951 | + } |
|
| 1952 | + } |
|
| 1953 | + } |
|
| 1954 | + } |
|
| 1955 | + } |
|
| 1956 | + |
|
| 1957 | + if (!$catids_arr) {
|
|
| 1958 | + $catids_arr[] = 1; |
|
| 1959 | + } |
|
| 1960 | + |
|
| 1961 | + $post_tags = trim($buffer[4]); // comma seperated tags |
|
| 1962 | + |
|
| 1963 | + $tag_arr = ''; |
|
| 1964 | + if ($post_tags) {
|
|
| 1965 | + $tag_arr = explode(',', $post_tags);
|
|
| 1966 | + } |
|
| 1967 | + |
|
| 1968 | + $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 1969 | + |
|
| 1970 | + $error = ''; |
|
| 1971 | + if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 1972 | + $invalid_post_type++; |
|
| 1973 | + continue; |
|
| 1974 | + } |
|
| 1975 | + |
|
| 1976 | + if ($post_title != '') {
|
|
| 1977 | + $menu_order = 0; |
|
| 1978 | + $image_folder_name = 'uplaod/'; |
|
| 1979 | + |
|
| 1980 | + $image_names = array(); |
|
| 1981 | + |
|
| 1982 | + for ($c = 5; $c < count($customKeyarray); $c++) {
|
|
| 1983 | + $gd_post_info[$customKeyarray[$c]] = addslashes($buffer[$c]); |
|
| 1984 | + |
|
| 1985 | + if ($customKeyarray[$c] == 'IMAGE') {
|
|
| 1986 | + $buffer[$c] = trim($buffer[$c]); |
|
| 1987 | + |
|
| 1988 | + if (!empty($buffer[$c])) {
|
|
| 1989 | + $image_names[] = $buffer[$c]; |
|
| 1990 | + } |
|
| 1991 | + } |
|
| 1992 | + |
|
| 1993 | + if ($customKeyarray[$c] == 'alive_days') {
|
|
| 1994 | + if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
|
| 1995 | + $submitdata = date('Y-m-d');
|
|
| 1996 | + |
|
| 1997 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 1998 | + } else {
|
|
| 1999 | + $gd_post_info['expire_date'] = 'Never'; |
|
| 2000 | + } |
|
| 2001 | + } |
|
| 2002 | + |
|
| 2003 | + if ($customKeyarray[$c] == 'post_city') {
|
|
| 2004 | + $post_city = addslashes($buffer[$c]); |
|
| 2005 | + } |
|
| 2006 | + |
|
| 2007 | + if ($customKeyarray[$c] == 'post_region') {
|
|
| 2008 | + $post_region = addslashes($buffer[$c]); |
|
| 2009 | + } |
|
| 2010 | + |
|
| 2011 | + if ($customKeyarray[$c] == 'post_country') {
|
|
| 2012 | + $post_country = addslashes($buffer[$c]); |
|
| 2013 | + } |
|
| 2014 | + |
|
| 2015 | + if ($customKeyarray[$c] == 'post_latitude') {
|
|
| 2016 | + $post_latitude = addslashes($buffer[$c]); |
|
| 2017 | + } |
|
| 2018 | + |
|
| 2019 | + if ($customKeyarray[$c] == 'post_longitude') {
|
|
| 2020 | + $post_longitude = addslashes($buffer[$c]); |
|
| 2021 | + } |
|
| 2022 | 2022 | |
| 2023 | 2023 | // Post status |
| 2024 | 2024 | if ($customKeyarray[$c] == 'post_status') {
|
| 2025 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2026 | - } |
|
| 2027 | - } |
|
| 2028 | - |
|
| 2029 | - /* ================ before array create ============== */ |
|
| 2030 | - $location_result = geodir_get_default_location(); |
|
| 2031 | - if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2032 | - $blank_address++; |
|
| 2033 | - continue; |
|
| 2034 | - } else if ($location_result->location_id == 0) {
|
|
| 2035 | - if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2036 | - $address_invalid++; |
|
| 2037 | - continue; |
|
| 2038 | - } |
|
| 2039 | - } |
|
| 2025 | + $post_status = sanitize_key( $buffer[$c] ); |
|
| 2026 | + } |
|
| 2027 | + } |
|
| 2028 | + |
|
| 2029 | + /* ================ before array create ============== */ |
|
| 2030 | + $location_result = geodir_get_default_location(); |
|
| 2031 | + if ((!isset($gd_post_info['post_city']) || $gd_post_info['post_city'] == '') || (!isset($gd_post_info['post_region']) || $gd_post_info['post_region'] == '') || (!isset($gd_post_info['post_country']) || $gd_post_info['post_country'] == '') || (!isset($gd_post_info['post_address']) || $gd_post_info['post_address'] == '') || (!isset($gd_post_info['post_latitude']) || $gd_post_info['post_latitude'] == '') || (!isset($gd_post_info['post_longitude']) || $gd_post_info['post_longitude'] == '')) {
|
|
| 2032 | + $blank_address++; |
|
| 2033 | + continue; |
|
| 2034 | + } else if ($location_result->location_id == 0) {
|
|
| 2035 | + if ((geodir_strtolower($gd_post_info['post_city']) != geodir_strtolower($location_result->city)) || (geodir_strtolower($gd_post_info['post_region']) != geodir_strtolower($location_result->region)) || (geodir_strtolower($gd_post_info['post_country']) != geodir_strtolower($location_result->country))) {
|
|
| 2036 | + $address_invalid++; |
|
| 2037 | + continue; |
|
| 2038 | + } |
|
| 2039 | + } |
|
| 2040 | 2040 | |
| 2041 | 2041 | // Default post status |
| 2042 | 2042 | $default_status = 'publish'; |
| 2043 | 2043 | $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
| 2044 | 2044 | $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
| 2045 | 2045 | |
| 2046 | - $my_post['post_title'] = $post_title; |
|
| 2047 | - $my_post['post_content'] = $post_desc; |
|
| 2048 | - $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2049 | - $my_post['post_author'] = $current_post_author; |
|
| 2050 | - $my_post['post_status'] = $post_status; |
|
| 2051 | - $my_post['post_category'] = $catids_arr; |
|
| 2052 | - $my_post['post_tags'] = $tag_arr; |
|
| 2053 | - |
|
| 2054 | - $gd_post_info['post_tags'] = $tag_arr; |
|
| 2055 | - $gd_post_info['post_title'] = $post_title; |
|
| 2056 | - $gd_post_info['post_status'] = $post_status; |
|
| 2057 | - $gd_post_info['submit_time'] = time(); |
|
| 2058 | - $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2059 | - |
|
| 2060 | - $last_postid = wp_insert_post($my_post); |
|
| 2061 | - $countpost++; |
|
| 2062 | - |
|
| 2063 | - // Check if we need to save post location as new location |
|
| 2064 | - if ($location_result->location_id > 0) {
|
|
| 2065 | - if (isset($post_city) && isset($post_region)) {
|
|
| 2066 | - $request_info['post_location'] = array( |
|
| 2067 | - 'city' => $post_city, |
|
| 2068 | - 'region' => $post_region, |
|
| 2069 | - 'country' => $post_country, |
|
| 2070 | - 'geo_lat' => $post_latitude, |
|
| 2071 | - 'geo_lng' => $post_longitude |
|
| 2072 | - ); |
|
| 2073 | - |
|
| 2074 | - $post_location_info = $request_info['post_location']; |
|
| 2075 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2076 | - $post_location_id = $location_id; |
|
| 2077 | - } else {
|
|
| 2078 | - $post_location_id = 0; |
|
| 2079 | - } |
|
| 2080 | - } else {
|
|
| 2081 | - $post_location_id = 0; |
|
| 2082 | - } |
|
| 2083 | - |
|
| 2084 | - /* ------- get default package info ----- */ |
|
| 2085 | - $payment_info = array(); |
|
| 2086 | - $package_info = array(); |
|
| 2087 | - |
|
| 2088 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2089 | - $package_id = ''; |
|
| 2090 | - if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2091 | - $package_id = $gd_post_info['package_id']; |
|
| 2092 | - } |
|
| 2093 | - |
|
| 2094 | - if (!empty($package_info)) {
|
|
| 2095 | - $payment_info['package_id'] = $package_info['pid']; |
|
| 2096 | - |
|
| 2097 | - if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2098 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2099 | - } else {
|
|
| 2100 | - $payment_info['expire_date'] = 'Never'; |
|
| 2101 | - } |
|
| 2102 | - |
|
| 2103 | - $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2104 | - } |
|
| 2105 | - |
|
| 2106 | - $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2107 | - |
|
| 2108 | - $post_type = get_post_type($last_postid); |
|
| 2109 | - |
|
| 2110 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2111 | - |
|
| 2112 | - geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2113 | - |
|
| 2114 | - if (!empty($image_names)) {
|
|
| 2115 | - $upload_files++; |
|
| 2116 | - $menu_order = 1; |
|
| 2117 | - |
|
| 2118 | - foreach ($image_names as $image_name) {
|
|
| 2119 | - $img_name_arr = explode('.', $image_name);
|
|
| 2120 | - |
|
| 2121 | - $uploads = wp_upload_dir(); |
|
| 2122 | - $sub_dir = $uploads['subdir']; |
|
| 2123 | - |
|
| 2124 | - $arr_file_type = wp_check_filetype($image_name); |
|
| 2125 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 2126 | - |
|
| 2127 | - $attachment = array(); |
|
| 2128 | - $attachment['post_id'] = $last_postid; |
|
| 2129 | - $attachment['title'] = $img_name_arr[0]; |
|
| 2130 | - $attachment['content'] = ''; |
|
| 2131 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2132 | - $attachment['mime_type'] = $uploaded_file_type; |
|
| 2133 | - $attachment['menu_order'] = $menu_order; |
|
| 2134 | - $attachment['is_featured'] = 0; |
|
| 2135 | - |
|
| 2136 | - $attachment_set = ''; |
|
| 2137 | - |
|
| 2138 | - foreach ($attachment as $key => $val) {
|
|
| 2139 | - if ($val != '') |
|
| 2140 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2141 | - } |
|
| 2142 | - $attachment_set = trim($attachment_set, ", "); |
|
| 2143 | - |
|
| 2144 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2145 | - |
|
| 2146 | - if ($menu_order == 1) {
|
|
| 2147 | - $post_type = get_post_type($last_postid); |
|
| 2148 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2149 | - } |
|
| 2150 | - $menu_order++; |
|
| 2151 | - } |
|
| 2152 | - } |
|
| 2153 | - |
|
| 2154 | - $gd_post_info['package_id'] = $package_id; |
|
| 2155 | - |
|
| 2156 | - /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2157 | - do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2158 | - |
|
| 2159 | - if (!empty($buffer[5])) {
|
|
| 2160 | - if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2161 | - $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2162 | - wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2163 | - wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2164 | - |
|
| 2165 | - $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2166 | - $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2167 | - geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2168 | - } |
|
| 2169 | - } |
|
| 2170 | - } else {
|
|
| 2171 | - $invalid_title++; |
|
| 2172 | - } |
|
| 2173 | - } |
|
| 2174 | - } |
|
| 2175 | - } |
|
| 2176 | - $return['rowcount'] = $countpost; |
|
| 2177 | - $return['invalidcount'] = $address_invalid; |
|
| 2178 | - $return['blank_address'] = $blank_address; |
|
| 2179 | - $return['upload_files'] = $upload_files; |
|
| 2180 | - $return['invalid_post_type'] = $invalid_post_type; |
|
| 2181 | - $return['invalid_title'] = $invalid_title; |
|
| 2182 | - $return['total_records'] = $total_records; |
|
| 2183 | - |
|
| 2184 | - echo json_encode($return); |
|
| 2185 | - exit; |
|
| 2046 | + $my_post['post_title'] = $post_title; |
|
| 2047 | + $my_post['post_content'] = $post_desc; |
|
| 2048 | + $my_post['post_type'] = addslashes($buffer[5]); |
|
| 2049 | + $my_post['post_author'] = $current_post_author; |
|
| 2050 | + $my_post['post_status'] = $post_status; |
|
| 2051 | + $my_post['post_category'] = $catids_arr; |
|
| 2052 | + $my_post['post_tags'] = $tag_arr; |
|
| 2053 | + |
|
| 2054 | + $gd_post_info['post_tags'] = $tag_arr; |
|
| 2055 | + $gd_post_info['post_title'] = $post_title; |
|
| 2056 | + $gd_post_info['post_status'] = $post_status; |
|
| 2057 | + $gd_post_info['submit_time'] = time(); |
|
| 2058 | + $gd_post_info['submit_ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 2059 | + |
|
| 2060 | + $last_postid = wp_insert_post($my_post); |
|
| 2061 | + $countpost++; |
|
| 2062 | + |
|
| 2063 | + // Check if we need to save post location as new location |
|
| 2064 | + if ($location_result->location_id > 0) {
|
|
| 2065 | + if (isset($post_city) && isset($post_region)) {
|
|
| 2066 | + $request_info['post_location'] = array( |
|
| 2067 | + 'city' => $post_city, |
|
| 2068 | + 'region' => $post_region, |
|
| 2069 | + 'country' => $post_country, |
|
| 2070 | + 'geo_lat' => $post_latitude, |
|
| 2071 | + 'geo_lng' => $post_longitude |
|
| 2072 | + ); |
|
| 2073 | + |
|
| 2074 | + $post_location_info = $request_info['post_location']; |
|
| 2075 | + if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2076 | + $post_location_id = $location_id; |
|
| 2077 | + } else {
|
|
| 2078 | + $post_location_id = 0; |
|
| 2079 | + } |
|
| 2080 | + } else {
|
|
| 2081 | + $post_location_id = 0; |
|
| 2082 | + } |
|
| 2083 | + |
|
| 2084 | + /* ------- get default package info ----- */ |
|
| 2085 | + $payment_info = array(); |
|
| 2086 | + $package_info = array(); |
|
| 2087 | + |
|
| 2088 | + $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2089 | + $package_id = ''; |
|
| 2090 | + if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
|
| 2091 | + $package_id = $gd_post_info['package_id']; |
|
| 2092 | + } |
|
| 2093 | + |
|
| 2094 | + if (!empty($package_info)) {
|
|
| 2095 | + $payment_info['package_id'] = $package_info['pid']; |
|
| 2096 | + |
|
| 2097 | + if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
|
| 2098 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2099 | + } else {
|
|
| 2100 | + $payment_info['expire_date'] = 'Never'; |
|
| 2101 | + } |
|
| 2102 | + |
|
| 2103 | + $gd_post_info = array_merge($gd_post_info, $payment_info); |
|
| 2104 | + } |
|
| 2105 | + |
|
| 2106 | + $gd_post_info['post_location_id'] = $post_location_id; |
|
| 2107 | + |
|
| 2108 | + $post_type = get_post_type($last_postid); |
|
| 2109 | + |
|
| 2110 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2111 | + |
|
| 2112 | + geodir_save_post_info($last_postid, $gd_post_info); |
|
| 2113 | + |
|
| 2114 | + if (!empty($image_names)) {
|
|
| 2115 | + $upload_files++; |
|
| 2116 | + $menu_order = 1; |
|
| 2117 | + |
|
| 2118 | + foreach ($image_names as $image_name) {
|
|
| 2119 | + $img_name_arr = explode('.', $image_name);
|
|
| 2120 | + |
|
| 2121 | + $uploads = wp_upload_dir(); |
|
| 2122 | + $sub_dir = $uploads['subdir']; |
|
| 2123 | + |
|
| 2124 | + $arr_file_type = wp_check_filetype($image_name); |
|
| 2125 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 2126 | + |
|
| 2127 | + $attachment = array(); |
|
| 2128 | + $attachment['post_id'] = $last_postid; |
|
| 2129 | + $attachment['title'] = $img_name_arr[0]; |
|
| 2130 | + $attachment['content'] = ''; |
|
| 2131 | + $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2132 | + $attachment['mime_type'] = $uploaded_file_type; |
|
| 2133 | + $attachment['menu_order'] = $menu_order; |
|
| 2134 | + $attachment['is_featured'] = 0; |
|
| 2135 | + |
|
| 2136 | + $attachment_set = ''; |
|
| 2137 | + |
|
| 2138 | + foreach ($attachment as $key => $val) {
|
|
| 2139 | + if ($val != '') |
|
| 2140 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2141 | + } |
|
| 2142 | + $attachment_set = trim($attachment_set, ", "); |
|
| 2143 | + |
|
| 2144 | + $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2145 | + |
|
| 2146 | + if ($menu_order == 1) {
|
|
| 2147 | + $post_type = get_post_type($last_postid); |
|
| 2148 | + $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2149 | + } |
|
| 2150 | + $menu_order++; |
|
| 2151 | + } |
|
| 2152 | + } |
|
| 2153 | + |
|
| 2154 | + $gd_post_info['package_id'] = $package_id; |
|
| 2155 | + |
|
| 2156 | + /** This action is documented in geodirectory-functions/post-functions.php */ |
|
| 2157 | + do_action('geodir_after_save_listing', $last_postid, $gd_post_info);
|
|
| 2158 | + |
|
| 2159 | + if (!empty($buffer[5])) {
|
|
| 2160 | + if (in_array($buffer[5], geodir_get_posttypes())) {
|
|
| 2161 | + $taxonomies = geodir_get_posttype_info(addslashes($buffer[5])); |
|
| 2162 | + wp_set_object_terms($last_postid, $my_post['post_tags'], $taxonomy = $taxonomies['taxonomies'][1]); |
|
| 2163 | + wp_set_object_terms($last_postid, $my_post['post_category'], $taxonomy = $taxonomies['taxonomies'][0]); |
|
| 2164 | + |
|
| 2165 | + $post_default_category = isset($my_post['post_default_category']) ? $my_post['post_default_category'] : ''; |
|
| 2166 | + $post_category_str = isset($my_post['post_category_str']) ? $my_post['post_category_str'] : ''; |
|
| 2167 | + geodir_set_postcat_structure($last_postid, $taxonomy, $post_default_category, $post_category_str); |
|
| 2168 | + } |
|
| 2169 | + } |
|
| 2170 | + } else {
|
|
| 2171 | + $invalid_title++; |
|
| 2172 | + } |
|
| 2173 | + } |
|
| 2174 | + } |
|
| 2175 | + } |
|
| 2176 | + $return['rowcount'] = $countpost; |
|
| 2177 | + $return['invalidcount'] = $address_invalid; |
|
| 2178 | + $return['blank_address'] = $blank_address; |
|
| 2179 | + $return['upload_files'] = $upload_files; |
|
| 2180 | + $return['invalid_post_type'] = $invalid_post_type; |
|
| 2181 | + $return['invalid_title'] = $invalid_title; |
|
| 2182 | + $return['total_records'] = $total_records; |
|
| 2183 | + |
|
| 2184 | + echo json_encode($return); |
|
| 2185 | + exit; |
|
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | 2188 | // Add the tab in left sidebar menu fro import & export page. |
@@ -2202,9 +2202,9 @@ discard block |
||
| 2202 | 2202 | * @param $post object $post The post object of the post being saved. |
| 2203 | 2203 | */ |
| 2204 | 2204 | function geodir_update_location_prefix($post_id,$post){
|
| 2205 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2206 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2207 | - } |
|
| 2205 | + if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2206 | + update_option('geodir_location_prefix',$post->post_name);
|
|
| 2207 | + } |
|
| 2208 | 2208 | |
| 2209 | 2209 | } |
| 2210 | 2210 | |
@@ -2215,50 +2215,50 @@ discard block |
||
| 2215 | 2215 | function geodir_ga_callback(){
|
| 2216 | 2216 | |
| 2217 | 2217 | if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
| 2218 | - $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2219 | - $code = "code=".$_REQUEST['code']; |
|
| 2220 | - $grant_type = "&grant_type=authorization_code"; |
|
| 2221 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2222 | - $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2223 | - $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2218 | + $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
|
| 2219 | + $code = "code=".$_REQUEST['code']; |
|
| 2220 | + $grant_type = "&grant_type=authorization_code"; |
|
| 2221 | + $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2222 | + $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
|
| 2223 | + $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
|
| 2224 | 2224 | |
| 2225 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2225 | + $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2226 | 2226 | |
| 2227 | - $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2227 | + $response = wp_remote_post($auth_url, array('timeout' => 15));
|
|
| 2228 | 2228 | |
| 2229 | - //print_r($response); |
|
| 2229 | + //print_r($response); |
|
| 2230 | 2230 | |
| 2231 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2232 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2231 | + $error_msg = __('Something went wrong','geodirectory');
|
|
| 2232 | + if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2233 | 2233 | |
| 2234 | - $parts = json_decode($response['body']); |
|
| 2235 | - //print_r($parts); |
|
| 2236 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2237 | - else{
|
|
| 2234 | + $parts = json_decode($response['body']); |
|
| 2235 | + //print_r($parts); |
|
| 2236 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2237 | + else{
|
|
| 2238 | 2238 | |
| 2239 | - update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2240 | - update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2241 | - ?><script>window.close();</script><?php |
|
| 2242 | - } |
|
| 2239 | + update_option('gd_ga_access_token', $parts->access_token);
|
|
| 2240 | + update_option('gd_ga_refresh_token', $parts->refresh_token);
|
|
| 2241 | + ?><script>window.close();</script><?php |
|
| 2242 | + } |
|
| 2243 | 2243 | |
| 2244 | 2244 | |
| 2245 | - } |
|
| 2246 | - elseif(!empty($response['response']['code'])) {
|
|
| 2247 | - $parts = json_decode($response['body']); |
|
| 2245 | + } |
|
| 2246 | + elseif(!empty($response['response']['code'])) {
|
|
| 2247 | + $parts = json_decode($response['body']); |
|
| 2248 | 2248 | |
| 2249 | - if(isset($parts->error)){
|
|
| 2250 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2251 | - }else{
|
|
| 2252 | - echo $error_msg." - #2";exit; |
|
| 2253 | - } |
|
| 2249 | + if(isset($parts->error)){
|
|
| 2250 | + echo $parts->error.": ".$parts->error_description;exit; |
|
| 2251 | + }else{
|
|
| 2252 | + echo $error_msg." - #2";exit; |
|
| 2253 | + } |
|
| 2254 | 2254 | |
| 2255 | - }else{
|
|
| 2255 | + }else{
|
|
| 2256 | 2256 | |
| 2257 | - echo $error_msg." - #3";exit; |
|
| 2257 | + echo $error_msg." - #3";exit; |
|
| 2258 | 2258 | |
| 2259 | - } |
|
| 2259 | + } |
|
| 2260 | 2260 | } |
| 2261 | - exit; |
|
| 2261 | + exit; |
|
| 2262 | 2262 | } |
| 2263 | 2263 | |
| 2264 | 2264 | add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
@@ -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 | |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | // Filter-Payment-Manager |
| 230 | 230 | |
| 231 | - add_meta_box('geodir_post_images', $post_typename . ' ' . __('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 231 | + add_meta_box('geodir_post_images', $post_typename.' '.__('Attachments', 'geodirectory'), 'geodir_post_attachments', $geodir_posttype, 'side');
|
|
| 232 | 232 | |
| 233 | - add_meta_box('geodir_post_info', $post_typename . ' ' . __('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 233 | + add_meta_box('geodir_post_info', $post_typename.' '.__('Information', 'geodirectory'), 'geodir_post_info_setting', $geodir_posttype, 'normal', 'high');
|
|
| 234 | 234 | |
| 235 | 235 | // no need of this box as all fields moved to main information box |
| 236 | 236 | //add_meta_box( 'geodir_post_addinfo', $post_typename. ' ' .__('Additional Information' , 'geodirectory'), 'geodir_post_addinfo_setting', $geodir_posttype,'normal', 'high' );
|
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -add_action('save_post', 'geodir_post_information_save',10,2);
|
|
| 242 | +add_action('save_post', 'geodir_post_information_save', 10, 2);
|
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $gd_taxonomy = geodir_get_taxonomies($geodir_post_type); |
| 268 | 268 | |
| 269 | - if(!empty($gd_taxonomy)) {
|
|
| 269 | + if (!empty($gd_taxonomy)) {
|
|
| 270 | 270 | foreach ($gd_taxonomy as $tax) {
|
| 271 | 271 | |
| 272 | - remove_meta_box($tax . 'div', $geodir_post_type, 'normal'); |
|
| 272 | + remove_meta_box($tax.'div', $geodir_post_type, 'normal'); |
|
| 273 | 273 | |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | global $wpdb; |
| 419 | 419 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 420 | 420 | ?> |
| 421 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 421 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 422 | 422 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 423 | 423 | <ul> |
| 424 | 424 | <?php |
@@ -429,18 +429,18 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | $check_html_variable = $wpdb->get_var( |
| 431 | 431 | $wpdb->prepare( |
| 432 | - "SELECT htmlvar_name FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 432 | + "SELECT htmlvar_name FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name = %s AND post_type = %s AND field_type=%s", |
|
| 433 | 433 | array($val['htmlvar_name'], $listing_type, $val['field_type']) |
| 434 | 434 | ) |
| 435 | 435 | ); |
| 436 | 436 | |
| 437 | 437 | $display = $check_html_variable ? ' style="display:none;"' : ''; |
| 438 | 438 | ?> |
| 439 | - <li <?php echo $display;?>> |
|
| 440 | - <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>" |
|
| 441 | - title="<?php echo $val['site_title'];?>" |
|
| 442 | - class="gt-draggable-form-items gt-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>" |
|
| 443 | - href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a> |
|
| 439 | + <li <?php echo $display; ?>> |
|
| 440 | + <a id="gt-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>" |
|
| 441 | + title="<?php echo $val['site_title']; ?>" |
|
| 442 | + class="gt-draggable-form-items gt-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>" |
|
| 443 | + href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory'); ?></a> |
|
| 444 | 444 | </li> |
| 445 | 445 | <?php |
| 446 | 446 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | <?php |
| 466 | 466 | global $wpdb; |
| 467 | 467 | |
| 468 | - $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)));
|
|
| 468 | + $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)));
|
|
| 469 | 469 | |
| 470 | 470 | if (!empty($fields)) {
|
| 471 | 471 | foreach ($fields as $field) {
|
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | * @since 1.6.6 |
| 492 | 492 | * @package GeoDirectory |
| 493 | 493 | */ |
| 494 | -function geodir_custom_fields($post_type=''){
|
|
| 494 | +function geodir_custom_fields($post_type = '') {
|
|
| 495 | 495 | |
| 496 | 496 | $custom_fields = array( |
| 497 | 497 | 'text' => array( |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | 'name' => __('Test', 'geodirectory'),
|
| 593 | 593 | 'description' => __('Adds a test value bla bla', 'geodirectory'),
|
| 594 | 594 | 'defaults' => array( |
| 595 | - 'data_type' => '', // true to show options, or define the SQL data type. |
|
| 595 | + 'data_type' => '', // true to show options, or define the SQL data type. |
|
| 596 | 596 | 'admin_title' => 'testing yo', // pre-fill value |
| 597 | 597 | 'site_title' => '', // pre-fill value |
| 598 | 598 | ) |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * } |
| 634 | 634 | * @param string $post_type The post type requested. |
| 635 | 635 | */ |
| 636 | - return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
|
|
| 636 | + return apply_filters('geodir_custom_fields', $custom_fields, $post_type);
|
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -646,17 +646,17 @@ discard block |
||
| 646 | 646 | {
|
| 647 | 647 | $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place'; |
| 648 | 648 | ?> |
| 649 | - <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/> |
|
| 649 | + <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/> |
|
| 650 | 650 | <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/> |
| 651 | 651 | <ul class="full gd-cf-tooltip-wrap"> |
| 652 | 652 | <li> |
| 653 | 653 | <div class="gdcf-tooltip"> |
| 654 | - <?php _e('This adds a section separator with a title.', 'geodirectory');?>
|
|
| 654 | + <?php _e('This adds a section separator with a title.', 'geodirectory'); ?>
|
|
| 655 | 655 | </div> |
| 656 | 656 | <a id="gt-fieldset" class="gd-draggable-form-items gt-fieldset" href="javascript:void(0);"> |
| 657 | 657 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 658 | 658 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 659 | - <?php _e('Fieldset (section separator)', 'geodirectory');?>
|
|
| 659 | + <?php _e('Fieldset (section separator)', 'geodirectory'); ?>
|
|
| 660 | 660 | </a> |
| 661 | 661 | </li> |
| 662 | 662 | </ul> |
@@ -664,23 +664,23 @@ discard block |
||
| 664 | 664 | <?php |
| 665 | 665 | $cfs = geodir_custom_fields($listing_type); |
| 666 | 666 | |
| 667 | - foreach($cfs as $id=>$cf){
|
|
| 667 | + foreach ($cfs as $id=>$cf) {
|
|
| 668 | 668 | ?> |
| 669 | 669 | <li class="gd-cf-tooltip-wrap"> |
| 670 | 670 | <?php |
| 671 | - if(isset($cf['description']) && $cf['description']){
|
|
| 671 | + if (isset($cf['description']) && $cf['description']) {
|
|
| 672 | 672 | echo '<div class="gdcf-tooltip">'.$cf['description'].'</div>'; |
| 673 | 673 | }?> |
| 674 | 674 | |
| 675 | - <a id="gd-<?php echo $id;?>" data-field-type-key="<?php echo $id;?>" data-field-type="<?php echo $cf['field_type'];?>" class="gd-draggable-form-items <?php echo $cf['class'];?>" href="javascript:void(0);"> |
|
| 675 | + <a id="gd-<?php echo $id; ?>" data-field-type-key="<?php echo $id; ?>" data-field-type="<?php echo $cf['field_type']; ?>" class="gd-draggable-form-items <?php echo $cf['class']; ?>" href="javascript:void(0);"> |
|
| 676 | 676 | <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 677 | 677 | echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 678 | - }elseif(isset($cf['icon']) && $cf['icon'] ){
|
|
| 678 | + }elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 679 | 679 | echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 680 | - }else{
|
|
| 680 | + } else {
|
|
| 681 | 681 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 682 | 682 | }?> |
| 683 | - <?php echo $cf['name'];?> |
|
| 683 | + <?php echo $cf['name']; ?> |
|
| 684 | 684 | </a> |
| 685 | 685 | </li> |
| 686 | 686 | <?php |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | <ul class="core"> |
| 711 | 711 | <?php |
| 712 | 712 | global $wpdb; |
| 713 | - $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 713 | + $fields = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type = %s ORDER BY sort_order ASC", array($listing_type)));
|
|
| 714 | 714 | |
| 715 | 715 | if (!empty($fields)) {
|
| 716 | 716 | foreach ($fields as $field) {
|
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | $field_type_key = $field->field_type_key; |
| 721 | 721 | $field_ins_upd = 'display'; |
| 722 | 722 | |
| 723 | - geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd,$field_type_key); |
|
| 723 | + geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd, $field_type_key); |
|
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | ?></ul> |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | switch ($sub_tab) {
|
| 800 | 800 | case 'custom_fields': |
| 801 | - $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 801 | + $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
|
|
| 802 | 802 | break; |
| 803 | 803 | |
| 804 | 804 | case 'sorting_options': |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | switch ($sub_tab) {
|
| 854 | 854 | case 'custom_fields': |
| 855 | - $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
|
|
| 855 | + $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
|
|
| 856 | 856 | break; |
| 857 | 857 | |
| 858 | 858 | case 'sorting_options': |
@@ -879,8 +879,8 @@ discard block |
||
| 879 | 879 | |
| 880 | 880 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 881 | 881 | |
| 882 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 883 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 882 | + if ($wpdb->get_var("SHOW COLUMNS FROM ".$plugin_prefix."gd_place_detail WHERE field = 'categories'"))
|
|
| 883 | + $wpdb->query("ALTER TABLE `".$plugin_prefix."gd_place_detail` DROP `categories`");
|
|
| 884 | 884 | |
| 885 | 885 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 886 | 886 | |
@@ -908,14 +908,14 @@ discard block |
||
| 908 | 908 | case 'diagnosis' : |
| 909 | 909 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 910 | 910 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 911 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 911 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 912 | 912 | exit(); |
| 913 | 913 | break; |
| 914 | 914 | |
| 915 | 915 | case 'diagnosis-fix' : |
| 916 | 916 | if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
| 917 | 917 | $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
| 918 | - call_user_func('geodir_diagnose_' . $diagnose_this);
|
|
| 918 | + call_user_func('geodir_diagnose_'.$diagnose_this);
|
|
| 919 | 919 | exit(); |
| 920 | 920 | break; |
| 921 | 921 | } |
@@ -940,50 +940,50 @@ discard block |
||
| 940 | 940 | {
|
| 941 | 941 | global $wpdb; |
| 942 | 942 | //$filter_arr['output_str'] .='###'.$table.'###'; |
| 943 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0) {
|
|
| 944 | - $filter_arr['output_str'] .= "<li>" . __('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory') . "</li>";
|
|
| 943 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0) {
|
|
| 944 | + $filter_arr['output_str'] .= "<li>".__('ERROR: You did not follow instructions! Now you will need to contact support to manually fix things.', 'geodirectory')."</li>";
|
|
| 945 | 945 | $filter_arr['is_error_during_diagnose'] = true; |
| 946 | 946 | |
| 947 | - } elseif ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 948 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 947 | + } elseif ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 948 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s_ms_bak table found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 949 | 949 | $filter_arr['is_error_during_diagnose'] = true; |
| 950 | - $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>";
|
|
| 950 | + $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>";
|
|
| 951 | 951 | $filter_arr['is_error_during_diagnose'] = true; |
| 952 | 952 | |
| 953 | 953 | if ($fix) {
|
| 954 | - $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
|
|
| 955 | - $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
|
|
| 954 | + $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$table."_ms_bak"); // get backup table count
|
|
| 955 | + $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."$table"); // get new table count
|
|
| 956 | 956 | |
| 957 | 957 | if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
|
| 958 | 958 | //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
|
| 959 | 959 | |
| 960 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
|
|
| 960 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename bak table to new table
|
|
| 961 | 961 | |
| 962 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 963 | - $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
|
|
| 962 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 963 | + $filter_arr['output_str'] .= "<li>".__('-->FIXED: Renamed and backed up the tables', 'geodirectory')."</li>";
|
|
| 964 | 964 | } else {
|
| 965 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 965 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
|
| 969 | 969 | |
| 970 | - $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
|
|
| 971 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
|
|
| 970 | + $wpdb->query("RENAME TABLE ".$wpdb->prefix."$table TO ".$table."_ms_bak2"); // rename new table to bak2
|
|
| 971 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$wpdb->prefix."$table"); // rename bak table to new table
|
|
| 972 | 972 | |
| 973 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 974 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
|
|
| 973 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 974 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table)."</li>";
|
|
| 975 | 975 | } else {
|
| 976 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 976 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
|
| 980 | 980 | |
| 981 | - $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
|
|
| 981 | + $wpdb->query("RENAME TABLE ".$table."_ms_bak TO ".$table."_ms_bak2"); // rename ms_bak table to ms_bak2
|
|
| 982 | 982 | |
| 983 | - if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
|
|
| 984 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
|
|
| 983 | + if ($wpdb->query("SHOW TABLES LIKE '".$table."_ms_bak'") == 0) {
|
|
| 984 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table)."</li>";
|
|
| 985 | 985 | } else {
|
| 986 | - $filter_arr['output_str'] .= "<li>" . __('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory') . "</li>";
|
|
| 986 | + $filter_arr['output_str'] .= "<li>".__('-->PROBLEM: Failed to rename tables, please contact support.', 'geodirectory')."</li>";
|
|
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | } |
@@ -991,54 +991,54 @@ discard block |
||
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | |
| 994 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") > 0) {
|
|
| 995 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 994 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") > 0) {
|
|
| 995 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: Two %s tables found', 'geodirectory'), $tabel_name)."</li>";
|
|
| 996 | 996 | $filter_arr['is_error_during_diagnose'] = true; |
| 997 | 997 | |
| 998 | 998 | if ($fix) {
|
| 999 | 999 | if ($wpdb->get_var("SELECT COUNT(*) FROM $table") == 0) {// if first table is empty just delete it
|
| 1000 | 1000 | if ($wpdb->query("DROP TABLE IF EXISTS $table")) {
|
| 1001 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table) . "</li>";
|
|
| 1001 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $table)."</li>";
|
|
| 1002 | 1002 | } else {
|
| 1003 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table) . "</li>";
|
|
| 1003 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $table)."</li>";
|
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | - } 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
|
|
| 1007 | - if ($wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "$table")) {
|
|
| 1008 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1006 | + } 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
|
|
| 1007 | + if ($wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."$table")) {
|
|
| 1008 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Deleted table %s', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1009 | 1009 | } else {
|
| 1010 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix . $table) . "</li>";
|
|
| 1010 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->PROBLEM: Delete table %s failed, please try manual delete from DB', 'geodirectory'), $wpdb->prefix.$table)."</li>";
|
|
| 1011 | 1011 | } |
| 1012 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1013 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1012 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1013 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1014 | 1014 | } else {
|
| 1015 | - $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>";
|
|
| 1015 | + $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>";
|
|
| 1016 | 1016 | } |
| 1017 | 1017 | } else {// else rename the original table to _ms_bak
|
| 1018 | - if ($wpdb->query("RENAME TABLE $table TO " . $table . "_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1019 | - $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>";
|
|
| 1018 | + if ($wpdb->query("RENAME TABLE $table TO ".$table."_ms_bak") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1019 | + $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>";
|
|
| 1020 | 1020 | } else {
|
| 1021 | - $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>";
|
|
| 1021 | + $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>";
|
|
| 1022 | 1022 | } |
| 1023 | 1023 | } |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1027 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1026 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") > 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1027 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table not converted', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1028 | 1028 | $filter_arr['is_error_during_diagnose'] = true; |
| 1029 | 1029 | |
| 1030 | 1030 | if ($fix) {
|
| 1031 | 1031 | // if original table exists but new does not, rename |
| 1032 | - if ($wpdb->query("RENAME TABLE $table TO " . $wpdb->prefix . "$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1033 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix . $table) . "</li>";
|
|
| 1032 | + if ($wpdb->query("RENAME TABLE $table TO ".$wpdb->prefix."$table") || $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
|
|
| 1033 | + $filter_arr['output_str'] .= "<li>".sprintf(__('-->FIXED: Table %s renamed to %s', 'geodirectory'), $table, $wpdb->prefix.$table)."</li>";
|
|
| 1034 | 1034 | } else {
|
| 1035 | - $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>";
|
|
| 1035 | + $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>";
|
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | - } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") == 0) {
|
|
| 1041 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1040 | + } elseif ($wpdb->query("SHOW TABLES LIKE '$table'") == 0 && $wpdb->query("SHOW TABLES LIKE '".$wpdb->prefix."$table'") == 0) {
|
|
| 1041 | + $filter_arr['output_str'] .= "<li>".sprintf(__('ERROR: %s table does not exist', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1042 | 1042 | $filter_arr['is_error_during_diagnose'] = true; |
| 1043 | 1043 | |
| 1044 | 1044 | if ($fix) {
|
@@ -1052,11 +1052,11 @@ discard block |
||
| 1052 | 1052 | delete_option('geodir_custom_posts_db_version');
|
| 1053 | 1053 | delete_option('geodir_reviewratings_db_version');
|
| 1054 | 1054 | delete_option('geodiradvancesearch_db_version');
|
| 1055 | - $filter_arr['output_str'] .= "<li>" . __('-->TRY: Please refresh page to run table install functions', 'geodirectory') . "</li>";
|
|
| 1055 | + $filter_arr['output_str'] .= "<li>".__('-->TRY: Please refresh page to run table install functions', 'geodirectory')."</li>";
|
|
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | } else {
|
| 1059 | - $filter_arr['output_str'] .= "<li>" . sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name) . "</li>";
|
|
| 1059 | + $filter_arr['output_str'] .= "<li>".sprintf(__('%s table converted correctly', 'geodirectory'), $tabel_name)."</li>";
|
|
| 1060 | 1060 | } |
| 1061 | 1061 | return $filter_arr; |
| 1062 | 1062 | } |
@@ -1085,23 +1085,23 @@ discard block |
||
| 1085 | 1085 | if (!empty($all_postypes)) {
|
| 1086 | 1086 | foreach ($all_postypes as $key) {
|
| 1087 | 1087 | // update each GD CPT |
| 1088 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
|
|
| 1088 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d");
|
|
| 1089 | 1089 | |
| 1090 | 1090 | if (!empty($posts)) {
|
| 1091 | 1091 | |
| 1092 | 1092 | foreach ($posts as $p) {
|
| 1093 | 1093 | $p->post_type = $key; |
| 1094 | - $raw_tags = wp_get_object_terms($p->post_id, $p->post_type . '_tags', array('fields' => 'names'));
|
|
| 1094 | + $raw_tags = wp_get_object_terms($p->post_id, $p->post_type.'_tags', array('fields' => 'names'));
|
|
| 1095 | 1095 | if (empty($raw_tags)) {
|
| 1096 | 1096 | $post_tags = ''; |
| 1097 | 1097 | } else {
|
| 1098 | 1098 | $post_tags = implode(",", $raw_tags);
|
| 1099 | 1099 | } |
| 1100 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1101 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1100 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1101 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET post_tags=%s WHERE post_id =%d", $post_tags, $p->post_id));
|
|
| 1102 | 1102 | |
| 1103 | 1103 | } |
| 1104 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1104 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | |
| 1111 | 1111 | if ($is_error_during_diagnose) {
|
| 1112 | 1112 | $info_div_class = "geodir_problem_info"; |
| 1113 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1113 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1114 | 1114 | } else {
|
| 1115 | 1115 | $info_div_class = "geodir_noproblem_info"; |
| 1116 | 1116 | $fix_button_txt = ''; |
@@ -1147,29 +1147,29 @@ discard block |
||
| 1147 | 1147 | if (!empty($all_postypes)) {
|
| 1148 | 1148 | foreach ($all_postypes as $key) {
|
| 1149 | 1149 | // update each GD CTP |
| 1150 | - $posts = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d WHERE d." . $key . "category='' ");
|
|
| 1150 | + $posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."geodir_".$key."_detail d WHERE d.".$key."category='' ");
|
|
| 1151 | 1151 | |
| 1152 | 1152 | if (!empty($posts)) {
|
| 1153 | 1153 | |
| 1154 | 1154 | foreach ($posts as $p) {
|
| 1155 | 1155 | $p->post_type = $key; |
| 1156 | - $raw_cats = wp_get_object_terms($p->post_id, $p->post_type . 'category', array('fields' => 'ids'));
|
|
| 1156 | + $raw_cats = wp_get_object_terms($p->post_id, $p->post_type.'category', array('fields' => 'ids'));
|
|
| 1157 | 1157 | |
| 1158 | 1158 | if (empty($raw_cats)) {
|
| 1159 | 1159 | $post_categories = get_post_meta($p->post_id, 'post_categories', true); |
| 1160 | 1160 | |
| 1161 | - if (!empty($post_categories) && !empty($post_categories[$p->post_type . 'category'])) {
|
|
| 1162 | - $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
|
|
| 1163 | - foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
|
|
| 1161 | + if (!empty($post_categories) && !empty($post_categories[$p->post_type.'category'])) {
|
|
| 1162 | + $post_categories[$p->post_type.'category'] = str_replace("d:", "", $post_categories[$p->post_type.'category']);
|
|
| 1163 | + foreach (explode(",", $post_categories[$p->post_type.'category']) as $cat_part) {
|
|
| 1164 | 1164 | if (is_numeric($cat_part)) {
|
| 1165 | - $raw_cats[] = (int)$cat_part; |
|
| 1165 | + $raw_cats[] = (int) $cat_part; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | if (!empty($raw_cats)) {
|
| 1172 | - $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type . 'category'); |
|
| 1172 | + $term_taxonomy_ids = wp_set_object_terms($p->post_id, $raw_cats, $p->post_type.'category'); |
|
| 1173 | 1173 | |
| 1174 | 1174 | } |
| 1175 | 1175 | |
@@ -1179,14 +1179,14 @@ discard block |
||
| 1179 | 1179 | if (empty($raw_cats)) {
|
| 1180 | 1180 | $post_cats = ''; |
| 1181 | 1181 | } else {
|
| 1182 | - $post_cats = ',' . implode(",", $raw_cats) . ',';
|
|
| 1182 | + $post_cats = ','.implode(",", $raw_cats).',';
|
|
| 1183 | 1183 | } |
| 1184 | - $tablename = $plugin_prefix . $p->post_type . '_detail'; |
|
| 1185 | - $wpdb->query($wpdb->prepare("UPDATE " . $tablename . " SET " . $p->post_type . "category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1184 | + $tablename = $plugin_prefix.$p->post_type.'_detail'; |
|
| 1185 | + $wpdb->query($wpdb->prepare("UPDATE ".$tablename." SET ".$p->post_type."category=%s WHERE post_id =%d", $post_cats, $p->post_id));
|
|
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | 1188 | } |
| 1189 | - $output_str .= "<li>" . $key . __(': Done', 'geodirectory') . "</li>";
|
|
| 1189 | + $output_str .= "<li>".$key.__(': Done', 'geodirectory')."</li>";
|
|
| 1190 | 1190 | |
| 1191 | 1191 | } |
| 1192 | 1192 | |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | |
| 1195 | 1195 | if ($is_error_during_diagnose) {
|
| 1196 | 1196 | $info_div_class = "geodir_problem_info"; |
| 1197 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1197 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1198 | 1198 | } else {
|
| 1199 | 1199 | $info_div_class = "geodir_noproblem_info"; |
| 1200 | 1200 | $fix_button_txt = ''; |
@@ -1247,15 +1247,15 @@ discard block |
||
| 1247 | 1247 | if (!empty($ver_arr)) {
|
| 1248 | 1248 | foreach ($ver_arr as $key => $val) {
|
| 1249 | 1249 | if (delete_option($val)) {
|
| 1250 | - $output_str .= "<li>" . $key . __(' Version: Deleted', 'geodirectory') . "</li>";
|
|
| 1250 | + $output_str .= "<li>".$key.__(' Version: Deleted', 'geodirectory')."</li>";
|
|
| 1251 | 1251 | } else {
|
| 1252 | - $output_str .= "<li>" . $key . __(' Version: Not Found', 'geodirectory') . "</li>";
|
|
| 1252 | + $output_str .= "<li>".$key.__(' Version: Not Found', 'geodirectory')."</li>";
|
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | 1257 | if ($output_str) {
|
| 1258 | - $output_str .= "<li><strong>" . __(' Upgrade/install scripts will run on next page reload.', 'geodirectory') . "</strong></li>";
|
|
| 1258 | + $output_str .= "<li><strong>".__(' Upgrade/install scripts will run on next page reload.', 'geodirectory')."</strong></li>";
|
|
| 1259 | 1259 | } |
| 1260 | 1260 | |
| 1261 | 1261 | } |
@@ -1292,43 +1292,43 @@ discard block |
||
| 1292 | 1292 | $output_str = ''; |
| 1293 | 1293 | |
| 1294 | 1294 | // check review locations |
| 1295 | - 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")) {
|
|
| 1296 | - $output_str .= "<li>" . __('Review locations missing or broken', 'geodirectory') . "</li>";
|
|
| 1295 | + 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")) {
|
|
| 1296 | + $output_str .= "<li>".__('Review locations missing or broken', 'geodirectory')."</li>";
|
|
| 1297 | 1297 | $is_error_during_diagnose = true; |
| 1298 | 1298 | |
| 1299 | 1299 | if ($fix) {
|
| 1300 | 1300 | if (geodir_fix_review_location()) {
|
| 1301 | - $output_str .= "<li><strong>" . __('-->FIXED: Review locations fixed', 'geodirectory') . "</strong></li>";
|
|
| 1301 | + $output_str .= "<li><strong>".__('-->FIXED: Review locations fixed', 'geodirectory')."</strong></li>";
|
|
| 1302 | 1302 | } else {
|
| 1303 | - $output_str .= "<li><strong>" . __('-->FAILED: Review locations fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1303 | + $output_str .= "<li><strong>".__('-->FAILED: Review locations fix failed', 'geodirectory')."</strong></li>";
|
|
| 1304 | 1304 | } |
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | } else {
|
| 1308 | - $output_str .= "<li>" . __('Review locations ok', 'geodirectory') . "</li>";
|
|
| 1308 | + $output_str .= "<li>".__('Review locations ok', 'geodirectory')."</li>";
|
|
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | 1311 | // check review content |
| 1312 | - if ($wpdb->get_results("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_content IS NULL")) {
|
|
| 1313 | - $output_str .= "<li>" . __('Review content missing or broken', 'geodirectory') . "</li>";
|
|
| 1312 | + if ($wpdb->get_results("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_content IS NULL")) {
|
|
| 1313 | + $output_str .= "<li>".__('Review content missing or broken', 'geodirectory')."</li>";
|
|
| 1314 | 1314 | $is_error_during_diagnose = true; |
| 1315 | 1315 | |
| 1316 | 1316 | if ($fix) {
|
| 1317 | 1317 | if (geodir_fix_review_content()) {
|
| 1318 | - $output_str .= "<li><strong>" . __('-->FIXED: Review content fixed', 'geodirectory') . "</strong></li>";
|
|
| 1318 | + $output_str .= "<li><strong>".__('-->FIXED: Review content fixed', 'geodirectory')."</strong></li>";
|
|
| 1319 | 1319 | } else {
|
| 1320 | - $output_str .= "<li><strong>" . __('-->FAILED: Review content fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1320 | + $output_str .= "<li><strong>".__('-->FAILED: Review content fix failed', 'geodirectory')."</strong></li>";
|
|
| 1321 | 1321 | } |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | } else {
|
| 1325 | - $output_str .= "<li>" . __('Review content ok', 'geodirectory') . "</li>";
|
|
| 1325 | + $output_str .= "<li>".__('Review content ok', 'geodirectory')."</li>";
|
|
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | |
| 1329 | 1329 | if ($is_error_during_diagnose) {
|
| 1330 | 1330 | $info_div_class = "geodir_problem_info"; |
| 1331 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1331 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='ratings' />";
|
|
| 1332 | 1332 | } else {
|
| 1333 | 1333 | $info_div_class = "geodir_noproblem_info"; |
| 1334 | 1334 | $fix_button_txt = ''; |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | |
| 1393 | 1393 | if ($is_error_during_diagnose) {
|
| 1394 | 1394 | $info_div_class = "geodir_problem_info"; |
| 1395 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1395 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='multisite_conversion' />";
|
|
| 1396 | 1396 | } else {
|
| 1397 | 1397 | $info_div_class = "geodir_noproblem_info"; |
| 1398 | 1398 | $fix_button_txt = ''; |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | else {
|
| 1427 | 1427 | $page_found = $wpdb->get_var( |
| 1428 | 1428 | $wpdb->prepare( |
| 1429 | - "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", |
|
| 1429 | + "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;", |
|
| 1430 | 1430 | array($slug) |
| 1431 | 1431 | ) |
| 1432 | 1432 | ); |
@@ -1472,18 +1472,18 @@ discard block |
||
| 1472 | 1472 | ////////////////////////////////// |
| 1473 | 1473 | $option_value = get_option('geodir_home_page');
|
| 1474 | 1474 | $page = get_post($option_value); |
| 1475 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1475 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1476 | 1476 | |
| 1477 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1478 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1477 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1478 | + $output_str .= "<li>".__('GD Home page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1479 | 1479 | else {
|
| 1480 | 1480 | $is_error_during_diagnose = true; |
| 1481 | - $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1481 | + $output_str .= "<li><strong>".__('GD Home page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1482 | 1482 | if ($fix) {
|
| 1483 | 1483 | if (geodir_fix_virtual_page('gd-home', __('GD Home page', 'geodirectory'), $page_found, 'geodir_home_page')) {
|
| 1484 | - $output_str .= "<li><strong>" . __('-->FIXED: GD Home page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1484 | + $output_str .= "<li><strong>".__('-->FIXED: GD Home page fixed', 'geodirectory')."</strong></li>";
|
|
| 1485 | 1485 | } else {
|
| 1486 | - $output_str .= "<li><strong>" . __('-->FAILED: GD Home page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1486 | + $output_str .= "<li><strong>".__('-->FAILED: GD Home page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1487 | 1487 | } |
| 1488 | 1488 | } |
| 1489 | 1489 | } |
@@ -1497,18 +1497,18 @@ discard block |
||
| 1497 | 1497 | ////////////////////////////////// |
| 1498 | 1498 | $option_value = get_option('geodir_add_listing_page');
|
| 1499 | 1499 | $page = get_post($option_value); |
| 1500 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1500 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1501 | 1501 | |
| 1502 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1503 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1502 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1503 | + $output_str .= "<li>".__('Add Listing page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1504 | 1504 | else {
|
| 1505 | 1505 | $is_error_during_diagnose = true; |
| 1506 | - $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1506 | + $output_str .= "<li><strong>".__('Add Listing page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1507 | 1507 | if ($fix) {
|
| 1508 | 1508 | if (geodir_fix_virtual_page('add-listing', __('Add Listing', 'geodirectory'), $page_found, 'geodir_add_listing_page')) {
|
| 1509 | - $output_str .= "<li><strong>" . __('-->FIXED: Add Listing page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1509 | + $output_str .= "<li><strong>".__('-->FIXED: Add Listing page fixed', 'geodirectory')."</strong></li>";
|
|
| 1510 | 1510 | } else {
|
| 1511 | - $output_str .= "<li><strong>" . __('-->FAILED: Add Listing page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1511 | + $output_str .= "<li><strong>".__('-->FAILED: Add Listing page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1512 | 1512 | } |
| 1513 | 1513 | } |
| 1514 | 1514 | } |
@@ -1523,18 +1523,18 @@ discard block |
||
| 1523 | 1523 | ////////////////////////////////// |
| 1524 | 1524 | $option_value = get_option('geodir_preview_page');
|
| 1525 | 1525 | $page = get_post($option_value); |
| 1526 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1526 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1527 | 1527 | |
| 1528 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1529 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1528 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1529 | + $output_str .= "<li>".__('Listing Preview page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1530 | 1530 | else {
|
| 1531 | 1531 | $is_error_during_diagnose = true; |
| 1532 | - $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1532 | + $output_str .= "<li><strong>".__('Listing Preview page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1533 | 1533 | if ($fix) {
|
| 1534 | 1534 | if (geodir_fix_virtual_page('listing-preview', __('Listing Preview', 'geodirectory'), $page_found, 'geodir_preview_page')) {
|
| 1535 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Preview page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1535 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Preview page fixed', 'geodirectory')."</strong></li>";
|
|
| 1536 | 1536 | } else {
|
| 1537 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Preview page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1537 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Preview page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1538 | 1538 | } |
| 1539 | 1539 | } |
| 1540 | 1540 | } |
@@ -1548,18 +1548,18 @@ discard block |
||
| 1548 | 1548 | ////////////////////////////////// |
| 1549 | 1549 | $option_value = get_option('geodir_success_page');
|
| 1550 | 1550 | $page = get_post($option_value); |
| 1551 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1551 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1552 | 1552 | |
| 1553 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1554 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1553 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1554 | + $output_str .= "<li>".__('Listing Success page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1555 | 1555 | else {
|
| 1556 | 1556 | $is_error_during_diagnose = true; |
| 1557 | - $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1557 | + $output_str .= "<li><strong>".__('Listing Success page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1558 | 1558 | if ($fix) {
|
| 1559 | 1559 | if (geodir_fix_virtual_page('listing-success', __('Listing Success', 'geodirectory'), $page_found, 'geodir_success_page')) {
|
| 1560 | - $output_str .= "<li><strong>" . __('-->FIXED: Listing Success page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1560 | + $output_str .= "<li><strong>".__('-->FIXED: Listing Success page fixed', 'geodirectory')."</strong></li>";
|
|
| 1561 | 1561 | } else {
|
| 1562 | - $output_str .= "<li><strong>" . __('-->FAILED: Listing Success page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1562 | + $output_str .= "<li><strong>".__('-->FAILED: Listing Success page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1563 | 1563 | } |
| 1564 | 1564 | } |
| 1565 | 1565 | } |
@@ -1573,18 +1573,18 @@ discard block |
||
| 1573 | 1573 | ////////////////////////////////// |
| 1574 | 1574 | $option_value = get_option('geodir_info_page');
|
| 1575 | 1575 | $page = get_post($option_value); |
| 1576 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1576 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1577 | 1577 | |
| 1578 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1579 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1578 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1579 | + $output_str .= "<li>".__('Info page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1580 | 1580 | else {
|
| 1581 | 1581 | $is_error_during_diagnose = true; |
| 1582 | - $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1582 | + $output_str .= "<li><strong>".__('Info page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1583 | 1583 | if ($fix) {
|
| 1584 | 1584 | if (geodir_fix_virtual_page('gd-info', __('Info', 'geodirectory'), $page_found, 'geodir_info_page')) {
|
| 1585 | - $output_str .= "<li><strong>" . __('-->FIXED: Info page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1585 | + $output_str .= "<li><strong>".__('-->FIXED: Info page fixed', 'geodirectory')."</strong></li>";
|
|
| 1586 | 1586 | } else {
|
| 1587 | - $output_str .= "<li><strong>" . __('-->FAILED: Info page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1587 | + $output_str .= "<li><strong>".__('-->FAILED: Info page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1588 | 1588 | } |
| 1589 | 1589 | } |
| 1590 | 1590 | } |
@@ -1598,18 +1598,18 @@ discard block |
||
| 1598 | 1598 | ////////////////////////////////// |
| 1599 | 1599 | $option_value = get_option('geodir_login_page');
|
| 1600 | 1600 | $page = get_post($option_value); |
| 1601 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1601 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1602 | 1602 | |
| 1603 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1604 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1603 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1604 | + $output_str .= "<li>".__('Login page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1605 | 1605 | else {
|
| 1606 | 1606 | $is_error_during_diagnose = true; |
| 1607 | - $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1607 | + $output_str .= "<li><strong>".__('Login page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1608 | 1608 | if ($fix) {
|
| 1609 | 1609 | if (geodir_fix_virtual_page('gd-login', __('Login', 'geodirectory'), $page_found, 'geodir_login_page')) {
|
| 1610 | - $output_str .= "<li><strong>" . __('-->FIXED: Login page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1610 | + $output_str .= "<li><strong>".__('-->FIXED: Login page fixed', 'geodirectory')."</strong></li>";
|
|
| 1611 | 1611 | } else {
|
| 1612 | - $output_str .= "<li><strong>" . __('-->FAILED: Login page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1612 | + $output_str .= "<li><strong>".__('-->FAILED: Login page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1613 | 1613 | } |
| 1614 | 1614 | } |
| 1615 | 1615 | } |
@@ -1623,18 +1623,18 @@ discard block |
||
| 1623 | 1623 | ////////////////////////////////// |
| 1624 | 1624 | $option_value = get_option('geodir_location_page');
|
| 1625 | 1625 | $page = get_post($option_value); |
| 1626 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1626 | + if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
|
|
| 1627 | 1627 | |
| 1628 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1629 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1628 | + if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish') |
|
| 1629 | + $output_str .= "<li>".__('Location page exists with proper setting.', 'geodirectory')."</li>";
|
|
| 1630 | 1630 | else {
|
| 1631 | 1631 | $is_error_during_diagnose = true; |
| 1632 | - $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
|
| 1632 | + $output_str .= "<li><strong>".__('Location page is missing.', 'geodirectory')."</strong></li>";
|
|
| 1633 | 1633 | if ($fix) {
|
| 1634 | 1634 | if (geodir_fix_virtual_page('location', __('Location', 'geodirectory'), $page_found, 'geodir_location_page')) {
|
| 1635 | - $output_str .= "<li><strong>" . __('-->FIXED: Location page fixed', 'geodirectory') . "</strong></li>";
|
|
| 1635 | + $output_str .= "<li><strong>".__('-->FIXED: Location page fixed', 'geodirectory')."</strong></li>";
|
|
| 1636 | 1636 | } else {
|
| 1637 | - $output_str .= "<li><strong>" . __('-->FAILED: Location page fix failed', 'geodirectory') . "</strong></li>";
|
|
| 1637 | + $output_str .= "<li><strong>".__('-->FAILED: Location page fix failed', 'geodirectory')."</strong></li>";
|
|
| 1638 | 1638 | } |
| 1639 | 1639 | } |
| 1640 | 1640 | } |
@@ -1643,13 +1643,13 @@ discard block |
||
| 1643 | 1643 | /* Diagnose Location Page Ends */ |
| 1644 | 1644 | //////////////////////////////// |
| 1645 | 1645 | |
| 1646 | - $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
|
|
| 1646 | + $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
|
|
| 1647 | 1647 | /** |
| 1648 | 1648 | * This action is called at the end of the GD Tools page check function. |
| 1649 | 1649 | * |
| 1650 | 1650 | * @since 1.5.2 |
| 1651 | 1651 | */ |
| 1652 | - $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
|
|
| 1652 | + $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
|
|
| 1653 | 1653 | |
| 1654 | 1654 | $output_str = $page_chk_arr['output_str']; |
| 1655 | 1655 | $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose']; |
@@ -1659,7 +1659,7 @@ discard block |
||
| 1659 | 1659 | flush_rewrite_rules(); |
| 1660 | 1660 | } |
| 1661 | 1661 | $info_div_class = "geodir_problem_info"; |
| 1662 | - $fix_button_txt = "<input type='button' value='" . __('Fix', 'geodirectory') . "' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1662 | + $fix_button_txt = "<input type='button' value='".__('Fix', 'geodirectory')."' class='button-primary geodir_fix_diagnostic_issue' data-diagnostic-issue='default_pages' />";
|
|
| 1663 | 1663 | } else {
|
| 1664 | 1664 | $info_div_class = "geodir_noproblem_info"; |
| 1665 | 1665 | $fix_button_txt = ''; |
@@ -1687,10 +1687,10 @@ discard block |
||
| 1687 | 1687 | $fix_button_txt = ''; |
| 1688 | 1688 | |
| 1689 | 1689 | if ($is_error_during_diagnose) {
|
| 1690 | - $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>";
|
|
| 1690 | + $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>";
|
|
| 1691 | 1691 | $info_div_class = "geodir_problem_info"; |
| 1692 | 1692 | } else {
|
| 1693 | - $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
|
|
| 1693 | + $output_str .= "<li>".__('Load custom fields in to file for translation: ok', 'geodirectory')."</li>";
|
|
| 1694 | 1694 | $info_div_class = "geodir_noproblem_info"; |
| 1695 | 1695 | $fix_button_txt = ''; |
| 1696 | 1696 | } |
@@ -1732,17 +1732,17 @@ discard block |
||
| 1732 | 1732 | global $wpdb, $wp_query, $plugin_prefix; |
| 1733 | 1733 | |
| 1734 | 1734 | 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'])) {
|
| 1735 | - $table = $plugin_prefix . $wp_query->query_vars['post_type'] . '_detail'; |
|
| 1735 | + $table = $plugin_prefix.$wp_query->query_vars['post_type'].'_detail'; |
|
| 1736 | 1736 | |
| 1737 | - $join = $clauses['join'] . ' INNER JOIN ' . $table . ' AS gd_posts ON (gd_posts.post_id = ' . $wpdb->posts . '.ID)'; |
|
| 1737 | + $join = $clauses['join'].' INNER JOIN '.$table.' AS gd_posts ON (gd_posts.post_id = '.$wpdb->posts.'.ID)'; |
|
| 1738 | 1738 | $clauses['join'] = $join; |
| 1739 | 1739 | |
| 1740 | - $fields = $clauses['fields'] != '' ? $clauses['fields'] . ', ' : ''; |
|
| 1740 | + $fields = $clauses['fields'] != '' ? $clauses['fields'].', ' : ''; |
|
| 1741 | 1741 | $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'; |
| 1742 | 1742 | $clauses['fields'] = $fields; |
| 1743 | 1743 | |
| 1744 | 1744 | $order = !empty($wp_query->query_vars['order']) ? $wp_query->query_vars['order'] : 'ASC'; |
| 1745 | - $orderby = 'gd_expire ' . $order; |
|
| 1745 | + $orderby = 'gd_expire '.$order; |
|
| 1746 | 1746 | $clauses['orderby'] = $orderby; |
| 1747 | 1747 | } |
| 1748 | 1748 | return $clauses; |
@@ -1785,7 +1785,7 @@ discard block |
||
| 1785 | 1785 | global $current_user; |
| 1786 | 1786 | $upload_dir = wp_upload_dir(); |
| 1787 | 1787 | |
| 1788 | - $file = $upload_dir['path'] . '/temp_' . $current_user->data->ID . '/geodir_tmp.csv'; |
|
| 1788 | + $file = $upload_dir['path'].'/temp_'.$current_user->data->ID.'/geodir_tmp.csv'; |
|
| 1789 | 1789 | $handle = fopen($file, 'w'); |
| 1790 | 1790 | |
| 1791 | 1791 | fwrite($handle, $input); |
@@ -1830,7 +1830,7 @@ discard block |
||
| 1830 | 1830 | $uploads_dir = $uploads['path']; |
| 1831 | 1831 | $image_name_arr = explode('/', $filename);
|
| 1832 | 1832 | $filename = end($image_name_arr); |
| 1833 | - $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1833 | + $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1834 | 1834 | $return = array(); |
| 1835 | 1835 | $return['file'] = $uploadedFile; |
| 1836 | 1836 | $return['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
|
@@ -1847,8 +1847,8 @@ discard block |
||
| 1847 | 1847 | |
| 1848 | 1848 | if (($handle = fopen($target_path, "r")) !== FALSE) {
|
| 1849 | 1849 | while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
|
| 1850 | - if(is_array($data) && !empty($data)) {
|
|
| 1851 | - $file[] = '"' . implode('","', $data) . '"';
|
|
| 1850 | + if (is_array($data) && !empty($data)) {
|
|
| 1851 | + $file[] = '"'.implode('","', $data).'"';
|
|
| 1852 | 1852 | } |
| 1853 | 1853 | } |
| 1854 | 1854 | fclose($handle); |
@@ -1965,10 +1965,10 @@ discard block |
||
| 1965 | 1965 | $tag_arr = explode(',', $post_tags);
|
| 1966 | 1966 | } |
| 1967 | 1967 | |
| 1968 | - $table = $plugin_prefix . $buffer[5] . '_detail'; // check table in database |
|
| 1968 | + $table = $plugin_prefix.$buffer[5].'_detail'; // check table in database |
|
| 1969 | 1969 | |
| 1970 | 1970 | $error = ''; |
| 1971 | - if ($wpdb->get_var("SHOW TABLES LIKE '" . $table . "'") != $table) {
|
|
| 1971 | + if ($wpdb->get_var("SHOW TABLES LIKE '".$table."'") != $table) {
|
|
| 1972 | 1972 | $invalid_post_type++; |
| 1973 | 1973 | continue; |
| 1974 | 1974 | } |
@@ -1994,7 +1994,7 @@ discard block |
||
| 1994 | 1994 | if ($buffer[$c] != '0' && $buffer[$c] != '') {
|
| 1995 | 1995 | $submitdata = date('Y-m-d');
|
| 1996 | 1996 | |
| 1997 | - $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata . "+" . addslashes($buffer[$c]) . " days"));
|
|
| 1997 | + $gd_post_info['expire_date'] = date('Y-m-d', strtotime($submitdata."+".addslashes($buffer[$c])." days"));
|
|
| 1998 | 1998 | } else {
|
| 1999 | 1999 | $gd_post_info['expire_date'] = 'Never'; |
| 2000 | 2000 | } |
@@ -2022,7 +2022,7 @@ discard block |
||
| 2022 | 2022 | |
| 2023 | 2023 | // Post status |
| 2024 | 2024 | if ($customKeyarray[$c] == 'post_status') {
|
| 2025 | - $post_status = sanitize_key( $buffer[$c] ); |
|
| 2025 | + $post_status = sanitize_key($buffer[$c]); |
|
| 2026 | 2026 | } |
| 2027 | 2027 | } |
| 2028 | 2028 | |
@@ -2040,8 +2040,8 @@ discard block |
||
| 2040 | 2040 | |
| 2041 | 2041 | // Default post status |
| 2042 | 2042 | $default_status = 'publish'; |
| 2043 | - $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status; |
|
| 2044 | - $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status; |
|
| 2043 | + $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status; |
|
| 2044 | + $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status; |
|
| 2045 | 2045 | |
| 2046 | 2046 | $my_post['post_title'] = $post_title; |
| 2047 | 2047 | $my_post['post_content'] = $post_desc; |
@@ -2085,7 +2085,7 @@ discard block |
||
| 2085 | 2085 | $payment_info = array(); |
| 2086 | 2086 | $package_info = array(); |
| 2087 | 2087 | |
| 2088 | - $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2088 | + $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]); |
|
| 2089 | 2089 | $package_id = ''; |
| 2090 | 2090 | if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
|
| 2091 | 2091 | $package_id = $gd_post_info['package_id']; |
@@ -2095,7 +2095,7 @@ discard block |
||
| 2095 | 2095 | $payment_info['package_id'] = $package_info['pid']; |
| 2096 | 2096 | |
| 2097 | 2097 | if (isset($package_info['alive_days']) && $package_info['alive_days'] != 0) {
|
| 2098 | - $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['alive_days'] . " days"));
|
|
| 2098 | + $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['alive_days']." days"));
|
|
| 2099 | 2099 | } else {
|
| 2100 | 2100 | $payment_info['expire_date'] = 'Never'; |
| 2101 | 2101 | } |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | |
| 2108 | 2108 | $post_type = get_post_type($last_postid); |
| 2109 | 2109 | |
| 2110 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 2110 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 2111 | 2111 | |
| 2112 | 2112 | geodir_save_post_info($last_postid, $gd_post_info); |
| 2113 | 2113 | |
@@ -2128,7 +2128,7 @@ discard block |
||
| 2128 | 2128 | $attachment['post_id'] = $last_postid; |
| 2129 | 2129 | $attachment['title'] = $img_name_arr[0]; |
| 2130 | 2130 | $attachment['content'] = ''; |
| 2131 | - $attachment['file'] = $sub_dir . '/' . $image_name; |
|
| 2131 | + $attachment['file'] = $sub_dir.'/'.$image_name; |
|
| 2132 | 2132 | $attachment['mime_type'] = $uploaded_file_type; |
| 2133 | 2133 | $attachment['menu_order'] = $menu_order; |
| 2134 | 2134 | $attachment['is_featured'] = 0; |
@@ -2137,15 +2137,15 @@ discard block |
||
| 2137 | 2137 | |
| 2138 | 2138 | foreach ($attachment as $key => $val) {
|
| 2139 | 2139 | if ($val != '') |
| 2140 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2140 | + $attachment_set .= $key." = '".$val."', "; |
|
| 2141 | 2141 | } |
| 2142 | 2142 | $attachment_set = trim($attachment_set, ", "); |
| 2143 | 2143 | |
| 2144 | - $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
|
|
| 2144 | + $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
|
|
| 2145 | 2145 | |
| 2146 | 2146 | if ($menu_order == 1) {
|
| 2147 | 2147 | $post_type = get_post_type($last_postid); |
| 2148 | - $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($sub_dir . '/' . $image_name, $last_postid)));
|
|
| 2148 | + $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($sub_dir.'/'.$image_name, $last_postid)));
|
|
| 2149 | 2149 | } |
| 2150 | 2150 | $menu_order++; |
| 2151 | 2151 | } |
@@ -2186,11 +2186,11 @@ discard block |
||
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | 2188 | // Add the tab in left sidebar menu fro import & export page. |
| 2189 | -add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 ); |
|
| 2189 | +add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
|
|
| 2190 | 2190 | |
| 2191 | 2191 | // Handle ajax request for import/export. |
| 2192 | -add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' ); |
|
| 2193 | -add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' ); |
|
| 2192 | +add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
|
|
| 2193 | +add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
|
|
| 2194 | 2194 | |
| 2195 | 2195 | |
| 2196 | 2196 | /** |
@@ -2201,40 +2201,40 @@ discard block |
||
| 2201 | 2201 | * @param $post_id int $post_id The post ID of the post being saved. |
| 2202 | 2202 | * @param $post object $post The post object of the post being saved. |
| 2203 | 2203 | */ |
| 2204 | -function geodir_update_location_prefix($post_id,$post){
|
|
| 2205 | - if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
|
|
| 2206 | - update_option('geodir_location_prefix',$post->post_name);
|
|
| 2204 | +function geodir_update_location_prefix($post_id, $post) {
|
|
| 2205 | + if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
|
|
| 2206 | + update_option('geodir_location_prefix', $post->post_name);
|
|
| 2207 | 2207 | } |
| 2208 | 2208 | |
| 2209 | 2209 | } |
| 2210 | 2210 | |
| 2211 | -add_action('save_post', 'geodir_update_location_prefix',10,2);
|
|
| 2211 | +add_action('save_post', 'geodir_update_location_prefix', 10, 2);
|
|
| 2212 | 2212 | |
| 2213 | -add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' ); |
|
| 2213 | +add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
|
|
| 2214 | 2214 | |
| 2215 | -function geodir_ga_callback(){
|
|
| 2215 | +function geodir_ga_callback() {
|
|
| 2216 | 2216 | |
| 2217 | -if(isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2217 | +if (isset($_REQUEST['code']) && $_REQUEST['code']) {
|
|
| 2218 | 2218 | $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?"; |
| 2219 | 2219 | $code = "code=".$_REQUEST['code']; |
| 2220 | 2220 | $grant_type = "&grant_type=authorization_code"; |
| 2221 | - $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
|
|
| 2221 | + $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
|
|
| 2222 | 2222 | $client_id = "&client_id=".get_option('geodir_ga_client_id');
|
| 2223 | 2223 | $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
|
| 2224 | 2224 | |
| 2225 | - $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id .$client_secret; |
|
| 2225 | + $auth_url = $oAuthURL.$code.$redirect_uri.$grant_type.$client_id.$client_secret; |
|
| 2226 | 2226 | |
| 2227 | 2227 | $response = wp_remote_post($auth_url, array('timeout' => 15));
|
| 2228 | 2228 | |
| 2229 | 2229 | //print_r($response); |
| 2230 | 2230 | |
| 2231 | - $error_msg = __('Something went wrong','geodirectory');
|
|
| 2232 | - if(!empty($response['response']['code']) && $response['response']['code']==200){
|
|
| 2231 | + $error_msg = __('Something went wrong', 'geodirectory');
|
|
| 2232 | + if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
|
|
| 2233 | 2233 | |
| 2234 | 2234 | $parts = json_decode($response['body']); |
| 2235 | 2235 | //print_r($parts); |
| 2236 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2237 | - else{
|
|
| 2236 | + if (!isset($parts->access_token)) {echo $error_msg." - #1"; exit; }
|
|
| 2237 | + else {
|
|
| 2238 | 2238 | |
| 2239 | 2239 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2240 | 2240 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2243,25 +2243,25 @@ discard block |
||
| 2243 | 2243 | |
| 2244 | 2244 | |
| 2245 | 2245 | } |
| 2246 | - elseif(!empty($response['response']['code'])) {
|
|
| 2246 | + elseif (!empty($response['response']['code'])) {
|
|
| 2247 | 2247 | $parts = json_decode($response['body']); |
| 2248 | 2248 | |
| 2249 | - if(isset($parts->error)){
|
|
| 2250 | - echo $parts->error.": ".$parts->error_description;exit; |
|
| 2251 | - }else{
|
|
| 2252 | - echo $error_msg." - #2";exit; |
|
| 2249 | + if (isset($parts->error)) {
|
|
| 2250 | + echo $parts->error.": ".$parts->error_description; exit; |
|
| 2251 | + } else {
|
|
| 2252 | + echo $error_msg." - #2"; exit; |
|
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | - }else{
|
|
| 2255 | + } else {
|
|
| 2256 | 2256 | |
| 2257 | - echo $error_msg." - #3";exit; |
|
| 2257 | + echo $error_msg." - #3"; exit; |
|
| 2258 | 2258 | |
| 2259 | 2259 | } |
| 2260 | 2260 | } |
| 2261 | 2261 | exit; |
| 2262 | 2262 | } |
| 2263 | 2263 | |
| 2264 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
| 2264 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
|
|
| 2265 | 2265 | |
| 2266 | 2266 | if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
|
| 2267 | 2267 | add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
|
@@ -24,8 +24,11 @@ discard block |
||
| 24 | 24 | global $current_tab; |
| 25 | 25 | geodir_redirect_to_admin_panel_on_installed(); |
| 26 | 26 | $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 27 | + if (!(isset($_REQUEST['action']))) { |
|
| 28 | + // this will avoid Ajax requests |
|
| 29 | + geodir_handle_option_form_submit($current_tab); |
|
| 30 | + } |
|
| 31 | + // located in admin function.php |
|
| 29 | 32 | /** |
| 30 | 33 | * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
| 31 | 34 | * |
@@ -316,8 +319,9 @@ discard block |
||
| 316 | 319 | if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
| 317 | 320 | |
| 318 | 321 | foreach ($notification as $key => $value) {
|
| 319 | - if ($value['type'] == 'textarea') |
|
| 320 | - $notification[$key]['type'] = 'editor'; |
|
| 322 | + if ($value['type'] == 'textarea') { |
|
| 323 | + $notification[$key]['type'] = 'editor'; |
|
| 324 | + } |
|
| 321 | 325 | } |
| 322 | 326 | |
| 323 | 327 | } |
@@ -342,8 +346,9 @@ discard block |
||
| 342 | 346 | if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
| 343 | 347 | |
| 344 | 348 | foreach ($design_setting as $key => $value) {
|
| 345 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 346 | - $design_setting[$key]['type'] = 'editor'; |
|
| 349 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') { |
|
| 350 | + $design_setting[$key]['type'] = 'editor'; |
|
| 351 | + } |
|
| 347 | 352 | } |
| 348 | 353 | |
| 349 | 354 | } |
@@ -675,9 +680,9 @@ discard block |
||
| 675 | 680 | <a id="gd-<?php echo $id;?>" data-field-type-key="<?php echo $id;?>" data-field-type="<?php echo $cf['field_type'];?>" class="gd-draggable-form-items <?php echo $cf['class'];?>" href="javascript:void(0);"> |
| 676 | 681 | <?php if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 677 | 682 | echo '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 678 | - }elseif(isset($cf['icon']) && $cf['icon'] ){
|
|
| 683 | + } elseif(isset($cf['icon']) && $cf['icon'] ){
|
|
| 679 | 684 | echo '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 680 | - }else{
|
|
| 685 | + } else{
|
|
| 681 | 686 | echo '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 682 | 687 | }?> |
| 683 | 688 | <?php echo $cf['name'];?> |
@@ -879,8 +884,9 @@ discard block |
||
| 879 | 884 | |
| 880 | 885 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 881 | 886 | |
| 882 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 883 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 887 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) { |
|
| 888 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
| 889 | + } |
|
| 884 | 890 | |
| 885 | 891 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 886 | 892 | |
@@ -906,15 +912,17 @@ discard block |
||
| 906 | 912 | $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
| 907 | 913 | switch ($geodir_admin_ajax_action) {
|
| 908 | 914 | case 'diagnosis' : |
| 909 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 910 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 915 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 916 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 917 | + } |
|
| 911 | 918 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 912 | 919 | exit(); |
| 913 | 920 | break; |
| 914 | 921 | |
| 915 | 922 | case 'diagnosis-fix' : |
| 916 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 917 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 923 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 924 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 925 | + } |
|
| 918 | 926 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 919 | 927 | exit(); |
| 920 | 928 | break; |
@@ -1472,11 +1480,11 @@ discard block |
||
| 1472 | 1480 | ////////////////////////////////// |
| 1473 | 1481 | $option_value = get_option('geodir_home_page');
|
| 1474 | 1482 | $page = get_post($option_value); |
| 1475 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1483 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1476 | 1484 | |
| 1477 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1478 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1479 | - else {
|
|
| 1485 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1486 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1487 | + } else {
|
|
| 1480 | 1488 | $is_error_during_diagnose = true; |
| 1481 | 1489 | $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
| 1482 | 1490 | if ($fix) {
|
@@ -1497,11 +1505,11 @@ discard block |
||
| 1497 | 1505 | ////////////////////////////////// |
| 1498 | 1506 | $option_value = get_option('geodir_add_listing_page');
|
| 1499 | 1507 | $page = get_post($option_value); |
| 1500 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1508 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1501 | 1509 | |
| 1502 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1503 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1504 | - else {
|
|
| 1510 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1511 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1512 | + } else {
|
|
| 1505 | 1513 | $is_error_during_diagnose = true; |
| 1506 | 1514 | $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
| 1507 | 1515 | if ($fix) {
|
@@ -1523,11 +1531,11 @@ discard block |
||
| 1523 | 1531 | ////////////////////////////////// |
| 1524 | 1532 | $option_value = get_option('geodir_preview_page');
|
| 1525 | 1533 | $page = get_post($option_value); |
| 1526 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1534 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1527 | 1535 | |
| 1528 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1529 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1530 | - else {
|
|
| 1536 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1537 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1538 | + } else {
|
|
| 1531 | 1539 | $is_error_during_diagnose = true; |
| 1532 | 1540 | $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
| 1533 | 1541 | if ($fix) {
|
@@ -1548,11 +1556,11 @@ discard block |
||
| 1548 | 1556 | ////////////////////////////////// |
| 1549 | 1557 | $option_value = get_option('geodir_success_page');
|
| 1550 | 1558 | $page = get_post($option_value); |
| 1551 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1559 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1552 | 1560 | |
| 1553 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1554 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1555 | - else {
|
|
| 1561 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1562 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1563 | + } else {
|
|
| 1556 | 1564 | $is_error_during_diagnose = true; |
| 1557 | 1565 | $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
| 1558 | 1566 | if ($fix) {
|
@@ -1573,11 +1581,11 @@ discard block |
||
| 1573 | 1581 | ////////////////////////////////// |
| 1574 | 1582 | $option_value = get_option('geodir_info_page');
|
| 1575 | 1583 | $page = get_post($option_value); |
| 1576 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1584 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1577 | 1585 | |
| 1578 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1579 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1580 | - else {
|
|
| 1586 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1587 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1588 | + } else {
|
|
| 1581 | 1589 | $is_error_during_diagnose = true; |
| 1582 | 1590 | $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
| 1583 | 1591 | if ($fix) {
|
@@ -1598,11 +1606,11 @@ discard block |
||
| 1598 | 1606 | ////////////////////////////////// |
| 1599 | 1607 | $option_value = get_option('geodir_login_page');
|
| 1600 | 1608 | $page = get_post($option_value); |
| 1601 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1609 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1602 | 1610 | |
| 1603 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1604 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1605 | - else {
|
|
| 1611 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1612 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1613 | + } else {
|
|
| 1606 | 1614 | $is_error_during_diagnose = true; |
| 1607 | 1615 | $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
| 1608 | 1616 | if ($fix) {
|
@@ -1623,11 +1631,11 @@ discard block |
||
| 1623 | 1631 | ////////////////////////////////// |
| 1624 | 1632 | $option_value = get_option('geodir_location_page');
|
| 1625 | 1633 | $page = get_post($option_value); |
| 1626 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1634 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1627 | 1635 | |
| 1628 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1629 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1630 | - else {
|
|
| 1636 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1637 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1638 | + } else {
|
|
| 1631 | 1639 | $is_error_during_diagnose = true; |
| 1632 | 1640 | $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
| 1633 | 1641 | if ($fix) {
|
@@ -2072,8 +2080,9 @@ discard block |
||
| 2072 | 2080 | ); |
| 2073 | 2081 | |
| 2074 | 2082 | $post_location_info = $request_info['post_location']; |
| 2075 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 2076 | - $post_location_id = $location_id; |
|
| 2083 | + if ($location_id = geodir_add_new_location($post_location_info)) { |
|
| 2084 | + $post_location_id = $location_id; |
|
| 2085 | + } |
|
| 2077 | 2086 | } else {
|
| 2078 | 2087 | $post_location_id = 0; |
| 2079 | 2088 | } |
@@ -2136,8 +2145,9 @@ discard block |
||
| 2136 | 2145 | $attachment_set = ''; |
| 2137 | 2146 | |
| 2138 | 2147 | foreach ($attachment as $key => $val) {
|
| 2139 | - if ($val != '') |
|
| 2140 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2148 | + if ($val != '') { |
|
| 2149 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 2150 | + } |
|
| 2141 | 2151 | } |
| 2142 | 2152 | $attachment_set = trim($attachment_set, ", "); |
| 2143 | 2153 | |
@@ -2233,8 +2243,7 @@ discard block |
||
| 2233 | 2243 | |
| 2234 | 2244 | $parts = json_decode($response['body']); |
| 2235 | 2245 | //print_r($parts); |
| 2236 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2237 | - else{
|
|
| 2246 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
|
|
| 2238 | 2247 | |
| 2239 | 2248 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2240 | 2249 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2242,17 +2251,16 @@ discard block |
||
| 2242 | 2251 | } |
| 2243 | 2252 | |
| 2244 | 2253 | |
| 2245 | - } |
|
| 2246 | - elseif(!empty($response['response']['code'])) {
|
|
| 2254 | + } elseif(!empty($response['response']['code'])) {
|
|
| 2247 | 2255 | $parts = json_decode($response['body']); |
| 2248 | 2256 | |
| 2249 | 2257 | if(isset($parts->error)){
|
| 2250 | 2258 | echo $parts->error.": ".$parts->error_description;exit; |
| 2251 | - }else{
|
|
| 2259 | + } else{
|
|
| 2252 | 2260 | echo $error_msg." - #2";exit; |
| 2253 | 2261 | } |
| 2254 | 2262 | |
| 2255 | - }else{
|
|
| 2263 | + } else{
|
|
| 2256 | 2264 | |
| 2257 | 2265 | echo $error_msg." - #3";exit; |
| 2258 | 2266 | |