Test Failed
Push — master ( b84796...765145 )
by Stiofan
08:16
created

upgrade.php ➔ geodir_upgrade_166()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Upgrade related functions.
4
 *
5
 * @since 1.0.0
6
 * @package GeoDirectory
7
 * @global object $wpdb WordPress Database object.
8
 */
9
10
global $wpdb;
11
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
    }
24
25
    if (GEODIRECTORY_VERSION <= '1.4.6') {
26
        add_action('init', 'geodir_upgrade_146', 11);
27
    }
28
29
    if (GEODIRECTORY_VERSION <= '1.4.8') {
30
        add_action('init', 'geodir_upgrade_148', 11);
31
    }
32
33
    if (GEODIRECTORY_VERSION <= '1.5.0') {
34
        add_action('init', 'geodir_upgrade_150', 11);
35
    }
36
37
    if (GEODIRECTORY_VERSION <= '1.5.2') {
38
        add_action('init', 'geodir_upgrade_152', 11);
39
    }
40
41
    if (GEODIRECTORY_VERSION <= '1.5.3') {
42
        add_action('init', 'geodir_upgrade_153', 11);
43
    }
44
45
    if (GEODIRECTORY_VERSION <= '1.5.4') {
46
        add_action('init', 'geodir_upgrade_154', 11);
47
    }
48
49
50
51
    add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions
52
53
    update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION);
54
55
}
56
57
58
/**
59
 * Handles upgrade for all geodirectory versions.
60
 *
61
 * @since 1.0.0
62
 * @package GeoDirectory
63
 */
64
function geodirectory_upgrade_all()
65
{
66
    geodir_create_tables();
67
    geodir_update_review_db();
68
    gd_install_theme_compat();
69
    gd_convert_custom_field_display();
70
}
71
72
/**
73
 * Handles upgrade for geodirectory versions <= 1.3.6.
74
 *
75
 * @since 1.0.0
76
 * @package GeoDirectory
77
 */
78
function geodir_upgrade_136()
79
{
80
    geodir_fix_review_overall_rating();
81
}
82
83
/**
84
 * Handles upgrade for geodirectory versions <= 1.4.6.
85
 *
86
 * @since 1.0.0
87
 * @package GeoDirectory
88
 */
89
function geodir_upgrade_146(){
90
    gd_convert_virtual_pages();
91
}
92
93
/**
94
 * Handles upgrade for geodirectory versions <= 1.5.0.
95
 *
96
 * @since 1.5.0
97
 * @package GeoDirectory
98
 */
99
function geodir_upgrade_150(){
100
    gd_fix_cpt_rewrite_slug();
101
}
102
103
104
105
/**
106
 * Handles upgrade for geodirectory versions <= 1.4.8.
107
 *
108
 * @since 1.4.8
109
 * @package GeoDirectory
110
 */
111
function geodir_upgrade_148(){
112
    /*
113
     * Blank the users google password if present as we now use oAuth 2.0
114
     */
115
    update_option('geodir_ga_pass','');
116
    update_option('geodir_ga_user','');
117
118
}
119
120
121
/**
122
 * Handles upgrade for geodirectory versions <= 1.5.3.
123
 *
124
 * @since 1.5.3
125
 * @package GeoDirectory
126
 */
127
function geodir_upgrade_153(){
128
    geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
129
    geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
130
}
131
132
/**
133
 * Handles upgrade for geodirectory versions <= 1.5.3.
134
 *
135
 * @since 1.5.3
136
 * @package GeoDirectory
137
 */
138
function geodir_upgrade_154(){
139
    geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
140
}
141
142
/**
143
 * Handles upgrade for geodirectory versions <= 1.5.2.
144
 *
145
 * @since 1.5.2
146
 * @package GeoDirectory
147
 */
148
function geodir_upgrade_152(){
149
    gd_fix_address_detail_table_limit();
150
}
151
152
153
154
155
/**
156
 * Handles upgrade for review table.
157
 *
158
 * @since 1.0.0
159
 * @package GeoDirectory
160
 * @global object $wpdb WordPress Database object.
161
 * @global string $plugin_prefix Geodirectory plugin table prefix.
162
 */
163
function geodir_update_review_db()
164
{
165
    global $wpdb, $plugin_prefix;
166
167
    geodir_fix_review_date();
168
    geodir_fix_review_post_status();
169
    geodir_fix_review_content();
170
    geodir_fix_review_location();
171
172
}
173
174
/**
175
 * Fixes review date.
176
 *
177
 * @since 1.0.0
178
 * @package GeoDirectory
179
 * @global object $wpdb WordPress Database object.
180
 */
181
function geodir_fix_review_date()
182
{
183
    global $wpdb;
184
    $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'");
185
}
186
187
/**
188
 * Fixes review post status.
189
 *
190
 * @since 1.0.0
191
 * @package GeoDirectory
192
 * @global object $wpdb WordPress Database object.
193
 */
194
function geodir_fix_review_post_status()
195
{
196
    global $wpdb;
197
    $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'");
198
}
199
200
/**
201
 * Fixes review content.
202
 *
203
 * @since 1.0.0
204
 * @package GeoDirectory
205
 * @global object $wpdb WordPress Database object.
206
 * @return bool
207
 */
208
function geodir_fix_review_content()
209
{
210
    global $wpdb;
211
    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")) {
212
        return true;
213
    } else {
214
        return false;
215
    }
216
}
217
218
/**
219
 * Fixes review location.
220
 *
221
 * @since 1.0.0
222
 * @package GeoDirectory
223
 * @global object $wpdb WordPress Database object.
224
 * @return bool
225
 */
226
function geodir_fix_review_location()
227
{
228
    global $wpdb;
229
230
    $all_postypes = geodir_get_posttypes();
231
232
    if (!empty($all_postypes)) {
233
        foreach ($all_postypes as $key) {
0 ignored issues
show
Bug introduced by
The expression $all_postypes of type array|object|string is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
234
            // update each GD CTP
235
236
            $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");
237
238
        }
239
        return true;
240
    }
241
    return false;
242
}
243
244
/**
245
 * Fixes review overall rating.
246
 *
247
 * @since 1.0.0
248
 * @package GeoDirectory
249
 * @global object $wpdb WordPress Database object.
250
 */
251
function geodir_fix_review_overall_rating()
252
{
253
    global $wpdb;
254
255
    $all_postypes = geodir_get_posttypes();
256
257
    if (!empty($all_postypes)) {
258
        foreach ($all_postypes as $key) {
0 ignored issues
show
Bug introduced by
The expression $all_postypes of type array|object|string is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
259
            // update each GD CTP
260
            $reviews = $wpdb->get_results("SELECT post_id FROM " . $wpdb->prefix . "geodir_" . $key . "_detail d");
261
262
            if (!empty($reviews)) {
263
                foreach ($reviews as $post_id) {
264
                    geodir_update_postrating($post_id->post_id, $key);
265
                }
266
267
            }
268
269
        }
270
271
    }
272
}
273
274
275
function gd_convert_custom_field_display(){
276
    global $wpdb;
277
278
    $field_info = $wpdb->get_results("select * from " . GEODIR_CUSTOM_FIELDS_TABLE);
279
280
    $has_run = get_option('gd_convert_custom_field_display');
281
    if($has_run){return;}
282
283
    // set the field_type_key for standard fields
284
    $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET field_type_key = field_type");
285
286
287
    if(is_array( $field_info)){
288
289
        foreach( $field_info as $cf){
290
291
            $id = $cf->id;
292
293
            if(!property_exists($cf,'show_in') || !$id){return;}
294
295
            $show_in_arr = array();
296
297
            if($cf->is_default){
298
                $show_in_arr[] = "[detail]";
299
            }
300
301
            if($cf->show_on_detail){
302
                $show_in_arr[] = "[moreinfo]";
303
            }
304
305
            if($cf->show_on_listing){
306
                $show_in_arr[] = "[listing]";
307
            }
308
309
            if($cf->show_as_tab || $cf->htmlvar_name=='geodir_video' || $cf->htmlvar_name=='geodir_special_offers'){
310
                $show_in_arr[] = "[owntab]";
311
            }
312
313
            if($cf->htmlvar_name=='post' || $cf->htmlvar_name=='geodir_contact' || $cf->htmlvar_name=='geodir_timing'){
314
                $show_in_arr[] = "[mapbubble]";
315
            }
316
317
            if(!empty($show_in_arr )){
318
                $show_in_arr = implode(',',$show_in_arr);
319
            }else{
320
                $show_in_arr = '';
321
            }
322
323
            $wpdb->query("UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET show_in='$show_in_arr' WHERE id=$id");
324
325
        }
326
327
        update_option('gd_convert_custom_field_display',1);
328
    }
329
}
330
331
############################################
332
########### THEME COMPATIBILITY ############
333
############################################
334
335
/**
336
 * Inserts theme compatibility settings data for supported themes.
337
 *
338
 * @since 1.0.0
339
 * @package GeoDirectory
340
 * @global object $wpdb WordPress Database object.
341
 */
342
function gd_install_theme_compat()
343
{
344
    global $wpdb;
345
346
    $theme_compat = array();
0 ignored issues
show
Unused Code introduced by
$theme_compat is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
347
    $theme_compat = get_option('gd_theme_compats');
348
//GDF
349
    $theme_compat['GeoDirectory_Framework'] = array(
350
        'geodir_wrapper_open_id' => 'geodir_wrapper',
351
        'geodir_wrapper_open_class' => '',
352
        'geodir_wrapper_open_replace' => '',
353
        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
354
        'geodir_wrapper_content_open_id' => 'geodir_content',
355
        'geodir_wrapper_content_open_class' => '',
356
        'geodir_wrapper_content_open_replace' => '',
357
        'geodir_wrapper_content_close_replace' => '',
358
        'geodir_article_open_id' => '',
359
        'geodir_article_open_class' => '',
360
        'geodir_article_open_replace' => '',
361
        'geodir_article_close_replace' => '',
362
        'geodir_sidebar_right_open_id' => '',
363
        'geodir_sidebar_right_open_class' => '',
364
        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
365
        'geodir_sidebar_right_close_replace' => '',
366
        'geodir_sidebar_left_open_id' => '',
367
        'geodir_sidebar_left_open_class' => '',
368
        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
369
        'geodir_sidebar_left_close_replace' => '',
370
        'geodir_main_content_open_id' => '',
371
        'geodir_main_content_open_class' => '',
372
        'geodir_main_content_open_replace' => '<!-- removed -->',
373
        'geodir_main_content_close_replace' => '<!-- removed -->',
374
        'geodir_top_content_add' => '',
375
        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
376
        'geodir_before_widget_filter' => '',
377
        'geodir_after_widget_filter' => '',
378
        'geodir_theme_compat_css' => '',
379
        'geodir_theme_compat_js' => '',
380
        'geodir_theme_compat_default_options' => '',
381
        'geodir_theme_compat_code' => ''
382
    );
383
384
//Directory Theme
385
    $theme_compat['Directory_Starter'] = array(
386
        'geodir_wrapper_open_id' => 'geodir_wrapper',
387
        'geodir_wrapper_open_class' => '',
388
        'geodir_wrapper_open_replace' => '',
389
        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
390
        'geodir_wrapper_content_open_id' => 'geodir_content',
391
        'geodir_wrapper_content_open_class' => '',
392
        'geodir_wrapper_content_open_replace' => '',
393
        'geodir_wrapper_content_close_replace' => '',
394
        'geodir_article_open_id' => '',
395
        'geodir_article_open_class' => '',
396
        'geodir_article_open_replace' => '',
397
        'geodir_article_close_replace' => '',
398
        'geodir_sidebar_right_open_id' => '',
399
        'geodir_sidebar_right_open_class' => '',
400
        'geodir_sidebar_right_open_replace' => '<aside id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
401
        'geodir_sidebar_right_close_replace' => '',
402
        'geodir_sidebar_left_open_id' => '',
403
        'geodir_sidebar_left_open_class' => '',
404
        'geodir_sidebar_left_open_replace' => '<aside  id="gd-sidebar-wrapper" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
405
        'geodir_sidebar_left_close_replace' => '',
406
        'geodir_main_content_open_id' => '',
407
        'geodir_main_content_open_class' => '',
408
        'geodir_main_content_open_replace' => '<!-- removed -->',
409
        'geodir_main_content_close_replace' => '<!-- removed -->',
410
        'geodir_top_content_add' => '',
411
        'geodir_before_main_content_add' => '<div class="clearfix geodir-common">',
412
        'geodir_before_widget_filter' => '',
413
        'geodir_after_widget_filter' => '',
414
        'geodir_theme_compat_css' => '',
415
        'geodir_theme_compat_js' => '',
416
        'geodir_theme_compat_default_options' => '',
417
        'geodir_theme_compat_code' => ''
418
    );
419
420
//Jobby
421
    $theme_compat['Jobby'] = $theme_compat['Directory_Starter'];
422
423
//GeoProperty
424
    $theme_compat['GeoProperty'] = $theme_compat['Directory_Starter'];
425
426
//Avada
427
    $theme_compat['Avada'] = array(
428
        'geodir_wrapper_open_id' => '',
429
        'geodir_wrapper_open_class' => '',
430
        'geodir_wrapper_open_replace' => '<!-- removed -->',
431
        'geodir_wrapper_close_replace' => '<!-- removed -->',
432
        'geodir_wrapper_content_open_id' => 'content',
433
        'geodir_wrapper_content_open_class' => '',
434
        'geodir_wrapper_content_open_replace' => '',
435
        'geodir_wrapper_content_close_replace' => '',
436
        'geodir_article_open_id' => '',
437
        'geodir_article_open_class' => '',
438
        'geodir_article_open_replace' => '',
439
        'geodir_article_close_replace' => '',
440
        'geodir_sidebar_right_open_id' => '',
441
        'geodir_sidebar_right_open_class' => '',
442
        'geodir_sidebar_right_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
443
        'geodir_sidebar_right_close_replace' => '</div><!-- end sidebar -->',
444
        'geodir_sidebar_left_open_id' => '',
445
        'geodir_sidebar_left_open_class' => '',
446
        'geodir_sidebar_left_open_replace' => '<div id="sidebar" class="sidebar [class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>',
447
        'geodir_sidebar_left_close_replace' => '</div><!-- end sidebar -->',
448
        'geodir_main_content_open_id' => '',
449
        'geodir_main_content_open_class' => '',
450
        'geodir_main_content_open_replace' => '<!-- removed -->',
451
        'geodir_main_content_close_replace' => '<!-- removed -->',
452
        'geodir_top_content_add' => '',
453
        'geodir_before_main_content_add' => '',
454
        'geodir_before_widget_filter' => '',
455
        'geodir_after_widget_filter' => '',
456
        '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;}'),
457
        'geodir_theme_compat_js' => '',
458
        'geodir_theme_compat_default_options' => '',
459
        'geodir_theme_compat_code' => 'Avada'
460
    );
461
462
//Enfold
463
    $theme_compat['Enfold'] = array(
464
        'geodir_wrapper_open_id' => '',
465
        'geodir_wrapper_open_class' => '',
466
        'geodir_wrapper_open_replace' => '',
467
        'geodir_wrapper_close_replace' => '</div></div><!-- content ends here-->',
468
        'geodir_wrapper_content_open_id' => '',
469
        'geodir_wrapper_content_open_class' => '',
470
        'geodir_wrapper_content_open_replace' => '',
471
        'geodir_wrapper_content_close_replace' => '</div></main>',
472
        'geodir_article_open_id' => '',
473
        'geodir_article_open_class' => '',
474
        'geodir_article_open_replace' => '',
475
        'geodir_article_close_replace' => '',
476
        'geodir_sidebar_right_open_id' => '',
477
        'geodir_sidebar_right_open_class' => '',
478
        'geodir_sidebar_right_open_replace' => '',
479
        'geodir_sidebar_right_close_replace' => '</div></aside><!-- sidebar ends here-->',
480
        'geodir_sidebar_left_open_id' => '',
481
        'geodir_sidebar_left_open_class' => '',
482
        'geodir_sidebar_left_open_replace' => '',
483
        'geodir_sidebar_left_close_replace' => '</div></aside><!-- sidebar ends here-->',
484
        'geodir_main_content_open_id' => '',
485
        'geodir_main_content_open_class' => '',
486
        'geodir_main_content_open_replace' => '',
487
        'geodir_main_content_close_replace' => '',
488
        'geodir_top_content_add' => '',
489
        'geodir_before_main_content_add' => '',
490
        'geodir_before_widget_filter' => '',
491
        'geodir_after_widget_filter' => '',
492
        '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;}'),
493
        'geodir_theme_compat_js' => '',
494
        'geodir_theme_compat_default_options' => '',
495
        'geodir_theme_compat_code' => 'Enfold'
496
    );
497
498
// X
499
    $theme_compat['X'] = array(
500
        'geodir_wrapper_open_id' => '',
501
        'geodir_wrapper_open_class' => '',
502
        'geodir_wrapper_open_replace' => '',
503
        'geodir_wrapper_close_replace' => '',
504
        'geodir_wrapper_content_open_id' => '',
505
        'geodir_wrapper_content_open_class' => '',
506
        'geodir_wrapper_content_open_replace' => '',
507
        'geodir_wrapper_content_close_replace' => '',
508
        'geodir_article_open_id' => '',
509
        'geodir_article_open_class' => '',
510
        'geodir_article_open_replace' => '',
511
        'geodir_article_close_replace' => '',
512
        'geodir_sidebar_right_open_id' => '',
513
        'geodir_sidebar_right_open_class' => '',
514
        'geodir_sidebar_right_open_replace' => '',
515
        'geodir_sidebar_right_close_replace' => '',
516
        'geodir_sidebar_left_open_id' => '',
517
        'geodir_sidebar_left_open_class' => '',
518
        'geodir_sidebar_left_open_replace' => '',
519
        'geodir_sidebar_left_close_replace' => '',
520
        'geodir_main_content_open_id' => '',
521
        'geodir_main_content_open_class' => '',
522
        'geodir_main_content_open_replace' => '',
523
        'geodir_main_content_close_replace' => '',
524
        'geodir_top_content_add' => '',
525
        'geodir_before_main_content_add' => '',
526
        'geodir_before_widget_filter' => '',
527
        'geodir_after_widget_filter' => '',
528
        '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}'),
529
        'geodir_theme_compat_js' => '',
530
        'geodir_theme_compat_default_options' => '',
531
        'geodir_theme_compat_code' => 'X'
532
    );
533
534
// Divi
535
    $theme_compat['Divi'] = array(
536
        'geodir_wrapper_open_id' => 'main-content',
537
        'geodir_wrapper_open_class' => '',
538
        'geodir_wrapper_open_replace' => '',
539
        'geodir_wrapper_close_replace' => '',
540
        'geodir_wrapper_content_open_id' => 'left-area',
541
        'geodir_wrapper_content_open_class' => '',
542
        'geodir_wrapper_content_open_replace' => '<div class="container"><div id="content-area" class="clearfix"><div id="[id]" class="[class]" role="main" >',
543
        'geodir_wrapper_content_close_replace' => '',
544
        'geodir_article_open_id' => '',
545
        'geodir_article_open_class' => '',
546
        'geodir_article_open_replace' => '',
547
        'geodir_article_close_replace' => '',
548
        'geodir_sidebar_right_open_id' => 'sidebar',
549
        'geodir_sidebar_right_open_class' => '',
550
        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
551
        'geodir_sidebar_right_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
552
        'geodir_sidebar_left_open_id' => 'sidebar',
553
        'geodir_sidebar_left_open_class' => '',
554
        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="" role="complementary" itemscope itemtype="[itemtype]" >',
555
        'geodir_sidebar_left_close_replace' => '</aside><!-- sidebar ends here--></div></div>',
556
        'geodir_main_content_open_id' => '',
557
        'geodir_main_content_open_class' => '',
558
        'geodir_main_content_open_replace' => '',
559
        'geodir_main_content_close_replace' => '',
560
        'geodir_top_content_add' => '',
561
        'geodir_before_main_content_add' => '',
562
        'geodir_before_widget_filter' => '',
563
        'geodir_after_widget_filter' => '',
564
        '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}'),
565
        'geodir_theme_compat_js' => '',
566
        'geodir_theme_compat_default_options' => '',
567
        'geodir_theme_compat_code' => 'Divi'
568
    );
569
570
// Genesis
571
    $theme_compat['Genesis'] = array(
572
        'geodir_wrapper_open_id' => '',
573
        'geodir_wrapper_open_class' => 'content-sidebar-wrap',
574
        'geodir_wrapper_open_replace' => '',
575
        'geodir_wrapper_close_replace' => '',
576
        'geodir_wrapper_content_open_id' => '',
577
        'geodir_wrapper_content_open_class' => 'content',
578
        'geodir_wrapper_content_open_replace' => '<div class="[class]" role="main" >',
579
        'geodir_wrapper_content_close_replace' => '',
580
        'geodir_article_open_id' => '',
581
        'geodir_article_open_class' => '',
582
        'geodir_article_open_replace' => '',
583
        'geodir_article_close_replace' => '',
584
        'geodir_sidebar_right_open_id' => '',
585
        'geodir_sidebar_right_open_class' => 'sidebar sidebar-primary widget-area',
586
        'geodir_sidebar_right_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
587
        'geodir_sidebar_right_close_replace' => '',
588
        'geodir_sidebar_left_open_id' => '',
589
        'geodir_sidebar_left_open_class' => 'sidebar sidebar-secondary widget-area',
590
        'geodir_sidebar_left_open_replace' => '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]">',
591
        'geodir_sidebar_left_close_replace' => '',
592
        'geodir_main_content_open_id' => '',
593
        'geodir_main_content_open_class' => '',
594
        'geodir_main_content_open_replace' => '<main  id="[id]" class="entry [class]"  role="main">',
595
        'geodir_main_content_close_replace' => '',
596
        'geodir_top_content_add' => '',
597
        'geodir_before_main_content_add' => '',
598
        'geodir_before_widget_filter' => '',
599
        'geodir_after_widget_filter' => '',
600
        'geodir_location_switcher_menu_li_class_filter' => 'menu-item menu-item-gd-location-switcher menu-item-has-children gd-location-switcher',
601
        '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}'),
602
        'geodir_theme_compat_js' => '',
603
        'geodir_theme_compat_default_options' => '',
604
        'geodir_theme_compat_code' => 'Genesis'
605
    );
606
607
// Jupiter
608
    $theme_compat['Jupiter'] = array(
609
        'geodir_wrapper_open_id' => '',
610
        'geodir_wrapper_open_class' => '',
611
        '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">',
612
        'geodir_wrapper_close_replace' => '</div></div></div>',
613
        'geodir_wrapper_content_open_id' => '',
614
        'geodir_wrapper_content_open_class' => '',
615
        'geodir_wrapper_content_open_replace' => '',
616
        'geodir_wrapper_content_close_replace' => '',
617
        'geodir_article_open_id' => '',
618
        'geodir_article_open_class' => '',
619
        'geodir_article_open_replace' => '',
620
        'geodir_article_close_replace' => '',
621
        'geodir_sidebar_right_open_id' => 'mk-sidebar',
622
        'geodir_sidebar_right_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
623
        'geodir_sidebar_right_open_replace' => '',
624
        'geodir_sidebar_right_close_replace' => '',
625
        'geodir_sidebar_left_open_id' => 'mk-sidebar',
626
        'geodir_sidebar_left_open_class' => 'mk-builtin geodir-sidebar-right geodir-listings-sidebar-right',
627
        'geodir_sidebar_left_open_replace' => '',
628
        'geodir_sidebar_left_close_replace' => '',
629
        'geodir_main_content_open_id' => '',
630
        'geodir_main_content_open_class' => '',
631
        'geodir_main_content_open_replace' => '',
632
        'geodir_main_content_close_replace' => '',
633
        'geodir_top_content_add' => '',
634
        'geodir_before_main_content_add' => '',
635
        'geodir_before_widget_filter' => '',
636
        'geodir_after_widget_filter' => '',
637
        'geodir_before_title_filter' => '<h3 class="widgettitle geodir-widget-title">',
638
        'geodir_after_title_filter' => '',
639
        'geodir_menu_li_class_filter' => 'menu-item menu-item-has-children no-mega-menu',
640
        'geodir_sub_menu_ul_class_filter' => '',
641
        'geodir_sub_menu_li_class_filter' => '',
642
        'geodir_menu_a_class_filter' => 'menu-item-link',
643
        'geodir_sub_menu_a_class_filter' => 'menu-item-link one-page-nav-item',
644
        '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',
645
        'geodir_location_switcher_menu_a_class_filter' => 'menu-item-link',
646
        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
647
        'geodir_location_switcher_menu_sub_li_class_filter' => '',
648
        '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}'),
649
        'geodir_theme_compat_js' => '',
650
        'geodir_theme_compat_default_options' => '',
651
        'geodir_theme_compat_code' => 'Jupiter'
652
    );
653
654
// Multi News
655
    $theme_compat['Multi_News'] = array(
656
        'geodir_wrapper_open_id' => '',
657
        'geodir_wrapper_open_class' => 'main-container clearfix',
658
        'geodir_wrapper_open_replace' => '',
659
        'geodir_wrapper_close_replace' => '',
660
        'geodir_wrapper_content_open_id' => '',
661
        'geodir_wrapper_content_open_class' => '',
662
        'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content  "><div class="site-content page-wrap">',
663
        'geodir_wrapper_content_close_replace' => '</div></div></div>',
664
        'geodir_article_open_id' => '',
665
        'geodir_article_open_class' => '',
666
        'geodir_article_open_replace' => '',
667
        'geodir_article_close_replace' => '',
668
        'geodir_sidebar_right_open_id' => '',
669
        'geodir_sidebar_right_open_class' => '',
670
        'geodir_sidebar_right_open_replace' => '<aside  class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
671
        'geodir_sidebar_right_close_replace' => '',
672
        'geodir_sidebar_left_open_id' => '',
673
        'geodir_sidebar_left_open_class' => '',
674
        'geodir_sidebar_left_open_replace' => '<aside  class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >',
675
        'geodir_sidebar_left_close_replace' => '',
676
        'geodir_main_content_open_id' => '',
677
        'geodir_main_content_open_class' => '',
678
        'geodir_main_content_open_replace' => '<div class="site-content page-wrap">',
679
        'geodir_main_content_close_replace' => '</div>',
680
        'geodir_top_content_add' => '',
681
        'geodir_before_main_content_add' => '',
682
        'geodir_full_page_class_filter' => 'section full-width-section',
683
        'geodir_before_widget_filter' => '',
684
        'geodir_after_widget_filter' => '',
685
        'geodir_before_title_filter' => '<div class="widget-title"><h2>',
686
        'geodir_after_title_filter' => '</h2></div>',
687
        'geodir_menu_li_class_filter' => '',
688
        'geodir_sub_menu_ul_class_filter' => '',
689
        'geodir_sub_menu_li_class_filter' => '',
690
        'geodir_menu_a_class_filter' => '',
691
        'geodir_sub_menu_a_class_filter' => '',
692
        'geodir_location_switcher_menu_li_class_filter' => '',
693
        'geodir_location_switcher_menu_a_class_filter' => '',
694
        'geodir_location_switcher_menu_sub_ul_class_filter' => '',
695
        'geodir_location_switcher_menu_sub_li_class_filter' => '',
696
        '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}'),
697
        '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"})});',
698
        'geodir_theme_compat_default_options' => '',
699
        'geodir_theme_compat_code' => 'Multi_News'
700
    );
701
702
    update_option('gd_theme_compats', $theme_compat);
703
704
    gd_set_theme_compat();// set the compat pack if avail
705
}
706
707
708
/**
709
 * Converts virtual pages to normal pages.
710
 *
711
 * @since 1.0.0
712
 * @package GeoDirectory
713
 * @global object $wpdb WordPress Database object.
714
 */
715
function gd_convert_virtual_pages(){
716
    global $wpdb;
717
718
    // Update the add listing page settings
719
    $add_listing_page = $wpdb->get_var(
720
        $wpdb->prepare(
721
            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
722
            array('add-listing')
723
        )
724
    );
725
726
    if($add_listing_page){
727
        wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') );
728
        update_option( 'geodir_add_listing_page', $add_listing_page);
729
    }
730
731
    // Update the listing preview page settings
732
    $listing_preview_page = $wpdb->get_var(
733
        $wpdb->prepare(
734
            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
735
            array('listing-preview')
736
        )
737
    );
738
739
    if($listing_preview_page){
740
        wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') );
741
        update_option( 'geodir_preview_page', $listing_preview_page);
742
    }
743
744
    // Update the listing success page settings
745
    $listing_success_page = $wpdb->get_var(
746
        $wpdb->prepare(
747
            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
748
            array('listing-success')
749
        )
750
    );
751
752
    if($listing_success_page){
753
        wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') );
754
        update_option( 'geodir_success_page', $listing_success_page);
755
    }
756
757
    // Update the listing success page settings
758
    $location_page = $wpdb->get_var(
759
        $wpdb->prepare(
760
            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s AND post_status='virtual' LIMIT 1;",
761
            array('location')
762
        )
763
    );
764
765
    if($location_page){
766
        $location_slug = get_option('geodir_location_prefix');
767
        if(!$location_slug ){$location_slug  = 'location';}
768
        wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) );
769
        update_option( 'geodir_location_page', $location_page);
770
    }
771
772
}
773
774
775
/**
776
 * Converts all GD CPT's to the new rewrite slug by removing /%gd_taxonomy% from the slug
777
 *
778
 * @since 1.5.0
779
 * @package GeoDirectory
780
 */
781
function gd_fix_cpt_rewrite_slug()
782
{
783
784
    $alt_post_types = array();
785
    $post_types = get_option('geodir_post_types');
786
787
788
    if (is_array($post_types)){
789
790
        foreach ($post_types as $post_type => $args) {
791
792
793
            if(isset($args['rewrite']['slug'])){
794
                $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']);
795
            }
796
797
                $alt_post_types[$post_type] = $args;
798
799
        }
800
    }
801
802
    if(!empty($alt_post_types)) {
803
        update_option('geodir_post_types',$alt_post_types);
804
        }
805
806
807
    // flush the rewrite rules
808
    flush_rewrite_rules();
809
}
810
811
812
/**
813
 * Fixes the address field limit of 30 to 50 in details table.
814
 *
815
 * @since 1.0.0
816
 * @package GeoDirectory
817
 * @global object $wpdb WordPress Database object.
818
 */
819
function gd_fix_address_detail_table_limit()
820
{
821
    global $wpdb;
822
823
    $all_postypes = geodir_get_posttypes();
824
825
    if (!empty($all_postypes)) {
826
        foreach ($all_postypes as $key) {
0 ignored issues
show
Bug introduced by
The expression $all_postypes of type array|object|string is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
827
            // update each GD CTP
828
            try {
829
                $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");
830
            } catch(Exception $e) {
831
                error_log( 'Error: ' . $e->getMessage() );
832
            }
833
        }
834
    }
835
}
836