@@ -1,75 +1,75 @@ |
||
1 | 1 | <?php |
2 | 2 | class AdminTests extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testAdminPanel() |
|
11 | - { |
|
10 | + public function testAdminPanel() |
|
11 | + { |
|
12 | 12 | |
13 | - $_POST = array( |
|
14 | - 'geodir_wrapper_open_id' => '', |
|
15 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
16 | - 'geodir_wrapper_open_replace' => '', |
|
17 | - 'geodir_wrapper_close_replace' => '', |
|
18 | - 'geodir_wrapper_content_open_id' => '', |
|
19 | - 'geodir_wrapper_content_open_class' => '', |
|
20 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
21 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
22 | - 'geodir_article_open_id' => '', |
|
23 | - 'geodir_article_open_class' => '', |
|
24 | - 'geodir_article_open_replace' => '', |
|
25 | - 'geodir_article_close_replace' => '', |
|
26 | - 'geodir_sidebar_right_open_id' => '', |
|
27 | - 'geodir_sidebar_right_open_class' => '', |
|
28 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
29 | - 'geodir_sidebar_right_close_replace' => '', |
|
30 | - 'geodir_sidebar_left_open_id' => '', |
|
31 | - 'geodir_sidebar_left_open_class' => '', |
|
32 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
33 | - 'geodir_sidebar_left_close_replace' => '', |
|
34 | - 'geodir_main_content_open_id' => '', |
|
35 | - 'geodir_main_content_open_class' => '', |
|
36 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
37 | - 'geodir_main_content_close_replace' => '</div>', |
|
38 | - 'geodir_top_content_add' => '', |
|
39 | - 'geodir_before_main_content_add' => '', |
|
40 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
41 | - 'geodir_before_widget_filter' => '', |
|
42 | - 'geodir_after_widget_filter' => '', |
|
43 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
44 | - 'geodir_after_title_filter' => '</h2></div>', |
|
45 | - 'geodir_menu_li_class_filter' => '', |
|
46 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
47 | - 'geodir_sub_menu_li_class_filter' => '', |
|
48 | - 'geodir_menu_a_class_filter' => '', |
|
49 | - 'geodir_sub_menu_a_class_filter' => '', |
|
50 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
51 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
52 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
53 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
54 | - '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}'), |
|
55 | - '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"})});', |
|
56 | - 'geodir_theme_compat_default_options' => '', |
|
57 | - 'geodir_theme_compat_code' => 'Multi_News', |
|
58 | - 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
59 | - ); |
|
60 | - geodir_update_options_compatibility_settings(); |
|
13 | + $_POST = array( |
|
14 | + 'geodir_wrapper_open_id' => '', |
|
15 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
16 | + 'geodir_wrapper_open_replace' => '', |
|
17 | + 'geodir_wrapper_close_replace' => '', |
|
18 | + 'geodir_wrapper_content_open_id' => '', |
|
19 | + 'geodir_wrapper_content_open_class' => '', |
|
20 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
21 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
22 | + 'geodir_article_open_id' => '', |
|
23 | + 'geodir_article_open_class' => '', |
|
24 | + 'geodir_article_open_replace' => '', |
|
25 | + 'geodir_article_close_replace' => '', |
|
26 | + 'geodir_sidebar_right_open_id' => '', |
|
27 | + 'geodir_sidebar_right_open_class' => '', |
|
28 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
29 | + 'geodir_sidebar_right_close_replace' => '', |
|
30 | + 'geodir_sidebar_left_open_id' => '', |
|
31 | + 'geodir_sidebar_left_open_class' => '', |
|
32 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
33 | + 'geodir_sidebar_left_close_replace' => '', |
|
34 | + 'geodir_main_content_open_id' => '', |
|
35 | + 'geodir_main_content_open_class' => '', |
|
36 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
37 | + 'geodir_main_content_close_replace' => '</div>', |
|
38 | + 'geodir_top_content_add' => '', |
|
39 | + 'geodir_before_main_content_add' => '', |
|
40 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
41 | + 'geodir_before_widget_filter' => '', |
|
42 | + 'geodir_after_widget_filter' => '', |
|
43 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
44 | + 'geodir_after_title_filter' => '</h2></div>', |
|
45 | + 'geodir_menu_li_class_filter' => '', |
|
46 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
47 | + 'geodir_sub_menu_li_class_filter' => '', |
|
48 | + 'geodir_menu_a_class_filter' => '', |
|
49 | + 'geodir_sub_menu_a_class_filter' => '', |
|
50 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
51 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
52 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
53 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
54 | + '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}'), |
|
55 | + '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"})});', |
|
56 | + 'geodir_theme_compat_default_options' => '', |
|
57 | + 'geodir_theme_compat_code' => 'Multi_News', |
|
58 | + 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
59 | + ); |
|
60 | + geodir_update_options_compatibility_settings(); |
|
61 | 61 | |
62 | - ob_start(); |
|
63 | - geodir_admin_panel(); |
|
64 | - $output = ob_get_contents(); |
|
65 | - ob_end_clean(); |
|
66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
62 | + ob_start(); |
|
63 | + geodir_admin_panel(); |
|
64 | + $output = ob_get_contents(); |
|
65 | + ob_end_clean(); |
|
66 | + $this->assertContains( 'gd-wrapper-main', $output ); |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - public function tearDown() |
|
71 | - { |
|
72 | - parent::tearDown(); |
|
73 | - } |
|
70 | + public function tearDown() |
|
71 | + { |
|
72 | + parent::tearDown(); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | \ No newline at end of file |
@@ -63,7 +63,7 @@ |
||
63 | 63 | geodir_admin_panel(); |
64 | 64 | $output = ob_get_contents(); |
65 | 65 | ob_end_clean(); |
66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
66 | + $this->assertContains('gd-wrapper-main', $output); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 |
@@ -1,102 +1,102 @@ |
||
1 | 1 | <?php |
2 | 2 | class Register extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(0); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(0); |
|
8 | + } |
|
9 | 9 | |
10 | - public function test_register_empty_username() { |
|
11 | - $errors = geodir_register_new_user( |
|
12 | - '', |
|
13 | - '[email protected]' |
|
14 | - ); |
|
15 | - $errors = (array) $errors; |
|
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | - } |
|
10 | + public function test_register_empty_username() { |
|
11 | + $errors = geodir_register_new_user( |
|
12 | + '', |
|
13 | + '[email protected]' |
|
14 | + ); |
|
15 | + $errors = (array) $errors; |
|
16 | + $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | + $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | + } |
|
19 | 19 | |
20 | - public function test_register_invalid_username() { |
|
21 | - $errors = geodir_register_new_user( |
|
22 | - '@#$%^', |
|
23 | - '[email protected]' |
|
24 | - ); |
|
25 | - $errors = (array) $errors; |
|
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | - } |
|
20 | + public function test_register_invalid_username() { |
|
21 | + $errors = geodir_register_new_user( |
|
22 | + '@#$%^', |
|
23 | + '[email protected]' |
|
24 | + ); |
|
25 | + $errors = (array) $errors; |
|
26 | + $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | + $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | + } |
|
29 | 29 | |
30 | - public function test_register_invalid_email() { |
|
31 | - $errors = geodir_register_new_user( |
|
32 | - 'hello', |
|
33 | - 'hello@@hi.com' |
|
34 | - ); |
|
35 | - $errors = (array) $errors; |
|
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | - } |
|
30 | + public function test_register_invalid_email() { |
|
31 | + $errors = geodir_register_new_user( |
|
32 | + 'hello', |
|
33 | + 'hello@@hi.com' |
|
34 | + ); |
|
35 | + $errors = (array) $errors; |
|
36 | + $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | + $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | + } |
|
39 | 39 | |
40 | - public function test_register_empty_email() { |
|
41 | - $errors = geodir_register_new_user( |
|
42 | - 'hello', |
|
43 | - '' |
|
44 | - ); |
|
45 | - $errors = (array) $errors; |
|
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | - } |
|
40 | + public function test_register_empty_email() { |
|
41 | + $errors = geodir_register_new_user( |
|
42 | + 'hello', |
|
43 | + '' |
|
44 | + ); |
|
45 | + $errors = (array) $errors; |
|
46 | + $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | + $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | + } |
|
49 | 49 | |
50 | - public function test_register_invalid_password() { |
|
51 | - update_option('geodir_allow_cpass', 1); |
|
52 | - $_REQUEST['user_pass'] = '12345'; |
|
53 | - $_REQUEST['user_pass2'] = '1234'; |
|
54 | - $_POST['user_fname'] = 'Test User'; |
|
55 | - $errors = geodir_register_new_user( |
|
56 | - 'hello', |
|
57 | - '[email protected]' |
|
58 | - ); |
|
59 | - $errors = (array) $errors; |
|
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
50 | + public function test_register_invalid_password() { |
|
51 | + update_option('geodir_allow_cpass', 1); |
|
52 | + $_REQUEST['user_pass'] = '12345'; |
|
53 | + $_REQUEST['user_pass2'] = '1234'; |
|
54 | + $_POST['user_fname'] = 'Test User'; |
|
55 | + $errors = geodir_register_new_user( |
|
56 | + 'hello', |
|
57 | + '[email protected]' |
|
58 | + ); |
|
59 | + $errors = (array) $errors; |
|
60 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | + $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
62 | 62 | |
63 | - $_REQUEST['user_pass'] = '12345'; |
|
64 | - $_REQUEST['user_pass2'] = '12345'; |
|
65 | - $errors = geodir_register_new_user( |
|
66 | - 'hello', |
|
67 | - '[email protected]' |
|
68 | - ); |
|
69 | - $errors = (array) $errors; |
|
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | - } |
|
63 | + $_REQUEST['user_pass'] = '12345'; |
|
64 | + $_REQUEST['user_pass2'] = '12345'; |
|
65 | + $errors = geodir_register_new_user( |
|
66 | + 'hello', |
|
67 | + '[email protected]' |
|
68 | + ); |
|
69 | + $errors = (array) $errors; |
|
70 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | + $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | + } |
|
73 | 73 | |
74 | - public function test_register_success() { |
|
75 | - $_POST['user_fname'] = 'Test User'; |
|
76 | - $data = geodir_register_new_user( |
|
77 | - 'hello', |
|
78 | - '[email protected]' |
|
79 | - ); |
|
80 | - $this->assertInternalType("int", $data[0]); |
|
81 | - } |
|
74 | + public function test_register_success() { |
|
75 | + $_POST['user_fname'] = 'Test User'; |
|
76 | + $data = geodir_register_new_user( |
|
77 | + 'hello', |
|
78 | + '[email protected]' |
|
79 | + ); |
|
80 | + $this->assertInternalType("int", $data[0]); |
|
81 | + } |
|
82 | 82 | |
83 | - public function testResetPassword() |
|
84 | - { |
|
85 | - global $errors; |
|
86 | - $_REQUEST['action'] = 'login'; |
|
87 | - $_POST['log'] = 'admin'; |
|
88 | - add_filter('wp_redirect', '__return_false'); |
|
89 | - geodir_user_signup(); |
|
90 | - remove_filter('wp_redirect', '__return_false'); |
|
91 | - $errors = (array) $errors; |
|
92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
94 | - } |
|
83 | + public function testResetPassword() |
|
84 | + { |
|
85 | + global $errors; |
|
86 | + $_REQUEST['action'] = 'login'; |
|
87 | + $_POST['log'] = 'admin'; |
|
88 | + add_filter('wp_redirect', '__return_false'); |
|
89 | + geodir_user_signup(); |
|
90 | + remove_filter('wp_redirect', '__return_false'); |
|
91 | + $errors = (array) $errors; |
|
92 | + $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | + $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
94 | + } |
|
95 | 95 | |
96 | - public function tearDown() |
|
97 | - { |
|
98 | - parent::tearDown(); |
|
99 | - } |
|
96 | + public function tearDown() |
|
97 | + { |
|
98 | + parent::tearDown(); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | \ No newline at end of file |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | '[email protected]' |
14 | 14 | ); |
15 | 15 | $errors = (array) $errors; |
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
16 | + $this->assertArrayHasKey('empty_username', $errors["errors"]); |
|
17 | + $this->assertContains('Please enter a username', $errors["errors"]["empty_username"][0]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function test_register_invalid_username() { |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | '[email protected]' |
24 | 24 | ); |
25 | 25 | $errors = (array) $errors; |
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
26 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
27 | + $this->assertContains('This username is invalid', $errors["errors"]["invalid_username"][0]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function test_register_invalid_email() { |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'hello@@hi.com' |
34 | 34 | ); |
35 | 35 | $errors = (array) $errors; |
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
36 | + $this->assertArrayHasKey('invalid_email', $errors["errors"]); |
|
37 | + $this->assertContains('The email address isn’t correct', $errors["errors"]["invalid_email"][0]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function test_register_empty_email() { |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | '' |
44 | 44 | ); |
45 | 45 | $errors = (array) $errors; |
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
46 | + $this->assertArrayHasKey('empty_email', $errors["errors"]); |
|
47 | + $this->assertContains('Please type your e-mail address', $errors["errors"]["empty_email"][0]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function test_register_invalid_password() { |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | '[email protected]' |
58 | 58 | ); |
59 | 59 | $errors = (array) $errors; |
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
60 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
61 | + $this->assertContains('Passwords do not match', $errors["errors"]["pass_match"][0]); |
|
62 | 62 | |
63 | 63 | $_REQUEST['user_pass'] = '12345'; |
64 | 64 | $_REQUEST['user_pass2'] = '12345'; |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | '[email protected]' |
68 | 68 | ); |
69 | 69 | $errors = (array) $errors; |
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
70 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
71 | + $this->assertContains('Password must be 7 characters or more', $errors["errors"]["pass_match"][0]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function test_register_success() { |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | geodir_user_signup(); |
90 | 90 | remove_filter('wp_redirect', '__return_false'); |
91 | 91 | $errors = (array) $errors; |
92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
92 | + $this->assertArrayHasKey('empty_password', $errors["errors"]); |
|
93 | + $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function tearDown() |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */ |
4 | -define( 'ABSPATH', getenv( 'WP_CORE_DIR' ) . '/' ); |
|
4 | +define('ABSPATH', getenv('WP_CORE_DIR').'/'); |
|
5 | 5 | |
6 | 6 | // Test with multisite enabled |
7 | -define( 'WP_TESTS_MULTISITE', (bool) getenv( 'WP_MULTISITE' ) ); |
|
7 | +define('WP_TESTS_MULTISITE', (bool) getenv('WP_MULTISITE')); |
|
8 | 8 | |
9 | 9 | // Force known bugs |
10 | 10 | // define( 'WP_TESTS_FORCE_KNOWN_BUGS', true ); |
11 | 11 | |
12 | 12 | // Test with WordPress debug mode on |
13 | -define( 'WP_DEBUG', true ); |
|
13 | +define('WP_DEBUG', true); |
|
14 | 14 | |
15 | 15 | // ** MySQL settings ** // |
16 | 16 | |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | // These tests will DROP ALL TABLES in the database with the prefix named below. |
22 | 22 | // DO NOT use a production database or one that is shared with something else. |
23 | 23 | |
24 | -define( 'DB_NAME', 'wordpress_test' ); |
|
25 | -define( 'DB_USER', 'root' ); |
|
26 | -define( 'DB_PASSWORD', 'root' ); |
|
27 | -define( 'DB_HOST', 'localhost' ); |
|
28 | -define( 'DB_CHARSET', 'utf8' ); |
|
29 | -define( 'DB_COLLATE', '' ); |
|
24 | +define('DB_NAME', 'wordpress_test'); |
|
25 | +define('DB_USER', 'root'); |
|
26 | +define('DB_PASSWORD', 'root'); |
|
27 | +define('DB_HOST', 'localhost'); |
|
28 | +define('DB_CHARSET', 'utf8'); |
|
29 | +define('DB_COLLATE', ''); |
|
30 | 30 | |
31 | -define( 'WP_TESTS_DOMAIN', 'example.org' ); |
|
32 | -define( 'WP_TESTS_EMAIL', '[email protected]' ); |
|
33 | -define( 'WP_TESTS_TITLE', 'Test Blog' ); |
|
31 | +define('WP_TESTS_DOMAIN', 'example.org'); |
|
32 | +define('WP_TESTS_EMAIL', '[email protected]'); |
|
33 | +define('WP_TESTS_TITLE', 'Test Blog'); |
|
34 | 34 | |
35 | -define( 'WP_PHP_BINARY', 'php' ); |
|
35 | +define('WP_PHP_BINARY', 'php'); |
|
36 | 36 | |
37 | -define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); |
|
38 | -define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) ); |
|
37 | +define('FS_CHMOD_DIR', (0755 & ~ umask())); |
|
38 | +define('FS_CHMOD_FILE', (0644 & ~ umask())); |
|
39 | 39 | |
40 | -define( 'WPLANG', '' ); |
|
41 | -$table_prefix = 'wptests_'; |
|
42 | 40 | \ No newline at end of file |
41 | +define('WPLANG', ''); |
|
42 | +$table_prefix = 'wptests_'; |
|
43 | 43 | \ No newline at end of file |
@@ -1,141 +1,141 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckShortcodes extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - |
|
9 | - } |
|
10 | - |
|
11 | - public function testHomeMapShortcode() |
|
12 | - { |
|
13 | - $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
14 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
15 | - } |
|
16 | - |
|
17 | - public function testListingMapShortcode() |
|
18 | - { |
|
19 | - $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
20 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
21 | - } |
|
22 | - |
|
23 | - public function testListingSliderShortcode() |
|
24 | - { |
|
25 | - $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
|
26 | - $this->assertContains( 'geodir_widget_carousel', $output ); |
|
27 | - } |
|
28 | - |
|
29 | - public function testLoginBoxShortcode() |
|
30 | - { |
|
31 | - $output = do_shortcode('[gd_login_box]'); |
|
32 | - $this->assertContains( 'geodir-loginbox-list', $output ); |
|
33 | - } |
|
34 | - |
|
35 | - public function testPopPostCatShortcode() |
|
36 | - { |
|
37 | - global $geodir_post_type; |
|
38 | - $geodir_post_type = 'gd_place'; |
|
39 | - $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
|
40 | - $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
41 | - } |
|
42 | - |
|
43 | - public function testPopPostViewShortcode() |
|
44 | - { |
|
45 | - $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
|
46 | - $this->assertContains( 'geodir_category_list_view', $output ); |
|
47 | - } |
|
48 | - |
|
49 | - public function testRecentReviewsShortcode() |
|
50 | - { |
|
51 | - $query_args = array( |
|
52 | - 'post_status' => 'publish', |
|
53 | - 'post_type' => 'gd_place', |
|
54 | - 'posts_per_page' => 1, |
|
55 | - ); |
|
56 | - |
|
57 | - $all_posts = new WP_Query( $query_args ); |
|
58 | - $post_id = null; |
|
59 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
60 | - $post_id = get_the_ID(); |
|
61 | - endwhile; |
|
62 | - |
|
63 | - $this->assertTrue(is_int($post_id)); |
|
64 | - |
|
65 | - $time = current_time('mysql'); |
|
66 | - |
|
67 | - $data = array( |
|
68 | - 'comment_post_ID' => $post_id, |
|
69 | - 'comment_author' => 'admin', |
|
70 | - 'comment_author_email' => '[email protected]', |
|
71 | - 'comment_author_url' => 'http://wpgeodirectory.com', |
|
72 | - 'comment_content' => 'content here testtcc', |
|
73 | - 'comment_type' => '', |
|
74 | - 'comment_parent' => 0, |
|
75 | - 'user_id' => 1, |
|
76 | - 'comment_author_IP' => '127.0.0.1', |
|
77 | - 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
78 | - 'comment_date' => $time, |
|
79 | - 'comment_approved' => 1, |
|
80 | - ); |
|
81 | - |
|
82 | - $comment_id = wp_insert_comment($data); |
|
83 | - |
|
84 | - $_REQUEST['geodir_overallrating'] = 5.0; |
|
85 | - geodir_save_rating($comment_id); |
|
86 | - |
|
87 | - $output = do_shortcode('[gd_recent_reviews count=5]'); |
|
88 | - $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
89 | - } |
|
90 | - |
|
91 | - public function testRelatedListingsShortcode() |
|
92 | - { |
|
93 | - $query_args = array( |
|
94 | - 'post_status' => 'publish', |
|
95 | - 'post_type' => 'gd_place', |
|
96 | - 'posts_per_page' => 1, |
|
97 | - ); |
|
98 | - |
|
99 | - $all_posts = new WP_Query( $query_args ); |
|
100 | - $post_id = null; |
|
101 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
102 | - $post_id = get_the_ID(); |
|
103 | - global $post; |
|
104 | - $post = geodir_get_post_info($post_id); |
|
105 | - setup_postdata($post); |
|
106 | - $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
|
107 | - $this->assertContains( 'geodir_location_listing', $output ); |
|
108 | - endwhile; |
|
109 | - |
|
110 | - $this->assertTrue(is_int($post_id)); |
|
111 | - |
|
112 | - } |
|
113 | - |
|
114 | - public function testListingsShortcode() |
|
115 | - { |
|
116 | - $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
|
117 | - $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
118 | - } |
|
119 | - |
|
120 | - public function texstBestOfWidgetShortcode() |
|
121 | - { |
|
122 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
123 | - include_once($template); |
|
124 | - |
|
125 | - $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
|
126 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
127 | - } |
|
128 | - |
|
129 | - public function testAddListingShortcode() |
|
130 | - { |
|
131 | - $_REQUEST['listing_type'] = 'gd_place'; |
|
132 | - $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
133 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
134 | - } |
|
135 | - |
|
136 | - public function tearDown() |
|
137 | - { |
|
138 | - parent::tearDown(); |
|
139 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + |
|
9 | + } |
|
10 | + |
|
11 | + public function testHomeMapShortcode() |
|
12 | + { |
|
13 | + $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
14 | + $this->assertContains( 'geodir-map-home-page', $output ); |
|
15 | + } |
|
16 | + |
|
17 | + public function testListingMapShortcode() |
|
18 | + { |
|
19 | + $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
20 | + $this->assertContains( 'geodir-map-listing-page', $output ); |
|
21 | + } |
|
22 | + |
|
23 | + public function testListingSliderShortcode() |
|
24 | + { |
|
25 | + $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
|
26 | + $this->assertContains( 'geodir_widget_carousel', $output ); |
|
27 | + } |
|
28 | + |
|
29 | + public function testLoginBoxShortcode() |
|
30 | + { |
|
31 | + $output = do_shortcode('[gd_login_box]'); |
|
32 | + $this->assertContains( 'geodir-loginbox-list', $output ); |
|
33 | + } |
|
34 | + |
|
35 | + public function testPopPostCatShortcode() |
|
36 | + { |
|
37 | + global $geodir_post_type; |
|
38 | + $geodir_post_type = 'gd_place'; |
|
39 | + $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
|
40 | + $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
41 | + } |
|
42 | + |
|
43 | + public function testPopPostViewShortcode() |
|
44 | + { |
|
45 | + $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
|
46 | + $this->assertContains( 'geodir_category_list_view', $output ); |
|
47 | + } |
|
48 | + |
|
49 | + public function testRecentReviewsShortcode() |
|
50 | + { |
|
51 | + $query_args = array( |
|
52 | + 'post_status' => 'publish', |
|
53 | + 'post_type' => 'gd_place', |
|
54 | + 'posts_per_page' => 1, |
|
55 | + ); |
|
56 | + |
|
57 | + $all_posts = new WP_Query( $query_args ); |
|
58 | + $post_id = null; |
|
59 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
60 | + $post_id = get_the_ID(); |
|
61 | + endwhile; |
|
62 | + |
|
63 | + $this->assertTrue(is_int($post_id)); |
|
64 | + |
|
65 | + $time = current_time('mysql'); |
|
66 | + |
|
67 | + $data = array( |
|
68 | + 'comment_post_ID' => $post_id, |
|
69 | + 'comment_author' => 'admin', |
|
70 | + 'comment_author_email' => '[email protected]', |
|
71 | + 'comment_author_url' => 'http://wpgeodirectory.com', |
|
72 | + 'comment_content' => 'content here testtcc', |
|
73 | + 'comment_type' => '', |
|
74 | + 'comment_parent' => 0, |
|
75 | + 'user_id' => 1, |
|
76 | + 'comment_author_IP' => '127.0.0.1', |
|
77 | + 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
78 | + 'comment_date' => $time, |
|
79 | + 'comment_approved' => 1, |
|
80 | + ); |
|
81 | + |
|
82 | + $comment_id = wp_insert_comment($data); |
|
83 | + |
|
84 | + $_REQUEST['geodir_overallrating'] = 5.0; |
|
85 | + geodir_save_rating($comment_id); |
|
86 | + |
|
87 | + $output = do_shortcode('[gd_recent_reviews count=5]'); |
|
88 | + $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
89 | + } |
|
90 | + |
|
91 | + public function testRelatedListingsShortcode() |
|
92 | + { |
|
93 | + $query_args = array( |
|
94 | + 'post_status' => 'publish', |
|
95 | + 'post_type' => 'gd_place', |
|
96 | + 'posts_per_page' => 1, |
|
97 | + ); |
|
98 | + |
|
99 | + $all_posts = new WP_Query( $query_args ); |
|
100 | + $post_id = null; |
|
101 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
102 | + $post_id = get_the_ID(); |
|
103 | + global $post; |
|
104 | + $post = geodir_get_post_info($post_id); |
|
105 | + setup_postdata($post); |
|
106 | + $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
|
107 | + $this->assertContains( 'geodir_location_listing', $output ); |
|
108 | + endwhile; |
|
109 | + |
|
110 | + $this->assertTrue(is_int($post_id)); |
|
111 | + |
|
112 | + } |
|
113 | + |
|
114 | + public function testListingsShortcode() |
|
115 | + { |
|
116 | + $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
|
117 | + $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
118 | + } |
|
119 | + |
|
120 | + public function texstBestOfWidgetShortcode() |
|
121 | + { |
|
122 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
123 | + include_once($template); |
|
124 | + |
|
125 | + $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
|
126 | + $this->assertContains( 'geodir_bestof_widget', $output ); |
|
127 | + } |
|
128 | + |
|
129 | + public function testAddListingShortcode() |
|
130 | + { |
|
131 | + $_REQUEST['listing_type'] = 'gd_place'; |
|
132 | + $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
133 | + $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
134 | + } |
|
135 | + |
|
136 | + public function tearDown() |
|
137 | + { |
|
138 | + parent::tearDown(); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | ?> |
142 | 142 | \ No newline at end of file |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | public function testHomeMapShortcode() |
12 | 12 | { |
13 | 13 | $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
14 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
14 | + $this->assertContains('geodir-map-home-page', $output); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function testListingMapShortcode() |
18 | 18 | { |
19 | 19 | $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
20 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
20 | + $this->assertContains('geodir-map-listing-page', $output); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function testListingSliderShortcode() |
24 | 24 | { |
25 | 25 | $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
26 | - $this->assertContains( 'geodir_widget_carousel', $output ); |
|
26 | + $this->assertContains('geodir_widget_carousel', $output); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testLoginBoxShortcode() |
30 | 30 | { |
31 | 31 | $output = do_shortcode('[gd_login_box]'); |
32 | - $this->assertContains( 'geodir-loginbox-list', $output ); |
|
32 | + $this->assertContains('geodir-loginbox-list', $output); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testPopPostCatShortcode() |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | global $geodir_post_type; |
38 | 38 | $geodir_post_type = 'gd_place'; |
39 | 39 | $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
40 | - $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
40 | + $this->assertContains('geodir-popular-cat-list', $output); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function testPopPostViewShortcode() |
44 | 44 | { |
45 | 45 | $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
46 | - $this->assertContains( 'geodir_category_list_view', $output ); |
|
46 | + $this->assertContains('geodir_category_list_view', $output); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testRecentReviewsShortcode() |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | 'posts_per_page' => 1, |
55 | 55 | ); |
56 | 56 | |
57 | - $all_posts = new WP_Query( $query_args ); |
|
57 | + $all_posts = new WP_Query($query_args); |
|
58 | 58 | $post_id = null; |
59 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
59 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
60 | 60 | $post_id = get_the_ID(); |
61 | 61 | endwhile; |
62 | 62 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | geodir_save_rating($comment_id); |
86 | 86 | |
87 | 87 | $output = do_shortcode('[gd_recent_reviews count=5]'); |
88 | - $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
88 | + $this->assertContains('geodir_sc_recent_reviews', $output); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function testRelatedListingsShortcode() |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | 'posts_per_page' => 1, |
97 | 97 | ); |
98 | 98 | |
99 | - $all_posts = new WP_Query( $query_args ); |
|
99 | + $all_posts = new WP_Query($query_args); |
|
100 | 100 | $post_id = null; |
101 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
101 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
102 | 102 | $post_id = get_the_ID(); |
103 | 103 | global $post; |
104 | - $post = geodir_get_post_info($post_id); |
|
104 | + $post = geodir_get_post_info($post_id); |
|
105 | 105 | setup_postdata($post); |
106 | 106 | $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
107 | - $this->assertContains( 'geodir_location_listing', $output ); |
|
107 | + $this->assertContains('geodir_location_listing', $output); |
|
108 | 108 | endwhile; |
109 | 109 | |
110 | 110 | $this->assertTrue(is_int($post_id)); |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | public function testListingsShortcode() |
115 | 115 | { |
116 | 116 | $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
117 | - $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
117 | + $this->assertContains('geodir-sc-gd-listings', $output); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function texstBestOfWidgetShortcode() |
121 | 121 | { |
122 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
122 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
123 | 123 | include_once($template); |
124 | 124 | |
125 | 125 | $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
126 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
126 | + $this->assertContains('geodir_bestof_widget', $output); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function testAddListingShortcode() |
130 | 130 | { |
131 | 131 | $_REQUEST['listing_type'] = 'gd_place'; |
132 | 132 | $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
133 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
133 | + $this->assertContains('geodir-add-listing-submit', $output); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function tearDown() |
@@ -1,53 +1,53 @@ |
||
1 | 1 | <?php |
2 | 2 | class AuthorPage extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + } |
|
8 | 8 | |
9 | - public function testAuthorPage() |
|
10 | - { |
|
11 | - global $current_user; |
|
9 | + public function testAuthorPage() |
|
10 | + { |
|
11 | + global $current_user; |
|
12 | 12 | |
13 | - $user_id = $current_user->ID; |
|
13 | + $user_id = $current_user->ID; |
|
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | - // Add listing |
|
17 | + // Add listing |
|
18 | 18 | |
19 | - $args = array( |
|
20 | - 'listing_type' => 'gd_place', |
|
21 | - 'post_title' => 'Test Listing Title 2', |
|
22 | - 'post_desc' => 'Test Desc', |
|
23 | - 'post_tags' => 'test1,test2', |
|
24 | - 'post_address' => 'New York City Hall', |
|
25 | - 'post_zip' => '10007', |
|
26 | - 'post_mapview' => 'ROADMAP', |
|
27 | - 'post_mapzoom' => '10', |
|
28 | - 'geodir_timing' => '10.00 am to 6 pm every day', |
|
29 | - 'geodir_contact' => '1234567890', |
|
30 | - 'geodir_email' => '[email protected]', |
|
31 | - 'geodir_website' => 'http://test.com', |
|
32 | - 'geodir_twitter' => 'http://twitter.com/test', |
|
33 | - 'geodir_facebook' => 'http://facebook.com/test', |
|
34 | - 'geodir_special_offers' => 'Test offer' |
|
35 | - ); |
|
36 | - $post_id = geodir_save_listing($args, true); |
|
19 | + $args = array( |
|
20 | + 'listing_type' => 'gd_place', |
|
21 | + 'post_title' => 'Test Listing Title 2', |
|
22 | + 'post_desc' => 'Test Desc', |
|
23 | + 'post_tags' => 'test1,test2', |
|
24 | + 'post_address' => 'New York City Hall', |
|
25 | + 'post_zip' => '10007', |
|
26 | + 'post_mapview' => 'ROADMAP', |
|
27 | + 'post_mapzoom' => '10', |
|
28 | + 'geodir_timing' => '10.00 am to 6 pm every day', |
|
29 | + 'geodir_contact' => '1234567890', |
|
30 | + 'geodir_email' => '[email protected]', |
|
31 | + 'geodir_website' => 'http://test.com', |
|
32 | + 'geodir_twitter' => 'http://twitter.com/test', |
|
33 | + 'geodir_facebook' => 'http://facebook.com/test', |
|
34 | + 'geodir_special_offers' => 'Test offer' |
|
35 | + ); |
|
36 | + $post_id = geodir_save_listing($args, true); |
|
37 | 37 | |
38 | - $this->assertTrue(is_int($post_id)); |
|
38 | + $this->assertTrue(is_int($post_id)); |
|
39 | 39 | |
40 | - $count = count_user_posts( $user_id, "gd_place" ); |
|
40 | + $count = count_user_posts( $user_id, "gd_place" ); |
|
41 | 41 | |
42 | - $this->assertTrue(is_int((int) $count)); |
|
42 | + $this->assertTrue(is_int((int) $count)); |
|
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | - public function tearDown() |
|
49 | - { |
|
50 | - parent::tearDown(); |
|
51 | - } |
|
48 | + public function tearDown() |
|
49 | + { |
|
50 | + parent::tearDown(); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | $this->assertTrue(is_int($post_id)); |
39 | 39 | |
40 | - $count = count_user_posts( $user_id, "gd_place" ); |
|
40 | + $count = count_user_posts($user_id, "gd_place"); |
|
41 | 41 | |
42 | 42 | $this->assertTrue(is_int((int) $count)); |
43 | 43 |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | * @global object $wpdb WordPress Database object. |
2196 | 2196 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
2197 | 2197 | * @param int $attachment_id Attachment ID. |
2198 | - * @return bool|void Returns false on failure. |
|
2198 | + * @return false|null Returns false on failure. |
|
2199 | 2199 | */ |
2200 | 2200 | function geodirectory_before_featured_image_delete($attachment_id) |
2201 | 2201 | { |
@@ -2368,6 +2368,7 @@ discard block |
||
2368 | 2368 | * @global object $wpdb WordPress Database object. |
2369 | 2369 | * @global object $current_user Current user object. |
2370 | 2370 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
2371 | + * @param string $user_id |
|
2371 | 2372 | * @return array User listing count for each post type. |
2372 | 2373 | */ |
2373 | 2374 | function geodir_user_post_listing_count($user_id=null) |
@@ -3176,7 +3177,7 @@ discard block |
||
3176 | 3177 | * @since 1.0.0 |
3177 | 3178 | * @package GeoDirectory |
3178 | 3179 | * @param array $classes The class array of the HTML element. |
3179 | - * @return array Modified class array. |
|
3180 | + * @return string[] Modified class array. |
|
3180 | 3181 | */ |
3181 | 3182 | function geodir_body_class_no_rating($classes = array()) |
3182 | 3183 | { |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | add_filter('query_vars', 'geodir_add_location_var'); |
87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var'); |
88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8 |
89 | -if (get_option('permalink_structure') != '') |
|
90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
89 | +if (get_option('permalink_structure') != '') { |
|
90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
91 | +} |
|
91 | 92 | |
92 | 93 | add_filter('parse_query', 'geodir_modified_query'); |
93 | 94 | |
@@ -421,8 +422,9 @@ discard block |
||
421 | 422 | */ |
422 | 423 | do_action('geodir_after_social_sharing_buttons'); |
423 | 424 | $content_html = ob_get_clean(); |
424 | - if (trim($content_html) != '') |
|
425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
425 | + if (trim($content_html) != '') { |
|
426 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
427 | + } |
|
426 | 428 | if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
427 | 429 | /** |
428 | 430 | * Filter the geodir_social_sharing_buttons() function content. |
@@ -468,8 +470,9 @@ discard block |
||
468 | 470 | */ |
469 | 471 | do_action('geodir_after_share_this_button'); |
470 | 472 | $content_html = ob_get_clean(); |
471 | - if (trim($content_html) != '') |
|
472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | + if (trim($content_html) != '') { |
|
474 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
475 | + } |
|
473 | 476 | if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
474 | 477 | /** |
475 | 478 | * Filter the geodir_share_this_button() function content. |
@@ -524,8 +527,9 @@ discard block |
||
524 | 527 | */ |
525 | 528 | do_action('geodir_after_edit_post_link'); |
526 | 529 | $content_html = ob_get_clean(); |
527 | - if (trim($content_html) != '') |
|
528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
530 | + if (trim($content_html) != '') { |
|
531 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
532 | + } |
|
529 | 533 | if ((int)get_option('geodir_disable_user_links_section') != 1) { |
530 | 534 | /** |
531 | 535 | * Filter the geodir_edit_post_link() function content. |
@@ -1098,8 +1102,9 @@ discard block |
||
1098 | 1102 | */ |
1099 | 1103 | do_action('geodir_after_google_analytics'); |
1100 | 1104 | $content_html = ob_get_clean(); |
1101 | - if (trim($content_html) != '') |
|
1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1105 | + if (trim($content_html) != '') { |
|
1106 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1107 | + } |
|
1103 | 1108 | if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
1104 | 1109 | /** |
1105 | 1110 | * Filter the geodir_edit_post_link() function content. |
@@ -1236,8 +1241,9 @@ discard block |
||
1236 | 1241 | do_action('geodir_after_detail_page_more_info'); |
1237 | 1242 | |
1238 | 1243 | $content_html = ob_get_clean(); |
1239 | - if (trim($content_html) != '') |
|
1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1244 | + if (trim($content_html) != '') { |
|
1245 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1246 | + } |
|
1241 | 1247 | if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
1242 | 1248 | /** |
1243 | 1249 | * Filter the output html for function geodir_detail_page_more_info(). |
@@ -1353,8 +1359,9 @@ discard block |
||
1353 | 1359 | $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
1354 | 1360 | |
1355 | 1361 | foreach ($arr_alert_msg as $key => $value) { |
1356 | - if (!is_scalar($value)) |
|
1357 | - continue; |
|
1362 | + if (!is_scalar($value)) { |
|
1363 | + continue; |
|
1364 | + } |
|
1358 | 1365 | $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
1359 | 1366 | } |
1360 | 1367 | |
@@ -1410,17 +1417,19 @@ discard block |
||
1410 | 1417 | global $geodir_sidebars; |
1411 | 1418 | global $sidebars_widgets; |
1412 | 1419 | |
1413 | - if (!is_array($sidebars_widgets)) |
|
1414 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1420 | + if (!is_array($sidebars_widgets)) { |
|
1421 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1422 | + } |
|
1415 | 1423 | $geodir_old_sidebars = array(); |
1416 | 1424 | |
1417 | 1425 | if (is_array($geodir_sidebars)) { |
1418 | 1426 | foreach ($geodir_sidebars as $val) { |
1419 | 1427 | if (is_array($sidebars_widgets)) { |
1420 | - if (array_key_exists($val, $sidebars_widgets)) |
|
1421 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1422 | - else |
|
1423 | - $geodir_old_sidebars[$val] = array(); |
|
1428 | + if (array_key_exists($val, $sidebars_widgets)) { |
|
1429 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1430 | + } else { |
|
1431 | + $geodir_old_sidebars[$val] = array(); |
|
1432 | + } |
|
1424 | 1433 | } |
1425 | 1434 | } |
1426 | 1435 | } |
@@ -1441,16 +1450,19 @@ discard block |
||
1441 | 1450 | { |
1442 | 1451 | global $sidebars_widgets; |
1443 | 1452 | |
1444 | - if (!is_array($sidebars_widgets)) |
|
1445 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1453 | + if (!is_array($sidebars_widgets)) { |
|
1454 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1455 | + } |
|
1446 | 1456 | |
1447 | 1457 | if (is_array($sidebars_widgets)) { |
1448 | 1458 | $geodir_old_sidebars = get_option('geodir_sidebars'); |
1449 | 1459 | if (is_array($geodir_old_sidebars)) { |
1450 | 1460 | foreach ($geodir_old_sidebars as $key => $val) { |
1451 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1461 | + if(0 === strpos($key, 'geodir_')) { |
|
1462 | + // if gd widget |
|
1452 | 1463 | { |
1453 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1464 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1465 | + } |
|
1454 | 1466 | } |
1455 | 1467 | |
1456 | 1468 | |
@@ -1586,20 +1598,25 @@ discard block |
||
1586 | 1598 | } |
1587 | 1599 | } |
1588 | 1600 | |
1589 | - if ($tab == 'post_info') |
|
1590 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1601 | + if ($tab == 'post_info') { |
|
1602 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1603 | + } |
|
1591 | 1604 | |
1592 | - if ($tab == 'post_images') |
|
1593 | - $is_display = (!empty($post_images)) ? true : false; |
|
1605 | + if ($tab == 'post_images') { |
|
1606 | + $is_display = (!empty($post_images)) ? true : false; |
|
1607 | + } |
|
1594 | 1608 | |
1595 | - if ($tab == 'post_video') |
|
1596 | - $is_display = (!empty($video)) ? true : false; |
|
1609 | + if ($tab == 'post_video') { |
|
1610 | + $is_display = (!empty($video)) ? true : false; |
|
1611 | + } |
|
1597 | 1612 | |
1598 | - if ($tab == 'special_offers') |
|
1599 | - $is_display = (!empty($special_offers)) ? true : false; |
|
1613 | + if ($tab == 'special_offers') { |
|
1614 | + $is_display = (!empty($special_offers)) ? true : false; |
|
1615 | + } |
|
1600 | 1616 | |
1601 | - if ($tab == 'reviews') |
|
1602 | - $is_display = (geodir_is_page('detail')) ? true : false; |
|
1617 | + if ($tab == 'reviews') { |
|
1618 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
1619 | + } |
|
1603 | 1620 | |
1604 | 1621 | if ($tab == 'related_listing') { |
1605 | 1622 | $message = __('No listings found which match your selection.', 'geodirectory'); |
@@ -1833,11 +1850,13 @@ discard block |
||
1833 | 1850 | $region_slug = $default_location->region_slug; |
1834 | 1851 | $city_slug = $default_location->city_slug; |
1835 | 1852 | |
1836 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1837 | - return $slug_exists = true; |
|
1853 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) { |
|
1854 | + return $slug_exists = true; |
|
1855 | + } |
|
1838 | 1856 | |
1839 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1840 | - return $slug_exists = true; |
|
1857 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) { |
|
1858 | + return $slug_exists = true; |
|
1859 | + } |
|
1841 | 1860 | |
1842 | 1861 | return $slug_exists; |
1843 | 1862 | } |
@@ -1879,40 +1898,31 @@ discard block |
||
1879 | 1898 | if(geodir_is_page('home')){ |
1880 | 1899 | $gd_page = 'home'; |
1881 | 1900 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1882 | - } |
|
1883 | - elseif(geodir_is_page('detail')){ |
|
1901 | + } elseif(geodir_is_page('detail')){ |
|
1884 | 1902 | $gd_page = 'detail'; |
1885 | 1903 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1886 | - } |
|
1887 | - elseif(geodir_is_page('pt')){ |
|
1904 | + } elseif(geodir_is_page('pt')){ |
|
1888 | 1905 | $gd_page = 'pt'; |
1889 | 1906 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1890 | - } |
|
1891 | - elseif(geodir_is_page('listing')){ |
|
1907 | + } elseif(geodir_is_page('listing')){ |
|
1892 | 1908 | $gd_page = 'listing'; |
1893 | 1909 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1894 | - } |
|
1895 | - elseif(geodir_is_page('location')){ |
|
1910 | + } elseif(geodir_is_page('location')){ |
|
1896 | 1911 | $gd_page = 'location'; |
1897 | 1912 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1898 | - } |
|
1899 | - elseif(geodir_is_page('search')){ |
|
1913 | + } elseif(geodir_is_page('search')){ |
|
1900 | 1914 | $gd_page = 'search'; |
1901 | 1915 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1902 | - } |
|
1903 | - elseif(geodir_is_page('add-listing')){ |
|
1916 | + } elseif(geodir_is_page('add-listing')){ |
|
1904 | 1917 | $gd_page = 'add-listing'; |
1905 | 1918 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1906 | - } |
|
1907 | - elseif(geodir_is_page('author')){ |
|
1919 | + } elseif(geodir_is_page('author')){ |
|
1908 | 1920 | $gd_page = 'author'; |
1909 | 1921 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1910 | - } |
|
1911 | - elseif(geodir_is_page('login')){ |
|
1922 | + } elseif(geodir_is_page('login')){ |
|
1912 | 1923 | $gd_page = 'login'; |
1913 | 1924 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1914 | - } |
|
1915 | - elseif(geodir_is_page('listing-success')){ |
|
1925 | + } elseif(geodir_is_page('listing-success')){ |
|
1916 | 1926 | $gd_page = 'listing-success'; |
1917 | 1927 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1918 | 1928 | } |
@@ -1990,11 +2000,13 @@ discard block |
||
1990 | 2000 | |
1991 | 2001 | if (!get_option('geodir_remove_url_seperator')) { |
1992 | 2002 | |
1993 | - if (get_option('geodir_listingurl_separator')) |
|
1994 | - delete_option('geodir_listingurl_separator'); |
|
2003 | + if (get_option('geodir_listingurl_separator')) { |
|
2004 | + delete_option('geodir_listingurl_separator'); |
|
2005 | + } |
|
1995 | 2006 | |
1996 | - if (get_option('geodir_detailurl_separator')) |
|
1997 | - delete_option('geodir_detailurl_separator'); |
|
2007 | + if (get_option('geodir_detailurl_separator')) { |
|
2008 | + delete_option('geodir_detailurl_separator'); |
|
2009 | + } |
|
1998 | 2010 | |
1999 | 2011 | flush_rewrite_rules(false); |
2000 | 2012 | |
@@ -2018,8 +2030,9 @@ discard block |
||
2018 | 2030 | { |
2019 | 2031 | foreach ($permalink_arr as $key => $value) { |
2020 | 2032 | |
2021 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2022 | - unset($permalink_arr[$key]); |
|
2033 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') { |
|
2034 | + unset($permalink_arr[$key]); |
|
2035 | + } |
|
2023 | 2036 | |
2024 | 2037 | } |
2025 | 2038 | |
@@ -2154,16 +2167,18 @@ discard block |
||
2154 | 2167 | |
2155 | 2168 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
2156 | 2169 | |
2157 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2158 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2170 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') { |
|
2171 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2172 | + } |
|
2159 | 2173 | } |
2160 | 2174 | |
2161 | 2175 | if (array_key_exists('special_offers', $tabs_arr)) { |
2162 | 2176 | |
2163 | 2177 | $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
2164 | 2178 | |
2165 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2166 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2179 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') { |
|
2180 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2181 | + } |
|
2167 | 2182 | } |
2168 | 2183 | |
2169 | 2184 | } |
@@ -2218,8 +2233,9 @@ discard block |
||
2218 | 2233 | |
2219 | 2234 | $all_postypes = geodir_get_posttypes(); |
2220 | 2235 | |
2221 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2222 | - return false; |
|
2236 | + if (!in_array($post_type, $all_postypes) || !is_admin()) { |
|
2237 | + return false; |
|
2238 | + } |
|
2223 | 2239 | |
2224 | 2240 | $uploads = wp_upload_dir(); |
2225 | 2241 | |
@@ -2293,8 +2309,9 @@ discard block |
||
2293 | 2309 | $file_info = pathinfo($attach->file); |
2294 | 2310 | |
2295 | 2311 | $sub_dir = ''; |
2296 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2297 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2312 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') { |
|
2313 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2314 | + } |
|
2298 | 2315 | |
2299 | 2316 | $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
2300 | 2317 | $uploads_path = $uploads['basedir']; |
@@ -2315,8 +2332,9 @@ discard block |
||
2315 | 2332 | |
2316 | 2333 | if (!empty($attachment_data)) { |
2317 | 2334 | |
2318 | - if ($attachment_data->ID) |
|
2319 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2335 | + if ($attachment_data->ID) { |
|
2336 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2337 | + } |
|
2320 | 2338 | |
2321 | 2339 | } else { |
2322 | 2340 | |
@@ -2493,7 +2511,7 @@ discard block |
||
2493 | 2511 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
2494 | 2512 | $variables_array['value'] = ''; |
2495 | 2513 | $variables_array['value'] = $post->{$type['htmlvar_name']}; |
2496 | - }else{ |
|
2514 | + } else{ |
|
2497 | 2515 | $i = 0; |
2498 | 2516 | $fieldset_count++; |
2499 | 2517 | $field_set_start = 1; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_get_ajax_url() |
21 | 21 | { |
22 | - return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
22 | + return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | ///////////////////// |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var'); |
88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8 |
89 | 89 | if (get_option('permalink_structure') != '') |
90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
91 | 91 | |
92 | 92 | add_filter('parse_query', 'geodir_modified_query'); |
93 | 93 | |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | /* POST AND LOOP ACTIONS */ |
155 | 155 | //////////////////////// |
156 | 156 | if (!is_admin()) { |
157 | - add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere |
|
158 | - add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | - /** Exclude Virtual Pages From Pages List **/ |
|
160 | - add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | - add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | - add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | - add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | - add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
157 | + add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere |
|
158 | + add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | + /** Exclude Virtual Pages From Pages List **/ |
|
160 | + add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | + add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | + add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | + add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | + add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | */ |
223 | 223 | function geodir_unset_prev_theme_nav_location($newname) |
224 | 224 | { |
225 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | - if ($geodir_theme_location) { |
|
227 | - update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
228 | - } else { |
|
229 | - update_option('geodir_theme_location_nav', ''); |
|
230 | - } |
|
225 | + $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | + if ($geodir_theme_location) { |
|
227 | + update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
228 | + } else { |
|
229 | + update_option('geodir_theme_location_nav', ''); |
|
230 | + } |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /// add action for theme switch to blank previous theme navigation location setting |
@@ -248,32 +248,32 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function geodir_add_post_filters() |
250 | 250 | { |
251 | - /** |
|
252 | - * Contains all function for filtering listing. |
|
253 | - * |
|
254 | - * @since 1.0.0 |
|
255 | - * @package GeoDirectory |
|
256 | - */ |
|
257 | - include_once('geodirectory-functions/listing_filters.php'); |
|
251 | + /** |
|
252 | + * Contains all function for filtering listing. |
|
253 | + * |
|
254 | + * @since 1.0.0 |
|
255 | + * @package GeoDirectory |
|
256 | + */ |
|
257 | + include_once('geodirectory-functions/listing_filters.php'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | 261 | if (!function_exists('geodir_init_defaults')) { |
262 | - /** |
|
263 | - * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
264 | - * |
|
265 | - * @since 1.0.0 |
|
266 | - * @package GeoDirectory |
|
267 | - */ |
|
268 | - function geodir_init_defaults() |
|
269 | - { |
|
270 | - if (function_exists('geodir_register_defaults')) { |
|
262 | + /** |
|
263 | + * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
264 | + * |
|
265 | + * @since 1.0.0 |
|
266 | + * @package GeoDirectory |
|
267 | + */ |
|
268 | + function geodir_init_defaults() |
|
269 | + { |
|
270 | + if (function_exists('geodir_register_defaults')) { |
|
271 | 271 | |
272 | - geodir_register_defaults(); |
|
272 | + geodir_register_defaults(); |
|
273 | 273 | |
274 | - } |
|
274 | + } |
|
275 | 275 | |
276 | - } |
|
276 | + } |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -295,26 +295,26 @@ discard block |
||
295 | 295 | // CALLED ON 'sidebars_widgets' FILTER |
296 | 296 | |
297 | 297 | if (!function_exists('geodir_restrict_widget')) { |
298 | - /** |
|
299 | - * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
300 | - * |
|
301 | - * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
302 | - * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
303 | - * @since 1.0.0 |
|
304 | - * @package GeoDirectory |
|
305 | - */ |
|
306 | - function geodir_restrict_widget() |
|
307 | - { |
|
308 | - global $is_listing, $is_single_place; |
|
298 | + /** |
|
299 | + * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
300 | + * |
|
301 | + * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
302 | + * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
303 | + * @since 1.0.0 |
|
304 | + * @package GeoDirectory |
|
305 | + */ |
|
306 | + function geodir_restrict_widget() |
|
307 | + { |
|
308 | + global $is_listing, $is_single_place; |
|
309 | 309 | |
310 | - // set is listing |
|
311 | - (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
310 | + // set is listing |
|
311 | + (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
312 | 312 | |
313 | - // set is single place |
|
314 | - (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
313 | + // set is single place |
|
314 | + (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
315 | 315 | |
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -335,32 +335,32 @@ discard block |
||
335 | 335 | */ |
336 | 336 | function geodir_detail_page_sidebar_content_sorting() |
337 | 337 | { |
338 | - $arr_detail_page_sidebar_content = |
|
339 | - /** |
|
340 | - * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
341 | - * |
|
342 | - * This filter can be used to remove sections of the details page sidebar, |
|
343 | - * add new sections or rearrange the order of the sections. |
|
344 | - * |
|
345 | - * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
346 | - * @since 1.0.0 |
|
347 | - */ |
|
348 | - apply_filters('geodir_detail_page_sidebar_content', |
|
349 | - array('geodir_social_sharing_buttons', |
|
350 | - 'geodir_share_this_button', |
|
351 | - 'geodir_detail_page_google_analytics', |
|
352 | - 'geodir_edit_post_link', |
|
353 | - 'geodir_detail_page_review_rating', |
|
354 | - 'geodir_detail_page_more_info' |
|
355 | - ) // end of array |
|
356 | - ); // end of apply filter |
|
357 | - if (!empty($arr_detail_page_sidebar_content)) { |
|
358 | - foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
359 | - if (function_exists($content_function)) { |
|
360 | - add_action('geodir_detail_page_sidebar', $content_function); |
|
361 | - } |
|
362 | - } |
|
363 | - } |
|
338 | + $arr_detail_page_sidebar_content = |
|
339 | + /** |
|
340 | + * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
341 | + * |
|
342 | + * This filter can be used to remove sections of the details page sidebar, |
|
343 | + * add new sections or rearrange the order of the sections. |
|
344 | + * |
|
345 | + * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
346 | + * @since 1.0.0 |
|
347 | + */ |
|
348 | + apply_filters('geodir_detail_page_sidebar_content', |
|
349 | + array('geodir_social_sharing_buttons', |
|
350 | + 'geodir_share_this_button', |
|
351 | + 'geodir_detail_page_google_analytics', |
|
352 | + 'geodir_edit_post_link', |
|
353 | + 'geodir_detail_page_review_rating', |
|
354 | + 'geodir_detail_page_more_info' |
|
355 | + ) // end of array |
|
356 | + ); // end of apply filter |
|
357 | + if (!empty($arr_detail_page_sidebar_content)) { |
|
358 | + foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
359 | + if (function_exists($content_function)) { |
|
360 | + add_action('geodir_detail_page_sidebar', $content_function); |
|
361 | + } |
|
362 | + } |
|
363 | + } |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1); |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | */ |
376 | 376 | function geodir_add_to_favourite_link() |
377 | 377 | { |
378 | - global $post, $preview; |
|
379 | - if (!$preview && geodir_is_page('detail')) { |
|
380 | - ?> |
|
378 | + global $post, $preview; |
|
379 | + if (!$preview && geodir_is_page('detail')) { |
|
380 | + ?> |
|
381 | 381 | <p class="edit_link"> |
382 | 382 | <?php geodir_favourite_html($post->post_author, $post->ID); ?> |
383 | 383 | </p> |
384 | 384 | <?php |
385 | - } |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -396,41 +396,41 @@ discard block |
||
396 | 396 | */ |
397 | 397 | function geodir_social_sharing_buttons() |
398 | 398 | { |
399 | - global $preview; |
|
400 | - ob_start(); // Start buffering; |
|
401 | - /** |
|
402 | - * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
403 | - * |
|
404 | - * @since 1.0.0 |
|
405 | - */ |
|
406 | - do_action('geodir_before_social_sharing_buttons'); |
|
407 | - if (!$preview) { |
|
408 | - ?> |
|
399 | + global $preview; |
|
400 | + ob_start(); // Start buffering; |
|
401 | + /** |
|
402 | + * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
403 | + * |
|
404 | + * @since 1.0.0 |
|
405 | + */ |
|
406 | + do_action('geodir_before_social_sharing_buttons'); |
|
407 | + if (!$preview) { |
|
408 | + ?> |
|
409 | 409 | <div class="likethis"> |
410 | 410 | <?php geodir_twitter_tweet_button(); ?> |
411 | 411 | <?php geodir_fb_like_button(); ?> |
412 | 412 | <?php geodir_google_plus_button(); ?> |
413 | 413 | </div> |
414 | 414 | <?php |
415 | - }// end of if, if its a preview or not |
|
416 | - |
|
417 | - /** |
|
418 | - * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
419 | - * |
|
420 | - * @since 1.0.0 |
|
421 | - */ |
|
422 | - do_action('geodir_after_social_sharing_buttons'); |
|
423 | - $content_html = ob_get_clean(); |
|
424 | - if (trim($content_html) != '') |
|
425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
426 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
427 | - /** |
|
428 | - * Filter the geodir_social_sharing_buttons() function content. |
|
429 | - * |
|
430 | - * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
431 | - */ |
|
432 | - echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
433 | - } |
|
415 | + }// end of if, if its a preview or not |
|
416 | + |
|
417 | + /** |
|
418 | + * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
419 | + * |
|
420 | + * @since 1.0.0 |
|
421 | + */ |
|
422 | + do_action('geodir_after_social_sharing_buttons'); |
|
423 | + $content_html = ob_get_clean(); |
|
424 | + if (trim($content_html) != '') |
|
425 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
426 | + if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
427 | + /** |
|
428 | + * Filter the geodir_social_sharing_buttons() function content. |
|
429 | + * |
|
430 | + * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
431 | + */ |
|
432 | + echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
433 | + } |
|
434 | 434 | |
435 | 435 | |
436 | 436 | } |
@@ -446,39 +446,39 @@ discard block |
||
446 | 446 | */ |
447 | 447 | function geodir_share_this_button() |
448 | 448 | { |
449 | - global $preview; |
|
450 | - ob_start(); // Start buffering; |
|
451 | - /** |
|
452 | - * This is called before the share this html in the function geodir_share_this_button() |
|
453 | - * |
|
454 | - * @since 1.0.0 |
|
455 | - */ |
|
456 | - do_action('geodir_before_share_this_button'); |
|
457 | - if (!$preview) { |
|
458 | - ?> |
|
449 | + global $preview; |
|
450 | + ob_start(); // Start buffering; |
|
451 | + /** |
|
452 | + * This is called before the share this html in the function geodir_share_this_button() |
|
453 | + * |
|
454 | + * @since 1.0.0 |
|
455 | + */ |
|
456 | + do_action('geodir_before_share_this_button'); |
|
457 | + if (!$preview) { |
|
458 | + ?> |
|
459 | 459 | <div class="share clearfix"> |
460 | 460 | <?php geodir_share_this_button_code(); ?> |
461 | 461 | </div> |
462 | 462 | <?php |
463 | - }// end of if, if its a preview or not |
|
464 | - /** |
|
465 | - * This is called after the share this html in the function geodir_share_this_button() |
|
466 | - * |
|
467 | - * @since 1.0.0 |
|
468 | - */ |
|
469 | - do_action('geodir_after_share_this_button'); |
|
470 | - $content_html = ob_get_clean(); |
|
471 | - if (trim($content_html) != '') |
|
472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | - if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
474 | - /** |
|
475 | - * Filter the geodir_share_this_button() function content. |
|
476 | - * |
|
477 | - * @param string $content_html The output html of the geodir_share_this_button() function. |
|
478 | - * @since 1.0.0 |
|
479 | - */ |
|
480 | - echo $content_html = apply_filters('geodir_share_this_button_html', $content_html); |
|
481 | - } |
|
463 | + }// end of if, if its a preview or not |
|
464 | + /** |
|
465 | + * This is called after the share this html in the function geodir_share_this_button() |
|
466 | + * |
|
467 | + * @since 1.0.0 |
|
468 | + */ |
|
469 | + do_action('geodir_after_share_this_button'); |
|
470 | + $content_html = ob_get_clean(); |
|
471 | + if (trim($content_html) != '') |
|
472 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | + if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
474 | + /** |
|
475 | + * Filter the geodir_share_this_button() function content. |
|
476 | + * |
|
477 | + * @param string $content_html The output html of the geodir_share_this_button() function. |
|
478 | + * @since 1.0.0 |
|
479 | + */ |
|
480 | + echo $content_html = apply_filters('geodir_share_this_button_html', $content_html); |
|
481 | + } |
|
482 | 482 | |
483 | 483 | } |
484 | 484 | |
@@ -494,46 +494,46 @@ discard block |
||
494 | 494 | */ |
495 | 495 | function geodir_edit_post_link() |
496 | 496 | { |
497 | - global $post, $preview; |
|
498 | - ob_start(); // Start buffering; |
|
499 | - /** |
|
500 | - * This is called before the edit post link html in the function geodir_edit_post_link() |
|
501 | - * |
|
502 | - * @since 1.0.0 |
|
503 | - */ |
|
504 | - do_action('geodir_before_edit_post_link'); |
|
505 | - if (!$preview) { |
|
506 | - $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
497 | + global $post, $preview; |
|
498 | + ob_start(); // Start buffering; |
|
499 | + /** |
|
500 | + * This is called before the edit post link html in the function geodir_edit_post_link() |
|
501 | + * |
|
502 | + * @since 1.0.0 |
|
503 | + */ |
|
504 | + do_action('geodir_before_edit_post_link'); |
|
505 | + if (!$preview) { |
|
506 | + $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
507 | 507 | |
508 | - if ($is_current_user_owner) { |
|
509 | - $post_id = $post->ID; |
|
508 | + if ($is_current_user_owner) { |
|
509 | + $post_id = $post->ID; |
|
510 | 510 | |
511 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
512 | - $post_id = (int)$_REQUEST['pid']; |
|
513 | - } |
|
511 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
512 | + $post_id = (int)$_REQUEST['pid']; |
|
513 | + } |
|
514 | 514 | |
515 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
516 | - $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
517 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
518 | - } |
|
519 | - }// end of if, if its a preview or not |
|
520 | - /** |
|
521 | - * This is called after the edit post link html in the function geodir_edit_post_link() |
|
522 | - * |
|
523 | - * @since 1.0.0 |
|
524 | - */ |
|
525 | - do_action('geodir_after_edit_post_link'); |
|
526 | - $content_html = ob_get_clean(); |
|
527 | - if (trim($content_html) != '') |
|
528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
529 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
530 | - /** |
|
531 | - * Filter the geodir_edit_post_link() function content. |
|
532 | - * |
|
533 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
534 | - */ |
|
535 | - echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
536 | - } |
|
515 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
516 | + $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
517 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
518 | + } |
|
519 | + }// end of if, if its a preview or not |
|
520 | + /** |
|
521 | + * This is called after the edit post link html in the function geodir_edit_post_link() |
|
522 | + * |
|
523 | + * @since 1.0.0 |
|
524 | + */ |
|
525 | + do_action('geodir_after_edit_post_link'); |
|
526 | + $content_html = ob_get_clean(); |
|
527 | + if (trim($content_html) != '') |
|
528 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
529 | + if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
530 | + /** |
|
531 | + * Filter the geodir_edit_post_link() function content. |
|
532 | + * |
|
533 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
534 | + */ |
|
535 | + echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
536 | + } |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -547,41 +547,41 @@ discard block |
||
547 | 547 | */ |
548 | 548 | function geodir_detail_page_google_analytics() |
549 | 549 | { |
550 | - global $post; |
|
551 | - $package_info = array(); |
|
552 | - $package_info = geodir_post_package_info($package_info, $post); |
|
550 | + global $post; |
|
551 | + $package_info = array(); |
|
552 | + $package_info = geodir_post_package_info($package_info, $post); |
|
553 | 553 | |
554 | - $id = trim(get_option('geodir_ga_id')); |
|
554 | + $id = trim(get_option('geodir_ga_id')); |
|
555 | 555 | |
556 | - if (!$id) { |
|
557 | - return; //if no Google Analytics ID then bail. |
|
558 | - } |
|
556 | + if (!$id) { |
|
557 | + return; //if no Google Analytics ID then bail. |
|
558 | + } |
|
559 | 559 | |
560 | - ob_start(); // Start buffering; |
|
561 | - /** |
|
562 | - * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
563 | - * |
|
564 | - * @since 1.0.0 |
|
565 | - */ |
|
566 | - do_action('geodir_before_google_analytics'); |
|
560 | + ob_start(); // Start buffering; |
|
561 | + /** |
|
562 | + * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
563 | + * |
|
564 | + * @since 1.0.0 |
|
565 | + */ |
|
566 | + do_action('geodir_before_google_analytics'); |
|
567 | 567 | |
568 | - $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
569 | - /** |
|
570 | - * Filter the time interval to check & refresh new users results. |
|
571 | - * |
|
572 | - * @since 1.5.9 |
|
573 | - * |
|
574 | - * @param int $refresh_time Time interval to check & refresh new users results. |
|
575 | - */ |
|
576 | - $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
577 | - $refresh_time = absint($refresh_time * 1000); |
|
568 | + $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
569 | + /** |
|
570 | + * Filter the time interval to check & refresh new users results. |
|
571 | + * |
|
572 | + * @since 1.5.9 |
|
573 | + * |
|
574 | + * @param int $refresh_time Time interval to check & refresh new users results. |
|
575 | + */ |
|
576 | + $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
577 | + $refresh_time = absint($refresh_time * 1000); |
|
578 | 578 | |
579 | - $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
579 | + $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
580 | 580 | |
581 | - $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
582 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
583 | - $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
584 | - ?> |
|
581 | + $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
582 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
583 | + $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
584 | + ?> |
|
585 | 585 | <script type="text/javascript"> |
586 | 586 | var gd_gaTimeOut; |
587 | 587 | var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
@@ -833,15 +833,15 @@ discard block |
||
833 | 833 | var labels = results[1].rows.map(function(row) { return +row[0]; }); |
834 | 834 | |
835 | 835 | <?php |
836 | - // Here we list the shorthand days of the week so it can be used in translation. |
|
837 | - __("Mon",'geodirectory'); |
|
838 | - __("Tue",'geodirectory'); |
|
839 | - __("Wed",'geodirectory'); |
|
840 | - __("Thu",'geodirectory'); |
|
841 | - __("Fri",'geodirectory'); |
|
842 | - __("Sat",'geodirectory'); |
|
843 | - __("Sun",'geodirectory'); |
|
844 | - ?> |
|
836 | + // Here we list the shorthand days of the week so it can be used in translation. |
|
837 | + __("Mon",'geodirectory'); |
|
838 | + __("Tue",'geodirectory'); |
|
839 | + __("Wed",'geodirectory'); |
|
840 | + __("Thu",'geodirectory'); |
|
841 | + __("Fri",'geodirectory'); |
|
842 | + __("Sat",'geodirectory'); |
|
843 | + __("Sun",'geodirectory'); |
|
844 | + ?> |
|
845 | 845 | |
846 | 846 | labels = [ |
847 | 847 | "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
@@ -1090,24 +1090,24 @@ discard block |
||
1090 | 1090 | </span> |
1091 | 1091 | |
1092 | 1092 | <?php |
1093 | - } |
|
1094 | - /** |
|
1095 | - * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1096 | - * |
|
1097 | - * @since 1.0.0 |
|
1098 | - */ |
|
1099 | - do_action('geodir_after_google_analytics'); |
|
1100 | - $content_html = ob_get_clean(); |
|
1101 | - if (trim($content_html) != '') |
|
1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1103 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1104 | - /** |
|
1105 | - * Filter the geodir_edit_post_link() function content. |
|
1106 | - * |
|
1107 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1108 | - */ |
|
1109 | - echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1110 | - } |
|
1093 | + } |
|
1094 | + /** |
|
1095 | + * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1096 | + * |
|
1097 | + * @since 1.0.0 |
|
1098 | + */ |
|
1099 | + do_action('geodir_after_google_analytics'); |
|
1100 | + $content_html = ob_get_clean(); |
|
1101 | + if (trim($content_html) != '') |
|
1102 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1103 | + if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1104 | + /** |
|
1105 | + * Filter the geodir_edit_post_link() function content. |
|
1106 | + * |
|
1107 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1108 | + */ |
|
1109 | + echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1110 | + } |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | /** |
@@ -1123,90 +1123,90 @@ discard block |
||
1123 | 1123 | */ |
1124 | 1124 | function geodir_detail_page_review_rating() |
1125 | 1125 | { |
1126 | - global $post, $preview, $post_images; |
|
1127 | - ob_start(); // Start buffering; |
|
1128 | - /** |
|
1129 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1130 | - * |
|
1131 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1132 | - * |
|
1133 | - * @since 1.0.0 |
|
1134 | - */ |
|
1135 | - do_action('geodir_before_detail_page_review_rating'); |
|
1136 | - |
|
1137 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
1138 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
1139 | - |
|
1140 | - if ($post_avgratings != 0 && !$preview) { |
|
1141 | - /** |
|
1142 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1143 | - * |
|
1144 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1145 | - * |
|
1146 | - * @since 1.0.0 |
|
1147 | - * @param float $post_avgratings Average rating for the surrent post. |
|
1148 | - * @param int $post->ID Current post ID. |
|
1149 | - */ |
|
1150 | - do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1151 | - |
|
1152 | - $html = '<p style=" float:left;">'; |
|
1153 | - $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1154 | - $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1155 | - $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1126 | + global $post, $preview, $post_images; |
|
1127 | + ob_start(); // Start buffering; |
|
1128 | + /** |
|
1129 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1130 | + * |
|
1131 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1132 | + * |
|
1133 | + * @since 1.0.0 |
|
1134 | + */ |
|
1135 | + do_action('geodir_before_detail_page_review_rating'); |
|
1136 | + |
|
1137 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
1138 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
1139 | + |
|
1140 | + if ($post_avgratings != 0 && !$preview) { |
|
1141 | + /** |
|
1142 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1143 | + * |
|
1144 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1145 | + * |
|
1146 | + * @since 1.0.0 |
|
1147 | + * @param float $post_avgratings Average rating for the surrent post. |
|
1148 | + * @param int $post->ID Current post ID. |
|
1149 | + */ |
|
1150 | + do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1151 | + |
|
1152 | + $html = '<p style=" float:left;">'; |
|
1153 | + $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1154 | + $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1155 | + $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1156 | 1156 | |
1157 | 1157 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1158 | 1158 | |
1159 | 1159 | $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
1160 | 1160 | |
1161 | - $html .= '<span class="item">'; |
|
1162 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1161 | + $html .= '<span class="item">'; |
|
1162 | + $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1163 | 1163 | |
1164 | - if ($post_images) { |
|
1165 | - foreach ($post_images as $img) { |
|
1166 | - $post_img = $img->src; |
|
1167 | - break; |
|
1168 | - } |
|
1169 | - } |
|
1170 | - |
|
1171 | - if (isset($post_img) && $post_img) { |
|
1172 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1173 | - } |
|
1174 | - |
|
1175 | - $html .= '</span>'; |
|
1176 | - |
|
1177 | - echo $html .= '</div>'; |
|
1178 | - /** |
|
1179 | - * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1180 | - * |
|
1181 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1182 | - * |
|
1183 | - * @since 1.0.0 |
|
1184 | - * @param float $post_avgratings Average rating for the surrent post. |
|
1185 | - * @param int $post->ID Current post ID. |
|
1186 | - */ |
|
1187 | - do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1188 | - } |
|
1189 | - /** |
|
1190 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1191 | - * |
|
1192 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1193 | - * |
|
1194 | - * @since 1.0.0 |
|
1195 | - */ |
|
1196 | - do_action('geodir_after_detail_page_review_rating'); |
|
1197 | - $content_html = ob_get_clean(); |
|
1198 | - if (trim($content_html) != '') { |
|
1199 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1200 | - } |
|
1201 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1202 | - /** |
|
1203 | - * Filter the geodir_detail_page_review_rating() function content. |
|
1204 | - * |
|
1205 | - * @since 1.0.0 |
|
1206 | - * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1207 | - */ |
|
1208 | - echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1209 | - } |
|
1164 | + if ($post_images) { |
|
1165 | + foreach ($post_images as $img) { |
|
1166 | + $post_img = $img->src; |
|
1167 | + break; |
|
1168 | + } |
|
1169 | + } |
|
1170 | + |
|
1171 | + if (isset($post_img) && $post_img) { |
|
1172 | + $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1173 | + } |
|
1174 | + |
|
1175 | + $html .= '</span>'; |
|
1176 | + |
|
1177 | + echo $html .= '</div>'; |
|
1178 | + /** |
|
1179 | + * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1180 | + * |
|
1181 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1182 | + * |
|
1183 | + * @since 1.0.0 |
|
1184 | + * @param float $post_avgratings Average rating for the surrent post. |
|
1185 | + * @param int $post->ID Current post ID. |
|
1186 | + */ |
|
1187 | + do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1188 | + } |
|
1189 | + /** |
|
1190 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1191 | + * |
|
1192 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1193 | + * |
|
1194 | + * @since 1.0.0 |
|
1195 | + */ |
|
1196 | + do_action('geodir_after_detail_page_review_rating'); |
|
1197 | + $content_html = ob_get_clean(); |
|
1198 | + if (trim($content_html) != '') { |
|
1199 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1200 | + } |
|
1201 | + if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1202 | + /** |
|
1203 | + * Filter the geodir_detail_page_review_rating() function content. |
|
1204 | + * |
|
1205 | + * @since 1.0.0 |
|
1206 | + * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1207 | + */ |
|
1208 | + echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1209 | + } |
|
1210 | 1210 | } |
1211 | 1211 | |
1212 | 1212 | /** |
@@ -1218,35 +1218,35 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | function geodir_detail_page_more_info() |
1220 | 1220 | { |
1221 | - ob_start(); // Start buffering; |
|
1222 | - /** |
|
1223 | - * This is called before the info section html. |
|
1224 | - * |
|
1225 | - * @since 1.0.0 |
|
1226 | - */ |
|
1227 | - do_action('geodir_before_detail_page_more_info'); |
|
1228 | - if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1229 | - echo $geodir_post_detail_fields; |
|
1230 | - } |
|
1231 | - /** |
|
1232 | - * This is called after the info section html. |
|
1233 | - * |
|
1234 | - * @since 1.0.0 |
|
1235 | - */ |
|
1236 | - do_action('geodir_after_detail_page_more_info'); |
|
1237 | - |
|
1238 | - $content_html = ob_get_clean(); |
|
1239 | - if (trim($content_html) != '') |
|
1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1241 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1242 | - /** |
|
1243 | - * Filter the output html for function geodir_detail_page_more_info(). |
|
1244 | - * |
|
1245 | - * @since 1.0.0 |
|
1246 | - * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1247 | - */ |
|
1248 | - echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1249 | - } |
|
1221 | + ob_start(); // Start buffering; |
|
1222 | + /** |
|
1223 | + * This is called before the info section html. |
|
1224 | + * |
|
1225 | + * @since 1.0.0 |
|
1226 | + */ |
|
1227 | + do_action('geodir_before_detail_page_more_info'); |
|
1228 | + if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1229 | + echo $geodir_post_detail_fields; |
|
1230 | + } |
|
1231 | + /** |
|
1232 | + * This is called after the info section html. |
|
1233 | + * |
|
1234 | + * @since 1.0.0 |
|
1235 | + */ |
|
1236 | + do_action('geodir_after_detail_page_more_info'); |
|
1237 | + |
|
1238 | + $content_html = ob_get_clean(); |
|
1239 | + if (trim($content_html) != '') |
|
1240 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1241 | + if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1242 | + /** |
|
1243 | + * Filter the output html for function geodir_detail_page_more_info(). |
|
1244 | + * |
|
1245 | + * @since 1.0.0 |
|
1246 | + * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1247 | + */ |
|
1248 | + echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1249 | + } |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | |
@@ -1260,15 +1260,15 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | function geodir_localize_all_js_msg() |
1262 | 1262 | {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
1263 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1264 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1265 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1266 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1267 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1268 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1269 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1270 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1271 | - } |
|
1263 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1264 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1265 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1266 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1267 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1268 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1269 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1270 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1271 | + } |
|
1272 | 1272 | |
1273 | 1273 | /** |
1274 | 1274 | * Filter the allowed image type extensions for post images. |
@@ -1278,60 +1278,60 @@ discard block |
||
1278 | 1278 | */ |
1279 | 1279 | $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png')); |
1280 | 1280 | |
1281 | - $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1282 | - $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1283 | - $default_marker_width = $default_marker_size['w']; |
|
1284 | - $default_marker_height = $default_marker_size['h']; |
|
1281 | + $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1282 | + $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1283 | + $default_marker_width = $default_marker_size['w']; |
|
1284 | + $default_marker_height = $default_marker_size['h']; |
|
1285 | 1285 | |
1286 | - $arr_alert_msg = array( |
|
1287 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
1288 | - 'geodir_admin_ajax_url' => $ajax_url, |
|
1289 | - 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1290 | - 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1291 | - 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1292 | - 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1293 | - //start not show alert msg |
|
1294 | - 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1295 | - 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1296 | - 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1297 | - 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1298 | - 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1299 | - // end not show alert msg |
|
1300 | - 'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'), |
|
1301 | - 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1302 | - //start not show alert msg |
|
1303 | - 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1304 | - 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1305 | - 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1306 | - 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1307 | - 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1308 | - 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1309 | - 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1310 | - 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1311 | - 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1312 | - 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1313 | - 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1314 | - 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1315 | - 'geodir_default_marker_icon' => $default_marker_icon, |
|
1316 | - 'geodir_default_marker_w' => $default_marker_width, |
|
1317 | - 'geodir_default_marker_h' => $default_marker_height, |
|
1318 | - 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1319 | - 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1320 | - 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1321 | - 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1322 | - 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1323 | - 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1324 | - 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1325 | - 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1326 | - /* on/off dragging for phone devices */ |
|
1327 | - 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1328 | - 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1329 | - 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1330 | - 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1331 | - 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1332 | - 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1333 | - 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1334 | - 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1286 | + $arr_alert_msg = array( |
|
1287 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
1288 | + 'geodir_admin_ajax_url' => $ajax_url, |
|
1289 | + 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1290 | + 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1291 | + 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1292 | + 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1293 | + //start not show alert msg |
|
1294 | + 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1295 | + 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1296 | + 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1297 | + 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1298 | + 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1299 | + // end not show alert msg |
|
1300 | + 'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'), |
|
1301 | + 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1302 | + //start not show alert msg |
|
1303 | + 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1304 | + 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1305 | + 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1306 | + 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1307 | + 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1308 | + 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1309 | + 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1310 | + 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1311 | + 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1312 | + 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1313 | + 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1314 | + 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1315 | + 'geodir_default_marker_icon' => $default_marker_icon, |
|
1316 | + 'geodir_default_marker_w' => $default_marker_width, |
|
1317 | + 'geodir_default_marker_h' => $default_marker_height, |
|
1318 | + 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1319 | + 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1320 | + 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1321 | + 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1322 | + 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1323 | + 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1324 | + 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1325 | + 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1326 | + /* on/off dragging for phone devices */ |
|
1327 | + 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1328 | + 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1329 | + 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1330 | + 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1331 | + 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1332 | + 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1333 | + 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1334 | + 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1335 | 1335 | 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'), |
1336 | 1336 | 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'), |
1337 | 1337 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
@@ -1339,33 +1339,33 @@ discard block |
||
1339 | 1339 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1340 | 1340 | 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
1341 | 1341 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1342 | - 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
|
1343 | - 'geodir_map_name' => geodir_map_name(), |
|
1344 | - 'osmStart' => __('Start', 'geodirectory'), |
|
1345 | - 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1346 | - 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1347 | - ); |
|
1348 | - |
|
1349 | - /** |
|
1350 | - * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1351 | - * |
|
1352 | - * With this filter you can add, remove or change translated JS strings. |
|
1353 | - * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1354 | - * |
|
1355 | - * @since 1.0.0 |
|
1356 | - */ |
|
1357 | - $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1358 | - |
|
1359 | - foreach ($arr_alert_msg as $key => $value) { |
|
1360 | - if (!is_scalar($value)) |
|
1361 | - continue; |
|
1362 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1363 | - } |
|
1342 | + 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
|
1343 | + 'geodir_map_name' => geodir_map_name(), |
|
1344 | + 'osmStart' => __('Start', 'geodirectory'), |
|
1345 | + 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1346 | + 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1347 | + ); |
|
1348 | + |
|
1349 | + /** |
|
1350 | + * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1351 | + * |
|
1352 | + * With this filter you can add, remove or change translated JS strings. |
|
1353 | + * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1354 | + * |
|
1355 | + * @since 1.0.0 |
|
1356 | + */ |
|
1357 | + $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1364 | 1358 | |
1365 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1366 | - echo '<script>'; |
|
1367 | - echo $script; |
|
1368 | - echo '</script>'; |
|
1359 | + foreach ($arr_alert_msg as $key => $value) { |
|
1360 | + if (!is_scalar($value)) |
|
1361 | + continue; |
|
1362 | + $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1363 | + } |
|
1364 | + |
|
1365 | + $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1366 | + echo '<script>'; |
|
1367 | + echo $script; |
|
1368 | + echo '</script>'; |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31); |
@@ -1381,11 +1381,11 @@ discard block |
||
1381 | 1381 | */ |
1382 | 1382 | function geodir_admin_bar_site_menu($wp_admin_bar) |
1383 | 1383 | { |
1384 | - if (get_option("geodir_installed")) { |
|
1385 | - if (current_user_can('manage_options')) { |
|
1386 | - $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1387 | - } |
|
1388 | - } |
|
1384 | + if (get_option("geodir_installed")) { |
|
1385 | + if (current_user_can('manage_options')) { |
|
1386 | + $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1387 | + } |
|
1388 | + } |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/ |
@@ -1411,25 +1411,25 @@ discard block |
||
1411 | 1411 | */ |
1412 | 1412 | function geodir_store_sidebars() |
1413 | 1413 | { |
1414 | - global $geodir_sidebars; |
|
1415 | - global $sidebars_widgets; |
|
1416 | - |
|
1417 | - if (!is_array($sidebars_widgets)) |
|
1418 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1419 | - $geodir_old_sidebars = array(); |
|
1420 | - |
|
1421 | - if (is_array($geodir_sidebars)) { |
|
1422 | - foreach ($geodir_sidebars as $val) { |
|
1423 | - if (is_array($sidebars_widgets)) { |
|
1424 | - if (array_key_exists($val, $sidebars_widgets)) |
|
1425 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1426 | - else |
|
1427 | - $geodir_old_sidebars[$val] = array(); |
|
1428 | - } |
|
1429 | - } |
|
1430 | - } |
|
1431 | - update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1432 | - geodir_option_version_backup('geodir_sidebars'); |
|
1414 | + global $geodir_sidebars; |
|
1415 | + global $sidebars_widgets; |
|
1416 | + |
|
1417 | + if (!is_array($sidebars_widgets)) |
|
1418 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1419 | + $geodir_old_sidebars = array(); |
|
1420 | + |
|
1421 | + if (is_array($geodir_sidebars)) { |
|
1422 | + foreach ($geodir_sidebars as $val) { |
|
1423 | + if (is_array($sidebars_widgets)) { |
|
1424 | + if (array_key_exists($val, $sidebars_widgets)) |
|
1425 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1426 | + else |
|
1427 | + $geodir_old_sidebars[$val] = array(); |
|
1428 | + } |
|
1429 | + } |
|
1430 | + } |
|
1431 | + update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1432 | + geodir_option_version_backup('geodir_sidebars'); |
|
1433 | 1433 | |
1434 | 1434 | } |
1435 | 1435 | |
@@ -1443,28 +1443,28 @@ discard block |
||
1443 | 1443 | */ |
1444 | 1444 | function geodir_restore_sidebars() |
1445 | 1445 | { |
1446 | - global $sidebars_widgets; |
|
1447 | - |
|
1448 | - if (!is_array($sidebars_widgets)) |
|
1449 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1450 | - |
|
1451 | - if (is_array($sidebars_widgets)) { |
|
1452 | - $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1453 | - if (is_array($geodir_old_sidebars)) { |
|
1454 | - foreach ($geodir_old_sidebars as $key => $val) { |
|
1455 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1456 | - { |
|
1457 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1458 | - } |
|
1446 | + global $sidebars_widgets; |
|
1459 | 1447 | |
1448 | + if (!is_array($sidebars_widgets)) |
|
1449 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1460 | 1450 | |
1461 | - } |
|
1462 | - } |
|
1451 | + if (is_array($sidebars_widgets)) { |
|
1452 | + $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1453 | + if (is_array($geodir_old_sidebars)) { |
|
1454 | + foreach ($geodir_old_sidebars as $key => $val) { |
|
1455 | + if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1456 | + { |
|
1457 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1458 | + } |
|
1463 | 1459 | |
1464 | - } |
|
1465 | 1460 | |
1466 | - update_option('sidebars_widgets', $sidebars_widgets); |
|
1467 | - update_option('geodir_sidebars', ''); |
|
1461 | + } |
|
1462 | + } |
|
1463 | + |
|
1464 | + } |
|
1465 | + |
|
1466 | + update_option('sidebars_widgets', $sidebars_widgets); |
|
1467 | + update_option('geodir_sidebars', ''); |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | 1470 | add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview'); |
@@ -1477,9 +1477,9 @@ discard block |
||
1477 | 1477 | */ |
1478 | 1478 | function geodir_after_listing_post_gridview() |
1479 | 1479 | { |
1480 | - global $gridview_columns; |
|
1480 | + global $gridview_columns; |
|
1481 | 1481 | |
1482 | - $gridview_columns = ''; |
|
1482 | + $gridview_columns = ''; |
|
1483 | 1483 | |
1484 | 1484 | } |
1485 | 1485 | |
@@ -1507,11 +1507,11 @@ discard block |
||
1507 | 1507 | */ |
1508 | 1508 | function so_handle_038($url, $original_url, $_context) |
1509 | 1509 | { |
1510 | - if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1511 | - $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1512 | - } |
|
1510 | + if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1511 | + $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1512 | + } |
|
1513 | 1513 | |
1514 | - return $url; |
|
1514 | + return $url; |
|
1515 | 1515 | } |
1516 | 1516 | |
1517 | 1517 | |
@@ -1527,34 +1527,34 @@ discard block |
||
1527 | 1527 | function geodir_after_main_form_fields() { |
1528 | 1528 | global $gd_session; |
1529 | 1529 | |
1530 | - if (get_option('geodir_accept_term_condition')) { |
|
1531 | - global $post; |
|
1532 | - $term_condition = ''; |
|
1533 | - if (isset($_REQUEST['backandedit'])) { |
|
1534 | - $post = (object)$gd_session->get('listing'); |
|
1535 | - $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1536 | - } |
|
1537 | - |
|
1538 | - ?> |
|
1530 | + if (get_option('geodir_accept_term_condition')) { |
|
1531 | + global $post; |
|
1532 | + $term_condition = ''; |
|
1533 | + if (isset($_REQUEST['backandedit'])) { |
|
1534 | + $post = (object)$gd_session->get('listing'); |
|
1535 | + $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1536 | + } |
|
1537 | + |
|
1538 | + ?> |
|
1539 | 1539 | <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix"> |
1540 | 1540 | <label> </label> |
1541 | 1541 | |
1542 | 1542 | <div class="geodir_taxonomy_field" style="float:left; width:70%;"> |
1543 | 1543 | <span style="display:block"> |
1544 | 1544 | <input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') { |
1545 | - echo 'checked="checked"'; |
|
1546 | - } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1545 | + echo 'checked="checked"'; |
|
1546 | + } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1547 | 1547 | class="geodir_textfield" value="1" |
1548 | 1548 | style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
1549 | 1549 | </span> |
1550 | 1550 | </div> |
1551 | 1551 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
1552 | - _e($required_msg, 'geodirectory'); |
|
1553 | - } ?></span> |
|
1552 | + _e($required_msg, 'geodirectory'); |
|
1553 | + } ?></span> |
|
1554 | 1554 | </div> |
1555 | 1555 | <?php |
1556 | 1556 | |
1557 | - } |
|
1557 | + } |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | |
@@ -1579,42 +1579,42 @@ discard block |
||
1579 | 1579 | */ |
1580 | 1580 | function geodir_detail_page_tab_is_display($is_display, $tab) |
1581 | 1581 | { |
1582 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1582 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1583 | 1583 | |
1584 | - if ($tab == 'post_profile') { |
|
1585 | - /** This action is documented in geodirectory_template_actions.php */ |
|
1586 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1584 | + if ($tab == 'post_profile') { |
|
1585 | + /** This action is documented in geodirectory_template_actions.php */ |
|
1586 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1587 | 1587 | |
1588 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1589 | - $is_display = false; |
|
1590 | - } |
|
1591 | - } |
|
1588 | + if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1589 | + $is_display = false; |
|
1590 | + } |
|
1591 | + } |
|
1592 | 1592 | |
1593 | - if ($tab == 'post_info') |
|
1594 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1593 | + if ($tab == 'post_info') |
|
1594 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1595 | 1595 | |
1596 | - if ($tab == 'post_images') |
|
1597 | - $is_display = (!empty($post_images)) ? true : false; |
|
1596 | + if ($tab == 'post_images') |
|
1597 | + $is_display = (!empty($post_images)) ? true : false; |
|
1598 | 1598 | |
1599 | - if ($tab == 'post_video') |
|
1600 | - $is_display = (!empty($video)) ? true : false; |
|
1599 | + if ($tab == 'post_video') |
|
1600 | + $is_display = (!empty($video)) ? true : false; |
|
1601 | 1601 | |
1602 | - if ($tab == 'special_offers') |
|
1603 | - $is_display = (!empty($special_offers)) ? true : false; |
|
1602 | + if ($tab == 'special_offers') |
|
1603 | + $is_display = (!empty($special_offers)) ? true : false; |
|
1604 | 1604 | |
1605 | - if ($tab == 'reviews') |
|
1606 | - $is_display = (geodir_is_page('detail')) ? true : false; |
|
1605 | + if ($tab == 'reviews') |
|
1606 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
1607 | 1607 | |
1608 | - if ($tab == 'related_listing') { |
|
1609 | - $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1608 | + if ($tab == 'related_listing') { |
|
1609 | + $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1610 | 1610 | |
1611 | - /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1612 | - $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1611 | + /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1612 | + $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1613 | 1613 | |
1614 | - $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1615 | - } |
|
1614 | + $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1615 | + } |
|
1616 | 1616 | |
1617 | - return $is_display; |
|
1617 | + return $is_display; |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | |
@@ -1630,69 +1630,69 @@ discard block |
||
1630 | 1630 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
1631 | 1631 | */ |
1632 | 1632 | function geodir_changes_in_custom_fields_table() { |
1633 | - global $wpdb, $plugin_prefix; |
|
1633 | + global $wpdb, $plugin_prefix; |
|
1634 | 1634 | |
1635 | 1635 | // Remove unused virtual page |
1636 | 1636 | $listings_page_id = (int)get_option('geodir_listing_page'); |
1637 | 1637 | if ($listings_page_id) { |
1638 | 1638 | $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
1639 | - delete_option('geodir_listing_page'); |
|
1639 | + delete_option('geodir_listing_page'); |
|
1640 | 1640 | } |
1641 | 1641 | |
1642 | - if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1643 | - $wpdb->query( |
|
1644 | - $wpdb->prepare( |
|
1645 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1646 | - array('1', '1', 'admin') |
|
1647 | - ) |
|
1648 | - ); |
|
1642 | + if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1643 | + $wpdb->query( |
|
1644 | + $wpdb->prepare( |
|
1645 | + "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1646 | + array('1', '1', 'admin') |
|
1647 | + ) |
|
1648 | + ); |
|
1649 | 1649 | |
1650 | 1650 | |
1651 | - /* --- terms meta value set --- */ |
|
1651 | + /* --- terms meta value set --- */ |
|
1652 | 1652 | |
1653 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1653 | + update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1654 | 1654 | |
1655 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1655 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1656 | 1656 | |
1657 | - if (!empty($options_data)) { |
|
1657 | + if (!empty($options_data)) { |
|
1658 | 1658 | |
1659 | - foreach ($options_data as $optobj) { |
|
1659 | + foreach ($options_data as $optobj) { |
|
1660 | 1660 | |
1661 | - $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1661 | + $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1662 | 1662 | |
1663 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1663 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1664 | 1664 | |
1665 | - if (!empty($taxonomies_data)) { |
|
1665 | + if (!empty($taxonomies_data)) { |
|
1666 | 1666 | |
1667 | - foreach ($taxonomies_data as $taxobj) { |
|
1667 | + foreach ($taxonomies_data as $taxobj) { |
|
1668 | 1668 | |
1669 | - $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1670 | - $post_type = $taxObject->object_type[0]; |
|
1669 | + $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1670 | + $post_type = $taxObject->object_type[0]; |
|
1671 | 1671 | |
1672 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1672 | + $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1673 | 1673 | |
1674 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1674 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1675 | 1675 | |
1676 | - if ($duplicate_data) { |
|
1676 | + if ($duplicate_data) { |
|
1677 | 1677 | |
1678 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1678 | + $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1679 | 1679 | |
1680 | - } else { |
|
1680 | + } else { |
|
1681 | 1681 | |
1682 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1682 | + $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1683 | 1683 | |
1684 | - } |
|
1684 | + } |
|
1685 | 1685 | |
1686 | - } |
|
1686 | + } |
|
1687 | 1687 | |
1688 | - } |
|
1688 | + } |
|
1689 | 1689 | |
1690 | - } |
|
1691 | - } |
|
1690 | + } |
|
1691 | + } |
|
1692 | 1692 | |
1693 | - update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1693 | + update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1694 | 1694 | |
1695 | - } |
|
1695 | + } |
|
1696 | 1696 | |
1697 | 1697 | } |
1698 | 1698 | |
@@ -1711,24 +1711,24 @@ discard block |
||
1711 | 1711 | function geodir_location_slug_check($slug) |
1712 | 1712 | { |
1713 | 1713 | |
1714 | - global $wpdb, $table_prefix; |
|
1714 | + global $wpdb, $table_prefix; |
|
1715 | 1715 | |
1716 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1716 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1717 | 1717 | |
1718 | - if ($slug_exists) { |
|
1718 | + if ($slug_exists) { |
|
1719 | 1719 | |
1720 | - $suffix = 1; |
|
1721 | - do { |
|
1722 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1723 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1724 | - $suffix++; |
|
1725 | - } while ($location_slug_check && $suffix < 100); |
|
1720 | + $suffix = 1; |
|
1721 | + do { |
|
1722 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1723 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1724 | + $suffix++; |
|
1725 | + } while ($location_slug_check && $suffix < 100); |
|
1726 | 1726 | |
1727 | - $slug = $alt_location_name; |
|
1727 | + $slug = $alt_location_name; |
|
1728 | 1728 | |
1729 | - } |
|
1729 | + } |
|
1730 | 1730 | |
1731 | - return $slug; |
|
1731 | + return $slug; |
|
1732 | 1732 | |
1733 | 1733 | } |
1734 | 1734 | |
@@ -1753,42 +1753,42 @@ discard block |
||
1753 | 1753 | function geodir_update_term_slug($term_id, $tt_id, $taxonomy) |
1754 | 1754 | { |
1755 | 1755 | |
1756 | - global $wpdb, $plugin_prefix, $table_prefix; |
|
1756 | + global $wpdb, $plugin_prefix, $table_prefix; |
|
1757 | 1757 | |
1758 | - $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1758 | + $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1759 | 1759 | |
1760 | - $slug = $tern_data->slug; |
|
1760 | + $slug = $tern_data->slug; |
|
1761 | 1761 | |
1762 | - /** |
|
1763 | - * Filter if a term slug exists. |
|
1764 | - * |
|
1765 | - * @since 1.0.0 |
|
1766 | - * @package GeoDirectory |
|
1767 | - * @param bool $bool Default: false. |
|
1768 | - * @param string $slug The term slug. |
|
1769 | - * @param int $term_id The term ID. |
|
1770 | - */ |
|
1771 | - $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1762 | + /** |
|
1763 | + * Filter if a term slug exists. |
|
1764 | + * |
|
1765 | + * @since 1.0.0 |
|
1766 | + * @package GeoDirectory |
|
1767 | + * @param bool $bool Default: false. |
|
1768 | + * @param string $slug The term slug. |
|
1769 | + * @param int $term_id The term ID. |
|
1770 | + */ |
|
1771 | + $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1772 | 1772 | |
1773 | - if ($slug_exists) { |
|
1773 | + if ($slug_exists) { |
|
1774 | 1774 | |
1775 | - $suffix = 1; |
|
1776 | - do { |
|
1777 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1775 | + $suffix = 1; |
|
1776 | + do { |
|
1777 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1778 | 1778 | |
1779 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
1780 | - $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1779 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
1780 | + $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1781 | 1781 | |
1782 | - $suffix++; |
|
1783 | - } while ($term_slug_check && $suffix < 100); |
|
1782 | + $suffix++; |
|
1783 | + } while ($term_slug_check && $suffix < 100); |
|
1784 | 1784 | |
1785 | - $slug = $new_slug; |
|
1785 | + $slug = $new_slug; |
|
1786 | 1786 | |
1787 | - //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1787 | + //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1788 | 1788 | |
1789 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1789 | + $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1790 | 1790 | |
1791 | - } |
|
1791 | + } |
|
1792 | 1792 | |
1793 | 1793 | // Update tag in detail table. |
1794 | 1794 | $taxonomy_obj = get_taxonomy($taxonomy); |
@@ -1829,21 +1829,21 @@ discard block |
||
1829 | 1829 | function geodir_term_slug_is_exists($slug_exists, $slug, $term_id) |
1830 | 1830 | { |
1831 | 1831 | |
1832 | - global $wpdb, $table_prefix; |
|
1832 | + global $wpdb, $table_prefix; |
|
1833 | 1833 | |
1834 | - $default_location = geodir_get_default_location(); |
|
1834 | + $default_location = geodir_get_default_location(); |
|
1835 | 1835 | |
1836 | - $country_slug = $default_location->country_slug; |
|
1837 | - $region_slug = $default_location->region_slug; |
|
1838 | - $city_slug = $default_location->city_slug; |
|
1836 | + $country_slug = $default_location->country_slug; |
|
1837 | + $region_slug = $default_location->region_slug; |
|
1838 | + $city_slug = $default_location->city_slug; |
|
1839 | 1839 | |
1840 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1841 | - return $slug_exists = true; |
|
1840 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1841 | + return $slug_exists = true; |
|
1842 | 1842 | |
1843 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1844 | - return $slug_exists = true; |
|
1843 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1844 | + return $slug_exists = true; |
|
1845 | 1845 | |
1846 | - return $slug_exists; |
|
1846 | + return $slug_exists; |
|
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | |
@@ -1862,75 +1862,75 @@ discard block |
||
1862 | 1862 | */ |
1863 | 1863 | function geodir_custom_page_title($title = '', $sep = '') |
1864 | 1864 | { |
1865 | - global $wp; |
|
1866 | - if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
|
1867 | - return $title; |
|
1868 | - } |
|
1865 | + global $wp; |
|
1866 | + if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) { |
|
1867 | + return $title; |
|
1868 | + } |
|
1869 | 1869 | |
1870 | - if ($sep == '') { |
|
1871 | - /** |
|
1872 | - * Filter the page title separator. |
|
1873 | - * |
|
1874 | - * @since 1.0.0 |
|
1875 | - * @package GeoDirectory |
|
1876 | - * @param string $sep The separator, default: `|`. |
|
1877 | - */ |
|
1878 | - $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1879 | - } |
|
1870 | + if ($sep == '') { |
|
1871 | + /** |
|
1872 | + * Filter the page title separator. |
|
1873 | + * |
|
1874 | + * @since 1.0.0 |
|
1875 | + * @package GeoDirectory |
|
1876 | + * @param string $sep The separator, default: `|`. |
|
1877 | + */ |
|
1878 | + $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1879 | + } |
|
1880 | 1880 | |
1881 | 1881 | |
1882 | - $gd_page = ''; |
|
1883 | - if(geodir_is_page('home')){ |
|
1884 | - $gd_page = 'home'; |
|
1885 | - $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1886 | - } |
|
1887 | - elseif(geodir_is_page('detail')){ |
|
1888 | - $gd_page = 'detail'; |
|
1889 | - $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1890 | - } |
|
1891 | - elseif(geodir_is_page('pt')){ |
|
1892 | - $gd_page = 'pt'; |
|
1893 | - $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1894 | - } |
|
1895 | - elseif(geodir_is_page('listing')){ |
|
1896 | - $gd_page = 'listing'; |
|
1897 | - $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1898 | - } |
|
1899 | - elseif(geodir_is_page('location')){ |
|
1900 | - $gd_page = 'location'; |
|
1901 | - $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1902 | - } |
|
1903 | - elseif(geodir_is_page('search')){ |
|
1904 | - $gd_page = 'search'; |
|
1905 | - $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1906 | - } |
|
1907 | - elseif(geodir_is_page('add-listing')){ |
|
1908 | - $gd_page = 'add-listing'; |
|
1909 | - $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1910 | - } |
|
1911 | - elseif(geodir_is_page('author')){ |
|
1912 | - $gd_page = 'author'; |
|
1913 | - $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1914 | - } |
|
1915 | - elseif(geodir_is_page('login')){ |
|
1916 | - $gd_page = 'login'; |
|
1917 | - $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1918 | - } |
|
1919 | - elseif(geodir_is_page('listing-success')){ |
|
1920 | - $gd_page = 'listing-success'; |
|
1921 | - $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1922 | - } |
|
1882 | + $gd_page = ''; |
|
1883 | + if(geodir_is_page('home')){ |
|
1884 | + $gd_page = 'home'; |
|
1885 | + $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1886 | + } |
|
1887 | + elseif(geodir_is_page('detail')){ |
|
1888 | + $gd_page = 'detail'; |
|
1889 | + $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1890 | + } |
|
1891 | + elseif(geodir_is_page('pt')){ |
|
1892 | + $gd_page = 'pt'; |
|
1893 | + $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1894 | + } |
|
1895 | + elseif(geodir_is_page('listing')){ |
|
1896 | + $gd_page = 'listing'; |
|
1897 | + $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1898 | + } |
|
1899 | + elseif(geodir_is_page('location')){ |
|
1900 | + $gd_page = 'location'; |
|
1901 | + $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1902 | + } |
|
1903 | + elseif(geodir_is_page('search')){ |
|
1904 | + $gd_page = 'search'; |
|
1905 | + $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1906 | + } |
|
1907 | + elseif(geodir_is_page('add-listing')){ |
|
1908 | + $gd_page = 'add-listing'; |
|
1909 | + $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1910 | + } |
|
1911 | + elseif(geodir_is_page('author')){ |
|
1912 | + $gd_page = 'author'; |
|
1913 | + $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1914 | + } |
|
1915 | + elseif(geodir_is_page('login')){ |
|
1916 | + $gd_page = 'login'; |
|
1917 | + $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1918 | + } |
|
1919 | + elseif(geodir_is_page('listing-success')){ |
|
1920 | + $gd_page = 'listing-success'; |
|
1921 | + $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1922 | + } |
|
1923 | 1923 | |
1924 | 1924 | |
1925 | - /** |
|
1926 | - * Filter page meta title to replace variables. |
|
1927 | - * |
|
1928 | - * @since 1.5.4 |
|
1929 | - * @param string $title The page title including variables. |
|
1930 | - * @param string $gd_page The GeoDirectory page type if any. |
|
1931 | - * @param string $sep The title separator symbol. |
|
1932 | - */ |
|
1933 | - return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1925 | + /** |
|
1926 | + * Filter page meta title to replace variables. |
|
1927 | + * |
|
1928 | + * @since 1.5.4 |
|
1929 | + * @param string $title The page title including variables. |
|
1930 | + * @param string $gd_page The GeoDirectory page type if any. |
|
1931 | + * @param string $sep The title separator symbol. |
|
1932 | + */ |
|
1933 | + return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1934 | 1934 | |
1935 | 1935 | } |
1936 | 1936 | |
@@ -1946,36 +1946,36 @@ discard block |
||
1946 | 1946 | function geodir_set_post_attachment() |
1947 | 1947 | { |
1948 | 1948 | |
1949 | - if (!get_option('geodir_set_post_attachments')) { |
|
1949 | + if (!get_option('geodir_set_post_attachments')) { |
|
1950 | 1950 | |
1951 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1952 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1951 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1952 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1953 | 1953 | |
1954 | - $all_postypes = geodir_get_posttypes(); |
|
1954 | + $all_postypes = geodir_get_posttypes(); |
|
1955 | 1955 | |
1956 | - foreach($all_postypes as $post_type){ |
|
1957 | - $args = array( |
|
1958 | - 'posts_per_page' => -1, |
|
1959 | - 'post_type' => $post_type, |
|
1960 | - 'post_status' => 'publish'); |
|
1956 | + foreach($all_postypes as $post_type){ |
|
1957 | + $args = array( |
|
1958 | + 'posts_per_page' => -1, |
|
1959 | + 'post_type' => $post_type, |
|
1960 | + 'post_status' => 'publish'); |
|
1961 | 1961 | |
1962 | - $posts_array = get_posts($args); |
|
1962 | + $posts_array = get_posts($args); |
|
1963 | 1963 | |
1964 | - if (!empty($posts_array)) { |
|
1964 | + if (!empty($posts_array)) { |
|
1965 | 1965 | |
1966 | - foreach ($posts_array as $post) { |
|
1966 | + foreach ($posts_array as $post) { |
|
1967 | 1967 | |
1968 | - geodir_set_wp_featured_image($post->ID); |
|
1968 | + geodir_set_wp_featured_image($post->ID); |
|
1969 | 1969 | |
1970 | - } |
|
1970 | + } |
|
1971 | 1971 | |
1972 | - } |
|
1973 | - } |
|
1972 | + } |
|
1973 | + } |
|
1974 | 1974 | |
1975 | 1975 | |
1976 | - update_option('geodir_set_post_attachments', '1'); |
|
1976 | + update_option('geodir_set_post_attachments', '1'); |
|
1977 | 1977 | |
1978 | - } |
|
1978 | + } |
|
1979 | 1979 | |
1980 | 1980 | } |
1981 | 1981 | |
@@ -1992,19 +1992,19 @@ discard block |
||
1992 | 1992 | function geodir_remove_url_seperator() |
1993 | 1993 | { |
1994 | 1994 | |
1995 | - if (!get_option('geodir_remove_url_seperator')) { |
|
1995 | + if (!get_option('geodir_remove_url_seperator')) { |
|
1996 | 1996 | |
1997 | - if (get_option('geodir_listingurl_separator')) |
|
1998 | - delete_option('geodir_listingurl_separator'); |
|
1997 | + if (get_option('geodir_listingurl_separator')) |
|
1998 | + delete_option('geodir_listingurl_separator'); |
|
1999 | 1999 | |
2000 | - if (get_option('geodir_detailurl_separator')) |
|
2001 | - delete_option('geodir_detailurl_separator'); |
|
2000 | + if (get_option('geodir_detailurl_separator')) |
|
2001 | + delete_option('geodir_detailurl_separator'); |
|
2002 | 2002 | |
2003 | - flush_rewrite_rules(false); |
|
2003 | + flush_rewrite_rules(false); |
|
2004 | 2004 | |
2005 | - update_option('geodir_remove_url_seperator', '1'); |
|
2005 | + update_option('geodir_remove_url_seperator', '1'); |
|
2006 | 2006 | |
2007 | - } |
|
2007 | + } |
|
2008 | 2008 | |
2009 | 2009 | } |
2010 | 2010 | |
@@ -2020,19 +2020,19 @@ discard block |
||
2020 | 2020 | */ |
2021 | 2021 | function geodir_remove_url_seperator_form_permalink_settings($permalink_arr) |
2022 | 2022 | { |
2023 | - foreach ($permalink_arr as $key => $value) { |
|
2023 | + foreach ($permalink_arr as $key => $value) { |
|
2024 | 2024 | |
2025 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2026 | - unset($permalink_arr[$key]); |
|
2025 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2026 | + unset($permalink_arr[$key]); |
|
2027 | 2027 | |
2028 | - } |
|
2028 | + } |
|
2029 | 2029 | |
2030 | - return $permalink_arr; |
|
2030 | + return $permalink_arr; |
|
2031 | 2031 | |
2032 | 2032 | } |
2033 | 2033 | |
2034 | 2034 | if (!is_admin()) { |
2035 | - add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2035 | + add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2036 | 2036 | } |
2037 | 2037 | /** |
2038 | 2038 | * Set status from draft to publish. |
@@ -2045,16 +2045,16 @@ discard block |
||
2045 | 2045 | */ |
2046 | 2046 | function geodir_set_status_draft_to_publish_for_own_post($post) |
2047 | 2047 | { |
2048 | - $user_id = get_current_user_id(); |
|
2048 | + $user_id = get_current_user_id(); |
|
2049 | 2049 | |
2050 | - if(!$user_id){return $post;} |
|
2050 | + if(!$user_id){return $post;} |
|
2051 | 2051 | |
2052 | - $gd_post_types = geodir_get_posttypes(); |
|
2052 | + $gd_post_types = geodir_get_posttypes(); |
|
2053 | 2053 | |
2054 | - if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2055 | - $post[0]->post_status = 'publish'; |
|
2056 | - } |
|
2057 | - return $post; |
|
2054 | + if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2055 | + $post[0]->post_status = 'publish'; |
|
2056 | + } |
|
2057 | + return $post; |
|
2058 | 2058 | } |
2059 | 2059 | |
2060 | 2060 | |
@@ -2146,33 +2146,33 @@ discard block |
||
2146 | 2146 | */ |
2147 | 2147 | function geodir_detail_page_tab_headings_change($tabs_arr) |
2148 | 2148 | { |
2149 | - global $wpdb; |
|
2149 | + global $wpdb; |
|
2150 | 2150 | |
2151 | - $post_type = geodir_get_current_posttype(); |
|
2151 | + $post_type = geodir_get_current_posttype(); |
|
2152 | 2152 | |
2153 | - $all_postypes = geodir_get_posttypes(); |
|
2153 | + $all_postypes = geodir_get_posttypes(); |
|
2154 | 2154 | |
2155 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2155 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2156 | 2156 | |
2157 | - if (array_key_exists('post_video', $tabs_arr)) { |
|
2157 | + if (array_key_exists('post_video', $tabs_arr)) { |
|
2158 | 2158 | |
2159 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2159 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2160 | 2160 | |
2161 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2162 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2163 | - } |
|
2161 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2162 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2163 | + } |
|
2164 | 2164 | |
2165 | - if (array_key_exists('special_offers', $tabs_arr)) { |
|
2165 | + if (array_key_exists('special_offers', $tabs_arr)) { |
|
2166 | 2166 | |
2167 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2167 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2168 | 2168 | |
2169 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2170 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2171 | - } |
|
2169 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2170 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2171 | + } |
|
2172 | 2172 | |
2173 | - } |
|
2173 | + } |
|
2174 | 2174 | |
2175 | - return $tabs_arr; |
|
2175 | + return $tabs_arr; |
|
2176 | 2176 | |
2177 | 2177 | } |
2178 | 2178 | |
@@ -2185,10 +2185,10 @@ discard block |
||
2185 | 2185 | */ |
2186 | 2186 | function geodir_remove_template_redirect_actions() |
2187 | 2187 | { |
2188 | - if (geodir_is_page('login')){ |
|
2189 | - remove_all_actions('template_redirect'); |
|
2190 | - remove_action('init', 'avia_modify_front', 10); |
|
2191 | - } |
|
2188 | + if (geodir_is_page('login')){ |
|
2189 | + remove_all_actions('template_redirect'); |
|
2190 | + remove_action('init', 'avia_modify_front', 10); |
|
2191 | + } |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | |
@@ -2210,51 +2210,51 @@ discard block |
||
2210 | 2210 | function geodirectory_before_featured_image_delete($attachment_id) |
2211 | 2211 | { |
2212 | 2212 | |
2213 | - global $wpdb, $plugin_prefix; |
|
2213 | + global $wpdb, $plugin_prefix; |
|
2214 | 2214 | |
2215 | - $post_id = get_post_field('post_parent', $attachment_id); |
|
2215 | + $post_id = get_post_field('post_parent', $attachment_id); |
|
2216 | 2216 | |
2217 | - $attachment_url = wp_get_attachment_url($attachment_id); |
|
2217 | + $attachment_url = wp_get_attachment_url($attachment_id); |
|
2218 | 2218 | |
2219 | - if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2219 | + if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2220 | 2220 | |
2221 | - $post_type = get_post_type($post_id); |
|
2221 | + $post_type = get_post_type($post_id); |
|
2222 | 2222 | |
2223 | - $all_postypes = geodir_get_posttypes(); |
|
2223 | + $all_postypes = geodir_get_posttypes(); |
|
2224 | 2224 | |
2225 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2226 | - return false; |
|
2225 | + if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2226 | + return false; |
|
2227 | 2227 | |
2228 | - $uploads = wp_upload_dir(); |
|
2228 | + $uploads = wp_upload_dir(); |
|
2229 | 2229 | |
2230 | - $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2230 | + $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2231 | 2231 | |
2232 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2232 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2233 | 2233 | |
2234 | - $wpdb->query( |
|
2235 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2236 | - array($post_id, $split_img_file_path) |
|
2237 | - ) |
|
2238 | - ); |
|
2234 | + $wpdb->query( |
|
2235 | + $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2236 | + array($post_id, $split_img_file_path) |
|
2237 | + ) |
|
2238 | + ); |
|
2239 | 2239 | |
2240 | - $attachment_data = $wpdb->get_row( |
|
2241 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2242 | - array($post_id) |
|
2243 | - ) |
|
2244 | - ); |
|
2240 | + $attachment_data = $wpdb->get_row( |
|
2241 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2242 | + array($post_id) |
|
2243 | + ) |
|
2244 | + ); |
|
2245 | 2245 | |
2246 | - if (!empty($attachment_data)) { |
|
2247 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2248 | - } |
|
2246 | + if (!empty($attachment_data)) { |
|
2247 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2248 | + } |
|
2249 | 2249 | |
2250 | 2250 | |
2251 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2251 | + $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2252 | 2252 | |
2253 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2253 | + $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2254 | 2254 | |
2255 | - geodir_set_wp_featured_image($post_id); |
|
2255 | + geodir_set_wp_featured_image($post_id); |
|
2256 | 2256 | |
2257 | - } |
|
2257 | + } |
|
2258 | 2258 | |
2259 | 2259 | } |
2260 | 2260 | |
@@ -2272,79 +2272,79 @@ discard block |
||
2272 | 2272 | function geodir_temp_set_post_attachment() |
2273 | 2273 | { |
2274 | 2274 | |
2275 | - global $wpdb, $plugin_prefix; |
|
2275 | + global $wpdb, $plugin_prefix; |
|
2276 | 2276 | |
2277 | - $all_postypes = geodir_get_posttypes(); |
|
2277 | + $all_postypes = geodir_get_posttypes(); |
|
2278 | 2278 | |
2279 | - foreach ($all_postypes as $posttype) { |
|
2279 | + foreach ($all_postypes as $posttype) { |
|
2280 | 2280 | |
2281 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2281 | + $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2282 | 2282 | |
2283 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2283 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2284 | 2284 | |
2285 | - if (!empty($get_post_data)) { |
|
2285 | + if (!empty($get_post_data)) { |
|
2286 | 2286 | |
2287 | - foreach ($get_post_data as $data) { |
|
2287 | + foreach ($get_post_data as $data) { |
|
2288 | 2288 | |
2289 | - $post_id = $data->post_id; |
|
2289 | + $post_id = $data->post_id; |
|
2290 | 2290 | |
2291 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2291 | + $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2292 | 2292 | |
2293 | - if (!empty($attachment_data)) { |
|
2293 | + if (!empty($attachment_data)) { |
|
2294 | 2294 | |
2295 | - foreach ($attachment_data as $attach) { |
|
2295 | + foreach ($attachment_data as $attach) { |
|
2296 | 2296 | |
2297 | - $file_info = pathinfo($attach->file); |
|
2297 | + $file_info = pathinfo($attach->file); |
|
2298 | 2298 | |
2299 | - $sub_dir = ''; |
|
2300 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2301 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2299 | + $sub_dir = ''; |
|
2300 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2301 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2302 | 2302 | |
2303 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2304 | - $uploads_path = $uploads['basedir']; |
|
2303 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2304 | + $uploads_path = $uploads['basedir']; |
|
2305 | 2305 | |
2306 | - $file_name = $file_info['basename']; |
|
2306 | + $file_name = $file_info['basename']; |
|
2307 | 2307 | |
2308 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2308 | + $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2309 | 2309 | |
2310 | - if (!file_exists($img_arr['path'])) { |
|
2310 | + if (!file_exists($img_arr['path'])) { |
|
2311 | 2311 | |
2312 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2312 | + $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2313 | 2313 | |
2314 | - } |
|
2314 | + } |
|
2315 | 2315 | |
2316 | - } |
|
2316 | + } |
|
2317 | 2317 | |
2318 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2318 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2319 | 2319 | |
2320 | - if (!empty($attachment_data)) { |
|
2320 | + if (!empty($attachment_data)) { |
|
2321 | 2321 | |
2322 | - if ($attachment_data->ID) |
|
2323 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2322 | + if ($attachment_data->ID) |
|
2323 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2324 | 2324 | |
2325 | - } else { |
|
2325 | + } else { |
|
2326 | 2326 | |
2327 | - if (has_post_thumbnail($post_id)) { |
|
2327 | + if (has_post_thumbnail($post_id)) { |
|
2328 | 2328 | |
2329 | - $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2329 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2330 | 2330 | |
2331 | - wp_delete_attachment($post_thumbnail_id); |
|
2331 | + wp_delete_attachment($post_thumbnail_id); |
|
2332 | 2332 | |
2333 | - } |
|
2333 | + } |
|
2334 | 2334 | |
2335 | - } |
|
2335 | + } |
|
2336 | 2336 | |
2337 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2337 | + $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2338 | 2338 | |
2339 | - geodir_set_wp_featured_image($post_id); |
|
2339 | + geodir_set_wp_featured_image($post_id); |
|
2340 | 2340 | |
2341 | - } |
|
2341 | + } |
|
2342 | 2342 | |
2343 | - } |
|
2343 | + } |
|
2344 | 2344 | |
2345 | - } |
|
2345 | + } |
|
2346 | 2346 | |
2347 | - } |
|
2347 | + } |
|
2348 | 2348 | |
2349 | 2349 | } |
2350 | 2350 | |
@@ -2362,9 +2362,9 @@ discard block |
||
2362 | 2362 | function geodir_default_rating_star_icon() |
2363 | 2363 | { |
2364 | 2364 | |
2365 | - if (!get_option('geodir_default_rating_star_icon')) { |
|
2366 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2367 | - } |
|
2365 | + if (!get_option('geodir_default_rating_star_icon')) { |
|
2366 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2367 | + } |
|
2368 | 2368 | |
2369 | 2369 | } |
2370 | 2370 | |
@@ -2382,27 +2382,27 @@ discard block |
||
2382 | 2382 | */ |
2383 | 2383 | function geodir_user_post_listing_count($user_id=null) |
2384 | 2384 | { |
2385 | - global $wpdb, $plugin_prefix, $current_user; |
|
2386 | - if(!$user_id){ |
|
2387 | - $user_id = $current_user->ID; |
|
2388 | - } |
|
2385 | + global $wpdb, $plugin_prefix, $current_user; |
|
2386 | + if(!$user_id){ |
|
2387 | + $user_id = $current_user->ID; |
|
2388 | + } |
|
2389 | 2389 | |
2390 | - $user_id = $current_user->ID; |
|
2391 | - $all_postypes = geodir_get_posttypes(); |
|
2392 | - $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2390 | + $user_id = $current_user->ID; |
|
2391 | + $all_postypes = geodir_get_posttypes(); |
|
2392 | + $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2393 | 2393 | |
2394 | - $user_listing = array(); |
|
2395 | - if (is_array($all_posts) && !empty($all_posts)) { |
|
2396 | - foreach ($all_posts as $ptype) { |
|
2397 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2394 | + $user_listing = array(); |
|
2395 | + if (is_array($all_posts) && !empty($all_posts)) { |
|
2396 | + foreach ($all_posts as $ptype) { |
|
2397 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2398 | 2398 | |
2399 | - if ($total_posts > 0) { |
|
2400 | - $user_listing[$ptype] = $total_posts; |
|
2401 | - } |
|
2402 | - } |
|
2403 | - } |
|
2399 | + if ($total_posts > 0) { |
|
2400 | + $user_listing[$ptype] = $total_posts; |
|
2401 | + } |
|
2402 | + } |
|
2403 | + } |
|
2404 | 2404 | |
2405 | - return $user_listing; |
|
2405 | + return $user_listing; |
|
2406 | 2406 | } |
2407 | 2407 | |
2408 | 2408 | |
@@ -2422,192 +2422,192 @@ discard block |
||
2422 | 2422 | */ |
2423 | 2423 | function geodir_detail_page_custom_field_tab($tabs_arr) |
2424 | 2424 | { |
2425 | - global $post; |
|
2426 | - |
|
2427 | - $post_type = geodir_get_current_posttype(); |
|
2428 | - $all_postypes = geodir_get_posttypes(); |
|
2429 | - |
|
2430 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2431 | - $package_info = array(); |
|
2432 | - $package_info = geodir_post_package_info($package_info, $post); |
|
2433 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
2434 | - $fields_location = 'owntab'; |
|
2435 | - |
|
2436 | - $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
2437 | - |
|
2438 | - //remove video and special offers if it is already set to show |
|
2439 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2440 | - $unset_video = true; |
|
2441 | - } |
|
2442 | - |
|
2443 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2444 | - $unset_special_offers = true; |
|
2445 | - } |
|
2446 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2447 | - foreach($custom_fields as $key => $custom_field){ |
|
2448 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2449 | - unset($custom_fields[$key]); |
|
2450 | - } |
|
2451 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2452 | - unset($custom_fields[$key]); |
|
2453 | - } |
|
2454 | - } |
|
2455 | - } |
|
2456 | - |
|
2457 | - |
|
2425 | + global $post; |
|
2458 | 2426 | |
2459 | - if (!empty($custom_fields)) { |
|
2460 | - $parse_custom_fields = array(); |
|
2461 | - foreach ($custom_fields as $field) { |
|
2462 | - $field = stripslashes_deep($field); // strip slashes |
|
2463 | - |
|
2464 | - $type = $field; |
|
2465 | - $field_name = $field['htmlvar_name']; |
|
2466 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2467 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2468 | - } |
|
2469 | - |
|
2470 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2471 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2472 | - continue; |
|
2473 | - } |
|
2427 | + $post_type = geodir_get_current_posttype(); |
|
2428 | + $all_postypes = geodir_get_posttypes(); |
|
2474 | 2429 | |
2475 | - $parse_custom_fields[] = $field; |
|
2476 | - } |
|
2477 | - } |
|
2478 | - $custom_fields = $parse_custom_fields; |
|
2479 | - } |
|
2480 | - //print_r($custom_fields); |
|
2481 | - if (!empty($custom_fields)) { |
|
2430 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2431 | + $package_info = array(); |
|
2432 | + $package_info = geodir_post_package_info($package_info, $post); |
|
2433 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
2434 | + $fields_location = 'owntab'; |
|
2482 | 2435 | |
2483 | - global $field_set_start; |
|
2436 | + $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
2484 | 2437 | |
2485 | - $post = stripslashes_deep($post); // strip slashes |
|
2486 | - |
|
2487 | - $field_set_start = 0; |
|
2488 | - $fieldset_count = 0; |
|
2489 | - $fieldset = ''; |
|
2490 | - $total_fields = count($custom_fields); |
|
2491 | - $count_field = 0; |
|
2492 | - $fieldset_arr = array(); |
|
2493 | - $i = 0; |
|
2494 | - $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2495 | - |
|
2496 | - foreach ($custom_fields as $field) { |
|
2497 | - $count_field++; |
|
2498 | - $field_name = $field['htmlvar_name']; |
|
2499 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2500 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2501 | - } |
|
2438 | + //remove video and special offers if it is already set to show |
|
2439 | + if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2440 | + $unset_video = true; |
|
2441 | + } |
|
2502 | 2442 | |
2503 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2504 | - $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2505 | - $site_title = trim($field['site_title']); |
|
2506 | - $type = $field; |
|
2507 | - $variables_array = array(); |
|
2443 | + if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2444 | + $unset_special_offers = true; |
|
2445 | + } |
|
2446 | + if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2447 | + foreach($custom_fields as $key => $custom_field){ |
|
2448 | + if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2449 | + unset($custom_fields[$key]); |
|
2450 | + } |
|
2451 | + if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2452 | + unset($custom_fields[$key]); |
|
2453 | + } |
|
2454 | + } |
|
2455 | + } |
|
2508 | 2456 | |
2509 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2510 | - continue; |
|
2511 | - } |
|
2512 | 2457 | |
2513 | - if ($type['type'] != 'fieldset') { |
|
2514 | - $i++; |
|
2515 | - $variables_array['post_id'] = $post->ID; |
|
2516 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2517 | - $variables_array['value'] = ''; |
|
2518 | - $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
2519 | - }else{ |
|
2520 | - $i = 0; |
|
2521 | - $fieldset_count++; |
|
2522 | - $field_set_start = 1; |
|
2523 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2524 | - $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2525 | - } |
|
2526 | 2458 | |
2459 | + if (!empty($custom_fields)) { |
|
2460 | + $parse_custom_fields = array(); |
|
2461 | + foreach ($custom_fields as $field) { |
|
2462 | + $field = stripslashes_deep($field); // strip slashes |
|
2463 | + |
|
2464 | + $type = $field; |
|
2465 | + $field_name = $field['htmlvar_name']; |
|
2466 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2467 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2468 | + } |
|
2469 | + |
|
2470 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2471 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2472 | + continue; |
|
2473 | + } |
|
2474 | + |
|
2475 | + $parse_custom_fields[] = $field; |
|
2476 | + } |
|
2477 | + } |
|
2478 | + $custom_fields = $parse_custom_fields; |
|
2479 | + } |
|
2480 | + //print_r($custom_fields); |
|
2481 | + if (!empty($custom_fields)) { |
|
2527 | 2482 | |
2528 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2529 | - $type = stripslashes_deep($type); // strip slashes |
|
2530 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2531 | - $html = ''; |
|
2532 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
2533 | - if($html_var=='post'){$html_var='post_address';} |
|
2534 | - $field_icon = geodir_field_icon_proccess($type); |
|
2535 | - $filed_type = $type['type']; |
|
2536 | - |
|
2537 | - /** |
|
2538 | - * Filter the output for custom fields. |
|
2539 | - * |
|
2540 | - * Here we can remove or add new functions depending on the field type. |
|
2541 | - * |
|
2542 | - * @param string $html The html to be filtered (blank). |
|
2543 | - * @param string $fields_location The location the field is to be show. |
|
2544 | - * @param array $type The array of field values. |
|
2545 | - */ |
|
2546 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2547 | - |
|
2548 | - |
|
2549 | - /** |
|
2550 | - * Filter custom field output in tab. |
|
2551 | - * |
|
2552 | - * @since 1.5.6 |
|
2553 | - * |
|
2554 | - * @param string $html_var The HTML variable name for the field. |
|
2555 | - * @param string $html Custom field unfiltered HTML. |
|
2556 | - * @param array $variables_array Custom field variables array. |
|
2557 | - */ |
|
2558 | - $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2559 | - |
|
2560 | - $fieldset_html = ''; |
|
2561 | - if ($field_set_start == 1) { |
|
2562 | - $add_html = false; |
|
2563 | - if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2564 | - if ($fieldset != '') { |
|
2565 | - $add_html = true; |
|
2566 | - $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2567 | - $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2568 | - } |
|
2569 | - $fieldset_html = $fieldset; |
|
2570 | - $fieldset = ''; |
|
2571 | - } else { |
|
2572 | - $fieldset .= $html; |
|
2573 | - if ($total_fields == $count_field && $fieldset != '') { |
|
2574 | - $add_html = true; |
|
2575 | - $label = $fieldset_arr[$fieldset_count]['label']; |
|
2576 | - $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2577 | - $fieldset_html = $fieldset; |
|
2578 | - } |
|
2579 | - } |
|
2483 | + global $field_set_start; |
|
2580 | 2484 | |
2581 | - if ($add_html) { |
|
2582 | - $tabs_arr[$htmlvar_name] = array( |
|
2583 | - 'heading_text' => __($label, 'geodirectory'), |
|
2584 | - 'is_active_tab' => false, |
|
2585 | - /** |
|
2586 | - * Filter if a custom field should be displayed on the details page tab. |
|
2587 | - * |
|
2588 | - * @since 1.0.0 |
|
2589 | - * @param string $htmlvar_name The field HTML var name. |
|
2590 | - */ |
|
2591 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2592 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2593 | - ); |
|
2594 | - } |
|
2595 | - } else { |
|
2596 | - if ($html != '') { |
|
2597 | - $tabs_arr[$field['htmlvar_name']] = array( |
|
2598 | - 'heading_text' => __($label, 'geodirectory'), |
|
2599 | - 'is_active_tab' => false, |
|
2600 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
2601 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2602 | - 'tab_content' => $html |
|
2603 | - ); |
|
2604 | - } |
|
2605 | - } |
|
2606 | - } |
|
2607 | - } |
|
2608 | - } |
|
2609 | - } |
|
2610 | - return $tabs_arr; |
|
2485 | + $post = stripslashes_deep($post); // strip slashes |
|
2486 | + |
|
2487 | + $field_set_start = 0; |
|
2488 | + $fieldset_count = 0; |
|
2489 | + $fieldset = ''; |
|
2490 | + $total_fields = count($custom_fields); |
|
2491 | + $count_field = 0; |
|
2492 | + $fieldset_arr = array(); |
|
2493 | + $i = 0; |
|
2494 | + $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2495 | + |
|
2496 | + foreach ($custom_fields as $field) { |
|
2497 | + $count_field++; |
|
2498 | + $field_name = $field['htmlvar_name']; |
|
2499 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2500 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2501 | + } |
|
2502 | + |
|
2503 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2504 | + $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2505 | + $site_title = trim($field['site_title']); |
|
2506 | + $type = $field; |
|
2507 | + $variables_array = array(); |
|
2508 | + |
|
2509 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2510 | + continue; |
|
2511 | + } |
|
2512 | + |
|
2513 | + if ($type['type'] != 'fieldset') { |
|
2514 | + $i++; |
|
2515 | + $variables_array['post_id'] = $post->ID; |
|
2516 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2517 | + $variables_array['value'] = ''; |
|
2518 | + $variables_array['value'] = $post->{$type['htmlvar_name']}; |
|
2519 | + }else{ |
|
2520 | + $i = 0; |
|
2521 | + $fieldset_count++; |
|
2522 | + $field_set_start = 1; |
|
2523 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2524 | + $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2525 | + } |
|
2526 | + |
|
2527 | + |
|
2528 | + if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2529 | + $type = stripslashes_deep($type); // strip slashes |
|
2530 | + if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2531 | + $html = ''; |
|
2532 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
2533 | + if($html_var=='post'){$html_var='post_address';} |
|
2534 | + $field_icon = geodir_field_icon_proccess($type); |
|
2535 | + $filed_type = $type['type']; |
|
2536 | + |
|
2537 | + /** |
|
2538 | + * Filter the output for custom fields. |
|
2539 | + * |
|
2540 | + * Here we can remove or add new functions depending on the field type. |
|
2541 | + * |
|
2542 | + * @param string $html The html to be filtered (blank). |
|
2543 | + * @param string $fields_location The location the field is to be show. |
|
2544 | + * @param array $type The array of field values. |
|
2545 | + */ |
|
2546 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2547 | + |
|
2548 | + |
|
2549 | + /** |
|
2550 | + * Filter custom field output in tab. |
|
2551 | + * |
|
2552 | + * @since 1.5.6 |
|
2553 | + * |
|
2554 | + * @param string $html_var The HTML variable name for the field. |
|
2555 | + * @param string $html Custom field unfiltered HTML. |
|
2556 | + * @param array $variables_array Custom field variables array. |
|
2557 | + */ |
|
2558 | + $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2559 | + |
|
2560 | + $fieldset_html = ''; |
|
2561 | + if ($field_set_start == 1) { |
|
2562 | + $add_html = false; |
|
2563 | + if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2564 | + if ($fieldset != '') { |
|
2565 | + $add_html = true; |
|
2566 | + $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2567 | + $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2568 | + } |
|
2569 | + $fieldset_html = $fieldset; |
|
2570 | + $fieldset = ''; |
|
2571 | + } else { |
|
2572 | + $fieldset .= $html; |
|
2573 | + if ($total_fields == $count_field && $fieldset != '') { |
|
2574 | + $add_html = true; |
|
2575 | + $label = $fieldset_arr[$fieldset_count]['label']; |
|
2576 | + $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2577 | + $fieldset_html = $fieldset; |
|
2578 | + } |
|
2579 | + } |
|
2580 | + |
|
2581 | + if ($add_html) { |
|
2582 | + $tabs_arr[$htmlvar_name] = array( |
|
2583 | + 'heading_text' => __($label, 'geodirectory'), |
|
2584 | + 'is_active_tab' => false, |
|
2585 | + /** |
|
2586 | + * Filter if a custom field should be displayed on the details page tab. |
|
2587 | + * |
|
2588 | + * @since 1.0.0 |
|
2589 | + * @param string $htmlvar_name The field HTML var name. |
|
2590 | + */ |
|
2591 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2592 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2593 | + ); |
|
2594 | + } |
|
2595 | + } else { |
|
2596 | + if ($html != '') { |
|
2597 | + $tabs_arr[$field['htmlvar_name']] = array( |
|
2598 | + 'heading_text' => __($label, 'geodirectory'), |
|
2599 | + 'is_active_tab' => false, |
|
2600 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
2601 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2602 | + 'tab_content' => $html |
|
2603 | + ); |
|
2604 | + } |
|
2605 | + } |
|
2606 | + } |
|
2607 | + } |
|
2608 | + } |
|
2609 | + } |
|
2610 | + return $tabs_arr; |
|
2611 | 2611 | } |
2612 | 2612 | |
2613 | 2613 | /* display add listing page for wpml */ |
@@ -2631,37 +2631,37 @@ discard block |
||
2631 | 2631 | */ |
2632 | 2632 | function geodir_add_post_status_author_page() |
2633 | 2633 | { |
2634 | - global $wpdb, $post; |
|
2635 | - |
|
2636 | - $html = ''; |
|
2637 | - if (get_current_user_id()) { |
|
2638 | - if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2639 | - |
|
2640 | - // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2641 | - $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2642 | - $status = "<strong>("; |
|
2643 | - $status_icon = '<i class="fa fa-play"></i>'; |
|
2644 | - if ($real_status == 'publish') { |
|
2645 | - $status .= __('Published', 'geodirectory'); |
|
2646 | - } else { |
|
2647 | - $status .= __('Not published', 'geodirectory'); |
|
2648 | - $status_icon = '<i class="fa fa-pause"></i>'; |
|
2649 | - } |
|
2650 | - $status .= ")</strong>"; |
|
2634 | + global $wpdb, $post; |
|
2635 | + |
|
2636 | + $html = ''; |
|
2637 | + if (get_current_user_id()) { |
|
2638 | + if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2639 | + |
|
2640 | + // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2641 | + $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2642 | + $status = "<strong>("; |
|
2643 | + $status_icon = '<i class="fa fa-play"></i>'; |
|
2644 | + if ($real_status == 'publish') { |
|
2645 | + $status .= __('Published', 'geodirectory'); |
|
2646 | + } else { |
|
2647 | + $status .= __('Not published', 'geodirectory'); |
|
2648 | + $status_icon = '<i class="fa fa-pause"></i>'; |
|
2649 | + } |
|
2650 | + $status .= ")</strong>"; |
|
2651 | 2651 | |
2652 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2653 | - } |
|
2654 | - } |
|
2652 | + $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2653 | + } |
|
2654 | + } |
|
2655 | 2655 | |
2656 | - if ($html != '') { |
|
2657 | - /** |
|
2658 | - * Filter the post status text on the author page. |
|
2659 | - * |
|
2660 | - * @since 1.0.0 |
|
2661 | - * @param string $html The HTML of the status. |
|
2662 | - */ |
|
2663 | - echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2664 | - } |
|
2656 | + if ($html != '') { |
|
2657 | + /** |
|
2658 | + * Filter the post status text on the author page. |
|
2659 | + * |
|
2660 | + * @since 1.0.0 |
|
2661 | + * @param string $html The HTML of the status. |
|
2662 | + */ |
|
2663 | + echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2664 | + } |
|
2665 | 2665 | |
2666 | 2666 | |
2667 | 2667 | } |
@@ -2675,21 +2675,21 @@ discard block |
||
2675 | 2675 | */ |
2676 | 2676 | function geodir_init_no_rating() |
2677 | 2677 | { |
2678 | - if (get_option('geodir_disable_rating')) { |
|
2679 | - remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields'); |
|
2680 | - remove_action('comment_form_before_fields', 'geodir_comment_rating_fields'); |
|
2681 | - remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields'); |
|
2682 | - remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields'); |
|
2683 | - remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box'); |
|
2684 | - remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13); |
|
2685 | - remove_filter('comment_text', 'geodir_wrap_comment_text', 40); |
|
2686 | - |
|
2687 | - add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields'); |
|
2688 | - add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields'); |
|
2689 | - add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2); |
|
2690 | - add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100); |
|
2691 | - add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2692 | - } |
|
2678 | + if (get_option('geodir_disable_rating')) { |
|
2679 | + remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields'); |
|
2680 | + remove_action('comment_form_before_fields', 'geodir_comment_rating_fields'); |
|
2681 | + remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields'); |
|
2682 | + remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields'); |
|
2683 | + remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box'); |
|
2684 | + remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13); |
|
2685 | + remove_filter('comment_text', 'geodir_wrap_comment_text', 40); |
|
2686 | + |
|
2687 | + add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields'); |
|
2688 | + add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields'); |
|
2689 | + add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2); |
|
2690 | + add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100); |
|
2691 | + add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2692 | + } |
|
2693 | 2693 | } |
2694 | 2694 | |
2695 | 2695 | /** |
@@ -2701,24 +2701,24 @@ discard block |
||
2701 | 2701 | */ |
2702 | 2702 | function geodir_no_rating_rating_fields() |
2703 | 2703 | { |
2704 | - global $post; |
|
2704 | + global $post; |
|
2705 | 2705 | |
2706 | - $post_types = geodir_get_posttypes(); |
|
2706 | + $post_types = geodir_get_posttypes(); |
|
2707 | 2707 | |
2708 | - if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) { |
|
2709 | - if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) { |
|
2710 | - if (get_option('geodir_reviewrating_enable_rating')) { |
|
2711 | - echo '<input type="hidden" value="1" name="geodir_rating[overall]" />'; |
|
2712 | - } else { |
|
2713 | - echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2714 | - } |
|
2715 | - if (get_option('geodir_reviewrating_enable_images')) { |
|
2716 | - geodir_reviewrating_rating_img_html(); |
|
2717 | - } |
|
2718 | - } else { |
|
2719 | - echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2720 | - } |
|
2721 | - } |
|
2708 | + if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) { |
|
2709 | + if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) { |
|
2710 | + if (get_option('geodir_reviewrating_enable_rating')) { |
|
2711 | + echo '<input type="hidden" value="1" name="geodir_rating[overall]" />'; |
|
2712 | + } else { |
|
2713 | + echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2714 | + } |
|
2715 | + if (get_option('geodir_reviewrating_enable_images')) { |
|
2716 | + geodir_reviewrating_rating_img_html(); |
|
2717 | + } |
|
2718 | + } else { |
|
2719 | + echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />'; |
|
2720 | + } |
|
2721 | + } |
|
2722 | 2722 | } |
2723 | 2723 | |
2724 | 2724 | /** |
@@ -2732,11 +2732,11 @@ discard block |
||
2732 | 2732 | */ |
2733 | 2733 | function geodir_no_rating_comment_text($content, $comment = '') |
2734 | 2734 | { |
2735 | - if (!is_admin()) { |
|
2736 | - return '<div class="description">' . $content . '</div>'; |
|
2737 | - } else { |
|
2738 | - return $content; |
|
2739 | - } |
|
2735 | + if (!is_admin()) { |
|
2736 | + return '<div class="description">' . $content . '</div>'; |
|
2737 | + } else { |
|
2738 | + return $content; |
|
2739 | + } |
|
2740 | 2740 | } |
2741 | 2741 | |
2742 | 2742 | /** |
@@ -2749,7 +2749,7 @@ discard block |
||
2749 | 2749 | */ |
2750 | 2750 | function geodir_no_rating_review_rating_html($content = '') |
2751 | 2751 | { |
2752 | - return NULL; |
|
2752 | + return NULL; |
|
2753 | 2753 | } |
2754 | 2754 | |
2755 | 2755 | /** |
@@ -2763,19 +2763,19 @@ discard block |
||
2763 | 2763 | */ |
2764 | 2764 | function geodir_no_rating_get_sort_options($options, $post_type = '') |
2765 | 2765 | { |
2766 | - $new_options = array(); |
|
2767 | - if (!empty($options)) { |
|
2768 | - foreach ($options as $option) { |
|
2769 | - if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2770 | - continue; |
|
2771 | - } |
|
2772 | - $new_options[] = $option; |
|
2773 | - } |
|
2766 | + $new_options = array(); |
|
2767 | + if (!empty($options)) { |
|
2768 | + foreach ($options as $option) { |
|
2769 | + if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2770 | + continue; |
|
2771 | + } |
|
2772 | + $new_options[] = $option; |
|
2773 | + } |
|
2774 | 2774 | |
2775 | - $options = $new_options; |
|
2776 | - } |
|
2775 | + $options = $new_options; |
|
2776 | + } |
|
2777 | 2777 | |
2778 | - return $options; |
|
2778 | + return $options; |
|
2779 | 2779 | } |
2780 | 2780 | |
2781 | 2781 | add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100); |
@@ -2789,11 +2789,11 @@ discard block |
||
2789 | 2789 | */ |
2790 | 2790 | function geodir_all_js_msg_no_rating($msg = array()) |
2791 | 2791 | { |
2792 | - if (get_option('geodir_disable_rating')) { |
|
2793 | - $msg['gd_cmt_no_rating'] = true; |
|
2794 | - } |
|
2792 | + if (get_option('geodir_disable_rating')) { |
|
2793 | + $msg['gd_cmt_no_rating'] = true; |
|
2794 | + } |
|
2795 | 2795 | |
2796 | - return $msg; |
|
2796 | + return $msg; |
|
2797 | 2797 | } |
2798 | 2798 | |
2799 | 2799 | add_filter('body_class', 'geodir_body_class_no_rating', 100); |
@@ -2807,13 +2807,13 @@ discard block |
||
2807 | 2807 | */ |
2808 | 2808 | function geodir_body_class_no_rating($classes = array()) |
2809 | 2809 | { |
2810 | - if (get_option('geodir_disable_rating')) { |
|
2811 | - $classes[] = 'gd-no-rating'; |
|
2812 | - } |
|
2810 | + if (get_option('geodir_disable_rating')) { |
|
2811 | + $classes[] = 'gd-no-rating'; |
|
2812 | + } |
|
2813 | 2813 | |
2814 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2814 | + $classes[] = 'gd-map-' . geodir_map_name(); |
|
2815 | 2815 | |
2816 | - return $classes; |
|
2816 | + return $classes; |
|
2817 | 2817 | } |
2818 | 2818 | |
2819 | 2819 | add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100); |
@@ -2827,13 +2827,13 @@ discard block |
||
2827 | 2827 | */ |
2828 | 2828 | function geodir_admin_body_class_no_rating($class = '') |
2829 | 2829 | { |
2830 | - if (get_option('geodir_disable_rating')) { |
|
2831 | - $class .= ' gd-no-rating'; |
|
2832 | - } |
|
2830 | + if (get_option('geodir_disable_rating')) { |
|
2831 | + $class .= ' gd-no-rating'; |
|
2832 | + } |
|
2833 | 2833 | |
2834 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2834 | + $class .= ' gd-map-' . geodir_map_name(); |
|
2835 | 2835 | |
2836 | - return $class; |
|
2836 | + return $class; |
|
2837 | 2837 | } |
2838 | 2838 | |
2839 | 2839 | add_action('wp_head', 'geodir_wp_head_no_rating'); |
@@ -2846,10 +2846,10 @@ discard block |
||
2846 | 2846 | */ |
2847 | 2847 | function geodir_wp_head_no_rating() |
2848 | 2848 | { |
2849 | - if (get_option('geodir_disable_rating')) { |
|
2850 | - echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>'; |
|
2851 | - echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>'; |
|
2852 | - } |
|
2849 | + if (get_option('geodir_disable_rating')) { |
|
2850 | + echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>'; |
|
2851 | + echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>'; |
|
2852 | + } |
|
2853 | 2853 | } |
2854 | 2854 | |
2855 | 2855 | add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation'); |
@@ -2866,36 +2866,36 @@ discard block |
||
2866 | 2866 | * @return array Translation texts. |
2867 | 2867 | */ |
2868 | 2868 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2869 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2870 | - |
|
2871 | - $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2872 | - |
|
2873 | - /** |
|
2874 | - * Filters the geodirectory option names that requires to add for translation. |
|
2875 | - * |
|
2876 | - * @since 1.5.7 |
|
2877 | - * @package GeoDirectory |
|
2878 | - * |
|
2879 | - * @param array $gd_options Array of option names. |
|
2880 | - */ |
|
2881 | - $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2882 | - $gd_options = array_unique($gd_options); |
|
2883 | - |
|
2884 | - if (!empty($gd_options)) { |
|
2885 | - foreach ($gd_options as $gd_option) { |
|
2886 | - if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2887 | - $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2869 | + $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2870 | + |
|
2871 | + $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2872 | + |
|
2873 | + /** |
|
2874 | + * Filters the geodirectory option names that requires to add for translation. |
|
2875 | + * |
|
2876 | + * @since 1.5.7 |
|
2877 | + * @package GeoDirectory |
|
2878 | + * |
|
2879 | + * @param array $gd_options Array of option names. |
|
2880 | + */ |
|
2881 | + $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2882 | + $gd_options = array_unique($gd_options); |
|
2883 | + |
|
2884 | + if (!empty($gd_options)) { |
|
2885 | + foreach ($gd_options as $gd_option) { |
|
2886 | + if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2887 | + $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2888 | 2888 | |
2889 | - if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2890 | - $translation_texts[] = stripslashes_deep($option_value); |
|
2891 | - } |
|
2892 | - } |
|
2893 | - } |
|
2894 | - } |
|
2889 | + if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2890 | + $translation_texts[] = stripslashes_deep($option_value); |
|
2891 | + } |
|
2892 | + } |
|
2893 | + } |
|
2894 | + } |
|
2895 | 2895 | |
2896 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2896 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2897 | 2897 | |
2898 | - return $translation_texts; |
|
2898 | + return $translation_texts; |
|
2899 | 2899 | } |
2900 | 2900 | |
2901 | 2901 | add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation'); |
@@ -2909,15 +2909,15 @@ discard block |
||
2909 | 2909 | |
2910 | 2910 | add_filter('get_comments_link', 'gd_get_comments_link', 10, 2); |
2911 | 2911 | function gd_get_comments_link($comments_link, $post_id) { |
2912 | - $post_type = get_post_type($post_id); |
|
2912 | + $post_type = get_post_type($post_id); |
|
2913 | 2913 | |
2914 | - $all_postypes = geodir_get_posttypes(); |
|
2915 | - if (in_array($post_type, $all_postypes)) { |
|
2916 | - $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2917 | - $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2918 | - } |
|
2914 | + $all_postypes = geodir_get_posttypes(); |
|
2915 | + if (in_array($post_type, $all_postypes)) { |
|
2916 | + $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2917 | + $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2918 | + } |
|
2919 | 2919 | |
2920 | - return $comments_link; |
|
2920 | + return $comments_link; |
|
2921 | 2921 | } |
2922 | 2922 | |
2923 | 2923 | |
@@ -2935,11 +2935,11 @@ discard block |
||
2935 | 2935 | function geodir_add_nav_menu_class( $args ) |
2936 | 2936 | { |
2937 | 2937 | |
2938 | - if(isset($args['menu_class'])){ |
|
2939 | - $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2940 | - } |
|
2938 | + if(isset($args['menu_class'])){ |
|
2939 | + $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2940 | + } |
|
2941 | 2941 | |
2942 | - return $args; |
|
2942 | + return $args; |
|
2943 | 2943 | } |
2944 | 2944 | |
2945 | 2945 | add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
2946 | 2946 | \ No newline at end of file |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /* ON TEMPLATE INCLUDE */ |
137 | 137 | ///////////////////////// |
138 | 138 | |
139 | -add_filter('template_include', 'geodir_template_loader',9); |
|
139 | +add_filter('template_include', 'geodir_template_loader', 9); |
|
140 | 140 | |
141 | 141 | ///////////////////////// |
142 | 142 | /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */ |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | /* WP REVIEW COUNT ACTIONS */ |
177 | 177 | //////////////////////// |
178 | 178 | |
179 | -add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1); |
|
179 | +add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1); |
|
180 | 180 | //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100); |
181 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3); |
|
181 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3); |
|
182 | 182 | //add_action('created_term', 'geodir_term_review_count_force_update', 100); |
183 | 183 | add_action('edited_term', 'geodir_term_review_count_force_update', 100); |
184 | 184 | add_action('delete_term', 'geodir_term_review_count_force_update', 100); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | function geodir_unset_prev_theme_nav_location($newname) |
224 | 224 | { |
225 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
225 | + $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname); |
|
226 | 226 | if ($geodir_theme_location) { |
227 | 227 | update_option('geodir_theme_location_nav', $geodir_theme_location); |
228 | 228 | } else { |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | |
321 | 321 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
322 | 322 | |
323 | -add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
324 | -add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
323 | +add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
324 | +add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
325 | 325 | |
326 | 326 | // Detail page sidebar content |
327 | 327 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1); |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | do_action('geodir_after_social_sharing_buttons'); |
423 | 423 | $content_html = ob_get_clean(); |
424 | 424 | if (trim($content_html) != '') |
425 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
426 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
425 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>'; |
|
426 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
427 | 427 | /** |
428 | 428 | * Filter the geodir_social_sharing_buttons() function content. |
429 | 429 | * |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | do_action('geodir_after_share_this_button'); |
470 | 470 | $content_html = ob_get_clean(); |
471 | 471 | if (trim($content_html) != '') |
472 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
|
473 | - if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
472 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">'.$content_html.'</div>'; |
|
473 | + if ((int) get_option('geodir_disable_sharethis_button_section') != 1) { |
|
474 | 474 | /** |
475 | 475 | * Filter the geodir_share_this_button() function content. |
476 | 476 | * |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | $post_id = $post->ID; |
510 | 510 | |
511 | 511 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
512 | - $post_id = (int)$_REQUEST['pid']; |
|
512 | + $post_id = (int) $_REQUEST['pid']; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | $postlink = get_permalink(geodir_add_listing_page_id()); |
516 | 516 | $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
517 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
517 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>'; |
|
518 | 518 | } |
519 | 519 | }// end of if, if its a preview or not |
520 | 520 | /** |
@@ -525,8 +525,8 @@ discard block |
||
525 | 525 | do_action('geodir_after_edit_post_link'); |
526 | 526 | $content_html = ob_get_clean(); |
527 | 527 | if (trim($content_html) != '') |
528 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
529 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
528 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>'; |
|
529 | + if ((int) get_option('geodir_disable_user_links_section') != 1) { |
|
530 | 530 | /** |
531 | 531 | * Filter the geodir_edit_post_link() function content. |
532 | 532 | * |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | $hide_refresh = get_option('geodir_ga_auto_refresh'); |
580 | 580 | |
581 | 581 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
582 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
582 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) { |
|
583 | 583 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
584 | 584 | ?> |
585 | 585 | <script type="text/javascript"> |
586 | 586 | var gd_gaTimeOut; |
587 | - var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
|
588 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>; |
|
589 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>; |
|
587 | + var gd_gaTime = parseInt('<?php echo $refresh_time; ?>'); |
|
588 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>; |
|
589 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>; |
|
590 | 590 | ga_data1 = false; |
591 | 591 | ga_data2 = false; |
592 | 592 | ga_data3 = false; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | } |
728 | 728 | |
729 | 729 | function gdga_noResults() { |
730 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>'); |
|
730 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>'); |
|
731 | 731 | jQuery('#gdga-legend-container').html(''); |
732 | 732 | } |
733 | 733 | |
@@ -759,18 +759,18 @@ discard block |
||
759 | 759 | var data2 = results[1].rows.map(function(row) { return +row[2]; }); |
760 | 760 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; }); |
761 | 761 | |
762 | - var labels = ['<?php _e('Jan', 'geodirectory');?>', |
|
763 | - '<?php _e('Feb', 'geodirectory');?>', |
|
764 | - '<?php _e('Mar', 'geodirectory');?>', |
|
765 | - '<?php _e('Apr', 'geodirectory');?>', |
|
766 | - '<?php _e('May', 'geodirectory');?>', |
|
767 | - '<?php _e('Jun', 'geodirectory');?>', |
|
768 | - '<?php _e('Jul', 'geodirectory');?>', |
|
769 | - '<?php _e('Aug', 'geodirectory');?>', |
|
770 | - '<?php _e('Sep', 'geodirectory');?>', |
|
771 | - '<?php _e('Oct', 'geodirectory');?>', |
|
772 | - '<?php _e('Nov', 'geodirectory');?>', |
|
773 | - '<?php _e('Dec', 'geodirectory');?>']; |
|
762 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>', |
|
763 | + '<?php _e('Feb', 'geodirectory'); ?>', |
|
764 | + '<?php _e('Mar', 'geodirectory'); ?>', |
|
765 | + '<?php _e('Apr', 'geodirectory'); ?>', |
|
766 | + '<?php _e('May', 'geodirectory'); ?>', |
|
767 | + '<?php _e('Jun', 'geodirectory'); ?>', |
|
768 | + '<?php _e('Jul', 'geodirectory'); ?>', |
|
769 | + '<?php _e('Aug', 'geodirectory'); ?>', |
|
770 | + '<?php _e('Sep', 'geodirectory'); ?>', |
|
771 | + '<?php _e('Oct', 'geodirectory'); ?>', |
|
772 | + '<?php _e('Nov', 'geodirectory'); ?>', |
|
773 | + '<?php _e('Dec', 'geodirectory'); ?>']; |
|
774 | 774 | |
775 | 775 | // Ensure the data arrays are at least as long as the labels array. |
776 | 776 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -783,13 +783,13 @@ discard block |
||
783 | 783 | labels : labels, |
784 | 784 | datasets : [ |
785 | 785 | { |
786 | - label: '<?php _e('Last Year', 'geodirectory');?>', |
|
786 | + label: '<?php _e('Last Year', 'geodirectory'); ?>', |
|
787 | 787 | fillColor : "rgba(220,220,220,0.5)", |
788 | 788 | strokeColor : "rgba(220,220,220,1)", |
789 | 789 | data : data2 |
790 | 790 | }, |
791 | 791 | { |
792 | - label: '<?php _e('This Year', 'geodirectory');?>', |
|
792 | + label: '<?php _e('This Year', 'geodirectory'); ?>', |
|
793 | 793 | fillColor : "rgba(151,187,205,0.5)", |
794 | 794 | strokeColor : "rgba(151,187,205,1)", |
795 | 795 | data : data1 |
@@ -834,30 +834,30 @@ discard block |
||
834 | 834 | |
835 | 835 | <?php |
836 | 836 | // Here we list the shorthand days of the week so it can be used in translation. |
837 | - __("Mon",'geodirectory'); |
|
838 | - __("Tue",'geodirectory'); |
|
839 | - __("Wed",'geodirectory'); |
|
840 | - __("Thu",'geodirectory'); |
|
841 | - __("Fri",'geodirectory'); |
|
842 | - __("Sat",'geodirectory'); |
|
843 | - __("Sun",'geodirectory'); |
|
837 | + __("Mon", 'geodirectory'); |
|
838 | + __("Tue", 'geodirectory'); |
|
839 | + __("Wed", 'geodirectory'); |
|
840 | + __("Thu", 'geodirectory'); |
|
841 | + __("Fri", 'geodirectory'); |
|
842 | + __("Sat", 'geodirectory'); |
|
843 | + __("Sun", 'geodirectory'); |
|
844 | 844 | ?> |
845 | 845 | |
846 | 846 | labels = [ |
847 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
|
848 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>", |
|
849 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>", |
|
850 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>", |
|
851 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>", |
|
852 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>", |
|
853 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>" |
|
847 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>", |
|
848 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>", |
|
849 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>", |
|
850 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>", |
|
851 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>", |
|
852 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>", |
|
853 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>" |
|
854 | 854 | ]; |
855 | 855 | |
856 | 856 | var data = { |
857 | 857 | labels : labels, |
858 | 858 | datasets : [ |
859 | 859 | { |
860 | - label: '<?php _e('Last Week', 'geodirectory');?>', |
|
860 | + label: '<?php _e('Last Week', 'geodirectory'); ?>', |
|
861 | 861 | fillColor : "rgba(220,220,220,0.5)", |
862 | 862 | strokeColor : "rgba(220,220,220,1)", |
863 | 863 | pointColor : "rgba(220,220,220,1)", |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | data : data2 |
866 | 866 | }, |
867 | 867 | { |
868 | - label: '<?php _e('This Week', 'geodirectory');?>', |
|
868 | + label: '<?php _e('This Week', 'geodirectory'); ?>', |
|
869 | 869 | fillColor : "rgba(151,187,205,0.5)", |
870 | 870 | strokeColor : "rgba(151,187,205,1)", |
871 | 871 | pointColor : "rgba(151,187,205,1)", |
@@ -1072,18 +1072,18 @@ discard block |
||
1072 | 1072 | </style> |
1073 | 1073 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> |
1074 | 1074 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script> |
1075 | - <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button> |
|
1075 | + <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button> |
|
1076 | 1076 | <span id="ga_stats" class="gdga-analytics-box" style="display:none"> |
1077 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div> |
|
1077 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div> |
|
1078 | 1078 | <div id="gd-active-users-container"> |
1079 | - <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?> |
|
1079 | + <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?> |
|
1080 | 1080 | <b class="gd-ActiveUsers-value">0</b> |
1081 | 1081 | </div> |
1082 | 1082 | </div> |
1083 | 1083 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
1084 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option> |
|
1085 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option> |
|
1086 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option> |
|
1084 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option> |
|
1085 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option> |
|
1086 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option> |
|
1087 | 1087 | </select> |
1088 | 1088 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
1089 | 1089 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol> |
@@ -1099,8 +1099,8 @@ discard block |
||
1099 | 1099 | do_action('geodir_after_google_analytics'); |
1100 | 1100 | $content_html = ob_get_clean(); |
1101 | 1101 | if (trim($content_html) != '') |
1102 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1103 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1102 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>'; |
|
1103 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) { |
|
1104 | 1104 | /** |
1105 | 1105 | * Filter the geodir_edit_post_link() function content. |
1106 | 1106 | * |
@@ -1156,10 +1156,10 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1158 | 1158 | |
1159 | - $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
|
1159 | + $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />'; |
|
1160 | 1160 | |
1161 | 1161 | $html .= '<span class="item">'; |
1162 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1162 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>'; |
|
1163 | 1163 | |
1164 | 1164 | if ($post_images) { |
1165 | 1165 | foreach ($post_images as $img) { |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | if (isset($post_img) && $post_img) { |
1172 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1172 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />'; |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | $html .= '</span>'; |
@@ -1196,9 +1196,9 @@ discard block |
||
1196 | 1196 | do_action('geodir_after_detail_page_review_rating'); |
1197 | 1197 | $content_html = ob_get_clean(); |
1198 | 1198 | if (trim($content_html) != '') { |
1199 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1199 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>'; |
|
1200 | 1200 | } |
1201 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1201 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) { |
|
1202 | 1202 | /** |
1203 | 1203 | * Filter the geodir_detail_page_review_rating() function content. |
1204 | 1204 | * |
@@ -1237,8 +1237,8 @@ discard block |
||
1237 | 1237 | |
1238 | 1238 | $content_html = ob_get_clean(); |
1239 | 1239 | if (trim($content_html) != '') |
1240 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1241 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1240 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>'; |
|
1241 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) { |
|
1242 | 1242 | /** |
1243 | 1243 | * Filter the output html for function geodir_detail_page_more_info(). |
1244 | 1244 | * |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
1338 | 1338 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
1339 | 1339 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1340 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1340 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1341 | 1341 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1342 | 1342 | 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
1343 | 1343 | 'geodir_map_name' => geodir_map_name(), |
@@ -1359,10 +1359,10 @@ discard block |
||
1359 | 1359 | foreach ($arr_alert_msg as $key => $value) { |
1360 | 1360 | if (!is_scalar($value)) |
1361 | 1361 | continue; |
1362 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1362 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1365 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';'; |
|
1366 | 1366 | echo '<script>'; |
1367 | 1367 | echo $script; |
1368 | 1368 | echo '</script>'; |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | $geodir_old_sidebars = get_option('geodir_sidebars'); |
1453 | 1453 | if (is_array($geodir_old_sidebars)) { |
1454 | 1454 | foreach ($geodir_old_sidebars as $key => $val) { |
1455 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1455 | + if (0 === strpos($key, 'geodir_'))// if gd widget |
|
1456 | 1456 | { |
1457 | 1457 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
1458 | 1458 | } |
@@ -1531,7 +1531,7 @@ discard block |
||
1531 | 1531 | global $post; |
1532 | 1532 | $term_condition = ''; |
1533 | 1533 | if (isset($_REQUEST['backandedit'])) { |
1534 | - $post = (object)$gd_session->get('listing'); |
|
1534 | + $post = (object) $gd_session->get('listing'); |
|
1535 | 1535 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
1536 | 1536 | } |
1537 | 1537 | |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | echo 'checked="checked"'; |
1546 | 1546 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
1547 | 1547 | class="geodir_textfield" value="1" |
1548 | - style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1548 | + style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1549 | 1549 | </span> |
1550 | 1550 | </div> |
1551 | 1551 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
@@ -1585,7 +1585,7 @@ discard block |
||
1585 | 1585 | /** This action is documented in geodirectory_template_actions.php */ |
1586 | 1586 | $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
1587 | 1587 | |
1588 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1588 | + if (!($desc_limit === '' || (int) $desc_limit > 0)) { |
|
1589 | 1589 | $is_display = false; |
1590 | 1590 | } |
1591 | 1591 | } |
@@ -1633,16 +1633,16 @@ discard block |
||
1633 | 1633 | global $wpdb, $plugin_prefix; |
1634 | 1634 | |
1635 | 1635 | // Remove unused virtual page |
1636 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1636 | + $listings_page_id = (int) get_option('geodir_listing_page'); |
|
1637 | 1637 | if ($listings_page_id) { |
1638 | - $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1638 | + $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1639 | 1639 | delete_option('geodir_listing_page'); |
1640 | 1640 | } |
1641 | 1641 | |
1642 | 1642 | if (!get_option('geodir_changes_in_custom_fields_table')) { |
1643 | 1643 | $wpdb->query( |
1644 | 1644 | $wpdb->prepare( |
1645 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1645 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1646 | 1646 | array('1', '1', 'admin') |
1647 | 1647 | ) |
1648 | 1648 | ); |
@@ -1650,9 +1650,9 @@ discard block |
||
1650 | 1650 | |
1651 | 1651 | /* --- terms meta value set --- */ |
1652 | 1652 | |
1653 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1653 | + update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png'); |
|
1654 | 1654 | |
1655 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1655 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1656 | 1656 | |
1657 | 1657 | if (!empty($options_data)) { |
1658 | 1658 | |
@@ -1660,7 +1660,7 @@ discard block |
||
1660 | 1660 | |
1661 | 1661 | $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
1662 | 1662 | |
1663 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1663 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1664 | 1664 | |
1665 | 1665 | if (!empty($taxonomies_data)) { |
1666 | 1666 | |
@@ -1669,17 +1669,17 @@ discard block |
||
1669 | 1669 | $taxObject = get_taxonomy($taxobj->taxonomy); |
1670 | 1670 | $post_type = $taxObject->object_type[0]; |
1671 | 1671 | |
1672 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1672 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val; |
|
1673 | 1673 | |
1674 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1674 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val))); |
|
1675 | 1675 | |
1676 | 1676 | if ($duplicate_data) { |
1677 | 1677 | |
1678 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1678 | + $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1679 | 1679 | |
1680 | 1680 | } else { |
1681 | 1681 | |
1682 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1682 | + $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1683 | 1683 | |
1684 | 1684 | } |
1685 | 1685 | |
@@ -1713,14 +1713,14 @@ discard block |
||
1713 | 1713 | |
1714 | 1714 | global $wpdb, $table_prefix; |
1715 | 1715 | |
1716 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1716 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug))); |
|
1717 | 1717 | |
1718 | 1718 | if ($slug_exists) { |
1719 | 1719 | |
1720 | 1720 | $suffix = 1; |
1721 | 1721 | do { |
1722 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1723 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1722 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1723 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name))); |
|
1724 | 1724 | $suffix++; |
1725 | 1725 | } while ($location_slug_check && $suffix < 100); |
1726 | 1726 | |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | |
1775 | 1775 | $suffix = 1; |
1776 | 1776 | do { |
1777 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1777 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1778 | 1778 | |
1779 | 1779 | /** This action is documented in geodirectory_hooks_actions.php */ |
1780 | 1780 | $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | |
1787 | 1787 | //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
1788 | 1788 | |
1789 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1789 | + $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1790 | 1790 | |
1791 | 1791 | } |
1792 | 1792 | |
@@ -1795,18 +1795,18 @@ discard block |
||
1795 | 1795 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
1796 | 1796 | |
1797 | 1797 | $post_types = geodir_get_posttypes(); |
1798 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1799 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1798 | + if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) { |
|
1799 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1800 | 1800 | |
1801 | 1801 | if (!empty($posts_obj)) { |
1802 | 1802 | foreach ($posts_obj as $post_obj) { |
1803 | 1803 | $post_id = $post_obj->object_id; |
1804 | 1804 | |
1805 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1805 | + $raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names')); |
|
1806 | 1806 | $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
1807 | 1807 | |
1808 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1809 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1808 | + $listing_table = $plugin_prefix.$post_type.'_detail'; |
|
1809 | + $wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1810 | 1810 | } |
1811 | 1811 | } |
1812 | 1812 | } |
@@ -1840,7 +1840,7 @@ discard block |
||
1840 | 1840 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
1841 | 1841 | return $slug_exists = true; |
1842 | 1842 | |
1843 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1843 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1844 | 1844 | return $slug_exists = true; |
1845 | 1845 | |
1846 | 1846 | return $slug_exists; |
@@ -1880,43 +1880,43 @@ discard block |
||
1880 | 1880 | |
1881 | 1881 | |
1882 | 1882 | $gd_page = ''; |
1883 | - if(geodir_is_page('home')){ |
|
1883 | + if (geodir_is_page('home')) { |
|
1884 | 1884 | $gd_page = 'home'; |
1885 | 1885 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1886 | 1886 | } |
1887 | - elseif(geodir_is_page('detail')){ |
|
1887 | + elseif (geodir_is_page('detail')) { |
|
1888 | 1888 | $gd_page = 'detail'; |
1889 | 1889 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1890 | 1890 | } |
1891 | - elseif(geodir_is_page('pt')){ |
|
1891 | + elseif (geodir_is_page('pt')) { |
|
1892 | 1892 | $gd_page = 'pt'; |
1893 | 1893 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1894 | 1894 | } |
1895 | - elseif(geodir_is_page('listing')){ |
|
1895 | + elseif (geodir_is_page('listing')) { |
|
1896 | 1896 | $gd_page = 'listing'; |
1897 | 1897 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1898 | 1898 | } |
1899 | - elseif(geodir_is_page('location')){ |
|
1899 | + elseif (geodir_is_page('location')) { |
|
1900 | 1900 | $gd_page = 'location'; |
1901 | 1901 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1902 | 1902 | } |
1903 | - elseif(geodir_is_page('search')){ |
|
1903 | + elseif (geodir_is_page('search')) { |
|
1904 | 1904 | $gd_page = 'search'; |
1905 | 1905 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1906 | 1906 | } |
1907 | - elseif(geodir_is_page('add-listing')){ |
|
1907 | + elseif (geodir_is_page('add-listing')) { |
|
1908 | 1908 | $gd_page = 'add-listing'; |
1909 | 1909 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1910 | 1910 | } |
1911 | - elseif(geodir_is_page('author')){ |
|
1911 | + elseif (geodir_is_page('author')) { |
|
1912 | 1912 | $gd_page = 'author'; |
1913 | 1913 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1914 | 1914 | } |
1915 | - elseif(geodir_is_page('login')){ |
|
1915 | + elseif (geodir_is_page('login')) { |
|
1916 | 1916 | $gd_page = 'login'; |
1917 | 1917 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1918 | 1918 | } |
1919 | - elseif(geodir_is_page('listing-success')){ |
|
1919 | + elseif (geodir_is_page('listing-success')) { |
|
1920 | 1920 | $gd_page = 'listing-success'; |
1921 | 1921 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1922 | 1922 | } |
@@ -1948,12 +1948,12 @@ discard block |
||
1948 | 1948 | |
1949 | 1949 | if (!get_option('geodir_set_post_attachments')) { |
1950 | 1950 | |
1951 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1952 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1951 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1952 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
1953 | 1953 | |
1954 | 1954 | $all_postypes = geodir_get_posttypes(); |
1955 | 1955 | |
1956 | - foreach($all_postypes as $post_type){ |
|
1956 | + foreach ($all_postypes as $post_type) { |
|
1957 | 1957 | $args = array( |
1958 | 1958 | 'posts_per_page' => -1, |
1959 | 1959 | 'post_type' => $post_type, |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | { |
2048 | 2048 | $user_id = get_current_user_id(); |
2049 | 2049 | |
2050 | - if(!$user_id){return $post;} |
|
2050 | + if (!$user_id) {return $post; } |
|
2051 | 2051 | |
2052 | 2052 | $gd_post_types = geodir_get_posttypes(); |
2053 | 2053 | |
@@ -2156,7 +2156,7 @@ discard block |
||
2156 | 2156 | |
2157 | 2157 | if (array_key_exists('post_video', $tabs_arr)) { |
2158 | 2158 | |
2159 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2159 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2160 | 2160 | |
2161 | 2161 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
2162 | 2162 | $tabs_arr['post_video']['heading_text'] = $field_title; |
@@ -2164,7 +2164,7 @@ discard block |
||
2164 | 2164 | |
2165 | 2165 | if (array_key_exists('special_offers', $tabs_arr)) { |
2166 | 2166 | |
2167 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2167 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2168 | 2168 | |
2169 | 2169 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
2170 | 2170 | $tabs_arr['special_offers']['heading_text'] = $field_title; |
@@ -2185,7 +2185,7 @@ discard block |
||
2185 | 2185 | */ |
2186 | 2186 | function geodir_remove_template_redirect_actions() |
2187 | 2187 | { |
2188 | - if (geodir_is_page('login')){ |
|
2188 | + if (geodir_is_page('login')) { |
|
2189 | 2189 | remove_all_actions('template_redirect'); |
2190 | 2190 | remove_action('init', 'avia_modify_front', 10); |
2191 | 2191 | } |
@@ -2232,25 +2232,25 @@ discard block |
||
2232 | 2232 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
2233 | 2233 | |
2234 | 2234 | $wpdb->query( |
2235 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2235 | + $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ", |
|
2236 | 2236 | array($post_id, $split_img_file_path) |
2237 | 2237 | ) |
2238 | 2238 | ); |
2239 | 2239 | |
2240 | 2240 | $attachment_data = $wpdb->get_row( |
2241 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2241 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d", |
|
2242 | 2242 | array($post_id) |
2243 | 2243 | ) |
2244 | 2244 | ); |
2245 | 2245 | |
2246 | 2246 | if (!empty($attachment_data)) { |
2247 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2247 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | |
2251 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2251 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
2252 | 2252 | |
2253 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2253 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id); |
|
2254 | 2254 | |
2255 | 2255 | geodir_set_wp_featured_image($post_id); |
2256 | 2256 | |
@@ -2278,9 +2278,9 @@ discard block |
||
2278 | 2278 | |
2279 | 2279 | foreach ($all_postypes as $posttype) { |
2280 | 2280 | |
2281 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2281 | + $tablename = $plugin_prefix.$posttype.'_detail'; |
|
2282 | 2282 | |
2283 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2283 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename); |
|
2284 | 2284 | |
2285 | 2285 | if (!empty($get_post_data)) { |
2286 | 2286 | |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | |
2289 | 2289 | $post_id = $data->post_id; |
2290 | 2290 | |
2291 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2291 | + $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''"); |
|
2292 | 2292 | |
2293 | 2293 | if (!empty($attachment_data)) { |
2294 | 2294 | |
@@ -2305,22 +2305,22 @@ discard block |
||
2305 | 2305 | |
2306 | 2306 | $file_name = $file_info['basename']; |
2307 | 2307 | |
2308 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2308 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name; |
|
2309 | 2309 | |
2310 | 2310 | if (!file_exists($img_arr['path'])) { |
2311 | 2311 | |
2312 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2312 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID); |
|
2313 | 2313 | |
2314 | 2314 | } |
2315 | 2315 | |
2316 | 2316 | } |
2317 | 2317 | |
2318 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2318 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id"); |
|
2319 | 2319 | |
2320 | 2320 | if (!empty($attachment_data)) { |
2321 | 2321 | |
2322 | 2322 | if ($attachment_data->ID) |
2323 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2323 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2324 | 2324 | |
2325 | 2325 | } else { |
2326 | 2326 | |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | |
2335 | 2335 | } |
2336 | 2336 | |
2337 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2337 | + $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id); |
|
2338 | 2338 | |
2339 | 2339 | geodir_set_wp_featured_image($post_id); |
2340 | 2340 | |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | { |
2364 | 2364 | |
2365 | 2365 | if (!get_option('geodir_default_rating_star_icon')) { |
2366 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2366 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png'); |
|
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | } |
@@ -2380,10 +2380,10 @@ discard block |
||
2380 | 2380 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
2381 | 2381 | * @return array User listing count for each post type. |
2382 | 2382 | */ |
2383 | -function geodir_user_post_listing_count($user_id=null) |
|
2383 | +function geodir_user_post_listing_count($user_id = null) |
|
2384 | 2384 | { |
2385 | 2385 | global $wpdb, $plugin_prefix, $current_user; |
2386 | - if(!$user_id){ |
|
2386 | + if (!$user_id) { |
|
2387 | 2387 | $user_id = $current_user->ID; |
2388 | 2388 | } |
2389 | 2389 | |
@@ -2394,7 +2394,7 @@ discard block |
||
2394 | 2394 | $user_listing = array(); |
2395 | 2395 | if (is_array($all_posts) && !empty($all_posts)) { |
2396 | 2396 | foreach ($all_posts as $ptype) { |
2397 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2397 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2398 | 2398 | |
2399 | 2399 | if ($total_posts > 0) { |
2400 | 2400 | $user_listing[$ptype] = $total_posts; |
@@ -2436,19 +2436,19 @@ discard block |
||
2436 | 2436 | $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
2437 | 2437 | |
2438 | 2438 | //remove video and special offers if it is already set to show |
2439 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2439 | + if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) { |
|
2440 | 2440 | $unset_video = true; |
2441 | 2441 | } |
2442 | 2442 | |
2443 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2443 | + if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) { |
|
2444 | 2444 | $unset_special_offers = true; |
2445 | 2445 | } |
2446 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2447 | - foreach($custom_fields as $key => $custom_field){ |
|
2448 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2446 | + if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) { |
|
2447 | + foreach ($custom_fields as $key => $custom_field) { |
|
2448 | + if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) { |
|
2449 | 2449 | unset($custom_fields[$key]); |
2450 | 2450 | } |
2451 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2451 | + if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) { |
|
2452 | 2452 | unset($custom_fields[$key]); |
2453 | 2453 | } |
2454 | 2454 | } |
@@ -2467,7 +2467,7 @@ discard block |
||
2467 | 2467 | $post->{$field_name} = $_REQUEST[$field_name]; |
2468 | 2468 | } |
2469 | 2469 | |
2470 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2470 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) { |
|
2471 | 2471 | if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
2472 | 2472 | continue; |
2473 | 2473 | } |
@@ -2516,21 +2516,21 @@ discard block |
||
2516 | 2516 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
2517 | 2517 | $variables_array['value'] = ''; |
2518 | 2518 | $variables_array['value'] = $post->{$type['htmlvar_name']}; |
2519 | - }else{ |
|
2519 | + } else { |
|
2520 | 2520 | $i = 0; |
2521 | 2521 | $fieldset_count++; |
2522 | 2522 | $field_set_start = 1; |
2523 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2523 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count; |
|
2524 | 2524 | $fieldset_arr[$fieldset_count]['label'] = $label; |
2525 | 2525 | } |
2526 | 2526 | |
2527 | 2527 | |
2528 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2528 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; } |
|
2529 | 2529 | $type = stripslashes_deep($type); // strip slashes |
2530 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2530 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; } |
|
2531 | 2531 | $html = ''; |
2532 | 2532 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
2533 | - if($html_var=='post'){$html_var='post_address';} |
|
2533 | + if ($html_var == 'post') {$html_var = 'post_address'; } |
|
2534 | 2534 | $field_icon = geodir_field_icon_proccess($type); |
2535 | 2535 | $filed_type = $type['type']; |
2536 | 2536 | |
@@ -2543,7 +2543,7 @@ discard block |
||
2543 | 2543 | * @param string $fields_location The location the field is to be show. |
2544 | 2544 | * @param array $type The array of field values. |
2545 | 2545 | */ |
2546 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2546 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type); |
|
2547 | 2547 | |
2548 | 2548 | |
2549 | 2549 | /** |
@@ -2589,7 +2589,7 @@ discard block |
||
2589 | 2589 | * @param string $htmlvar_name The field HTML var name. |
2590 | 2590 | */ |
2591 | 2591 | 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
2592 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2592 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>' |
|
2593 | 2593 | ); |
2594 | 2594 | } |
2595 | 2595 | } else { |
@@ -2649,7 +2649,7 @@ discard block |
||
2649 | 2649 | } |
2650 | 2650 | $status .= ")</strong>"; |
2651 | 2651 | |
2652 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2652 | + $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>'; |
|
2653 | 2653 | } |
2654 | 2654 | } |
2655 | 2655 | |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | function geodir_no_rating_comment_text($content, $comment = '') |
2734 | 2734 | { |
2735 | 2735 | if (!is_admin()) { |
2736 | - return '<div class="description">' . $content . '</div>'; |
|
2736 | + return '<div class="description">'.$content.'</div>'; |
|
2737 | 2737 | } else { |
2738 | 2738 | return $content; |
2739 | 2739 | } |
@@ -2811,7 +2811,7 @@ discard block |
||
2811 | 2811 | $classes[] = 'gd-no-rating'; |
2812 | 2812 | } |
2813 | 2813 | |
2814 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2814 | + $classes[] = 'gd-map-'.geodir_map_name(); |
|
2815 | 2815 | |
2816 | 2816 | return $classes; |
2817 | 2817 | } |
@@ -2831,7 +2831,7 @@ discard block |
||
2831 | 2831 | $class .= ' gd-no-rating'; |
2832 | 2832 | } |
2833 | 2833 | |
2834 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2834 | + $class .= ' gd-map-'.geodir_map_name(); |
|
2835 | 2835 | |
2836 | 2836 | return $class; |
2837 | 2837 | } |
@@ -2866,7 +2866,7 @@ discard block |
||
2866 | 2866 | * @return array Translation texts. |
2867 | 2867 | */ |
2868 | 2868 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2869 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2869 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
2870 | 2870 | |
2871 | 2871 | $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
2872 | 2872 | |
@@ -2932,14 +2932,14 @@ discard block |
||
2932 | 2932 | * @param array $args The array of menu arguments. |
2933 | 2933 | * @return array The modified arguments. |
2934 | 2934 | */ |
2935 | -function geodir_add_nav_menu_class( $args ) |
|
2935 | +function geodir_add_nav_menu_class($args) |
|
2936 | 2936 | { |
2937 | 2937 | |
2938 | - if(isset($args['menu_class'])){ |
|
2938 | + if (isset($args['menu_class'])) { |
|
2939 | 2939 | $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
2940 | 2940 | } |
2941 | 2941 | |
2942 | 2942 | return $args; |
2943 | 2943 | } |
2944 | 2944 | |
2945 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
|
2946 | 2945 | \ No newline at end of file |
2946 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class'); |
|
2947 | 2947 | \ No newline at end of file |
@@ -41,7 +41,7 @@ |
||
41 | 41 | define('LISTING_DETAILS_TEXT', __('Enter Listing Details', 'geodirectory')); |
42 | 42 | |
43 | 43 | define('PLACE_TITLE_TEXT', __('Listing Title', 'geodirectory')); // depreciated @since 1.6.3 |
44 | -define('PLACE_DESC_TEXT', __('Listing Description', 'geodirectory'));// depreciated @since 1.6.3 |
|
44 | +define('PLACE_DESC_TEXT', __('Listing Description', 'geodirectory')); // depreciated @since 1.6.3 |
|
45 | 45 | |
46 | 46 | define('LISTING_ADDRESS_TEXT', __('Listing Address:', 'geodirectory')); |
47 | 47 | define('PLACE_ADDRESS', __('Address:', 'geodirectory')); |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | // Add marker cluster |
203 | 203 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
204 | 204 | $map_args['enable_marker_cluster'] = true; |
205 | - if(get_option('geodir_marker_cluster_type')) { |
|
205 | + if (get_option('geodir_marker_cluster_type')) { |
|
206 | 206 | if ($map_args['autozoom']) { |
207 | 207 | $map_args['enable_marker_cluster_no_reposition'] = false; |
208 | 208 | } else { |
209 | 209 | $map_args['enable_marker_cluster_no_reposition'] = true; |
210 | 210 | } |
211 | 211 | |
212 | - $map_args['enable_marker_cluster_server'] = true ; |
|
212 | + $map_args['enable_marker_cluster_server'] = true; |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | // if lat and long set in shortcode, hack it so the map is not repositioned |
220 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
220 | + if (!empty($params['latitude']) && !empty($params['longitude'])) { |
|
221 | 221 | $map_args['enable_marker_cluster_no_reposition'] = true; |
222 | 222 | } |
223 | 223 | |
@@ -890,20 +890,20 @@ discard block |
||
890 | 890 | |
891 | 891 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
892 | 892 | |
893 | - if ($show_adv_search != '' ) { |
|
894 | - $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
|
893 | + if ($show_adv_search != '') { |
|
894 | + $show_adv_class = 'geodir-advance-search-'.$show_adv_search.' '; |
|
895 | 895 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
896 | 896 | $show_adv_search = 'search'; |
897 | 897 | } |
898 | - $show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"'; |
|
898 | + $show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"'; |
|
899 | 899 | |
900 | - $params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']); |
|
900 | + $params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']); |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | ob_start(); |
904 | 904 | |
905 | 905 | //geodir_get_template_part('listing', 'filter-form'); |
906 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
906 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | 909 | ob_end_clean(); |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | // Validate character_count |
1105 | 1105 | //todo: is this necessary? |
1106 | - $params['character_count'] = $params['character_count']; |
|
1106 | + $params['character_count'] = $params['character_count']; |
|
1107 | 1107 | |
1108 | 1108 | // Validate our layout choice |
1109 | 1109 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | |
1116 | 1116 | // Validate Listing width, used in the template widget-listing-listview.php |
1117 | 1117 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
1118 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1118 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1119 | 1119 | |
1120 | 1120 | // Validate the checkboxes used on the widget |
1121 | 1121 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | if (!empty($params['tags'])) { |
1132 | 1132 | if (!is_array($params['tags'])) { |
1133 | 1133 | $comma = _x(',', 'tag delimiter'); |
1134 | - if ( ',' !== $comma ) { |
|
1134 | + if (',' !== $comma) { |
|
1135 | 1135 | $params['tags'] = str_replace($comma, ',', $params['tags']); |
1136 | 1136 | } |
1137 | 1137 | $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
@@ -1153,13 +1153,13 @@ discard block |
||
1153 | 1153 | unset($atts['pageno']); |
1154 | 1154 | } |
1155 | 1155 | |
1156 | - if ( !empty($atts['shortcode_content']) ) { |
|
1156 | + if (!empty($atts['shortcode_content'])) { |
|
1157 | 1157 | $content = $atts['shortcode_content']; |
1158 | 1158 | } |
1159 | 1159 | $params['shortcode_content'] = trim($content); |
1160 | 1160 | $atts['shortcode_content'] = trim($content); |
1161 | 1161 | |
1162 | - $params['shortcode_atts'] = $atts; |
|
1162 | + $params['shortcode_atts'] = $atts; |
|
1163 | 1163 | |
1164 | 1164 | $output = geodir_sc_gd_listings_output($params); |
1165 | 1165 | |
@@ -1226,8 +1226,8 @@ discard block |
||
1226 | 1226 | // Validate the checkboxes used on the widget |
1227 | 1227 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
1228 | 1228 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
1229 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1230 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1229 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1230 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1231 | 1231 | |
1232 | 1232 | if ($params['max_count'] != 'all') { |
1233 | 1233 | $params['max_count'] = absint($params['max_count']); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // If this file is called directly, abort. |
9 | 9 | if (!defined('WPINC')) { |
10 | - die; |
|
10 | + die; |
|
11 | 11 | } |
12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
13 | 13 | |
@@ -32,43 +32,43 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function geodir_sc_add_listing($atts) |
34 | 34 | { |
35 | - ob_start(); |
|
36 | - $defaults = array( |
|
37 | - 'pid' => '', |
|
38 | - 'listing_type' => 'gd_place', |
|
39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | - 'show_login' => false, |
|
41 | - ); |
|
42 | - $params = shortcode_atts($defaults, $atts); |
|
43 | - |
|
44 | - foreach ($params as $key => $value) { |
|
45 | - $_REQUEST[$key] = $value; |
|
46 | - } |
|
47 | - |
|
48 | - $user_id = get_current_user_id(); |
|
49 | - if (!$user_id) { |
|
50 | - echo $params['login_msg']; |
|
51 | - if ($params['show_login']) { |
|
52 | - echo "<br />"; |
|
53 | - $defaults = array( |
|
54 | - 'before_widget' => '', |
|
55 | - 'after_widget' => '', |
|
56 | - 'before_title' => '', |
|
57 | - 'after_title' => '', |
|
58 | - ); |
|
59 | - |
|
60 | - geodir_loginwidget_output($defaults, $defaults); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - } else { |
|
65 | - // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | - } |
|
67 | - $output = ob_get_contents(); |
|
68 | - |
|
69 | - ob_end_clean(); |
|
70 | - |
|
71 | - return $output; |
|
35 | + ob_start(); |
|
36 | + $defaults = array( |
|
37 | + 'pid' => '', |
|
38 | + 'listing_type' => 'gd_place', |
|
39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
40 | + 'show_login' => false, |
|
41 | + ); |
|
42 | + $params = shortcode_atts($defaults, $atts); |
|
43 | + |
|
44 | + foreach ($params as $key => $value) { |
|
45 | + $_REQUEST[$key] = $value; |
|
46 | + } |
|
47 | + |
|
48 | + $user_id = get_current_user_id(); |
|
49 | + if (!$user_id) { |
|
50 | + echo $params['login_msg']; |
|
51 | + if ($params['show_login']) { |
|
52 | + echo "<br />"; |
|
53 | + $defaults = array( |
|
54 | + 'before_widget' => '', |
|
55 | + 'after_widget' => '', |
|
56 | + 'before_title' => '', |
|
57 | + 'after_title' => '', |
|
58 | + ); |
|
59 | + |
|
60 | + geodir_loginwidget_output($defaults, $defaults); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + } else { |
|
65 | + // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
66 | + } |
|
67 | + $output = ob_get_contents(); |
|
68 | + |
|
69 | + ob_end_clean(); |
|
70 | + |
|
71 | + return $output; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -96,136 +96,136 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function geodir_sc_home_map($atts) |
98 | 98 | { |
99 | - ob_start(); |
|
100 | - $defaults = array( |
|
101 | - 'width' => '960', |
|
102 | - 'height' => '425', |
|
103 | - 'maptype' => 'ROADMAP', |
|
104 | - 'zoom' => '13', |
|
105 | - 'autozoom' => '', |
|
106 | - 'child_collapse' => '0', |
|
107 | - 'scrollwheel' => '0', |
|
99 | + ob_start(); |
|
100 | + $defaults = array( |
|
101 | + 'width' => '960', |
|
102 | + 'height' => '425', |
|
103 | + 'maptype' => 'ROADMAP', |
|
104 | + 'zoom' => '13', |
|
105 | + 'autozoom' => '', |
|
106 | + 'child_collapse' => '0', |
|
107 | + 'scrollwheel' => '0', |
|
108 | 108 | 'marker_cluster' => false, |
109 | - 'latitude' => '', |
|
110 | - 'longitude' => '' |
|
111 | - ); |
|
112 | - |
|
113 | - $params = shortcode_atts($defaults, $atts); |
|
114 | - |
|
115 | - $params = gdsc_validate_map_args($params); |
|
116 | - |
|
117 | - $map_args = array( |
|
118 | - 'map_canvas_name' => 'gd_home_map', |
|
119 | - 'latitude' => $params['latitude'], |
|
120 | - 'longitude' => $params['longitude'], |
|
121 | - |
|
122 | - /** |
|
123 | - * Filter the widget width of the map on home/listings page. |
|
124 | - * |
|
125 | - * @since 1.0.0 |
|
126 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | - */ |
|
128 | - 'width' => apply_filters('widget_width', $params['width']), |
|
129 | - /** |
|
130 | - * Filter the widget height of the map on home/listings page. |
|
131 | - * |
|
132 | - * @since 1.0.0 |
|
133 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | - */ |
|
135 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | - /** |
|
137 | - * Filter the widget maptype of the map on home/listings page. |
|
138 | - * |
|
139 | - * @since 1.0.0 |
|
109 | + 'latitude' => '', |
|
110 | + 'longitude' => '' |
|
111 | + ); |
|
112 | + |
|
113 | + $params = shortcode_atts($defaults, $atts); |
|
114 | + |
|
115 | + $params = gdsc_validate_map_args($params); |
|
116 | + |
|
117 | + $map_args = array( |
|
118 | + 'map_canvas_name' => 'gd_home_map', |
|
119 | + 'latitude' => $params['latitude'], |
|
120 | + 'longitude' => $params['longitude'], |
|
121 | + |
|
122 | + /** |
|
123 | + * Filter the widget width of the map on home/listings page. |
|
124 | + * |
|
125 | + * @since 1.0.0 |
|
126 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
127 | + */ |
|
128 | + 'width' => apply_filters('widget_width', $params['width']), |
|
129 | + /** |
|
130 | + * Filter the widget height of the map on home/listings page. |
|
131 | + * |
|
132 | + * @since 1.0.0 |
|
133 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
134 | + */ |
|
135 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
136 | + /** |
|
137 | + * Filter the widget maptype of the map on home/listings page. |
|
138 | + * |
|
139 | + * @since 1.0.0 |
|
140 | 140 | * @since 1.5.2 Added TERRAIN map type. |
141 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | - */ |
|
143 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | - /** |
|
145 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | - * |
|
147 | - * Should the scrollwheel zoom the map or not. |
|
148 | - * |
|
149 | - * @since 1.0.0 |
|
150 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | - */ |
|
152 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | - /** |
|
154 | - * Filter the widget zoom level of the map on home/listings page. |
|
155 | - * |
|
156 | - * @since 1.0.0 |
|
157 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | - */ |
|
159 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | - /** |
|
161 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | - * |
|
163 | - * If the map should autozoom to fit the markers shown. |
|
164 | - * |
|
165 | - * @since 1.0.0 |
|
166 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | - */ |
|
168 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | - /** |
|
170 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | - * |
|
172 | - * If the map should auto collapse the child categories if the category bar is present. |
|
173 | - * |
|
174 | - * @since 1.0.0 |
|
175 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | - */ |
|
177 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | - 'enable_cat_filters' => true, |
|
179 | - 'enable_text_search' => true, |
|
180 | - 'enable_post_type_filters' => true, |
|
181 | - /** |
|
182 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | - * |
|
184 | - * This is used when the location addon is used. |
|
185 | - * |
|
186 | - * @since 1.0.0 |
|
187 | - * @param bool $val True if location filters should be used, false if not. |
|
188 | - */ |
|
189 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | - 'enable_jason_on_load' => false, |
|
191 | - 'enable_marker_cluster' => false, |
|
192 | - 'enable_map_resize_button' => true, |
|
193 | - 'map_class_name' => 'geodir-map-home-page', |
|
194 | - 'is_geodir_home_map_widget' => true, |
|
195 | - ); |
|
141 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
142 | + */ |
|
143 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
144 | + /** |
|
145 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
146 | + * |
|
147 | + * Should the scrollwheel zoom the map or not. |
|
148 | + * |
|
149 | + * @since 1.0.0 |
|
150 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
151 | + */ |
|
152 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
153 | + /** |
|
154 | + * Filter the widget zoom level of the map on home/listings page. |
|
155 | + * |
|
156 | + * @since 1.0.0 |
|
157 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
158 | + */ |
|
159 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
160 | + /** |
|
161 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
162 | + * |
|
163 | + * If the map should autozoom to fit the markers shown. |
|
164 | + * |
|
165 | + * @since 1.0.0 |
|
166 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
167 | + */ |
|
168 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
169 | + /** |
|
170 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
171 | + * |
|
172 | + * If the map should auto collapse the child categories if the category bar is present. |
|
173 | + * |
|
174 | + * @since 1.0.0 |
|
175 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
176 | + */ |
|
177 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
178 | + 'enable_cat_filters' => true, |
|
179 | + 'enable_text_search' => true, |
|
180 | + 'enable_post_type_filters' => true, |
|
181 | + /** |
|
182 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
183 | + * |
|
184 | + * This is used when the location addon is used. |
|
185 | + * |
|
186 | + * @since 1.0.0 |
|
187 | + * @param bool $val True if location filters should be used, false if not. |
|
188 | + */ |
|
189 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
190 | + 'enable_jason_on_load' => false, |
|
191 | + 'enable_marker_cluster' => false, |
|
192 | + 'enable_map_resize_button' => true, |
|
193 | + 'map_class_name' => 'geodir-map-home-page', |
|
194 | + 'is_geodir_home_map_widget' => true, |
|
195 | + ); |
|
196 | 196 | |
197 | 197 | // Add marker cluster |
198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
199 | - $map_args['enable_marker_cluster'] = true; |
|
200 | - if(get_option('geodir_marker_cluster_type')) { |
|
201 | - if ($map_args['autozoom']) { |
|
202 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | - } else { |
|
204 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | - } |
|
199 | + $map_args['enable_marker_cluster'] = true; |
|
200 | + if(get_option('geodir_marker_cluster_type')) { |
|
201 | + if ($map_args['autozoom']) { |
|
202 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
203 | + } else { |
|
204 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
205 | + } |
|
206 | 206 | |
207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
207 | + $map_args['enable_marker_cluster_server'] = true ; |
|
208 | 208 | |
209 | - } |
|
209 | + } |
|
210 | 210 | } else { |
211 | 211 | $map_args['enable_marker_cluster'] = false; |
212 | 212 | } |
213 | 213 | |
214 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | - } |
|
214 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
215 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
216 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - geodir_draw_map($map_args); |
|
220 | + geodir_draw_map($map_args); |
|
221 | 221 | |
222 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
222 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
223 | 223 | |
224 | - $output = ob_get_contents(); |
|
224 | + $output = ob_get_contents(); |
|
225 | 225 | |
226 | - ob_end_clean(); |
|
226 | + ob_end_clean(); |
|
227 | 227 | |
228 | - return $output; |
|
228 | + return $output; |
|
229 | 229 | } |
230 | 230 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
231 | 231 | |
@@ -259,77 +259,77 @@ discard block |
||
259 | 259 | */ |
260 | 260 | function geodir_sc_listing_map($atts) |
261 | 261 | { |
262 | - ob_start(); |
|
263 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
264 | - |
|
265 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
266 | - |
|
267 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
268 | - |
|
269 | - $defaults = array( |
|
270 | - 'width' => '294', |
|
271 | - 'height' => '370', |
|
272 | - 'zoom' => '13', |
|
273 | - 'autozoom' => '', |
|
274 | - 'sticky' => '', |
|
275 | - 'showall' => '0', |
|
276 | - 'scrollwheel' => '0', |
|
277 | - 'maptype' => 'ROADMAP', |
|
278 | - 'child_collapse' => 0, |
|
262 | + ob_start(); |
|
263 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
264 | + |
|
265 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
266 | + |
|
267 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
268 | + |
|
269 | + $defaults = array( |
|
270 | + 'width' => '294', |
|
271 | + 'height' => '370', |
|
272 | + 'zoom' => '13', |
|
273 | + 'autozoom' => '', |
|
274 | + 'sticky' => '', |
|
275 | + 'showall' => '0', |
|
276 | + 'scrollwheel' => '0', |
|
277 | + 'maptype' => 'ROADMAP', |
|
278 | + 'child_collapse' => 0, |
|
279 | 279 | 'marker_cluster' => false |
280 | - ); |
|
281 | - |
|
282 | - $params = shortcode_atts($defaults, $atts); |
|
283 | - |
|
284 | - $params = gdsc_validate_map_args($params); |
|
285 | - |
|
286 | - $map_args = array( |
|
287 | - 'map_canvas_name' => 'gd_listing_map', |
|
288 | - 'width' => $params['width'], |
|
289 | - 'height' => $params['height'], |
|
290 | - 'zoom' => $params['zoom'], |
|
291 | - 'autozoom' => $params['autozoom'], |
|
292 | - 'sticky' => $params['sticky'], |
|
293 | - 'showall' => $params['showall'], |
|
294 | - 'scrollwheel' => $params['scrollwheel'], |
|
295 | - 'child_collapse' => 0, |
|
296 | - 'enable_cat_filters' => false, |
|
297 | - 'enable_text_search' => false, |
|
298 | - 'enable_post_type_filters' => false, |
|
299 | - 'enable_location_filters' => false, |
|
300 | - 'enable_jason_on_load' => true, |
|
301 | - ); |
|
302 | - |
|
303 | - if (is_single()) { |
|
304 | - |
|
305 | - global $post; |
|
306 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
307 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
308 | - $mapview = $post->post_mapview; |
|
309 | - $map_args['zoom'] = $post->post_mapzoom; |
|
310 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
311 | - |
|
312 | - } else { |
|
313 | - $default_location = geodir_get_default_location(); |
|
314 | - |
|
315 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
316 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
317 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
318 | - } |
|
319 | - |
|
320 | - if (empty($mapview)) { |
|
321 | - $mapview = 'ROADMAP'; |
|
322 | - } |
|
323 | - |
|
324 | - // Set default map options |
|
325 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
326 | - $map_args['latitude'] = $map_default_lat; |
|
327 | - $map_args['longitude'] = $map_default_lng; |
|
328 | - $map_args['streetViewControl'] = true; |
|
329 | - $map_args['maptype'] = $mapview; |
|
330 | - $map_args['showPreview'] = '0'; |
|
331 | - $map_args['maxZoom'] = 21; |
|
332 | - $map_args['bubble_size'] = 'small'; |
|
280 | + ); |
|
281 | + |
|
282 | + $params = shortcode_atts($defaults, $atts); |
|
283 | + |
|
284 | + $params = gdsc_validate_map_args($params); |
|
285 | + |
|
286 | + $map_args = array( |
|
287 | + 'map_canvas_name' => 'gd_listing_map', |
|
288 | + 'width' => $params['width'], |
|
289 | + 'height' => $params['height'], |
|
290 | + 'zoom' => $params['zoom'], |
|
291 | + 'autozoom' => $params['autozoom'], |
|
292 | + 'sticky' => $params['sticky'], |
|
293 | + 'showall' => $params['showall'], |
|
294 | + 'scrollwheel' => $params['scrollwheel'], |
|
295 | + 'child_collapse' => 0, |
|
296 | + 'enable_cat_filters' => false, |
|
297 | + 'enable_text_search' => false, |
|
298 | + 'enable_post_type_filters' => false, |
|
299 | + 'enable_location_filters' => false, |
|
300 | + 'enable_jason_on_load' => true, |
|
301 | + ); |
|
302 | + |
|
303 | + if (is_single()) { |
|
304 | + |
|
305 | + global $post; |
|
306 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
307 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
308 | + $mapview = $post->post_mapview; |
|
309 | + $map_args['zoom'] = $post->post_mapzoom; |
|
310 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
311 | + |
|
312 | + } else { |
|
313 | + $default_location = geodir_get_default_location(); |
|
314 | + |
|
315 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
316 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
317 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
318 | + } |
|
319 | + |
|
320 | + if (empty($mapview)) { |
|
321 | + $mapview = 'ROADMAP'; |
|
322 | + } |
|
323 | + |
|
324 | + // Set default map options |
|
325 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
326 | + $map_args['latitude'] = $map_default_lat; |
|
327 | + $map_args['longitude'] = $map_default_lng; |
|
328 | + $map_args['streetViewControl'] = true; |
|
329 | + $map_args['maptype'] = $mapview; |
|
330 | + $map_args['showPreview'] = '0'; |
|
331 | + $map_args['maxZoom'] = 21; |
|
332 | + $map_args['bubble_size'] = 'small'; |
|
333 | 333 | |
334 | 334 | // Add marker cluster |
335 | 335 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | $map_args['enable_marker_cluster'] = false; |
339 | 339 | } |
340 | 340 | |
341 | - geodir_draw_map($map_args); |
|
341 | + geodir_draw_map($map_args); |
|
342 | 342 | |
343 | - $output = ob_get_contents(); |
|
343 | + $output = ob_get_contents(); |
|
344 | 344 | |
345 | - ob_end_clean(); |
|
345 | + ob_end_clean(); |
|
346 | 346 | |
347 | - return $output; |
|
347 | + return $output; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -377,120 +377,120 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function geodir_sc_listing_slider($atts) |
379 | 379 | { |
380 | - ob_start(); |
|
381 | - $defaults = array( |
|
382 | - 'post_type' => 'gd_place', |
|
383 | - 'category' => '0', |
|
384 | - 'post_number' => '5', |
|
385 | - 'slideshow' => '0', |
|
386 | - 'animation_loop' => 0, |
|
387 | - 'direction_nav' => 0, |
|
388 | - 'slideshow_speed' => 5000, |
|
389 | - 'animation_speed' => 600, |
|
390 | - 'animation' => 'slide', |
|
391 | - 'order_by' => 'latest', |
|
392 | - 'show_title' => '', |
|
393 | - 'show_featured_only' => '', |
|
394 | - 'title' => '', |
|
395 | - ); |
|
396 | - |
|
397 | - $params = shortcode_atts($defaults, $atts); |
|
398 | - |
|
399 | - |
|
400 | - /* |
|
380 | + ob_start(); |
|
381 | + $defaults = array( |
|
382 | + 'post_type' => 'gd_place', |
|
383 | + 'category' => '0', |
|
384 | + 'post_number' => '5', |
|
385 | + 'slideshow' => '0', |
|
386 | + 'animation_loop' => 0, |
|
387 | + 'direction_nav' => 0, |
|
388 | + 'slideshow_speed' => 5000, |
|
389 | + 'animation_speed' => 600, |
|
390 | + 'animation' => 'slide', |
|
391 | + 'order_by' => 'latest', |
|
392 | + 'show_title' => '', |
|
393 | + 'show_featured_only' => '', |
|
394 | + 'title' => '', |
|
395 | + ); |
|
396 | + |
|
397 | + $params = shortcode_atts($defaults, $atts); |
|
398 | + |
|
399 | + |
|
400 | + /* |
|
401 | 401 | * |
402 | 402 | * Now we begin the validation of the attributes. |
403 | 403 | */ |
404 | - // Check we have a valid post_type |
|
405 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
406 | - $params['post_type'] = 'gd_place'; |
|
407 | - } |
|
408 | - |
|
409 | - // Check we have a valid sort_order |
|
410 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
411 | - |
|
412 | - // Match the chosen animation to our options |
|
413 | - $animation_list = array('slide', 'fade'); |
|
414 | - if (!(in_array($params['animation'], $animation_list))) { |
|
415 | - $params['animation'] = 'slide'; |
|
416 | - } |
|
417 | - |
|
418 | - // Post_number needs to be a positive integer |
|
419 | - $params['post_number'] = absint($params['post_number']); |
|
420 | - if (0 == $params['post_number']) { |
|
421 | - $params['post_number'] = 1; |
|
422 | - } |
|
423 | - |
|
424 | - // Manage the entered categories |
|
425 | - if (0 != $params['category'] || '' != $params['category']) { |
|
426 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
427 | - } |
|
428 | - // Convert show_title to a bool |
|
429 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
430 | - |
|
431 | - // Convert show_featured_only to a bool |
|
432 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
433 | - |
|
434 | - /* |
|
404 | + // Check we have a valid post_type |
|
405 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
406 | + $params['post_type'] = 'gd_place'; |
|
407 | + } |
|
408 | + |
|
409 | + // Check we have a valid sort_order |
|
410 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
411 | + |
|
412 | + // Match the chosen animation to our options |
|
413 | + $animation_list = array('slide', 'fade'); |
|
414 | + if (!(in_array($params['animation'], $animation_list))) { |
|
415 | + $params['animation'] = 'slide'; |
|
416 | + } |
|
417 | + |
|
418 | + // Post_number needs to be a positive integer |
|
419 | + $params['post_number'] = absint($params['post_number']); |
|
420 | + if (0 == $params['post_number']) { |
|
421 | + $params['post_number'] = 1; |
|
422 | + } |
|
423 | + |
|
424 | + // Manage the entered categories |
|
425 | + if (0 != $params['category'] || '' != $params['category']) { |
|
426 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
427 | + } |
|
428 | + // Convert show_title to a bool |
|
429 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
430 | + |
|
431 | + // Convert show_featured_only to a bool |
|
432 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
433 | + |
|
434 | + /* |
|
435 | 435 | * Hopefully all attributes are now valid, and safe to pass forward |
436 | 436 | */ |
437 | 437 | |
438 | - // redeclare vars after validation |
|
439 | - |
|
440 | - if (isset($params['direction_nav'])) { |
|
441 | - $params['directionNav'] = $params['direction_nav']; |
|
442 | - } |
|
443 | - if (isset($params['animation_loop'])) { |
|
444 | - $params['animationLoop'] = $params['animation_loop']; |
|
445 | - } |
|
446 | - if (isset($params['slideshow_speed'])) { |
|
447 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
448 | - } |
|
449 | - if (isset($params['animation_speed'])) { |
|
450 | - $params['animationSpeed'] = $params['animation_speed']; |
|
451 | - } |
|
452 | - if (isset($params['order_by'])) { |
|
453 | - $params['list_sort'] = $params['order_by']; |
|
454 | - } |
|
455 | - |
|
456 | - $query_args = array( |
|
457 | - 'post_number' => $params['post_number'], |
|
458 | - 'is_geodir_loop' => true, |
|
459 | - 'post_type' => $params['post_type'], |
|
460 | - 'order_by' => $params['order_by'] |
|
461 | - ); |
|
462 | - |
|
463 | - if (1 == $params['show_featured_only']) { |
|
464 | - $query_args['show_featured_only'] = 1; |
|
465 | - } |
|
466 | - |
|
467 | - if (0 != $params['category'] && '' != $params['category']) { |
|
468 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
469 | - $tax_query = array( |
|
470 | - 'taxonomy' => $category_taxonomy[0], |
|
471 | - 'field' => 'id', |
|
472 | - 'terms' => $params['category'], |
|
473 | - ); |
|
474 | - |
|
475 | - $query_args['tax_query'] = array($tax_query); |
|
476 | - } |
|
477 | - |
|
478 | - $defaults = array( |
|
479 | - 'before_widget' => '', |
|
480 | - 'after_widget' => '', |
|
481 | - 'before_title' => '', |
|
482 | - 'after_title' => '', |
|
483 | - ); |
|
484 | - |
|
485 | - $query_args = array_merge($query_args, $params); |
|
486 | - |
|
487 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
488 | - |
|
489 | - $output = ob_get_contents(); |
|
490 | - |
|
491 | - ob_end_clean(); |
|
492 | - |
|
493 | - return $output; |
|
438 | + // redeclare vars after validation |
|
439 | + |
|
440 | + if (isset($params['direction_nav'])) { |
|
441 | + $params['directionNav'] = $params['direction_nav']; |
|
442 | + } |
|
443 | + if (isset($params['animation_loop'])) { |
|
444 | + $params['animationLoop'] = $params['animation_loop']; |
|
445 | + } |
|
446 | + if (isset($params['slideshow_speed'])) { |
|
447 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
448 | + } |
|
449 | + if (isset($params['animation_speed'])) { |
|
450 | + $params['animationSpeed'] = $params['animation_speed']; |
|
451 | + } |
|
452 | + if (isset($params['order_by'])) { |
|
453 | + $params['list_sort'] = $params['order_by']; |
|
454 | + } |
|
455 | + |
|
456 | + $query_args = array( |
|
457 | + 'post_number' => $params['post_number'], |
|
458 | + 'is_geodir_loop' => true, |
|
459 | + 'post_type' => $params['post_type'], |
|
460 | + 'order_by' => $params['order_by'] |
|
461 | + ); |
|
462 | + |
|
463 | + if (1 == $params['show_featured_only']) { |
|
464 | + $query_args['show_featured_only'] = 1; |
|
465 | + } |
|
466 | + |
|
467 | + if (0 != $params['category'] && '' != $params['category']) { |
|
468 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
469 | + $tax_query = array( |
|
470 | + 'taxonomy' => $category_taxonomy[0], |
|
471 | + 'field' => 'id', |
|
472 | + 'terms' => $params['category'], |
|
473 | + ); |
|
474 | + |
|
475 | + $query_args['tax_query'] = array($tax_query); |
|
476 | + } |
|
477 | + |
|
478 | + $defaults = array( |
|
479 | + 'before_widget' => '', |
|
480 | + 'after_widget' => '', |
|
481 | + 'before_title' => '', |
|
482 | + 'after_title' => '', |
|
483 | + ); |
|
484 | + |
|
485 | + $query_args = array_merge($query_args, $params); |
|
486 | + |
|
487 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
488 | + |
|
489 | + $output = ob_get_contents(); |
|
490 | + |
|
491 | + ob_end_clean(); |
|
492 | + |
|
493 | + return $output; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -514,22 +514,22 @@ discard block |
||
514 | 514 | */ |
515 | 515 | function geodir_sc_login_box($atts) |
516 | 516 | { |
517 | - ob_start(); |
|
517 | + ob_start(); |
|
518 | 518 | |
519 | - $defaults = array( |
|
520 | - 'before_widget' => '', |
|
521 | - 'after_widget' => '', |
|
522 | - 'before_title' => '', |
|
523 | - 'after_title' => '', |
|
524 | - ); |
|
519 | + $defaults = array( |
|
520 | + 'before_widget' => '', |
|
521 | + 'after_widget' => '', |
|
522 | + 'before_title' => '', |
|
523 | + 'after_title' => '', |
|
524 | + ); |
|
525 | 525 | |
526 | - geodir_loginwidget_output($defaults, $defaults); |
|
526 | + geodir_loginwidget_output($defaults, $defaults); |
|
527 | 527 | |
528 | - $output = ob_get_contents(); |
|
528 | + $output = ob_get_contents(); |
|
529 | 529 | |
530 | - ob_end_clean(); |
|
530 | + ob_end_clean(); |
|
531 | 531 | |
532 | - return $output; |
|
532 | + return $output; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -560,30 +560,30 @@ discard block |
||
560 | 560 | */ |
561 | 561 | function geodir_sc_popular_post_category($atts) |
562 | 562 | { |
563 | - ob_start(); |
|
564 | - global $geodir_post_category_str; |
|
565 | - $defaults = array( |
|
566 | - 'category_limit' => 15, |
|
567 | - 'before_widget' => '', |
|
568 | - 'after_widget' => '', |
|
569 | - 'before_title' => '', |
|
570 | - 'after_title' => '', |
|
571 | - 'title' => '', |
|
572 | - 'default_post_type' => '', |
|
573 | - 'parent_only' => false, |
|
574 | - ); |
|
575 | - |
|
576 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
577 | - $params['category_limit'] = absint($params['category_limit']); |
|
578 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
579 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
580 | - geodir_popular_post_category_output($params, $params); |
|
581 | - |
|
582 | - $output = ob_get_contents(); |
|
583 | - |
|
584 | - ob_end_clean(); |
|
585 | - |
|
586 | - return $output; |
|
563 | + ob_start(); |
|
564 | + global $geodir_post_category_str; |
|
565 | + $defaults = array( |
|
566 | + 'category_limit' => 15, |
|
567 | + 'before_widget' => '', |
|
568 | + 'after_widget' => '', |
|
569 | + 'before_title' => '', |
|
570 | + 'after_title' => '', |
|
571 | + 'title' => '', |
|
572 | + 'default_post_type' => '', |
|
573 | + 'parent_only' => false, |
|
574 | + ); |
|
575 | + |
|
576 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
577 | + $params['category_limit'] = absint($params['category_limit']); |
|
578 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
579 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
580 | + geodir_popular_post_category_output($params, $params); |
|
581 | + |
|
582 | + $output = ob_get_contents(); |
|
583 | + |
|
584 | + ob_end_clean(); |
|
585 | + |
|
586 | + return $output; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -623,97 +623,97 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function geodir_sc_popular_post_view($atts) |
625 | 625 | { |
626 | - ob_start(); |
|
627 | - $defaults = array( |
|
628 | - 'post_type' => 'gd_place', |
|
629 | - 'category' => '0', |
|
630 | - 'post_number' => '5', |
|
631 | - 'layout' => 'gridview_onehalf', |
|
632 | - 'add_location_filter' => '0', |
|
633 | - 'list_sort' => 'latest', |
|
634 | - 'use_viewing_post_type' => '1', |
|
635 | - 'character_count' => '20', |
|
636 | - 'listing_width' => '', |
|
637 | - 'show_featured_only' => '0', |
|
638 | - 'show_special_only' => '0', |
|
639 | - 'with_pics_only' => '0', |
|
640 | - 'with_videos_only' => '0', |
|
641 | - 'before_widget' => '', |
|
642 | - 'after_widget' => '', |
|
643 | - 'before_title' => '<h3 class="widget-title">', |
|
644 | - 'after_title' => '</h3>', |
|
645 | - 'title' => '', |
|
646 | - 'category_title' => '', |
|
647 | - ); |
|
648 | - |
|
649 | - $params = shortcode_atts($defaults, $atts); |
|
650 | - |
|
651 | - /** |
|
652 | - * Validate our incoming params |
|
653 | - */ |
|
626 | + ob_start(); |
|
627 | + $defaults = array( |
|
628 | + 'post_type' => 'gd_place', |
|
629 | + 'category' => '0', |
|
630 | + 'post_number' => '5', |
|
631 | + 'layout' => 'gridview_onehalf', |
|
632 | + 'add_location_filter' => '0', |
|
633 | + 'list_sort' => 'latest', |
|
634 | + 'use_viewing_post_type' => '1', |
|
635 | + 'character_count' => '20', |
|
636 | + 'listing_width' => '', |
|
637 | + 'show_featured_only' => '0', |
|
638 | + 'show_special_only' => '0', |
|
639 | + 'with_pics_only' => '0', |
|
640 | + 'with_videos_only' => '0', |
|
641 | + 'before_widget' => '', |
|
642 | + 'after_widget' => '', |
|
643 | + 'before_title' => '<h3 class="widget-title">', |
|
644 | + 'after_title' => '</h3>', |
|
645 | + 'title' => '', |
|
646 | + 'category_title' => '', |
|
647 | + ); |
|
654 | 648 | |
655 | - // Validate the selected post type, default to gd_place on fail |
|
656 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
657 | - $params['post_type'] = 'gd_place'; |
|
658 | - } |
|
659 | - |
|
660 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
661 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
662 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
663 | - |
|
664 | - // Make sure we have an array |
|
665 | - if (!(is_array($params['category']))) { |
|
666 | - $params['category'] = explode(',', $params['category']); |
|
667 | - } |
|
668 | - |
|
669 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
670 | - // Otherwise it becomes empty and later on that will mean "All" |
|
671 | - $params['category'] = array_intersect($params['category'], $categories); |
|
672 | - |
|
673 | - // Post_number needs to be a positive integer |
|
674 | - $params['post_number'] = absint($params['post_number']); |
|
675 | - if (0 == $params['post_number']) { |
|
676 | - $params['post_number'] = 1; |
|
677 | - } |
|
678 | - |
|
679 | - // Validate our layout choice |
|
680 | - // Outside of the norm, I added some more simple terms to match the existing |
|
681 | - // So now I just run the switch to set it properly. |
|
682 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
683 | - |
|
684 | - // Validate our sorting choice |
|
685 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
686 | - |
|
687 | - // Validate character_count |
|
688 | - $params['character_count'] = absint($params['character_count']); |
|
689 | - if (20 > $params['character_count']) { |
|
690 | - $params['character_count'] = 20; |
|
691 | - } |
|
692 | - |
|
693 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
694 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
695 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
696 | - |
|
697 | - // Validate the checkboxes used on the widget |
|
698 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
699 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
700 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
701 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
702 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
703 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
704 | - |
|
705 | - /** |
|
706 | - * End of validation |
|
707 | - */ |
|
649 | + $params = shortcode_atts($defaults, $atts); |
|
650 | + |
|
651 | + /** |
|
652 | + * Validate our incoming params |
|
653 | + */ |
|
654 | + |
|
655 | + // Validate the selected post type, default to gd_place on fail |
|
656 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
657 | + $params['post_type'] = 'gd_place'; |
|
658 | + } |
|
659 | + |
|
660 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
661 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
662 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
708 | 663 | |
709 | - geodir_popular_postview_output($params, $params); |
|
664 | + // Make sure we have an array |
|
665 | + if (!(is_array($params['category']))) { |
|
666 | + $params['category'] = explode(',', $params['category']); |
|
667 | + } |
|
668 | + |
|
669 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
670 | + // Otherwise it becomes empty and later on that will mean "All" |
|
671 | + $params['category'] = array_intersect($params['category'], $categories); |
|
672 | + |
|
673 | + // Post_number needs to be a positive integer |
|
674 | + $params['post_number'] = absint($params['post_number']); |
|
675 | + if (0 == $params['post_number']) { |
|
676 | + $params['post_number'] = 1; |
|
677 | + } |
|
710 | 678 | |
679 | + // Validate our layout choice |
|
680 | + // Outside of the norm, I added some more simple terms to match the existing |
|
681 | + // So now I just run the switch to set it properly. |
|
682 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
711 | 683 | |
712 | - $output = ob_get_contents(); |
|
684 | + // Validate our sorting choice |
|
685 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
713 | 686 | |
714 | - ob_end_clean(); |
|
687 | + // Validate character_count |
|
688 | + $params['character_count'] = absint($params['character_count']); |
|
689 | + if (20 > $params['character_count']) { |
|
690 | + $params['character_count'] = 20; |
|
691 | + } |
|
715 | 692 | |
716 | - return $output; |
|
693 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
694 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
695 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
696 | + |
|
697 | + // Validate the checkboxes used on the widget |
|
698 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
699 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
700 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
701 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
702 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
703 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
704 | + |
|
705 | + /** |
|
706 | + * End of validation |
|
707 | + */ |
|
708 | + |
|
709 | + geodir_popular_postview_output($params, $params); |
|
710 | + |
|
711 | + |
|
712 | + $output = ob_get_contents(); |
|
713 | + |
|
714 | + ob_end_clean(); |
|
715 | + |
|
716 | + return $output; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -735,37 +735,37 @@ discard block |
||
735 | 735 | * @return string Recent reviews HTML. |
736 | 736 | */ |
737 | 737 | function geodir_sc_recent_reviews($atts) { |
738 | - ob_start(); |
|
739 | - $defaults = array( |
|
738 | + ob_start(); |
|
739 | + $defaults = array( |
|
740 | 740 | 'title' => '', |
741 | 741 | 'count' => 5, |
742 | - ); |
|
742 | + ); |
|
743 | 743 | |
744 | - $params = shortcode_atts($defaults, $atts); |
|
744 | + $params = shortcode_atts($defaults, $atts); |
|
745 | 745 | |
746 | - $count = absint($params['count']); |
|
747 | - if (0 == $count) { |
|
748 | - $count = 1; |
|
749 | - } |
|
746 | + $count = absint($params['count']); |
|
747 | + if (0 == $count) { |
|
748 | + $count = 1; |
|
749 | + } |
|
750 | 750 | |
751 | 751 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
752 | 752 | |
753 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
753 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
754 | 754 | |
755 | - if ($comments_li) { |
|
756 | - if ($title != '') { ?> |
|
755 | + if ($comments_li) { |
|
756 | + if ($title != '') { ?> |
|
757 | 757 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
758 | 758 | <?php } ?> |
759 | 759 | <div class="geodir_sc_recent_reviews_section"> |
760 | 760 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
761 | 761 | </div> |
762 | 762 | <?php |
763 | - } |
|
764 | - $output = ob_get_contents(); |
|
763 | + } |
|
764 | + $output = ob_get_contents(); |
|
765 | 765 | |
766 | - ob_end_clean(); |
|
766 | + ob_end_clean(); |
|
767 | 767 | |
768 | - return $output; |
|
768 | + return $output; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -795,64 +795,64 @@ discard block |
||
795 | 795 | */ |
796 | 796 | function geodir_sc_related_listings($atts) |
797 | 797 | { |
798 | - ob_start(); |
|
799 | - $defaults = array( |
|
800 | - 'post_number' => 5, |
|
801 | - 'relate_to' => 'category', |
|
802 | - 'layout' => 'gridview_onehalf', |
|
803 | - 'add_location_filter' => 0, |
|
804 | - 'listing_width' => '', |
|
805 | - 'list_sort' => 'latest', |
|
806 | - 'character_count' => 20, |
|
807 | - 'is_widget' => 1, |
|
808 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
809 | - ); |
|
810 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
811 | - |
|
812 | - $params = shortcode_atts($defaults, $atts); |
|
813 | - |
|
814 | - /** |
|
815 | - * Begin validating parameters |
|
816 | - */ |
|
798 | + ob_start(); |
|
799 | + $defaults = array( |
|
800 | + 'post_number' => 5, |
|
801 | + 'relate_to' => 'category', |
|
802 | + 'layout' => 'gridview_onehalf', |
|
803 | + 'add_location_filter' => 0, |
|
804 | + 'listing_width' => '', |
|
805 | + 'list_sort' => 'latest', |
|
806 | + 'character_count' => 20, |
|
807 | + 'is_widget' => 1, |
|
808 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
809 | + ); |
|
810 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
811 | + |
|
812 | + $params = shortcode_atts($defaults, $atts); |
|
813 | + |
|
814 | + /** |
|
815 | + * Begin validating parameters |
|
816 | + */ |
|
817 | 817 | |
818 | - // Validate that post_number is a number and is 1 or higher |
|
819 | - $params['post_number'] = absint($params['post_number']); |
|
820 | - if (0 === $params['post_number']) { |
|
821 | - $params['post_number'] = 1; |
|
822 | - } |
|
818 | + // Validate that post_number is a number and is 1 or higher |
|
819 | + $params['post_number'] = absint($params['post_number']); |
|
820 | + if (0 === $params['post_number']) { |
|
821 | + $params['post_number'] = 1; |
|
822 | + } |
|
823 | 823 | |
824 | - // Validate relate_to - only category or tags |
|
825 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
826 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
827 | - $params['relate_to'] = 'category'; |
|
828 | - } |
|
824 | + // Validate relate_to - only category or tags |
|
825 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
826 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
827 | + $params['relate_to'] = 'category'; |
|
828 | + } |
|
829 | 829 | |
830 | - // Validate layout selection |
|
831 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
830 | + // Validate layout selection |
|
831 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
832 | 832 | |
833 | - // Validate sorting option |
|
834 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
833 | + // Validate sorting option |
|
834 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
835 | 835 | |
836 | - // Validate add_location_filter |
|
837 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
836 | + // Validate add_location_filter |
|
837 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
838 | 838 | |
839 | - // Validate listing_width |
|
840 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
839 | + // Validate listing_width |
|
840 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
841 | 841 | |
842 | - // Validate character_count |
|
843 | - $params['character_count'] = absint($params['character_count']); |
|
844 | - if (20 > $params['character_count']) { |
|
845 | - $params['character_count'] = 20; |
|
846 | - } |
|
842 | + // Validate character_count |
|
843 | + $params['character_count'] = absint($params['character_count']); |
|
844 | + if (20 > $params['character_count']) { |
|
845 | + $params['character_count'] = 20; |
|
846 | + } |
|
847 | 847 | |
848 | - if ($related_display = geodir_related_posts_display($params)) { |
|
849 | - echo $related_display; |
|
850 | - } |
|
851 | - $output = ob_get_contents(); |
|
848 | + if ($related_display = geodir_related_posts_display($params)) { |
|
849 | + echo $related_display; |
|
850 | + } |
|
851 | + $output = ob_get_contents(); |
|
852 | 852 | |
853 | - ob_end_clean(); |
|
853 | + ob_end_clean(); |
|
854 | 854 | |
855 | - return $output; |
|
855 | + return $output; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -876,13 +876,13 @@ discard block |
||
876 | 876 | * @return string Advanced search widget HTML. |
877 | 877 | */ |
878 | 878 | function geodir_sc_advanced_search($atts) { |
879 | - $defaults = array( |
|
879 | + $defaults = array( |
|
880 | 880 | 'title' => '', |
881 | 881 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
882 | - 'after_widget' => '</section>', |
|
883 | - 'before_title' => '<h3 class="widget-title">', |
|
884 | - 'after_title' => '</h3>', |
|
885 | - 'show_adv_search' => 'default', |
|
882 | + 'after_widget' => '</section>', |
|
883 | + 'before_title' => '<h3 class="widget-title">', |
|
884 | + 'after_title' => '</h3>', |
|
885 | + 'show_adv_search' => 'default', |
|
886 | 886 | 'post_type' => '' |
887 | 887 | ); |
888 | 888 | |
@@ -906,9 +906,9 @@ discard block |
||
906 | 906 | the_widget('geodir_advance_search_widget', $params, $params ); |
907 | 907 | |
908 | 908 | $output = ob_get_contents(); |
909 | - ob_end_clean(); |
|
909 | + ob_end_clean(); |
|
910 | 910 | |
911 | - return $output; |
|
911 | + return $output; |
|
912 | 912 | } |
913 | 913 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
914 | 914 | |
@@ -954,48 +954,48 @@ discard block |
||
954 | 954 | 'add_location_filter' => '1', |
955 | 955 | 'tab_layout' => 'bestof-tabs-on-top', |
956 | 956 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
957 | - 'after_widget' => '</section>', |
|
958 | - 'before_title' => '<h3 class="widget-title">', |
|
959 | - 'after_title' => '</h3>', |
|
957 | + 'after_widget' => '</section>', |
|
958 | + 'before_title' => '<h3 class="widget-title">', |
|
959 | + 'after_title' => '</h3>', |
|
960 | 960 | ); |
961 | 961 | $params = shortcode_atts($defaults, $atts); |
962 | 962 | |
963 | - /** |
|
964 | - * Validate our incoming params |
|
965 | - */ |
|
963 | + /** |
|
964 | + * Validate our incoming params |
|
965 | + */ |
|
966 | 966 | |
967 | - // Validate the selected post type, default to gd_place on fail |
|
968 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | - $params['post_type'] = 'gd_place'; |
|
970 | - } |
|
967 | + // Validate the selected post type, default to gd_place on fail |
|
968 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
969 | + $params['post_type'] = 'gd_place'; |
|
970 | + } |
|
971 | 971 | |
972 | 972 | // Post limit needs to be a positive integer |
973 | - $params['post_limit'] = absint($params['post_limit']); |
|
974 | - if (0 == $params['post_limit']) { |
|
975 | - $params['post_limit'] = 5; |
|
976 | - } |
|
973 | + $params['post_limit'] = absint($params['post_limit']); |
|
974 | + if (0 == $params['post_limit']) { |
|
975 | + $params['post_limit'] = 5; |
|
976 | + } |
|
977 | 977 | |
978 | 978 | // Category limit needs to be a positive integer |
979 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | - if (0 == $params['categ_limit']) { |
|
981 | - $params['categ_limit'] = 3; |
|
982 | - } |
|
979 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
980 | + if (0 == $params['categ_limit']) { |
|
981 | + $params['categ_limit'] = 3; |
|
982 | + } |
|
983 | 983 | |
984 | 984 | // Tab layout validation |
985 | - $params['tab_layout'] = $params['tab_layout']; |
|
986 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | - } |
|
985 | + $params['tab_layout'] = $params['tab_layout']; |
|
986 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
987 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
988 | + } |
|
989 | 989 | |
990 | 990 | // Validate character_count |
991 | - $params['character_count'] = $params['character_count']; |
|
991 | + $params['character_count'] = $params['character_count']; |
|
992 | 992 | |
993 | 993 | ob_start(); |
994 | 994 | the_widget('geodir_bestof_widget', $params, $params); |
995 | - $output = ob_get_contents(); |
|
996 | - ob_end_clean(); |
|
995 | + $output = ob_get_contents(); |
|
996 | + ob_end_clean(); |
|
997 | 997 | |
998 | - return $output; |
|
998 | + return $output; |
|
999 | 999 | } |
1000 | 1000 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
1001 | 1001 | |
@@ -1043,127 +1043,127 @@ discard block |
||
1043 | 1043 | * @return string HTML content to display geodirectory listings. |
1044 | 1044 | */ |
1045 | 1045 | function geodir_sc_gd_listings($atts, $content = '') { |
1046 | - global $post; |
|
1047 | - $defaults = array( |
|
1048 | - 'title' => '', |
|
1049 | - 'post_type' => 'gd_place', |
|
1050 | - 'category' => 0, |
|
1051 | - 'list_sort' => 'latest', |
|
1052 | - 'event_type' => '', |
|
1053 | - 'post_number' => 10, |
|
1054 | - 'post_author' => '', |
|
1055 | - 'layout' => 'gridview_onehalf', |
|
1056 | - 'listing_width' => '', |
|
1057 | - 'character_count' => 20, |
|
1058 | - 'add_location_filter' => 1, |
|
1059 | - 'show_featured_only' => '', |
|
1060 | - 'show_special_only' => '', |
|
1061 | - 'with_pics_only' => '', |
|
1062 | - 'with_videos_only' => '', |
|
1063 | - 'with_pagination' => '1', |
|
1064 | - 'top_pagination' => '0', |
|
1065 | - 'bottom_pagination' => '1', |
|
1066 | - 'without_no_results' => 0, |
|
1067 | - 'tags' => '' |
|
1068 | - ); |
|
1069 | - $params = shortcode_atts($defaults, $atts); |
|
1070 | - |
|
1071 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
1072 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1073 | - |
|
1074 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
1075 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1076 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1077 | - |
|
1078 | - // Make sure we have an array |
|
1079 | - if (!(is_array($params['category']))) { |
|
1080 | - $params['category'] = explode(',', $params['category']); |
|
1081 | - } |
|
1082 | - |
|
1083 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1084 | - // Otherwise it becomes empty and later on that will mean "All" |
|
1085 | - $params['category'] = array_intersect($params['category'], $categories); |
|
1086 | - |
|
1087 | - // Post_number needs to be a positive integer |
|
1088 | - $params['post_number'] = absint($params['post_number']); |
|
1089 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1046 | + global $post; |
|
1047 | + $defaults = array( |
|
1048 | + 'title' => '', |
|
1049 | + 'post_type' => 'gd_place', |
|
1050 | + 'category' => 0, |
|
1051 | + 'list_sort' => 'latest', |
|
1052 | + 'event_type' => '', |
|
1053 | + 'post_number' => 10, |
|
1054 | + 'post_author' => '', |
|
1055 | + 'layout' => 'gridview_onehalf', |
|
1056 | + 'listing_width' => '', |
|
1057 | + 'character_count' => 20, |
|
1058 | + 'add_location_filter' => 1, |
|
1059 | + 'show_featured_only' => '', |
|
1060 | + 'show_special_only' => '', |
|
1061 | + 'with_pics_only' => '', |
|
1062 | + 'with_videos_only' => '', |
|
1063 | + 'with_pagination' => '1', |
|
1064 | + 'top_pagination' => '0', |
|
1065 | + 'bottom_pagination' => '1', |
|
1066 | + 'without_no_results' => 0, |
|
1067 | + 'tags' => '' |
|
1068 | + ); |
|
1069 | + $params = shortcode_atts($defaults, $atts); |
|
1070 | + |
|
1071 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
1072 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
1073 | + |
|
1074 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
1075 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
1076 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
1077 | + |
|
1078 | + // Make sure we have an array |
|
1079 | + if (!(is_array($params['category']))) { |
|
1080 | + $params['category'] = explode(',', $params['category']); |
|
1081 | + } |
|
1082 | + |
|
1083 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
1084 | + // Otherwise it becomes empty and later on that will mean "All" |
|
1085 | + $params['category'] = array_intersect($params['category'], $categories); |
|
1086 | + |
|
1087 | + // Post_number needs to be a positive integer |
|
1088 | + $params['post_number'] = absint($params['post_number']); |
|
1089 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
1090 | 1090 | |
1091 | - // Post_number needs to be a positive integer |
|
1092 | - if (!empty($atts['post_author'])) { |
|
1093 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1094 | - $params['post_author'] = $post->post_author; |
|
1095 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1096 | - $params['post_author'] = absint($atts['post_author']); |
|
1097 | - } else { |
|
1098 | - unset($params['post_author']); |
|
1099 | - } |
|
1100 | - } else { |
|
1101 | - unset($params['post_author']); |
|
1102 | - } |
|
1103 | - |
|
1104 | - // Validate character_count |
|
1105 | - //todo: is this necessary? |
|
1106 | - $params['character_count'] = $params['character_count']; |
|
1107 | - |
|
1108 | - // Validate our layout choice |
|
1109 | - // Outside of the norm, I added some more simple terms to match the existing |
|
1110 | - // So now I just run the switch to set it properly. |
|
1111 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1112 | - |
|
1113 | - // Validate our sorting choice |
|
1114 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1115 | - |
|
1116 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
1117 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1118 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1119 | - |
|
1120 | - // Validate the checkboxes used on the widget |
|
1121 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1122 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1123 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1124 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1125 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1126 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1127 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1128 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1129 | - |
|
1130 | - // Clean tags |
|
1131 | - if (!empty($params['tags'])) { |
|
1132 | - if (!is_array($params['tags'])) { |
|
1133 | - $comma = _x(',', 'tag delimiter'); |
|
1134 | - if ( ',' !== $comma ) { |
|
1135 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1136 | - } |
|
1137 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1138 | - $params['tags'] = array_map('trim', $params['tags']); |
|
1139 | - } |
|
1140 | - } else { |
|
1141 | - $params['tags'] = array(); |
|
1142 | - } |
|
1143 | - |
|
1144 | - /** |
|
1145 | - * End of validation |
|
1146 | - */ |
|
1147 | - if (isset($atts['geodir_ajax'])) { |
|
1148 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1149 | - unset($atts['geodir_ajax']); |
|
1150 | - } |
|
1151 | - if (isset($atts['pageno'])) { |
|
1152 | - $params['pageno'] = $atts['pageno']; |
|
1153 | - unset($atts['pageno']); |
|
1154 | - } |
|
1155 | - |
|
1156 | - if ( !empty($atts['shortcode_content']) ) { |
|
1157 | - $content = $atts['shortcode_content']; |
|
1158 | - } |
|
1159 | - $params['shortcode_content'] = trim($content); |
|
1160 | - $atts['shortcode_content'] = trim($content); |
|
1091 | + // Post_number needs to be a positive integer |
|
1092 | + if (!empty($atts['post_author'])) { |
|
1093 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
1094 | + $params['post_author'] = $post->post_author; |
|
1095 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
1096 | + $params['post_author'] = absint($atts['post_author']); |
|
1097 | + } else { |
|
1098 | + unset($params['post_author']); |
|
1099 | + } |
|
1100 | + } else { |
|
1101 | + unset($params['post_author']); |
|
1102 | + } |
|
1103 | + |
|
1104 | + // Validate character_count |
|
1105 | + //todo: is this necessary? |
|
1106 | + $params['character_count'] = $params['character_count']; |
|
1107 | + |
|
1108 | + // Validate our layout choice |
|
1109 | + // Outside of the norm, I added some more simple terms to match the existing |
|
1110 | + // So now I just run the switch to set it properly. |
|
1111 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
1112 | + |
|
1113 | + // Validate our sorting choice |
|
1114 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
1115 | + |
|
1116 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
1117 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
1118 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
1119 | + |
|
1120 | + // Validate the checkboxes used on the widget |
|
1121 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
1122 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
1123 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
1124 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
1125 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
1126 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
1127 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
1128 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
1129 | + |
|
1130 | + // Clean tags |
|
1131 | + if (!empty($params['tags'])) { |
|
1132 | + if (!is_array($params['tags'])) { |
|
1133 | + $comma = _x(',', 'tag delimiter'); |
|
1134 | + if ( ',' !== $comma ) { |
|
1135 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
1136 | + } |
|
1137 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
1138 | + $params['tags'] = array_map('trim', $params['tags']); |
|
1139 | + } |
|
1140 | + } else { |
|
1141 | + $params['tags'] = array(); |
|
1142 | + } |
|
1143 | + |
|
1144 | + /** |
|
1145 | + * End of validation |
|
1146 | + */ |
|
1147 | + if (isset($atts['geodir_ajax'])) { |
|
1148 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
1149 | + unset($atts['geodir_ajax']); |
|
1150 | + } |
|
1151 | + if (isset($atts['pageno'])) { |
|
1152 | + $params['pageno'] = $atts['pageno']; |
|
1153 | + unset($atts['pageno']); |
|
1154 | + } |
|
1155 | + |
|
1156 | + if ( !empty($atts['shortcode_content']) ) { |
|
1157 | + $content = $atts['shortcode_content']; |
|
1158 | + } |
|
1159 | + $params['shortcode_content'] = trim($content); |
|
1160 | + $atts['shortcode_content'] = trim($content); |
|
1161 | 1161 | |
1162 | - $params['shortcode_atts'] = $atts; |
|
1162 | + $params['shortcode_atts'] = $atts; |
|
1163 | 1163 | |
1164 | - $output = geodir_sc_gd_listings_output($params); |
|
1164 | + $output = geodir_sc_gd_listings_output($params); |
|
1165 | 1165 | |
1166 | - return $output; |
|
1166 | + return $output; |
|
1167 | 1167 | } |
1168 | 1168 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
1169 | 1169 | |
@@ -1203,56 +1203,56 @@ discard block |
||
1203 | 1203 | * @return string HTML content to display CPT categories. |
1204 | 1204 | */ |
1205 | 1205 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
1206 | - $defaults = array( |
|
1207 | - 'title' => '', |
|
1208 | - 'post_type' => '', // NULL for all |
|
1209 | - 'hide_empty' => '', |
|
1210 | - 'show_count' => '', |
|
1211 | - 'hide_icon' => '', |
|
1212 | - 'cpt_left' => '', |
|
1213 | - 'sort_by' => 'count', |
|
1214 | - 'max_count' => 'all', |
|
1215 | - 'max_level' => '1', |
|
1216 | - 'no_cpt_filter' => '', |
|
1217 | - 'no_cat_filter' => '', |
|
1218 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1219 | - 'after_widget' => '</section>', |
|
1220 | - 'before_title' => '<h3 class="widget-title">', |
|
1221 | - 'after_title' => '</h3>', |
|
1222 | - ); |
|
1223 | - $params = shortcode_atts($defaults, $atts); |
|
1224 | - |
|
1225 | - /** |
|
1226 | - * Validate our incoming params |
|
1227 | - */ |
|
1228 | - // Make sure we have an array |
|
1229 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1230 | - |
|
1231 | - // Validate the checkboxes used on the widget |
|
1232 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1233 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1234 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1235 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1206 | + $defaults = array( |
|
1207 | + 'title' => '', |
|
1208 | + 'post_type' => '', // NULL for all |
|
1209 | + 'hide_empty' => '', |
|
1210 | + 'show_count' => '', |
|
1211 | + 'hide_icon' => '', |
|
1212 | + 'cpt_left' => '', |
|
1213 | + 'sort_by' => 'count', |
|
1214 | + 'max_count' => 'all', |
|
1215 | + 'max_level' => '1', |
|
1216 | + 'no_cpt_filter' => '', |
|
1217 | + 'no_cat_filter' => '', |
|
1218 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
1219 | + 'after_widget' => '</section>', |
|
1220 | + 'before_title' => '<h3 class="widget-title">', |
|
1221 | + 'after_title' => '</h3>', |
|
1222 | + ); |
|
1223 | + $params = shortcode_atts($defaults, $atts); |
|
1236 | 1224 | |
1237 | - if ($params['max_count'] != 'all') { |
|
1238 | - $params['max_count'] = absint($params['max_count']); |
|
1239 | - } |
|
1225 | + /** |
|
1226 | + * Validate our incoming params |
|
1227 | + */ |
|
1228 | + // Make sure we have an array |
|
1229 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
1230 | + |
|
1231 | + // Validate the checkboxes used on the widget |
|
1232 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
1233 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
1234 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
1235 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
1236 | + |
|
1237 | + if ($params['max_count'] != 'all') { |
|
1238 | + $params['max_count'] = absint($params['max_count']); |
|
1239 | + } |
|
1240 | 1240 | |
1241 | - if ($params['max_level'] != 'all') { |
|
1242 | - $params['max_level'] = absint($params['max_level']); |
|
1243 | - } |
|
1241 | + if ($params['max_level'] != 'all') { |
|
1242 | + $params['max_level'] = absint($params['max_level']); |
|
1243 | + } |
|
1244 | 1244 | |
1245 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1246 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1245 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
1246 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
1247 | 1247 | |
1248 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1248 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
1249 | 1249 | |
1250 | - ob_start(); |
|
1251 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1252 | - $output = ob_get_contents(); |
|
1253 | - ob_end_clean(); |
|
1250 | + ob_start(); |
|
1251 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
1252 | + $output = ob_get_contents(); |
|
1253 | + ob_end_clean(); |
|
1254 | 1254 | |
1255 | - return $output; |
|
1255 | + return $output; |
|
1256 | 1256 | } |
1257 | 1257 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
1258 | 1258 | |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | * @return string HTML code. |
1268 | 1268 | */ |
1269 | 1269 | function geodir_sc_responsive_videos($atts, $content) { |
1270 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1270 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
1271 | 1271 | } |
1272 | 1272 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
1273 | 1273 | ?> |
1274 | 1274 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | // We are submitting iframes etc so we turn this off to allow them to show on preview. |
13 | 13 | if(geodir_is_page('preview')){ |
14 | - header("X-XSS-Protection: 0"); |
|
14 | + header("X-XSS-Protection: 0"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | |
39 | 39 | ###### SIDEBAR ON LEFT ###### |
40 | 40 | if (get_option('geodir_detail_sidebar_left_section')) { |
41 | - /** |
|
42 | - * Adds the details page sidebar to the details template page. |
|
43 | - * |
|
44 | - * @since 1.1.0 |
|
45 | - */ |
|
46 | - do_action('geodir_detail_sidebar'); |
|
41 | + /** |
|
42 | + * Adds the details page sidebar to the details template page. |
|
43 | + * |
|
44 | + * @since 1.1.0 |
|
45 | + */ |
|
46 | + do_action('geodir_detail_sidebar'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | ###### MAIN CONTENT WRAPPERS OPEN ###### |
@@ -72,29 +72,29 @@ discard block |
||
72 | 72 | // this call the main page content |
73 | 73 | global $preview; |
74 | 74 | if (have_posts() && !$preview) { |
75 | - the_post(); |
|
76 | - global $post, $post_images; |
|
77 | - /** |
|
78 | - * Calls the details page main content on the details template page. |
|
79 | - * |
|
80 | - * @since 1.1.0 |
|
81 | - * @param object $post The current post object. |
|
82 | - */ |
|
83 | - do_action('geodir_details_main_content', $post); |
|
75 | + the_post(); |
|
76 | + global $post, $post_images; |
|
77 | + /** |
|
78 | + * Calls the details page main content on the details template page. |
|
79 | + * |
|
80 | + * @since 1.1.0 |
|
81 | + * @param object $post The current post object. |
|
82 | + */ |
|
83 | + do_action('geodir_details_main_content', $post); |
|
84 | 84 | } elseif ($preview) { |
85 | - /** |
|
86 | - * Called on the details page if the page is being previewed. |
|
87 | - * |
|
88 | - * This sets the value of `$post` to the preview values before the main content is called. |
|
89 | - * |
|
90 | - * @since 1.1.0 |
|
91 | - */ |
|
92 | - do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values |
|
93 | - if (defined( 'GD_TESTING_MODE' )) { |
|
94 | - global $post; |
|
95 | - } |
|
96 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
97 | - do_action('geodir_details_main_content', $post); |
|
85 | + /** |
|
86 | + * Called on the details page if the page is being previewed. |
|
87 | + * |
|
88 | + * This sets the value of `$post` to the preview values before the main content is called. |
|
89 | + * |
|
90 | + * @since 1.1.0 |
|
91 | + */ |
|
92 | + do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values |
|
93 | + if (defined( 'GD_TESTING_MODE' )) { |
|
94 | + global $post; |
|
95 | + } |
|
96 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
97 | + do_action('geodir_details_main_content', $post); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** This action is documented in geodirectory-templates/geodir-home.php */ |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | ###### SIDEBAR ON RIGHT ###### |
120 | 120 | if (!get_option('geodir_detail_sidebar_left_section')) { |
121 | - /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
122 | - do_action('geodir_detail_sidebar'); |
|
121 | + /** This action is documented in geodirectory-templates/listing-detail.php */ |
|
122 | + do_action('geodir_detail_sidebar'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // We are submitting iframes etc so we turn this off to allow them to show on preview. |
13 | -if(geodir_is_page('preview')){ |
|
13 | +if (geodir_is_page('preview')) { |
|
14 | 14 | header("X-XSS-Protection: 0"); |
15 | 15 | } |
16 | 16 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string $itemtype The itemtype value of the HTML element. |
64 | 64 | * @see 'geodir_article_close' |
65 | 65 | */ |
66 | -do_action('geodir_article_open', 'details-page', 'post-' . get_the_ID(), get_post_class(), ''); |
|
66 | +do_action('geodir_article_open', 'details-page', 'post-'.get_the_ID(), get_post_class(), ''); |
|
67 | 67 | |
68 | 68 | ###### MAIN CONTENT ###### |
69 | 69 | /** This action is documented in geodirectory-templates/geodir-home.php */ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @since 1.1.0 |
91 | 91 | */ |
92 | 92 | do_action('geodir_action_geodir_set_preview_post'); // set the $post to the preview values |
93 | - if (defined( 'GD_TESTING_MODE' )) { |
|
93 | + if (defined('GD_TESTING_MODE')) { |
|
94 | 94 | global $post; |
95 | 95 | } |
96 | 96 | /** This action is documented in geodirectory-templates/listing-detail.php */ |