@@ -13,14 +13,14 @@ |
||
13 | 13 | * @since 1.0.0 |
14 | 14 | */ |
15 | 15 | include_once(geodir_plugin_path() . '/geodirectory-admin/option-pages/create_field.php'); |
16 | - die; |
|
16 | + die; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | 20 | if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] != '') { |
21 | - switch ($_REQUEST['ajax_action']): |
|
22 | - case 'get_cat_dl': |
|
23 | - geodir_get_categories_dl($_REQUEST['post_type'], $_REQUEST['selected'], false, true); |
|
24 | - break; |
|
25 | - endswitch; |
|
21 | + switch ($_REQUEST['ajax_action']): |
|
22 | + case 'get_cat_dl': |
|
23 | + geodir_get_categories_dl($_REQUEST['post_type'], $_REQUEST['selected'], false, true); |
|
24 | + break; |
|
25 | + endswitch; |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |
@@ -16,184 +16,184 @@ |
||
16 | 16 | */ |
17 | 17 | $geodir_settings['permalink_settings'] = apply_filters('geodir_permalink_settings', array( |
18 | 18 | |
19 | - /* Listing Permalink Settings start */ |
|
20 | - array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '), |
|
21 | - |
|
22 | - |
|
23 | - array('name' => __('Listing Detail Permalink Settings', 'geodirectory'), |
|
24 | - 'type' => 'sectionstart', |
|
25 | - 'desc' => '', |
|
26 | - 'id' => 'geodir_permalink'), |
|
27 | - |
|
28 | - array( |
|
29 | - 'name' => __('Add location in urls', 'geodirectory'), |
|
30 | - 'desc' => __('Add location slug in listing urls', 'geodirectory'), |
|
31 | - 'id' => 'geodir_add_location_url', |
|
32 | - 'type' => 'checkbox', |
|
33 | - 'std' => '1', |
|
34 | - 'checkboxgroup' => 'start' |
|
35 | - ), |
|
36 | - |
|
37 | - array( |
|
38 | - 'name' => __('Add full location in listing urls', 'geodirectory'), |
|
39 | - 'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'), |
|
40 | - 'id' => 'geodir_show_location_url', |
|
41 | - 'type' => 'radio', |
|
42 | - 'value' => 'all', |
|
43 | - 'std' => 'all', |
|
44 | - 'radiogroup' => '' |
|
45 | - ), |
|
46 | - |
|
47 | - array( |
|
48 | - 'name' => __('Add country and city slug in listing urls', 'geodirectory'), |
|
49 | - 'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'), |
|
50 | - 'id' => 'geodir_show_location_url', |
|
51 | - 'type' => 'radio', |
|
52 | - 'std' => 'all', |
|
53 | - 'value' => 'country_city', |
|
54 | - 'radiogroup' => '' |
|
55 | - ), |
|
56 | - array( |
|
57 | - 'name' => __('Add region and city slug in listing urls', 'geodirectory'), |
|
58 | - 'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'), |
|
59 | - 'id' => 'geodir_show_location_url', |
|
60 | - 'type' => 'radio', |
|
61 | - 'std' => 'all', |
|
62 | - 'value' => 'region_city', |
|
63 | - 'radiogroup' => '' |
|
64 | - ), |
|
65 | - array( |
|
66 | - 'name' => __('Add only city in listing urls', 'geodirectory'), |
|
67 | - 'desc' => __('Add city slug in listing urls', 'geodirectory'), |
|
68 | - 'id' => 'geodir_show_location_url', |
|
69 | - 'type' => 'radio', |
|
70 | - 'std' => 'all', |
|
71 | - 'value' => 'city', |
|
72 | - 'radiogroup' => 'end' |
|
73 | - ), |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - array( |
|
78 | - 'name' => __('Add category in listing urls', 'geodirectory'), |
|
79 | - 'desc' => __('Add requested category slugs in listing urls', 'geodirectory'), |
|
80 | - 'id' => 'geodir_add_categories_url', |
|
81 | - 'type' => 'checkbox', |
|
82 | - 'std' => '1', |
|
83 | - ), |
|
84 | - |
|
85 | - array( |
|
86 | - 'name' => __('Listing url prefix', 'geodirectory'), |
|
87 | - 'desc' => __('Listing prefix to show in url', 'geodirectory'), |
|
88 | - 'id' => 'geodir_listing_prefix', |
|
89 | - 'type' => 'text', |
|
90 | - 'css' => 'min-width:300px;', |
|
91 | - 'std' => 'places' |
|
92 | - ), |
|
93 | - |
|
94 | - array( |
|
95 | - 'name' => __('Location url prefix', 'geodirectory'), |
|
96 | - 'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'), |
|
97 | - 'id' => 'geodir_location_prefix', |
|
98 | - 'type' => 'text', |
|
99 | - 'css' => 'min-width:300px;', |
|
100 | - 'std' => 'location' // Default value to show home top section |
|
101 | - ), |
|
102 | - |
|
103 | - array( |
|
104 | - 'name' => __('Location and category url separator', 'geodirectory'), |
|
105 | - 'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'), |
|
106 | - 'id' => 'geodir_listingurl_separator', |
|
107 | - 'type' => 'text', |
|
108 | - 'css' => 'min-width:300px;', |
|
109 | - 'std' => 'C' // Default value to show home top section |
|
110 | - ), |
|
111 | - |
|
112 | - array( |
|
113 | - 'name' => __('Listing detail url separator', 'geodirectory'), |
|
114 | - 'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'), |
|
115 | - 'id' => 'geodir_detailurl_separator', |
|
116 | - 'type' => 'text', |
|
117 | - 'css' => 'min-width:300px;', |
|
118 | - 'std' => 'info' // Default value to show home top section |
|
119 | - ), |
|
120 | - |
|
121 | - |
|
122 | - array('type' => 'sectionend', 'id' => 'geodir_permalink'), |
|
123 | - |
|
124 | - array('name' => __('GeoDirectory Pages', 'geodirectory'), |
|
125 | - 'type' => 'sectionstart', |
|
126 | - 'desc' => '', |
|
127 | - 'id' => 'geodir_pages'), |
|
128 | - |
|
129 | - array( |
|
130 | - 'name' => __('GD Home page', 'geodirectory'), |
|
131 | - 'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'), |
|
132 | - 'id' => 'geodir_home_page', |
|
133 | - 'type' => 'single_select_page', |
|
134 | - 'class' => 'chosen_select' |
|
135 | - ), |
|
136 | - |
|
137 | - array( |
|
138 | - 'name' => __('Add listing page', 'geodirectory'), |
|
139 | - 'desc' => __('Select the page to use for adding listings', 'geodirectory'), |
|
140 | - 'id' => 'geodir_add_listing_page', |
|
141 | - 'type' => 'single_select_page', |
|
142 | - 'class' => 'chosen_select' |
|
143 | - ), |
|
144 | - |
|
145 | - array( |
|
146 | - 'name' => __('Listing preview page', 'geodirectory'), |
|
147 | - 'desc' => __('Select the page to use for listing preview', 'geodirectory'), |
|
148 | - 'id' => 'geodir_preview_page', |
|
149 | - 'type' => 'single_select_page', |
|
150 | - 'class' => 'chosen_select' |
|
151 | - ), |
|
152 | - |
|
153 | - array( |
|
154 | - 'name' => __('Listing success page', 'geodirectory'), |
|
155 | - 'desc' => __('Select the page to use for listing success', 'geodirectory'), |
|
156 | - 'id' => 'geodir_success_page', |
|
157 | - 'type' => 'single_select_page', |
|
158 | - 'class' => 'chosen_select' |
|
159 | - ), |
|
160 | - |
|
161 | - array( |
|
162 | - 'name' => __('Location page', 'geodirectory'), |
|
163 | - 'desc' => __('Select the page to use for locations', 'geodirectory'), |
|
164 | - 'id' => 'geodir_location_page', |
|
165 | - 'type' => 'single_select_page', |
|
166 | - 'class' => 'chosen_select' |
|
167 | - ), |
|
168 | - |
|
169 | - array( |
|
170 | - 'name' => __('Terms and Conditions page', 'geodirectory'), |
|
171 | - 'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'), |
|
172 | - 'id' => 'geodir_term_condition_page', |
|
173 | - 'type' => 'single_select_page', |
|
174 | - 'class' => 'chosen_select' |
|
175 | - ), |
|
176 | - |
|
177 | - array( |
|
178 | - 'name' => __('Info page', 'geodirectory'), |
|
179 | - 'desc' => __('Select the page to use for Gd general Info', 'geodirectory'), |
|
180 | - 'id' => 'geodir_info_page', |
|
181 | - 'type' => 'single_select_page', |
|
182 | - 'class' => 'chosen_select' |
|
183 | - ), |
|
184 | - |
|
185 | - array( |
|
186 | - 'name' => __('Login page', 'geodirectory'), |
|
187 | - 'desc' => __('Select the page to use for Login / Register', 'geodirectory'), |
|
188 | - 'id' => 'geodir_login_page', |
|
189 | - 'type' => 'single_select_page', |
|
190 | - 'class' => 'chosen_select' |
|
191 | - ), |
|
192 | - |
|
193 | - |
|
194 | - array('type' => 'sectionend', 'id' => 'geodir_pages'), |
|
195 | - |
|
196 | - /* Listing Detail Permalink Settings End */ |
|
19 | + /* Listing Permalink Settings start */ |
|
20 | + array('name' => __('Permalink', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set permalink', 'id' => 'geodir_permalink_settings '), |
|
21 | + |
|
22 | + |
|
23 | + array('name' => __('Listing Detail Permalink Settings', 'geodirectory'), |
|
24 | + 'type' => 'sectionstart', |
|
25 | + 'desc' => '', |
|
26 | + 'id' => 'geodir_permalink'), |
|
27 | + |
|
28 | + array( |
|
29 | + 'name' => __('Add location in urls', 'geodirectory'), |
|
30 | + 'desc' => __('Add location slug in listing urls', 'geodirectory'), |
|
31 | + 'id' => 'geodir_add_location_url', |
|
32 | + 'type' => 'checkbox', |
|
33 | + 'std' => '1', |
|
34 | + 'checkboxgroup' => 'start' |
|
35 | + ), |
|
36 | + |
|
37 | + array( |
|
38 | + 'name' => __('Add full location in listing urls', 'geodirectory'), |
|
39 | + 'desc' => __('Add full location info with country, region and city slug in listing urls', 'geodirectory'), |
|
40 | + 'id' => 'geodir_show_location_url', |
|
41 | + 'type' => 'radio', |
|
42 | + 'value' => 'all', |
|
43 | + 'std' => 'all', |
|
44 | + 'radiogroup' => '' |
|
45 | + ), |
|
46 | + |
|
47 | + array( |
|
48 | + 'name' => __('Add country and city slug in listing urls', 'geodirectory'), |
|
49 | + 'desc' => __('Add country and city slug in listing urls (/country/city/)', 'geodirectory'), |
|
50 | + 'id' => 'geodir_show_location_url', |
|
51 | + 'type' => 'radio', |
|
52 | + 'std' => 'all', |
|
53 | + 'value' => 'country_city', |
|
54 | + 'radiogroup' => '' |
|
55 | + ), |
|
56 | + array( |
|
57 | + 'name' => __('Add region and city slug in listing urls', 'geodirectory'), |
|
58 | + 'desc' => __('Add region and city slug in listing urls (/region/city/)', 'geodirectory'), |
|
59 | + 'id' => 'geodir_show_location_url', |
|
60 | + 'type' => 'radio', |
|
61 | + 'std' => 'all', |
|
62 | + 'value' => 'region_city', |
|
63 | + 'radiogroup' => '' |
|
64 | + ), |
|
65 | + array( |
|
66 | + 'name' => __('Add only city in listing urls', 'geodirectory'), |
|
67 | + 'desc' => __('Add city slug in listing urls', 'geodirectory'), |
|
68 | + 'id' => 'geodir_show_location_url', |
|
69 | + 'type' => 'radio', |
|
70 | + 'std' => 'all', |
|
71 | + 'value' => 'city', |
|
72 | + 'radiogroup' => 'end' |
|
73 | + ), |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + array( |
|
78 | + 'name' => __('Add category in listing urls', 'geodirectory'), |
|
79 | + 'desc' => __('Add requested category slugs in listing urls', 'geodirectory'), |
|
80 | + 'id' => 'geodir_add_categories_url', |
|
81 | + 'type' => 'checkbox', |
|
82 | + 'std' => '1', |
|
83 | + ), |
|
84 | + |
|
85 | + array( |
|
86 | + 'name' => __('Listing url prefix', 'geodirectory'), |
|
87 | + 'desc' => __('Listing prefix to show in url', 'geodirectory'), |
|
88 | + 'id' => 'geodir_listing_prefix', |
|
89 | + 'type' => 'text', |
|
90 | + 'css' => 'min-width:300px;', |
|
91 | + 'std' => 'places' |
|
92 | + ), |
|
93 | + |
|
94 | + array( |
|
95 | + 'name' => __('Location url prefix', 'geodirectory'), |
|
96 | + 'desc' => __('Depreciated, now uses the location page slug', 'geodirectory'), |
|
97 | + 'id' => 'geodir_location_prefix', |
|
98 | + 'type' => 'text', |
|
99 | + 'css' => 'min-width:300px;', |
|
100 | + 'std' => 'location' // Default value to show home top section |
|
101 | + ), |
|
102 | + |
|
103 | + array( |
|
104 | + 'name' => __('Location and category url separator', 'geodirectory'), |
|
105 | + 'desc' => __('Separator to show between location and category url slugs in listing urls', 'geodirectory'), |
|
106 | + 'id' => 'geodir_listingurl_separator', |
|
107 | + 'type' => 'text', |
|
108 | + 'css' => 'min-width:300px;', |
|
109 | + 'std' => 'C' // Default value to show home top section |
|
110 | + ), |
|
111 | + |
|
112 | + array( |
|
113 | + 'name' => __('Listing detail url separator', 'geodirectory'), |
|
114 | + 'desc' => __('Separator to show before listing slug in listing detail urls', 'geodirectory'), |
|
115 | + 'id' => 'geodir_detailurl_separator', |
|
116 | + 'type' => 'text', |
|
117 | + 'css' => 'min-width:300px;', |
|
118 | + 'std' => 'info' // Default value to show home top section |
|
119 | + ), |
|
120 | + |
|
121 | + |
|
122 | + array('type' => 'sectionend', 'id' => 'geodir_permalink'), |
|
123 | + |
|
124 | + array('name' => __('GeoDirectory Pages', 'geodirectory'), |
|
125 | + 'type' => 'sectionstart', |
|
126 | + 'desc' => '', |
|
127 | + 'id' => 'geodir_pages'), |
|
128 | + |
|
129 | + array( |
|
130 | + 'name' => __('GD Home page', 'geodirectory'), |
|
131 | + 'desc' => __('Select the page to use for the GD homepage (you must also set this page in Settings>Reading>Front page for it to work)', 'geodirectory'), |
|
132 | + 'id' => 'geodir_home_page', |
|
133 | + 'type' => 'single_select_page', |
|
134 | + 'class' => 'chosen_select' |
|
135 | + ), |
|
136 | + |
|
137 | + array( |
|
138 | + 'name' => __('Add listing page', 'geodirectory'), |
|
139 | + 'desc' => __('Select the page to use for adding listings', 'geodirectory'), |
|
140 | + 'id' => 'geodir_add_listing_page', |
|
141 | + 'type' => 'single_select_page', |
|
142 | + 'class' => 'chosen_select' |
|
143 | + ), |
|
144 | + |
|
145 | + array( |
|
146 | + 'name' => __('Listing preview page', 'geodirectory'), |
|
147 | + 'desc' => __('Select the page to use for listing preview', 'geodirectory'), |
|
148 | + 'id' => 'geodir_preview_page', |
|
149 | + 'type' => 'single_select_page', |
|
150 | + 'class' => 'chosen_select' |
|
151 | + ), |
|
152 | + |
|
153 | + array( |
|
154 | + 'name' => __('Listing success page', 'geodirectory'), |
|
155 | + 'desc' => __('Select the page to use for listing success', 'geodirectory'), |
|
156 | + 'id' => 'geodir_success_page', |
|
157 | + 'type' => 'single_select_page', |
|
158 | + 'class' => 'chosen_select' |
|
159 | + ), |
|
160 | + |
|
161 | + array( |
|
162 | + 'name' => __('Location page', 'geodirectory'), |
|
163 | + 'desc' => __('Select the page to use for locations', 'geodirectory'), |
|
164 | + 'id' => 'geodir_location_page', |
|
165 | + 'type' => 'single_select_page', |
|
166 | + 'class' => 'chosen_select' |
|
167 | + ), |
|
168 | + |
|
169 | + array( |
|
170 | + 'name' => __('Terms and Conditions page', 'geodirectory'), |
|
171 | + 'desc' => __('Select the page to use for Terms and Conditions (if enabled)', 'geodirectory'), |
|
172 | + 'id' => 'geodir_term_condition_page', |
|
173 | + 'type' => 'single_select_page', |
|
174 | + 'class' => 'chosen_select' |
|
175 | + ), |
|
176 | + |
|
177 | + array( |
|
178 | + 'name' => __('Info page', 'geodirectory'), |
|
179 | + 'desc' => __('Select the page to use for Gd general Info', 'geodirectory'), |
|
180 | + 'id' => 'geodir_info_page', |
|
181 | + 'type' => 'single_select_page', |
|
182 | + 'class' => 'chosen_select' |
|
183 | + ), |
|
184 | + |
|
185 | + array( |
|
186 | + 'name' => __('Login page', 'geodirectory'), |
|
187 | + 'desc' => __('Select the page to use for Login / Register', 'geodirectory'), |
|
188 | + 'id' => 'geodir_login_page', |
|
189 | + 'type' => 'single_select_page', |
|
190 | + 'class' => 'chosen_select' |
|
191 | + ), |
|
192 | + |
|
193 | + |
|
194 | + array('type' => 'sectionend', 'id' => 'geodir_pages'), |
|
195 | + |
|
196 | + /* Listing Detail Permalink Settings End */ |
|
197 | 197 | |
198 | 198 | |
199 | 199 | )); // End Design settings |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function geodir_divi_signup_body_class($classes) |
20 | 20 | { |
21 | - if (geodir_is_page('login')) { |
|
22 | - $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
23 | - $classes[] = 'divi-gd-signup'; |
|
24 | - } |
|
25 | - return $classes; |
|
21 | + if (geodir_is_page('login')) { |
|
22 | + $classes = str_replace('et_right_sidebar', 'et_full_width_page', $classes); |
|
23 | + $classes[] = 'divi-gd-signup'; |
|
24 | + } |
|
25 | + return $classes; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | add_action('geodir_wrapper_close', 'geodir_divi_action_wrapper_close', 11); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function geodir_divi_action_wrapper_close() |
36 | 36 | { |
37 | - if (geodir_is_page('login')) { |
|
38 | - // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
39 | - echo '</div></div>'; |
|
40 | - } |
|
37 | + if (geodir_is_page('login')) { |
|
38 | + // We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page |
|
39 | + echo '</div></div>'; |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function gd_compat_php_genesis() |
18 | 18 | { |
19 | 19 | // REPLACE GENESIS BREADCRUMBS WITH GD BREADCRUMBS |
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | 26 | |
27 | 27 | |
28 | - // make top section wide |
|
29 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
28 | + // make top section wide |
|
29 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
30 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
31 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
32 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
33 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
34 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
35 | 35 | |
36 | - // REMOVE PAGE TITLES |
|
37 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
36 | + // REMOVE PAGE TITLES |
|
37 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
38 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
39 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | } |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | function gd_genesis_compat_left_sidebars() |
54 | 54 | { |
55 | 55 | |
56 | - if (is_page_geodir_home()) { |
|
57 | - remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | - } elseif (geodir_is_page('location')) { |
|
60 | - remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | - add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | - } elseif (geodir_is_page('listing')) { |
|
63 | - remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | - add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | - } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | - //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | - //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | - } elseif (geodir_is_page('search')) { |
|
69 | - remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | - add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | - } elseif (geodir_is_page('author')) { |
|
72 | - remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | - add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | - } |
|
56 | + if (is_page_geodir_home()) { |
|
57 | + remove_action('geodir_home_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
58 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
59 | + } elseif (geodir_is_page('location')) { |
|
60 | + remove_action('geodir_location_sidebar_left', 'geodir_action_home_sidebar_left', 10); |
|
61 | + add_action('geodir_wrapper_close', 'geodir_action_home_sidebar_left', 11); |
|
62 | + } elseif (geodir_is_page('listing')) { |
|
63 | + remove_action('geodir_listings_sidebar_left', 'geodir_action_listings_sidebar_left', 10); |
|
64 | + add_action('geodir_wrapper_close', 'geodir_action_listings_sidebar_left', 11); |
|
65 | + } elseif (geodir_is_page('detail') && get_option('geodir_detail_sidebar_left_section')) { |
|
66 | + //remove_action( 'geodir_detail_sidebar', 'geodir_action_details_sidebar', 10 ); |
|
67 | + //add_action( 'geodir_wrapper_close', 'geodir_action_details_sidebar', 11 ); |
|
68 | + } elseif (geodir_is_page('search')) { |
|
69 | + remove_action('geodir_search_sidebar_left', 'geodir_action_search_sidebar_left', 10); |
|
70 | + add_action('geodir_wrapper_close', 'geodir_action_search_sidebar_left', 11); |
|
71 | + } elseif (geodir_is_page('author')) { |
|
72 | + remove_action('geodir_author_sidebar_left', 'geodir_action_author_sidebar_left', 10); |
|
73 | + add_action('geodir_wrapper_close', 'geodir_action_author_sidebar_left', 11); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | } |
@@ -88,65 +88,65 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function geodir_set_body_scs($classes) |
90 | 90 | { |
91 | - $remove_class = false; |
|
92 | - $new_class = ''; |
|
93 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | - $remove_class = true; |
|
95 | - if (get_option('geodir_show_home_left_section')) { |
|
96 | - $new_class .= 'sidebar-'; |
|
97 | - } |
|
98 | - if (get_option('geodir_show_home_contant_section')) { |
|
99 | - $new_class .= 'content'; |
|
100 | - } |
|
101 | - if (get_option('geodir_show_home_right_section')) { |
|
102 | - $new_class .= '-sidebar'; |
|
103 | - } |
|
104 | - } elseif (geodir_is_page('listing')) { |
|
105 | - $remove_class = true; |
|
106 | - if (get_option('geodir_show_listing_left_section')) { |
|
107 | - $new_class .= 'sidebar-'; |
|
108 | - } |
|
109 | - $new_class .= 'content'; |
|
110 | - if (get_option('geodir_show_listing_right_section')) { |
|
111 | - $new_class .= '-sidebar'; |
|
112 | - } |
|
113 | - } elseif (geodir_is_page('detail')) { |
|
114 | - $remove_class = true; |
|
115 | - if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | - $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | - } else { |
|
118 | - $new_class .= 'content-sidebar'; |
|
119 | - } |
|
120 | - } elseif (geodir_is_page('search')) { |
|
121 | - $remove_class = true; |
|
122 | - if (get_option('geodir_show_search_left_section')) { |
|
123 | - $new_class .= 'sidebar-'; |
|
124 | - } |
|
125 | - $new_class .= 'content'; |
|
126 | - if (get_option('geodir_show_search_right_section')) { |
|
127 | - $new_class .= '-sidebar'; |
|
128 | - } |
|
129 | - } elseif (geodir_is_page('author')) { |
|
130 | - $remove_class = true; |
|
131 | - if (get_option('geodir_show_author_left_section')) { |
|
132 | - $new_class .= 'sidebar-'; |
|
133 | - } |
|
134 | - $new_class .= 'content'; |
|
135 | - if (get_option('geodir_show_author_right_section')) { |
|
136 | - $new_class .= '-sidebar'; |
|
137 | - } |
|
138 | - } elseif (geodir_is_page('add-listing')) { |
|
139 | - $remove_class = true; |
|
140 | - $new_class .= 'content-sidebar'; |
|
141 | - } |
|
142 | - |
|
143 | - if ($remove_class) { |
|
144 | - $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | - //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | - $classes[] = $new_class; |
|
147 | - } |
|
148 | - |
|
149 | - return $classes; |
|
91 | + $remove_class = false; |
|
92 | + $new_class = ''; |
|
93 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
94 | + $remove_class = true; |
|
95 | + if (get_option('geodir_show_home_left_section')) { |
|
96 | + $new_class .= 'sidebar-'; |
|
97 | + } |
|
98 | + if (get_option('geodir_show_home_contant_section')) { |
|
99 | + $new_class .= 'content'; |
|
100 | + } |
|
101 | + if (get_option('geodir_show_home_right_section')) { |
|
102 | + $new_class .= '-sidebar'; |
|
103 | + } |
|
104 | + } elseif (geodir_is_page('listing')) { |
|
105 | + $remove_class = true; |
|
106 | + if (get_option('geodir_show_listing_left_section')) { |
|
107 | + $new_class .= 'sidebar-'; |
|
108 | + } |
|
109 | + $new_class .= 'content'; |
|
110 | + if (get_option('geodir_show_listing_right_section')) { |
|
111 | + $new_class .= '-sidebar'; |
|
112 | + } |
|
113 | + } elseif (geodir_is_page('detail')) { |
|
114 | + $remove_class = true; |
|
115 | + if (get_option('geodir_detail_sidebar_left_section')) { |
|
116 | + $new_class .= 'sidebar-content gd-details-sidebar-left'; |
|
117 | + } else { |
|
118 | + $new_class .= 'content-sidebar'; |
|
119 | + } |
|
120 | + } elseif (geodir_is_page('search')) { |
|
121 | + $remove_class = true; |
|
122 | + if (get_option('geodir_show_search_left_section')) { |
|
123 | + $new_class .= 'sidebar-'; |
|
124 | + } |
|
125 | + $new_class .= 'content'; |
|
126 | + if (get_option('geodir_show_search_right_section')) { |
|
127 | + $new_class .= '-sidebar'; |
|
128 | + } |
|
129 | + } elseif (geodir_is_page('author')) { |
|
130 | + $remove_class = true; |
|
131 | + if (get_option('geodir_show_author_left_section')) { |
|
132 | + $new_class .= 'sidebar-'; |
|
133 | + } |
|
134 | + $new_class .= 'content'; |
|
135 | + if (get_option('geodir_show_author_right_section')) { |
|
136 | + $new_class .= '-sidebar'; |
|
137 | + } |
|
138 | + } elseif (geodir_is_page('add-listing')) { |
|
139 | + $remove_class = true; |
|
140 | + $new_class .= 'content-sidebar'; |
|
141 | + } |
|
142 | + |
|
143 | + if ($remove_class) { |
|
144 | + $classes = array_diff($classes, array('content-sidebar', 'sidebar-content', 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar', 'full-width-content')); |
|
145 | + //str_replace(array('content-sidebar','sidebar-content','content-sidebar-sidebar','sidebar-sidebar-content','sidebar-content-sidebar','full-width-content'),array('','','','','',''),$classes); |
|
146 | + $classes[] = $new_class; |
|
147 | + } |
|
148 | + |
|
149 | + return $classes; |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | function gd_genesis_compat_add_top_section_back() |
161 | 161 | { |
162 | 162 | |
163 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | - geodir_action_geodir_sidebar_home_top(); |
|
165 | - } elseif (geodir_is_page('listing')) { |
|
166 | - geodir_action_geodir_sidebar_listings_top(); |
|
167 | - } elseif (geodir_is_page('detail')) { |
|
168 | - geodir_action_geodir_sidebar_detail_top(); |
|
169 | - } elseif (geodir_is_page('search')) { |
|
170 | - geodir_action_geodir_sidebar_search_top(); |
|
171 | - } elseif (geodir_is_page('author')) { |
|
172 | - geodir_action_geodir_sidebar_author_top(); |
|
173 | - } |
|
163 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
164 | + geodir_action_geodir_sidebar_home_top(); |
|
165 | + } elseif (geodir_is_page('listing')) { |
|
166 | + geodir_action_geodir_sidebar_listings_top(); |
|
167 | + } elseif (geodir_is_page('detail')) { |
|
168 | + geodir_action_geodir_sidebar_detail_top(); |
|
169 | + } elseif (geodir_is_page('search')) { |
|
170 | + geodir_action_geodir_sidebar_search_top(); |
|
171 | + } elseif (geodir_is_page('author')) { |
|
172 | + geodir_action_geodir_sidebar_author_top(); |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | 176 | } |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function geodir_replace_breadcrumb() |
185 | 185 | { |
186 | - if (is_front_page() && get_option('geodir_set_as_home') && !geodir_is_page('login')) { |
|
187 | - } else { |
|
188 | - echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | - geodir_breadcrumb(); |
|
190 | - echo '</div></div>'; |
|
191 | - } |
|
186 | + if (is_front_page() && get_option('geodir_set_as_home') && !geodir_is_page('login')) { |
|
187 | + } else { |
|
188 | + echo '<div class="geodir-breadcrumb-bar"><div class="wrap">'; |
|
189 | + geodir_breadcrumb(); |
|
190 | + echo '</div></div>'; |
|
191 | + } |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // Force Full Width on signup page |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function geodir_genesis_meta() |
203 | 203 | { |
204 | - if (geodir_is_page('login')) { |
|
205 | - add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | - } |
|
204 | + if (geodir_is_page('login')) { |
|
205 | + add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); |
|
206 | + } |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | add_action('geodir_add_listing_page_title', 'geodir_add_listing_page_title_genesis_before', 8); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | function geodir_add_listing_page_title_genesis_before() |
217 | 217 | { |
218 | 218 | |
219 | - echo "<div class='entry' >"; |
|
219 | + echo "<div class='entry' >"; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function geodir_add_listing_form_genesis_after() |
231 | 231 | { |
232 | 232 | |
233 | - echo "</div>"; |
|
233 | + echo "</div>"; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -249,38 +249,38 @@ discard block |
||
249 | 249 | { |
250 | 250 | |
251 | 251 | |
252 | - $title = ''; |
|
253 | - $subtitle = ''; |
|
254 | - |
|
255 | - if (geodir_is_page('listing')) { |
|
256 | - echo '<div class="wrap gd-title-wrap">'; |
|
257 | - geodir_action_listings_title(); |
|
258 | - echo '</div>'; |
|
259 | - } |
|
260 | - |
|
261 | - if (geodir_is_page('add-listing')) { |
|
262 | - echo '<div class="wrap gd-title-wrap">'; |
|
263 | - geodir_action_add_listing_page_title(); |
|
264 | - echo '</div>'; |
|
265 | - } |
|
266 | - |
|
267 | - if (geodir_is_page('author')) { |
|
268 | - echo '<div class="wrap gd-title-wrap">'; |
|
269 | - geodir_action_author_page_title(); |
|
270 | - echo '</div>'; |
|
271 | - } |
|
272 | - |
|
273 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | - echo '<div class="wrap gd-title-wrap">'; |
|
275 | - echo get_the_title(); |
|
276 | - echo '</div>'; |
|
277 | - } |
|
278 | - |
|
279 | - if (geodir_is_page('search')) { |
|
280 | - echo '<div class="wrap gd-title-wrap">'; |
|
281 | - geodir_action_search_page_title(); |
|
282 | - echo '</div>'; |
|
283 | - } |
|
252 | + $title = ''; |
|
253 | + $subtitle = ''; |
|
254 | + |
|
255 | + if (geodir_is_page('listing')) { |
|
256 | + echo '<div class="wrap gd-title-wrap">'; |
|
257 | + geodir_action_listings_title(); |
|
258 | + echo '</div>'; |
|
259 | + } |
|
260 | + |
|
261 | + if (geodir_is_page('add-listing')) { |
|
262 | + echo '<div class="wrap gd-title-wrap">'; |
|
263 | + geodir_action_add_listing_page_title(); |
|
264 | + echo '</div>'; |
|
265 | + } |
|
266 | + |
|
267 | + if (geodir_is_page('author')) { |
|
268 | + echo '<div class="wrap gd-title-wrap">'; |
|
269 | + geodir_action_author_page_title(); |
|
270 | + echo '</div>'; |
|
271 | + } |
|
272 | + |
|
273 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
274 | + echo '<div class="wrap gd-title-wrap">'; |
|
275 | + echo get_the_title(); |
|
276 | + echo '</div>'; |
|
277 | + } |
|
278 | + |
|
279 | + if (geodir_is_page('search')) { |
|
280 | + echo '<div class="wrap gd-title-wrap">'; |
|
281 | + geodir_action_search_page_title(); |
|
282 | + echo '</div>'; |
|
283 | + } |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function gd_genesis_listing_page_title_bar() |
295 | 295 | { |
296 | - geodir_action_listings_title(); |
|
297 | - //geodir_action_listings_description(); |
|
296 | + geodir_action_listings_title(); |
|
297 | + //geodir_action_listings_description(); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -307,19 +307,19 @@ discard block |
||
307 | 307 | */ |
308 | 308 | function gd_compat_php_genesis_geo_1280_fix() |
309 | 309 | { |
310 | - if (function_exists('geo1280_search_bar')) { |
|
311 | - remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | - add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
310 | + if (function_exists('geo1280_search_bar')) { |
|
311 | + remove_action('genesis_after_header', 'geo1280_search_bar', 20); |
|
312 | + add_action('genesis_after_header', 'geo1280_search_bar_fix', 4); |
|
313 | 313 | |
314 | - // |
|
314 | + // |
|
315 | 315 | |
316 | - remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | - remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | - add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
316 | + remove_action('genesis_after_header', 'geodir_replace_breadcrumb', 20); |
|
317 | + remove_action('genesis_before_content_sidebar_wrap', 'geodir_replace_breadcrumb', 20); |
|
318 | + add_action('geodir_wrapper_open', 'geodir_replace_breadcrumb', 105); |
|
319 | 319 | |
320 | - remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | - add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | - } |
|
320 | + remove_action('genesis_before_content_sidebar_wrap', 'geo1280_page_title', 10); |
|
321 | + add_action('geodir_wrapper_open', 'geo1280_page_title', 101); |
|
322 | + } |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | function geo1280_search_bar_fix() |
332 | 332 | { |
333 | 333 | |
334 | - echo '<div class="geo1280-placeholder"></div>'; |
|
335 | - if (is_active_sidebar('search-bar')) { |
|
336 | - genesis_widget_area('search-bar', array( |
|
337 | - 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | - 'after' => '</div></div>', |
|
339 | - )); |
|
340 | - } |
|
334 | + echo '<div class="geo1280-placeholder"></div>'; |
|
335 | + if (is_active_sidebar('search-bar')) { |
|
336 | + genesis_widget_area('search-bar', array( |
|
337 | + 'before' => '<div class="search-bar widget-area"><div class="wrap">', |
|
338 | + 'after' => '</div></div>', |
|
339 | + )); |
|
340 | + } |
|
341 | 341 | } |
@@ -1,43 +1,43 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Jupiter theme compatibility functions. |
|
4 | - * |
|
5 | - * This file lets the GeoDirectory Plugin use the Jupiter theme HTML wrappers to fit and work perfectly. |
|
6 | - * |
|
7 | - * @since 1.0.0 |
|
8 | - * @package GeoDirectory |
|
9 | - */ |
|
3 | + * Jupiter theme compatibility functions. |
|
4 | + * |
|
5 | + * This file lets the GeoDirectory Plugin use the Jupiter theme HTML wrappers to fit and work perfectly. |
|
6 | + * |
|
7 | + * @since 1.0.0 |
|
8 | + * @package GeoDirectory |
|
9 | + */ |
|
10 | 10 | add_action('after_setup_theme', 'jupiter_action_calls', 11); |
11 | 11 | /** |
12 | - * Action calls for jupiter theme compatibility. |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * @package GeoDirectory |
|
16 | - */ |
|
12 | + * Action calls for jupiter theme compatibility. |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * @package GeoDirectory |
|
16 | + */ |
|
17 | 17 | function jupiter_action_calls() |
18 | 18 | { |
19 | - // REMOVE BREADCRUMB |
|
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | - |
|
27 | - // REMOVE PAGE TITLES |
|
28 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
29 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
30 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
31 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
32 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
33 | - |
|
34 | - |
|
35 | - // CAHNGE PAGE TITLES |
|
36 | - remove_action('page_title', 'mk_page_title'); |
|
37 | - add_action('page_title', 'gd_mk_page_title'); |
|
38 | - // CHANGE BREADCRUMS FOR GD PAGES |
|
39 | - remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
40 | - add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
19 | + // REMOVE BREADCRUMB |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | + |
|
27 | + // REMOVE PAGE TITLES |
|
28 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
29 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
30 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
31 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
32 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
33 | + |
|
34 | + |
|
35 | + // CAHNGE PAGE TITLES |
|
36 | + remove_action('page_title', 'mk_page_title'); |
|
37 | + add_action('page_title', 'gd_mk_page_title'); |
|
38 | + // CHANGE BREADCRUMS FOR GD PAGES |
|
39 | + remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
40 | + add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | function gd_mk_theme_breadcrumbs() |
53 | 53 | { |
54 | 54 | |
55 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
56 | - jupiter_geodir_breadcrumb(); |
|
57 | - } elseif (geodir_is_page('listing')) { |
|
58 | - jupiter_geodir_breadcrumb(); |
|
59 | - } elseif (geodir_is_page('detail')) { |
|
60 | - jupiter_geodir_breadcrumb(); |
|
61 | - } elseif (geodir_is_page('search')) { |
|
62 | - jupiter_geodir_breadcrumb(); |
|
63 | - } elseif (geodir_is_page('author')) { |
|
64 | - jupiter_geodir_breadcrumb(); |
|
65 | - } else { |
|
66 | - mk_theme_breadcrumbs(); |
|
67 | - } |
|
55 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
56 | + jupiter_geodir_breadcrumb(); |
|
57 | + } elseif (geodir_is_page('listing')) { |
|
58 | + jupiter_geodir_breadcrumb(); |
|
59 | + } elseif (geodir_is_page('detail')) { |
|
60 | + jupiter_geodir_breadcrumb(); |
|
61 | + } elseif (geodir_is_page('search')) { |
|
62 | + jupiter_geodir_breadcrumb(); |
|
63 | + } elseif (geodir_is_page('author')) { |
|
64 | + jupiter_geodir_breadcrumb(); |
|
65 | + } else { |
|
66 | + mk_theme_breadcrumbs(); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,35 +76,35 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function gd_mk_page_title() |
78 | 78 | { |
79 | - global $wp; |
|
80 | - |
|
81 | - |
|
82 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
83 | - jupiter_geodir_page_title(); |
|
84 | - } elseif (geodir_is_page('listing')) { |
|
85 | - ob_start(); // Start buffering; |
|
86 | - geodir_action_listings_title(); |
|
87 | - $gd_title = ob_get_clean(); |
|
88 | - $title_p = explode('">', $gd_title); |
|
89 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
90 | - jupiter_geodir_page_title($title); |
|
91 | - } elseif (geodir_is_page('search')) { |
|
92 | - ob_start(); // Start buffering; |
|
93 | - geodir_action_listings_title(); |
|
94 | - $gd_title = ob_get_clean(); |
|
95 | - $title_p = explode('">', $gd_title); |
|
96 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
97 | - jupiter_geodir_page_title($title); |
|
98 | - } elseif (geodir_is_page('author')) { |
|
99 | - ob_start(); // Start buffering; |
|
100 | - geodir_action_author_page_title(); |
|
101 | - $gd_title = ob_get_clean(); |
|
102 | - $gd_title = str_replace('<h1>', "", $gd_title); |
|
103 | - $gd_title = str_replace('</h1>', "", $gd_title); |
|
104 | - jupiter_geodir_page_title($gd_title); |
|
105 | - } else { |
|
106 | - mk_page_title(); |
|
107 | - } |
|
79 | + global $wp; |
|
80 | + |
|
81 | + |
|
82 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
83 | + jupiter_geodir_page_title(); |
|
84 | + } elseif (geodir_is_page('listing')) { |
|
85 | + ob_start(); // Start buffering; |
|
86 | + geodir_action_listings_title(); |
|
87 | + $gd_title = ob_get_clean(); |
|
88 | + $title_p = explode('">', $gd_title); |
|
89 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
90 | + jupiter_geodir_page_title($title); |
|
91 | + } elseif (geodir_is_page('search')) { |
|
92 | + ob_start(); // Start buffering; |
|
93 | + geodir_action_listings_title(); |
|
94 | + $gd_title = ob_get_clean(); |
|
95 | + $title_p = explode('">', $gd_title); |
|
96 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
97 | + jupiter_geodir_page_title($title); |
|
98 | + } elseif (geodir_is_page('author')) { |
|
99 | + ob_start(); // Start buffering; |
|
100 | + geodir_action_author_page_title(); |
|
101 | + $gd_title = ob_get_clean(); |
|
102 | + $gd_title = str_replace('<h1>', "", $gd_title); |
|
103 | + $gd_title = str_replace('</h1>', "", $gd_title); |
|
104 | + jupiter_geodir_page_title($gd_title); |
|
105 | + } else { |
|
106 | + mk_page_title(); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | 110 | } |
@@ -119,48 +119,48 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function jupiter_geodir_breadcrumb() |
121 | 121 | { |
122 | - $item = ''; |
|
123 | - ob_start(); // Start buffering; |
|
124 | - geodir_breadcrumb(); |
|
125 | - $gd_crums = ob_get_clean(); |
|
126 | - if ($gd_crums) { |
|
127 | - $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
128 | - $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
129 | - $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
130 | - $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
131 | - $gd_crums = explode(" > ", $gd_crums); |
|
132 | - $trail_end = array_pop($gd_crums); |
|
133 | - $gd_crums['trail_end'] = $trail_end; |
|
134 | - //print_r($gd_crums);exit; |
|
135 | - //print_r($trail); |
|
136 | - $item = $gd_crums; |
|
137 | - |
|
138 | - } |
|
139 | - if (!$item) { |
|
140 | - return; |
|
141 | - } |
|
142 | - global $mk_options, $post; |
|
143 | - $post_id = global_get_post_id(); |
|
144 | - |
|
145 | - if ($post_id) { |
|
146 | - $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
147 | - $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
148 | - if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
149 | - $breadcrumb_skin_class = $breadcrumb_skin; |
|
150 | - } else { |
|
151 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
152 | - } |
|
153 | - } else { |
|
154 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - $delimiter = ' / '; |
|
159 | - |
|
160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
161 | - |
|
162 | - echo implode($delimiter, $item); |
|
163 | - echo "</div></div>"; |
|
122 | + $item = ''; |
|
123 | + ob_start(); // Start buffering; |
|
124 | + geodir_breadcrumb(); |
|
125 | + $gd_crums = ob_get_clean(); |
|
126 | + if ($gd_crums) { |
|
127 | + $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
128 | + $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
129 | + $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
130 | + $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
131 | + $gd_crums = explode(" > ", $gd_crums); |
|
132 | + $trail_end = array_pop($gd_crums); |
|
133 | + $gd_crums['trail_end'] = $trail_end; |
|
134 | + //print_r($gd_crums);exit; |
|
135 | + //print_r($trail); |
|
136 | + $item = $gd_crums; |
|
137 | + |
|
138 | + } |
|
139 | + if (!$item) { |
|
140 | + return; |
|
141 | + } |
|
142 | + global $mk_options, $post; |
|
143 | + $post_id = global_get_post_id(); |
|
144 | + |
|
145 | + if ($post_id) { |
|
146 | + $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
147 | + $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
148 | + if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
149 | + $breadcrumb_skin_class = $breadcrumb_skin; |
|
150 | + } else { |
|
151 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
152 | + } |
|
153 | + } else { |
|
154 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + $delimiter = ' / '; |
|
159 | + |
|
160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
161 | + |
|
162 | + echo implode($delimiter, $item); |
|
163 | + echo "</div></div>"; |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
@@ -174,41 +174,41 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function jupiter_geodir_page_title($title = '', $subtitle = '') |
176 | 176 | { |
177 | - global $mk_options; |
|
178 | - |
|
179 | - $post_id = global_get_post_id(); |
|
180 | - $shadow_css = ''; |
|
181 | - if ($mk_options['page_title_shadow'] == 'true') { |
|
182 | - $shadow_css = 'mk-drop-shadow'; |
|
183 | - } |
|
184 | - |
|
185 | - $align = !empty($align) ? $align : 'left'; |
|
186 | - |
|
187 | - //$title = 'xxxx'; |
|
188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
189 | - echo '<div class="mk-grid">'; |
|
190 | - if (!empty($title)) { |
|
191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
192 | - |
|
193 | - } |
|
194 | - |
|
195 | - if (!empty($subtitle)) { |
|
196 | - echo '<div class="page-introduce-subtitle">'; |
|
197 | - echo $subtitle; |
|
198 | - echo '</div>'; |
|
199 | - } |
|
200 | - if ($mk_options['disable_breadcrumb'] == 'true') { |
|
201 | - if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
202 | - /** |
|
203 | - * Calls the theme breadcrumbs for Jupiter theme. |
|
204 | - * |
|
205 | - * @since 1.4.0 |
|
206 | - */ |
|
207 | - do_action('theme_breadcrumbs', $post_id); |
|
208 | - } |
|
209 | - } |
|
210 | - |
|
211 | - echo '<div class="clearboth"></div></div></section>'; |
|
177 | + global $mk_options; |
|
178 | + |
|
179 | + $post_id = global_get_post_id(); |
|
180 | + $shadow_css = ''; |
|
181 | + if ($mk_options['page_title_shadow'] == 'true') { |
|
182 | + $shadow_css = 'mk-drop-shadow'; |
|
183 | + } |
|
184 | + |
|
185 | + $align = !empty($align) ? $align : 'left'; |
|
186 | + |
|
187 | + //$title = 'xxxx'; |
|
188 | + echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
189 | + echo '<div class="mk-grid">'; |
|
190 | + if (!empty($title)) { |
|
191 | + echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
192 | + |
|
193 | + } |
|
194 | + |
|
195 | + if (!empty($subtitle)) { |
|
196 | + echo '<div class="page-introduce-subtitle">'; |
|
197 | + echo $subtitle; |
|
198 | + echo '</div>'; |
|
199 | + } |
|
200 | + if ($mk_options['disable_breadcrumb'] == 'true') { |
|
201 | + if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
202 | + /** |
|
203 | + * Calls the theme breadcrumbs for Jupiter theme. |
|
204 | + * |
|
205 | + * @since 1.4.0 |
|
206 | + */ |
|
207 | + do_action('theme_breadcrumbs', $post_id); |
|
208 | + } |
|
209 | + } |
|
210 | + |
|
211 | + echo '<div class="clearboth"></div></div></section>'; |
|
212 | 212 | |
213 | 213 | |
214 | 214 | } |
@@ -16,36 +16,36 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function multi_news_action_calls() |
18 | 18 | { |
19 | - // REMOVE BREADCRUMB |
|
20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | - |
|
27 | - //ADD BREADCRUMS |
|
28 | - add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
29 | - add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
30 | - add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
31 | - add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
32 | - //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
33 | - add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
34 | - |
|
35 | - |
|
36 | - // fix breadcrums |
|
37 | - add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
38 | - |
|
39 | - // REMOVE PAGE TITLES |
|
40 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
41 | - // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
42 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
43 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
44 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
45 | - |
|
46 | - |
|
47 | - add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
48 | - add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
19 | + // REMOVE BREADCRUMB |
|
20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
26 | + |
|
27 | + //ADD BREADCRUMS |
|
28 | + add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
29 | + add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
30 | + add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
31 | + add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
32 | + //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
33 | + add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
34 | + |
|
35 | + |
|
36 | + // fix breadcrums |
|
37 | + add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
38 | + |
|
39 | + // REMOVE PAGE TITLES |
|
40 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
41 | + // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
42 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
43 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
44 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
45 | + |
|
46 | + |
|
47 | + add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
48 | + add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | function gd_mn_extra_wrap($page) |
59 | 59 | { |
60 | - if ($page == 'add-listing-page') { |
|
61 | - echo '<div class="site-content page-wrap">'; |
|
62 | - } elseif ($page == 'signup-page') { |
|
63 | - echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
64 | - } |
|
60 | + if ($page == 'add-listing-page') { |
|
61 | + echo '<div class="site-content page-wrap">'; |
|
62 | + } elseif ($page == 'signup-page') { |
|
63 | + echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function gd_mn_extra_wrap_end($page) |
77 | 77 | { |
78 | - if ($page == 'add-listing-page') { |
|
79 | - echo '</div>'; |
|
80 | - } |
|
78 | + if ($page == 'add-listing-page') { |
|
79 | + echo '</div>'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
83 | 83 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | function gd_mn_replace_breadcrums() |
92 | 92 | { |
93 | 93 | |
94 | - if (mom_option('breadcrumb') != 0) { ?> |
|
94 | + if (mom_option('breadcrumb') != 0) { ?> |
|
95 | 95 | <?php if (mom_option('cats_bread')) { |
96 | - $cclass = ''; |
|
97 | - if (mom_option('cat_slider') == false) { |
|
98 | - $cclass = 'post-crumbs '; |
|
99 | - } |
|
100 | - ?> |
|
96 | + $cclass = ''; |
|
97 | + if (mom_option('cat_slider') == false) { |
|
98 | + $cclass = 'post-crumbs '; |
|
99 | + } |
|
100 | + ?> |
|
101 | 101 | <div class="<?php echo $cclass; ?>entry-crumbs" xmlns:v="http://rdf.data-vocabulary.org/#"> |
102 | 102 | |
103 | 103 | <?php mom_breadcrumb(); ?> |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function gd_get_breadcrum_links() |
121 | 121 | { |
122 | - ob_start(); |
|
123 | - geodir_breadcrumb(); |
|
124 | - $crums = ob_get_contents(); |
|
125 | - ob_get_clean(); |
|
126 | - $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
127 | - if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
128 | - return $matches[0]; |
|
129 | - } else return ''; |
|
122 | + ob_start(); |
|
123 | + geodir_breadcrumb(); |
|
124 | + $crums = ob_get_contents(); |
|
125 | + ob_get_clean(); |
|
126 | + $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
127 | + if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
128 | + return $matches[0]; |
|
129 | + } else return ''; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function gd_breadcrumbs_plus_items($items) |
142 | 142 | { //print_r($items);exit; |
143 | - $bits = array(); |
|
144 | - $pieces = gd_get_breadcrum_links(); |
|
145 | - //unset($pieces[0]); |
|
146 | - $bits = $pieces; |
|
143 | + $bits = array(); |
|
144 | + $pieces = gd_get_breadcrum_links(); |
|
145 | + //unset($pieces[0]); |
|
146 | + $bits = $pieces; |
|
147 | 147 | |
148 | - $title = $items['last']; |
|
149 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
148 | + $title = $items['last']; |
|
149 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
150 | 150 | |
151 | - } elseif (geodir_is_page('listing')) { |
|
151 | + } elseif (geodir_is_page('listing')) { |
|
152 | 152 | |
153 | - } elseif (geodir_is_page('detail')) { |
|
154 | - ob_start(); |
|
155 | - geodir_action_page_title(); |
|
156 | - $title = ob_get_contents(); |
|
157 | - ob_end_clean(); |
|
158 | - } elseif (geodir_is_page('search')) { |
|
159 | - } elseif (geodir_is_page('author')) { |
|
160 | - } |
|
153 | + } elseif (geodir_is_page('detail')) { |
|
154 | + ob_start(); |
|
155 | + geodir_action_page_title(); |
|
156 | + $title = ob_get_contents(); |
|
157 | + ob_end_clean(); |
|
158 | + } elseif (geodir_is_page('search')) { |
|
159 | + } elseif (geodir_is_page('author')) { |
|
160 | + } |
|
161 | 161 | |
162 | - $title = strip_tags($title); |
|
163 | - $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
162 | + $title = strip_tags($title); |
|
163 | + $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
164 | 164 | |
165 | 165 | |
166 | - return $items; |
|
166 | + return $items; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -179,21 +179,21 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function gd_breadcrumbs_plus_items_add($items, $bits, $last) |
181 | 181 | { |
182 | - //$pieces = explode("</div>", $items[0]); |
|
183 | - if (is_array($bits)) { |
|
184 | - $items = array(); |
|
185 | - $pieces = ''; |
|
186 | - foreach ($bits as $bit) { |
|
187 | - $pieces .= $bit; |
|
188 | - } |
|
189 | - $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
190 | - if (isset($last) && $last) { |
|
191 | - $items['last'] = $last; |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - //print_r($items); |
|
196 | - return $items; |
|
182 | + //$pieces = explode("</div>", $items[0]); |
|
183 | + if (is_array($bits)) { |
|
184 | + $items = array(); |
|
185 | + $pieces = ''; |
|
186 | + foreach ($bits as $bit) { |
|
187 | + $pieces .= $bit; |
|
188 | + } |
|
189 | + $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
190 | + if (isset($last) && $last) { |
|
191 | + $items['last'] = $last; |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + //print_r($items); |
|
196 | + return $items; |
|
197 | 197 | |
198 | 198 | } |
199 | 199 |
@@ -126,8 +126,10 @@ |
||
126 | 126 | $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
127 | 127 | if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
128 | 128 | return $matches[0]; |
129 | - } else return ''; |
|
130 | -} |
|
129 | + } else { |
|
130 | + return ''; |
|
131 | + } |
|
132 | + } |
|
131 | 133 | |
132 | 134 | |
133 | 135 | /** |
@@ -33,257 +33,257 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function geodir_add_nav_menu_items() |
35 | 35 | { |
36 | - $items = ''; |
|
37 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | - |
|
39 | - if (get_option('geodir_show_listing_nav')) { |
|
40 | - |
|
41 | - $menu_class = ''; |
|
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
44 | - |
|
45 | - |
|
46 | - //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | - $post_types = geodir_get_posttypes('object'); |
|
48 | - $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | - if (!empty($post_types)) { |
|
50 | - foreach ($post_types as $post_type => $args) { |
|
51 | - if (!empty($show_post_type_main_nav)) { |
|
52 | - if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | - if (get_post_type_archive_link($post_type)) { |
|
54 | - $menu_class = ''; |
|
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
57 | - /** |
|
58 | - * Filter the menu li class. |
|
59 | - * |
|
60 | - * @since 1.0.0 |
|
61 | - * @param string $menu_class The menu HTML class. |
|
62 | - */ |
|
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | - /** |
|
65 | - * Filter the menu a class. |
|
66 | - * |
|
67 | - * @since 1.0.0 |
|
68 | - */ |
|
69 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | - $items .= '<li class="' . $li_class . '"> |
|
36 | + $items = ''; |
|
37 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
38 | + |
|
39 | + if (get_option('geodir_show_listing_nav')) { |
|
40 | + |
|
41 | + $menu_class = ''; |
|
42 | + if (geodir_is_page('listing')) |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + |
|
45 | + |
|
46 | + //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
47 | + $post_types = geodir_get_posttypes('object'); |
|
48 | + $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); |
|
49 | + if (!empty($post_types)) { |
|
50 | + foreach ($post_types as $post_type => $args) { |
|
51 | + if (!empty($show_post_type_main_nav)) { |
|
52 | + if (in_array($post_type, $show_post_type_main_nav)) { |
|
53 | + if (get_post_type_archive_link($post_type)) { |
|
54 | + $menu_class = ''; |
|
55 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | + $menu_class = 'current-menu-item'; |
|
57 | + /** |
|
58 | + * Filter the menu li class. |
|
59 | + * |
|
60 | + * @since 1.0.0 |
|
61 | + * @param string $menu_class The menu HTML class. |
|
62 | + */ |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
64 | + /** |
|
65 | + * Filter the menu a class. |
|
66 | + * |
|
67 | + * @since 1.0.0 |
|
68 | + */ |
|
69 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
70 | + $items .= '<li class="' . $li_class . '"> |
|
71 | 71 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
72 | 72 | ' . __(ucfirst($args->labels->name)) . ' |
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | - |
|
82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | - if ($is_listing_sub_meny_exists) { |
|
85 | - /** |
|
86 | - * Filter the menu li class. |
|
87 | - * |
|
88 | - * @since 1.0.0 |
|
89 | - * @param string $menu_class The menu HTML class. |
|
90 | - */ |
|
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | - /** |
|
93 | - * Filter the sub menu li class. |
|
94 | - * |
|
95 | - * @since 1.0.0 |
|
96 | - * @param string $menu_class The menu HTML class. |
|
97 | - */ |
|
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | - /** |
|
100 | - * Filter the sub menu ul class. |
|
101 | - * |
|
102 | - * @since 1.0.0 |
|
103 | - */ |
|
104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | - /** |
|
106 | - * Filter the menu a class. |
|
107 | - * |
|
108 | - * @since 1.0.0 |
|
109 | - */ |
|
110 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | - /** |
|
112 | - * Filter the sub menu a class. |
|
113 | - * |
|
114 | - * @since 1.0.0 |
|
115 | - */ |
|
116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | - $items .= '<li class="' . $li_class . '"> |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
81 | + |
|
82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav'); |
|
83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
84 | + if ($is_listing_sub_meny_exists) { |
|
85 | + /** |
|
86 | + * Filter the menu li class. |
|
87 | + * |
|
88 | + * @since 1.0.0 |
|
89 | + * @param string $menu_class The menu HTML class. |
|
90 | + */ |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
92 | + /** |
|
93 | + * Filter the sub menu li class. |
|
94 | + * |
|
95 | + * @since 1.0.0 |
|
96 | + * @param string $menu_class The menu HTML class. |
|
97 | + */ |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
99 | + /** |
|
100 | + * Filter the sub menu ul class. |
|
101 | + * |
|
102 | + * @since 1.0.0 |
|
103 | + */ |
|
104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
105 | + /** |
|
106 | + * Filter the menu a class. |
|
107 | + * |
|
108 | + * @since 1.0.0 |
|
109 | + */ |
|
110 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
111 | + /** |
|
112 | + * Filter the sub menu a class. |
|
113 | + * |
|
114 | + * @since 1.0.0 |
|
115 | + */ |
|
116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
117 | + $items .= '<li class="' . $li_class . '"> |
|
118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
119 | 119 | <ul class="' . $sub_ul_class . '">'; |
120 | - $post_types = geodir_get_posttypes('object'); |
|
120 | + $post_types = geodir_get_posttypes('object'); |
|
121 | 121 | |
122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
|
123 | 123 | |
124 | - if (!empty($post_types)) { |
|
125 | - global $geodir_add_location_url; |
|
126 | - $geodir_add_location_url = true; |
|
127 | - foreach ($post_types as $post_type => $args) { |
|
128 | - if (!empty($show_listing_post_types)) { |
|
129 | - if (in_array($post_type, $show_listing_post_types)) { |
|
130 | - if (get_post_type_archive_link($post_type)) { |
|
124 | + if (!empty($post_types)) { |
|
125 | + global $geodir_add_location_url; |
|
126 | + $geodir_add_location_url = true; |
|
127 | + foreach ($post_types as $post_type => $args) { |
|
128 | + if (!empty($show_listing_post_types)) { |
|
129 | + if (in_array($post_type, $show_listing_post_types)) { |
|
130 | + if (get_post_type_archive_link($post_type)) { |
|
131 | 131 | |
132 | - $menu_class = ''; |
|
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
132 | + $menu_class = ''; |
|
133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | + $menu_class = 'current-menu-item'; |
|
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
138 | 138 | ' . __(ucfirst($args->labels->name)) . ' |
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | - } |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - $geodir_add_location_url = NULL; |
|
146 | - } |
|
141 | + } |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + $geodir_add_location_url = NULL; |
|
146 | + } |
|
147 | 147 | |
148 | - $items .= ' </ul> |
|
148 | + $items .= ' </ul> |
|
149 | 149 | </li>'; |
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - if (get_option('geodir_show_addlisting_nav')) { |
|
154 | - |
|
155 | - $menu_class = ''; |
|
156 | - if (geodir_is_page('add-listing')) |
|
157 | - $menu_class = 'current-menu-item'; |
|
158 | - |
|
159 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
160 | - $post_types = geodir_get_posttypes('object'); |
|
161 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
162 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
163 | - |
|
164 | - if (!empty($post_types)) { |
|
165 | - foreach ($post_types as $post_type => $args) { |
|
166 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
167 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
168 | - if (!empty($show_add_listing_post_types_main_nav)) { |
|
169 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
170 | - if (geodir_get_addlisting_link($post_type)) { |
|
171 | - |
|
172 | - $menu_class = ''; |
|
173 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
174 | - $menu_class = 'current-menu-item'; |
|
175 | - /** |
|
176 | - * Filter the menu li class. |
|
177 | - * |
|
178 | - * @since 1.0.0 |
|
179 | - * @param string $menu_class The menu HTML class. |
|
180 | - */ |
|
181 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
182 | - /** |
|
183 | - * Filter the menu a class. |
|
184 | - * |
|
185 | - * @since 1.0.0 |
|
186 | - */ |
|
187 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
188 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
189 | - $items .= '<li class="' . $li_class . '"> |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + if (get_option('geodir_show_addlisting_nav')) { |
|
154 | + |
|
155 | + $menu_class = ''; |
|
156 | + if (geodir_is_page('add-listing')) |
|
157 | + $menu_class = 'current-menu-item'; |
|
158 | + |
|
159 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
160 | + $post_types = geodir_get_posttypes('object'); |
|
161 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav'); |
|
162 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); |
|
163 | + |
|
164 | + if (!empty($post_types)) { |
|
165 | + foreach ($post_types as $post_type => $args) { |
|
166 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
167 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
168 | + if (!empty($show_add_listing_post_types_main_nav)) { |
|
169 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) { |
|
170 | + if (geodir_get_addlisting_link($post_type)) { |
|
171 | + |
|
172 | + $menu_class = ''; |
|
173 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
174 | + $menu_class = 'current-menu-item'; |
|
175 | + /** |
|
176 | + * Filter the menu li class. |
|
177 | + * |
|
178 | + * @since 1.0.0 |
|
179 | + * @param string $menu_class The menu HTML class. |
|
180 | + */ |
|
181 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
182 | + /** |
|
183 | + * Filter the menu a class. |
|
184 | + * |
|
185 | + * @since 1.0.0 |
|
186 | + */ |
|
187 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
188 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
189 | + $items .= '<li class="' . $li_class . '"> |
|
190 | 190 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
191 | 191 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
192 | 192 | </a> |
193 | 193 | </li>'; |
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
202 | - } |
|
203 | - |
|
204 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
205 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
206 | - if ($is_add_listing_sub_meny_exists) { |
|
207 | - |
|
208 | - if (get_option('geodir_show_addlisting_nav')) { |
|
209 | - /** |
|
210 | - * Filter the menu li class. |
|
211 | - * |
|
212 | - * @since 1.0.0 |
|
213 | - * @param string $menu_class The menu HTML class. |
|
214 | - */ |
|
215 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
216 | - /** |
|
217 | - * Filter the sub menu li class. |
|
218 | - * |
|
219 | - * @since 1.0.0 |
|
220 | - * @param string $menu_class The menu HTML class. |
|
221 | - */ |
|
222 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
223 | - /** |
|
224 | - * Filter the sub menu ul class. |
|
225 | - * |
|
226 | - * @since 1.0.0 |
|
227 | - */ |
|
228 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
229 | - /** |
|
230 | - * Filter the menu a class. |
|
231 | - * |
|
232 | - * @since 1.0.0 |
|
233 | - */ |
|
234 | - $a_class = apply_filters('geodir_menu_a_class', ''); |
|
235 | - /** |
|
236 | - * Filter the sub menu a class. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - */ |
|
240 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
241 | - $items .= '<li class="' . $li_class . '"> |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
202 | + } |
|
203 | + |
|
204 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav'); |
|
205 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
206 | + if ($is_add_listing_sub_meny_exists) { |
|
207 | + |
|
208 | + if (get_option('geodir_show_addlisting_nav')) { |
|
209 | + /** |
|
210 | + * Filter the menu li class. |
|
211 | + * |
|
212 | + * @since 1.0.0 |
|
213 | + * @param string $menu_class The menu HTML class. |
|
214 | + */ |
|
215 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
216 | + /** |
|
217 | + * Filter the sub menu li class. |
|
218 | + * |
|
219 | + * @since 1.0.0 |
|
220 | + * @param string $menu_class The menu HTML class. |
|
221 | + */ |
|
222 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
223 | + /** |
|
224 | + * Filter the sub menu ul class. |
|
225 | + * |
|
226 | + * @since 1.0.0 |
|
227 | + */ |
|
228 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu'); |
|
229 | + /** |
|
230 | + * Filter the menu a class. |
|
231 | + * |
|
232 | + * @since 1.0.0 |
|
233 | + */ |
|
234 | + $a_class = apply_filters('geodir_menu_a_class', ''); |
|
235 | + /** |
|
236 | + * Filter the sub menu a class. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + */ |
|
240 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
|
241 | + $items .= '<li class="' . $li_class . '"> |
|
242 | 242 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
243 | 243 | <ul class="' . $sub_ul_class . '">'; |
244 | 244 | |
245 | - $post_types = geodir_get_posttypes('object'); |
|
246 | - |
|
247 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
248 | - |
|
249 | - if (!empty($post_types)) { |
|
250 | - foreach ($post_types as $post_type => $args) { |
|
251 | - if (!empty($geodir_allow_posttype_frontend)) { |
|
252 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
253 | - if (!empty($show_add_listing_post_types)) { |
|
254 | - if (in_array($post_type, $show_add_listing_post_types)) { |
|
255 | - if (geodir_get_addlisting_link($post_type)) { |
|
256 | - |
|
257 | - $menu_class = ''; |
|
258 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
259 | - $menu_class = 'current-menu-item'; |
|
260 | - /** |
|
261 | - * Filter the menu li class. |
|
262 | - * |
|
263 | - * @since 1.0.0 |
|
264 | - * @param string $menu_class The menu HTML class. |
|
265 | - */ |
|
266 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
267 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
268 | - $items .= '<li class="' . $li_class . '"> |
|
245 | + $post_types = geodir_get_posttypes('object'); |
|
246 | + |
|
247 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav'); |
|
248 | + |
|
249 | + if (!empty($post_types)) { |
|
250 | + foreach ($post_types as $post_type => $args) { |
|
251 | + if (!empty($geodir_allow_posttype_frontend)) { |
|
252 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) { |
|
253 | + if (!empty($show_add_listing_post_types)) { |
|
254 | + if (in_array($post_type, $show_add_listing_post_types)) { |
|
255 | + if (geodir_get_addlisting_link($post_type)) { |
|
256 | + |
|
257 | + $menu_class = ''; |
|
258 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
259 | + $menu_class = 'current-menu-item'; |
|
260 | + /** |
|
261 | + * Filter the menu li class. |
|
262 | + * |
|
263 | + * @since 1.0.0 |
|
264 | + * @param string $menu_class The menu HTML class. |
|
265 | + */ |
|
266 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
267 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
268 | + $items .= '<li class="' . $li_class . '"> |
|
269 | 269 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
270 | 270 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
271 | 271 | </a> |
272 | 272 | </li>'; |
273 | - } |
|
274 | - } |
|
275 | - } |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
273 | + } |
|
274 | + } |
|
275 | + } |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - $items .= ' </ul> |
|
281 | + $items .= ' </ul> |
|
282 | 282 | </li>'; |
283 | - } |
|
284 | - } |
|
285 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
286 | - return $items; |
|
283 | + } |
|
284 | + } |
|
285 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
286 | + return $items; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -301,20 +301,20 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function geodir_pagemenu_items($menu, $args) |
303 | 303 | { |
304 | - $locations = get_nav_menu_locations(); |
|
305 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
306 | - $geodir_theme_location_nav = array(); |
|
307 | - if (empty($locations) && empty($geodir_theme_location)) { |
|
308 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
309 | - $geodir_theme_location_nav[] = $args['theme_location']; |
|
310 | - update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
311 | - } |
|
312 | - //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
304 | + $locations = get_nav_menu_locations(); |
|
305 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
306 | + $geodir_theme_location_nav = array(); |
|
307 | + if (empty($locations) && empty($geodir_theme_location)) { |
|
308 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
309 | + $geodir_theme_location_nav[] = $args['theme_location']; |
|
310 | + update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
|
311 | + } |
|
312 | + //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
313 | 313 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
314 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
315 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
314 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
315 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
316 | 316 | |
317 | - return $menu; |
|
317 | + return $menu; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | function geodir_menu_items($items, $args) |
335 | 335 | { |
336 | 336 | |
337 | - $location = $args->theme_location; |
|
337 | + $location = $args->theme_location; |
|
338 | 338 | |
339 | - $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
339 | + $geodir_theme_location = get_option('geodir_theme_location_nav'); |
|
340 | 340 | |
341 | - if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
341 | + if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
|
342 | 342 | |
343 | - $items = $items . geodir_add_nav_menu_items(); |
|
344 | - return $items; |
|
343 | + $items = $items . geodir_add_nav_menu_items(); |
|
344 | + return $items; |
|
345 | 345 | |
346 | - } else { |
|
347 | - return $items; |
|
348 | - } |
|
346 | + } else { |
|
347 | + return $items; |
|
348 | + } |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -360,25 +360,25 @@ discard block |
||
360 | 360 | */ |
361 | 361 | function geodir_get_category_all_array() |
362 | 362 | { |
363 | - global $wpdb; |
|
364 | - $return_array = array(); |
|
365 | - |
|
366 | - $taxonomies = geodir_get_taxonomies(); |
|
367 | - $taxonomies = implode("','", $taxonomies); |
|
368 | - $taxonomies = "'" . $taxonomies . "'"; |
|
369 | - |
|
370 | - $pn_categories = $wpdb->get_results( |
|
371 | - $wpdb->prepare( |
|
372 | - "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
373 | - array($wpdb->terms . term_id) |
|
374 | - ) |
|
375 | - ); |
|
376 | - |
|
377 | - foreach ($pn_categories as $pn_categories_obj) { |
|
378 | - $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
379 | - "title" => $pn_categories_obj->name,); |
|
380 | - } |
|
381 | - return $return_array; |
|
363 | + global $wpdb; |
|
364 | + $return_array = array(); |
|
365 | + |
|
366 | + $taxonomies = geodir_get_taxonomies(); |
|
367 | + $taxonomies = implode("','", $taxonomies); |
|
368 | + $taxonomies = "'" . $taxonomies . "'"; |
|
369 | + |
|
370 | + $pn_categories = $wpdb->get_results( |
|
371 | + $wpdb->prepare( |
|
372 | + "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
373 | + array($wpdb->terms . term_id) |
|
374 | + ) |
|
375 | + ); |
|
376 | + |
|
377 | + foreach ($pn_categories as $pn_categories_obj) { |
|
378 | + $return_array[] = array("id" => $pn_categories_obj->cat_ID, |
|
379 | + "title" => $pn_categories_obj->name,); |
|
380 | + } |
|
381 | + return $return_array; |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -393,32 +393,32 @@ discard block |
||
393 | 393 | */ |
394 | 394 | function geodir_get_current_posttype() |
395 | 395 | { |
396 | - global $wp_query, $geodir_post_type; |
|
396 | + global $wp_query, $geodir_post_type; |
|
397 | 397 | |
398 | - $geodir_post_type = get_query_var('post_type'); |
|
398 | + $geodir_post_type = get_query_var('post_type'); |
|
399 | 399 | |
400 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
401 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
402 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
403 | - elseif (isset($_REQUEST['listing_type'])) |
|
404 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
405 | - } |
|
400 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
|
401 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
402 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
403 | + elseif (isset($_REQUEST['listing_type'])) |
|
404 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
405 | + } |
|
406 | 406 | |
407 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
408 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
407 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
408 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
409 | 409 | |
410 | - if (is_tax()) |
|
411 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
410 | + if (is_tax()) |
|
411 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
412 | 412 | |
413 | 413 | |
414 | - $all_postypes = geodir_get_posttypes(); |
|
415 | - $all_postypes = stripslashes_deep($all_postypes); |
|
414 | + $all_postypes = geodir_get_posttypes(); |
|
415 | + $all_postypes = stripslashes_deep($all_postypes); |
|
416 | 416 | |
417 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
418 | - $geodir_post_type = ''; |
|
417 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
418 | + $geodir_post_type = ''; |
|
419 | 419 | |
420 | 420 | |
421 | - return $geodir_post_type; |
|
421 | + return $geodir_post_type; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -432,21 +432,21 @@ discard block |
||
432 | 432 | */ |
433 | 433 | function geodir_get_posttypes($output = 'names') |
434 | 434 | { |
435 | - $post_types = array(); |
|
436 | - $post_types = get_option('geodir_post_types'); |
|
437 | - $post_types = stripslashes_deep($post_types); |
|
438 | - if (!empty($post_types)) { |
|
439 | - switch ($output): |
|
440 | - case 'object': |
|
441 | - case 'Object': |
|
442 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
443 | - break; |
|
444 | - case 'array': |
|
445 | - case 'Array': |
|
446 | - $post_types = (array)$post_types; |
|
447 | - break; |
|
435 | + $post_types = array(); |
|
436 | + $post_types = get_option('geodir_post_types'); |
|
437 | + $post_types = stripslashes_deep($post_types); |
|
438 | + if (!empty($post_types)) { |
|
439 | + switch ($output): |
|
440 | + case 'object': |
|
441 | + case 'Object': |
|
442 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
443 | + break; |
|
444 | + case 'array': |
|
445 | + case 'Array': |
|
446 | + $post_types = (array)$post_types; |
|
447 | + break; |
|
448 | 448 | case 'options': |
449 | - $post_types = (array)$post_types; |
|
449 | + $post_types = (array)$post_types; |
|
450 | 450 | |
451 | 451 | $options = array(); |
452 | 452 | if (!empty($post_types)) { |
@@ -455,17 +455,17 @@ discard block |
||
455 | 455 | } |
456 | 456 | } |
457 | 457 | $post_types = $options; |
458 | - break; |
|
459 | - default: |
|
460 | - $post_types = array_keys($post_types); |
|
461 | - break; |
|
462 | - endswitch; |
|
463 | - } |
|
464 | - |
|
465 | - if (!empty($post_types)) |
|
466 | - return $post_types; |
|
467 | - else |
|
468 | - return array(); |
|
458 | + break; |
|
459 | + default: |
|
460 | + $post_types = array_keys($post_types); |
|
461 | + break; |
|
462 | + endswitch; |
|
463 | + } |
|
464 | + |
|
465 | + if (!empty($post_types)) |
|
466 | + return $post_types; |
|
467 | + else |
|
468 | + return array(); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | /** |
@@ -478,108 +478,108 @@ discard block |
||
478 | 478 | */ |
479 | 479 | function geodir_get_posttype_info($post_type = '') |
480 | 480 | { |
481 | - $post_types = array(); |
|
482 | - $post_types = get_option('geodir_post_types'); |
|
483 | - $post_types = stripslashes_deep($post_types); |
|
484 | - if (!empty($post_types) && $post_type != '') { |
|
485 | - return $post_types[$post_type]; |
|
486 | - } else |
|
487 | - return false; |
|
481 | + $post_types = array(); |
|
482 | + $post_types = get_option('geodir_post_types'); |
|
483 | + $post_types = stripslashes_deep($post_types); |
|
484 | + if (!empty($post_types) && $post_type != '') { |
|
485 | + return $post_types[$post_type]; |
|
486 | + } else |
|
487 | + return false; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | if (!function_exists('geodir_get_taxonomies')) { |
491 | - /** |
|
492 | - * Get all custom taxonomies. |
|
493 | - * |
|
494 | - * @since 1.0.0 |
|
495 | - * @package GeoDirectory |
|
496 | - * @param string $post_type The post type. |
|
497 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
498 | - * @return array|bool Taxonomies on success. false on failure. |
|
499 | - */ |
|
500 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) |
|
501 | - { |
|
491 | + /** |
|
492 | + * Get all custom taxonomies. |
|
493 | + * |
|
494 | + * @since 1.0.0 |
|
495 | + * @package GeoDirectory |
|
496 | + * @param string $post_type The post type. |
|
497 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
498 | + * @return array|bool Taxonomies on success. false on failure. |
|
499 | + */ |
|
500 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) |
|
501 | + { |
|
502 | 502 | |
503 | - $taxonomies = array(); |
|
504 | - $gd_taxonomies = array(); |
|
503 | + $taxonomies = array(); |
|
504 | + $gd_taxonomies = array(); |
|
505 | 505 | |
506 | - if ($taxonomies = get_option('geodir_taxonomies')) { |
|
506 | + if ($taxonomies = get_option('geodir_taxonomies')) { |
|
507 | 507 | |
508 | 508 | |
509 | - $gd_taxonomies = array_keys($taxonomies); |
|
509 | + $gd_taxonomies = array_keys($taxonomies); |
|
510 | 510 | |
511 | 511 | |
512 | - if ($post_type != '') |
|
513 | - $gd_taxonomies = array(); |
|
512 | + if ($post_type != '') |
|
513 | + $gd_taxonomies = array(); |
|
514 | 514 | |
515 | - $i = 0; |
|
516 | - foreach ($taxonomies as $taxonomy => $args) { |
|
515 | + $i = 0; |
|
516 | + foreach ($taxonomies as $taxonomy => $args) { |
|
517 | 517 | |
518 | - if ($post_type != '' && $args['object_type'] == $post_type) |
|
519 | - $gd_taxonomies[] = $taxonomy; |
|
518 | + if ($post_type != '' && $args['object_type'] == $post_type) |
|
519 | + $gd_taxonomies[] = $taxonomy; |
|
520 | 520 | |
521 | - if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) { |
|
522 | - if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
523 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
524 | - } |
|
521 | + if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) { |
|
522 | + if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
523 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
524 | + } |
|
525 | 525 | |
526 | - } |
|
526 | + } |
|
527 | + |
|
528 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
529 | + } |
|
527 | 530 | |
528 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
529 | - } |
|
530 | - |
|
531 | - /** |
|
532 | - * Filter the taxonomies. |
|
533 | - * |
|
534 | - * @since 1.0.0 |
|
535 | - * @param array $gd_taxonomies The taxonomy array. |
|
536 | - */ |
|
537 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
538 | - |
|
539 | - if (!empty($taxonomies)) { |
|
540 | - return $taxonomies; |
|
541 | - } else { |
|
542 | - return false; |
|
543 | - } |
|
544 | - } |
|
531 | + /** |
|
532 | + * Filter the taxonomies. |
|
533 | + * |
|
534 | + * @since 1.0.0 |
|
535 | + * @param array $gd_taxonomies The taxonomy array. |
|
536 | + */ |
|
537 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies); |
|
538 | + |
|
539 | + if (!empty($taxonomies)) { |
|
540 | + return $taxonomies; |
|
541 | + } else { |
|
542 | + return false; |
|
543 | + } |
|
544 | + } |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | if (!function_exists(' geodir_get_categories_dl')) { |
548 | - /** |
|
549 | - * Get categories dropdown HTML. |
|
550 | - * |
|
551 | - * @since 1.0.0 |
|
552 | - * @package GeoDirectory |
|
553 | - * @param string $post_type The post type. |
|
554 | - * @param string $selected The selected value. |
|
555 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
557 | - * @return void|string Dropdown HTML. |
|
558 | - */ |
|
559 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
560 | - { |
|
561 | - |
|
562 | - $html = ''; |
|
563 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
564 | - |
|
565 | - $categories = get_terms($taxonomies); |
|
566 | - |
|
567 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
568 | - |
|
569 | - foreach ($categories as $category_obj) { |
|
570 | - $select_opt = ''; |
|
571 | - if ($selected == $category_obj->term_id) { |
|
572 | - $select_opt = 'selected="selected"'; |
|
573 | - } |
|
574 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
575 | - . ucfirst($category_obj->name) . '</option>'; |
|
576 | - } |
|
577 | - |
|
578 | - if ($echo) |
|
579 | - echo $html; |
|
580 | - else |
|
581 | - return $html; |
|
582 | - } |
|
548 | + /** |
|
549 | + * Get categories dropdown HTML. |
|
550 | + * |
|
551 | + * @since 1.0.0 |
|
552 | + * @package GeoDirectory |
|
553 | + * @param string $post_type The post type. |
|
554 | + * @param string $selected The selected value. |
|
555 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
556 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
557 | + * @return void|string Dropdown HTML. |
|
558 | + */ |
|
559 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
560 | + { |
|
561 | + |
|
562 | + $html = ''; |
|
563 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
564 | + |
|
565 | + $categories = get_terms($taxonomies); |
|
566 | + |
|
567 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
568 | + |
|
569 | + foreach ($categories as $category_obj) { |
|
570 | + $select_opt = ''; |
|
571 | + if ($selected == $category_obj->term_id) { |
|
572 | + $select_opt = 'selected="selected"'; |
|
573 | + } |
|
574 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
575 | + . ucfirst($category_obj->name) . '</option>'; |
|
576 | + } |
|
577 | + |
|
578 | + if ($echo) |
|
579 | + echo $html; |
|
580 | + else |
|
581 | + return $html; |
|
582 | + } |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -594,28 +594,28 @@ discard block |
||
594 | 594 | function geodir_get_listing_slug($object_type = '') |
595 | 595 | { |
596 | 596 | |
597 | - $listing_slug = ''; |
|
597 | + $listing_slug = ''; |
|
598 | 598 | |
599 | - $post_types = get_option('geodir_post_types'); |
|
600 | - $taxonomies = get_option('geodir_taxonomies'); |
|
599 | + $post_types = get_option('geodir_post_types'); |
|
600 | + $taxonomies = get_option('geodir_taxonomies'); |
|
601 | 601 | |
602 | 602 | |
603 | - if ($object_type != '') { |
|
604 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
603 | + if ($object_type != '') { |
|
604 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) { |
|
605 | 605 | |
606 | - $object_info = $post_types[$object_type]; |
|
607 | - $listing_slug = $object_info['listing_slug']; |
|
608 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
609 | - $object_info = $taxonomies[$object_type]; |
|
610 | - $listing_slug = $object_info['listing_slug']; |
|
611 | - } |
|
606 | + $object_info = $post_types[$object_type]; |
|
607 | + $listing_slug = $object_info['listing_slug']; |
|
608 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) { |
|
609 | + $object_info = $taxonomies[$object_type]; |
|
610 | + $listing_slug = $object_info['listing_slug']; |
|
611 | + } |
|
612 | 612 | |
613 | - } |
|
613 | + } |
|
614 | 614 | |
615 | - if (!empty($listing_slug)) |
|
616 | - return $listing_slug; |
|
617 | - else |
|
618 | - return false; |
|
615 | + if (!empty($listing_slug)) |
|
616 | + return $listing_slug; |
|
617 | + else |
|
618 | + return false; |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -630,212 +630,212 @@ discard block |
||
630 | 630 | */ |
631 | 631 | function geodir_get_taxonomy_posttype($taxonomy = '') |
632 | 632 | { |
633 | - global $wp_query; |
|
634 | - |
|
635 | - $post_type = array(); |
|
636 | - $taxonomies = array(); |
|
637 | - |
|
638 | - if (!empty($taxonomy)) { |
|
639 | - $taxonomies[] = $taxonomy; |
|
640 | - } elseif (isset($wp_query->tax_query->queries)) { |
|
641 | - $tax_arr = $wp_query->tax_query->queries; |
|
642 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
643 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
644 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
645 | - } |
|
646 | - |
|
647 | - if (!empty($taxonomies)) { |
|
648 | - foreach (geodir_get_posttypes() as $pt) { |
|
649 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
650 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
651 | - $post_type[] = $pt; |
|
652 | - } |
|
653 | - } |
|
654 | - |
|
655 | - if (!empty($post_type)) |
|
656 | - return $post_type[0]; |
|
657 | - else |
|
658 | - return false; |
|
633 | + global $wp_query; |
|
634 | + |
|
635 | + $post_type = array(); |
|
636 | + $taxonomies = array(); |
|
637 | + |
|
638 | + if (!empty($taxonomy)) { |
|
639 | + $taxonomies[] = $taxonomy; |
|
640 | + } elseif (isset($wp_query->tax_query->queries)) { |
|
641 | + $tax_arr = $wp_query->tax_query->queries; |
|
642 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
643 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
644 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
645 | + } |
|
646 | + |
|
647 | + if (!empty($taxonomies)) { |
|
648 | + foreach (geodir_get_posttypes() as $pt) { |
|
649 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
650 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
651 | + $post_type[] = $pt; |
|
652 | + } |
|
653 | + } |
|
654 | + |
|
655 | + if (!empty($post_type)) |
|
656 | + return $post_type[0]; |
|
657 | + else |
|
658 | + return false; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
662 | - /** |
|
663 | - * Custom taxonomy walker function. |
|
664 | - * |
|
665 | - * @since 1.0.0 |
|
666 | - * @package GeoDirectory |
|
667 | - * @param string $cat_taxonomy The taxonomy name. |
|
668 | - * @param int $cat_parent The parent term ID. |
|
669 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
670 | - * @param int $pading CSS padding in pixels. |
|
671 | - * @return string|void taxonomy HTML. |
|
672 | - */ |
|
673 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
674 | - { |
|
675 | - global $cat_display, $post_cat, $exclude_cats; |
|
676 | - |
|
677 | - $search_terms = trim($post_cat, ","); |
|
678 | - |
|
679 | - $search_terms = explode(",", $search_terms); |
|
680 | - |
|
681 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
682 | - |
|
683 | - $display = ''; |
|
684 | - $onchange = ''; |
|
685 | - $term_check = ''; |
|
686 | - $main_list_class = ''; |
|
687 | - $out = ''; |
|
688 | - //If there are terms, start displaying |
|
689 | - if (count($cat_terms) > 0) { |
|
690 | - //Displaying as a list |
|
691 | - $p = $pading * 20; |
|
692 | - $pading++; |
|
693 | - |
|
694 | - |
|
695 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
696 | - if ($cat_parent == 0) { |
|
697 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
698 | - $main_list_class = 'class="main_list_selecter"'; |
|
699 | - } else { |
|
700 | - //$display = 'display:none'; |
|
701 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
702 | - } |
|
703 | - } |
|
662 | + /** |
|
663 | + * Custom taxonomy walker function. |
|
664 | + * |
|
665 | + * @since 1.0.0 |
|
666 | + * @package GeoDirectory |
|
667 | + * @param string $cat_taxonomy The taxonomy name. |
|
668 | + * @param int $cat_parent The parent term ID. |
|
669 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
670 | + * @param int $pading CSS padding in pixels. |
|
671 | + * @return string|void taxonomy HTML. |
|
672 | + */ |
|
673 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
674 | + { |
|
675 | + global $cat_display, $post_cat, $exclude_cats; |
|
676 | + |
|
677 | + $search_terms = trim($post_cat, ","); |
|
678 | + |
|
679 | + $search_terms = explode(",", $search_terms); |
|
680 | + |
|
681 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats)); |
|
682 | + |
|
683 | + $display = ''; |
|
684 | + $onchange = ''; |
|
685 | + $term_check = ''; |
|
686 | + $main_list_class = ''; |
|
687 | + $out = ''; |
|
688 | + //If there are terms, start displaying |
|
689 | + if (count($cat_terms) > 0) { |
|
690 | + //Displaying as a list |
|
691 | + $p = $pading * 20; |
|
692 | + $pading++; |
|
693 | + |
|
694 | + |
|
695 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
|
696 | + if ($cat_parent == 0) { |
|
697 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
698 | + $main_list_class = 'class="main_list_selecter"'; |
|
699 | + } else { |
|
700 | + //$display = 'display:none'; |
|
701 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
702 | + } |
|
703 | + } |
|
704 | 704 | |
705 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
706 | - $p = 0; |
|
707 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
708 | - } |
|
705 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
706 | + $p = 0; |
|
707 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
708 | + } |
|
709 | 709 | |
710 | - foreach ($cat_terms as $cat_term) { |
|
710 | + foreach ($cat_terms as $cat_term) { |
|
711 | 711 | |
712 | - $checked = ''; |
|
712 | + $checked = ''; |
|
713 | 713 | |
714 | - if (in_array($cat_term->term_id, $search_terms)) { |
|
715 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
716 | - $checked = 'selected="selected"'; |
|
717 | - else |
|
718 | - $checked = 'checked="checked"'; |
|
719 | - } |
|
714 | + if (in_array($cat_term->term_id, $search_terms)) { |
|
715 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
716 | + $checked = 'selected="selected"'; |
|
717 | + else |
|
718 | + $checked = 'checked="checked"'; |
|
719 | + } |
|
720 | 720 | |
721 | - if ($cat_display == 'radio') |
|
722 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
723 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
724 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
721 | + if ($cat_display == 'radio') |
|
722 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
723 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
724 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
725 | 725 | |
726 | - else { |
|
727 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
728 | - } |
|
726 | + else { |
|
727 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
728 | + } |
|
729 | 729 | |
730 | - // Call recurson to print sub cats |
|
731 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
730 | + // Call recurson to print sub cats |
|
731 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
732 | 732 | |
733 | - } |
|
733 | + } |
|
734 | 734 | |
735 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
736 | - $out .= '</div>'; |
|
735 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
736 | + $out .= '</div>'; |
|
737 | 737 | |
738 | - return $out; |
|
739 | - } |
|
740 | - return; |
|
741 | - } |
|
738 | + return $out; |
|
739 | + } |
|
740 | + return; |
|
741 | + } |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | if (!function_exists('geodir_custom_taxonomy_walker2')) { |
745 | - /** |
|
746 | - * Custom taxonomy walker function. |
|
747 | - * |
|
748 | - * @since 1.0.0 |
|
749 | - * @package GeoDirectory |
|
750 | - * @global object $post WordPress Post object. |
|
751 | - * @global object $gd_session GeoDirectory Session object. |
|
752 | - * @param string $cat_taxonomy The taxonomy name. |
|
753 | - * @param string $cat_limit Number of categories to display. |
|
754 | - */ |
|
755 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
756 | - { |
|
757 | - $post_category = ''; |
|
758 | - $post_category_str = ''; |
|
759 | - global $exclude_cats, $gd_session; |
|
760 | - |
|
761 | - $cat_exclude = ''; |
|
762 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
763 | - $cat_exclude = serialize($exclude_cats); |
|
764 | - |
|
765 | - if (isset($_REQUEST['backandedit'])) { |
|
766 | - $post = (object)$gd_session->get('listing'); |
|
767 | - |
|
768 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
769 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
770 | - |
|
771 | - $post_categories = $post->post_category_str; |
|
772 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
773 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
774 | - |
|
775 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
776 | - global $post; |
|
777 | - |
|
778 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
779 | - if (empty($post_category) && isset($post->$cat_taxonomy)) { |
|
780 | - $post_category = $post->$cat_taxonomy; |
|
781 | - } |
|
745 | + /** |
|
746 | + * Custom taxonomy walker function. |
|
747 | + * |
|
748 | + * @since 1.0.0 |
|
749 | + * @package GeoDirectory |
|
750 | + * @global object $post WordPress Post object. |
|
751 | + * @global object $gd_session GeoDirectory Session object. |
|
752 | + * @param string $cat_taxonomy The taxonomy name. |
|
753 | + * @param string $cat_limit Number of categories to display. |
|
754 | + */ |
|
755 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
756 | + { |
|
757 | + $post_category = ''; |
|
758 | + $post_category_str = ''; |
|
759 | + global $exclude_cats, $gd_session; |
|
760 | + |
|
761 | + $cat_exclude = ''; |
|
762 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
763 | + $cat_exclude = serialize($exclude_cats); |
|
764 | + |
|
765 | + if (isset($_REQUEST['backandedit'])) { |
|
766 | + $post = (object)$gd_session->get('listing'); |
|
767 | + |
|
768 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
769 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
770 | + |
|
771 | + $post_categories = $post->post_category_str; |
|
772 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
773 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
774 | + |
|
775 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
|
776 | + global $post; |
|
777 | + |
|
778 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
779 | + if (empty($post_category) && isset($post->$cat_taxonomy)) { |
|
780 | + $post_category = $post->$cat_taxonomy; |
|
781 | + } |
|
782 | 782 | |
783 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
783 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
784 | 784 | |
785 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
786 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
787 | - if (is_numeric($cat_part)) { |
|
788 | - $cat_part_arr[] = $cat_part; |
|
789 | - } |
|
790 | - } |
|
791 | - if (is_array($cat_part_arr)) { |
|
792 | - $post_category = implode(',', $cat_part_arr); |
|
793 | - } |
|
794 | - } |
|
785 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) { |
|
786 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) { |
|
787 | + if (is_numeric($cat_part)) { |
|
788 | + $cat_part_arr[] = $cat_part; |
|
789 | + } |
|
790 | + } |
|
791 | + if (is_array($cat_part_arr)) { |
|
792 | + $post_category = implode(',', $cat_part_arr); |
|
793 | + } |
|
794 | + } |
|
795 | 795 | |
796 | - if (!empty($post_category)) { |
|
797 | - $cat1 = array_filter(explode(',', $post_category)); |
|
798 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
796 | + if (!empty($post_category)) { |
|
797 | + $cat1 = array_filter(explode(',', $post_category)); |
|
798 | + $post_category = ',' . implode(',', $cat1) . ','; |
|
799 | 799 | |
800 | - } |
|
800 | + } |
|
801 | 801 | |
802 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
802 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) { |
|
803 | 803 | |
804 | - $post_category_upd = explode(',', $post_category); |
|
805 | - $post_category_change = ''; |
|
806 | - foreach ($post_category_upd as $cat) { |
|
804 | + $post_category_upd = explode(',', $post_category); |
|
805 | + $post_category_change = ''; |
|
806 | + foreach ($post_category_upd as $cat) { |
|
807 | 807 | |
808 | - if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
809 | - $post_category_change .= ',' . $cat; |
|
810 | - } |
|
811 | - } |
|
812 | - $post_category = $post_category_change; |
|
813 | - } |
|
808 | + if (!in_array($cat, $exclude_cats) && $cat != '') { |
|
809 | + $post_category_change .= ',' . $cat; |
|
810 | + } |
|
811 | + } |
|
812 | + $post_category = $post_category_change; |
|
813 | + } |
|
814 | 814 | |
815 | 815 | |
816 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
817 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
818 | - } |
|
819 | - } |
|
816 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
817 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
818 | + } |
|
819 | + } |
|
820 | 820 | |
821 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
821 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
822 | 822 | |
823 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
823 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
824 | 824 | |
825 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
825 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
826 | 826 | |
827 | 827 | |
828 | - ?> |
|
828 | + ?> |
|
829 | 829 | <div class="cat_sublist"> |
830 | 830 | <?php |
831 | 831 | |
832 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
832 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
833 | 833 | |
834 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
834 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) { |
|
835 | 835 | |
836 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
837 | - } |
|
838 | - ?> |
|
836 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
837 | + } |
|
838 | + ?> |
|
839 | 839 | </div> |
840 | 840 | <script type="text/javascript"> |
841 | 841 | |
@@ -958,22 +958,22 @@ discard block |
||
958 | 958 | |
959 | 959 | </script> |
960 | 960 | <?php |
961 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
962 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
963 | - $post_cat_array = explode("#", $post_cat_str); |
|
964 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
965 | - $style = "display:none;"; |
|
966 | - } |
|
967 | - ?> |
|
961 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
962 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
963 | + $post_cat_array = explode("#", $post_cat_str); |
|
964 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
965 | + $style = "display:none;"; |
|
966 | + } |
|
967 | + ?> |
|
968 | 968 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
969 | - echo $style; |
|
970 | - }?> "> |
|
969 | + echo $style; |
|
970 | + }?> "> |
|
971 | 971 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
972 | - ?> |
|
972 | + ?> |
|
973 | 973 | </div> |
974 | 974 | <?php |
975 | 975 | |
976 | - } |
|
976 | + } |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | */ |
991 | 991 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
992 | 992 | { |
993 | - global $exclude_cats; |
|
994 | - |
|
995 | - if ($exclude != '') { |
|
996 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
997 | - print_r($exclude_cats); |
|
998 | - if(is_array( $exclude_cats)){ |
|
999 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1000 | - }else{ |
|
1001 | - $exclude_cats = intval($exclude_cats); |
|
1002 | - } |
|
993 | + global $exclude_cats; |
|
994 | + |
|
995 | + if ($exclude != '') { |
|
996 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
997 | + print_r($exclude_cats); |
|
998 | + if(is_array( $exclude_cats)){ |
|
999 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1000 | + }else{ |
|
1001 | + $exclude_cats = intval($exclude_cats); |
|
1002 | + } |
|
1003 | 1003 | |
1004 | - } |
|
1004 | + } |
|
1005 | 1005 | |
1006 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1007 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1008 | - ) { |
|
1009 | - ?> |
|
1006 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
1007 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
1008 | + ) { |
|
1009 | + ?> |
|
1010 | 1010 | |
1011 | 1011 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1012 | 1012 | |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | <br/> |
1037 | 1037 | <?php |
1038 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1039 | - if (!empty($cat_terms)) { ?> |
|
1038 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1039 | + if (!empty($cat_terms)) { ?> |
|
1040 | 1040 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span> |
1041 | 1041 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
1042 | 1042 | <?php } ?> |
@@ -1058,53 +1058,53 @@ discard block |
||
1058 | 1058 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
1059 | 1059 | { |
1060 | 1060 | |
1061 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1062 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
1063 | - $post_cat_array = explode("#", $post_cat_str); |
|
1064 | - if (is_array($post_cat_array)) { |
|
1065 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1061 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) { |
|
1062 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
1063 | + $post_cat_array = explode("#", $post_cat_str); |
|
1064 | + if (is_array($post_cat_array)) { |
|
1065 | + $post_cat_array = array_unique( $post_cat_array ); |
|
1066 | 1066 | |
1067 | 1067 | foreach ($post_cat_array as $post_cat_html) { |
1068 | 1068 | |
1069 | - $post_cat_info = explode(":", $post_cat_html); |
|
1070 | - $post_maincat_str = $post_cat_info[0]; |
|
1069 | + $post_cat_info = explode(":", $post_cat_html); |
|
1070 | + $post_maincat_str = $post_cat_info[0]; |
|
1071 | 1071 | |
1072 | - if (!empty($post_maincat_str)) { |
|
1073 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1074 | - $post_maincat_id = $post_maincat_info[0]; |
|
1075 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1076 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1077 | - } |
|
1078 | - $post_sub_catid = ''; |
|
1079 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1080 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1081 | - } |
|
1072 | + if (!empty($post_maincat_str)) { |
|
1073 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1074 | + $post_maincat_id = $post_maincat_info[0]; |
|
1075 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1076 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1077 | + } |
|
1078 | + $post_sub_catid = ''; |
|
1079 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1080 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1081 | + } |
|
1082 | 1082 | |
1083 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1083 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1084 | 1084 | |
1085 | - } |
|
1086 | - } else { |
|
1085 | + } |
|
1086 | + } else { |
|
1087 | 1087 | |
1088 | - $post_cat_info = explode(":", $post_cat_str); |
|
1089 | - $post_maincat_str = $post_cat_info[0]; |
|
1088 | + $post_cat_info = explode(":", $post_cat_str); |
|
1089 | + $post_maincat_str = $post_cat_info[0]; |
|
1090 | 1090 | |
1091 | - $post_sub_catid = ''; |
|
1091 | + $post_sub_catid = ''; |
|
1092 | 1092 | |
1093 | - if (!empty($post_maincat_str)) { |
|
1094 | - $post_maincat_info = explode(",", $post_maincat_str); |
|
1095 | - $post_maincat_id = $post_maincat_info[0]; |
|
1096 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1097 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1098 | - } |
|
1093 | + if (!empty($post_maincat_str)) { |
|
1094 | + $post_maincat_info = explode(",", $post_maincat_str); |
|
1095 | + $post_maincat_id = $post_maincat_info[0]; |
|
1096 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
1097 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
1098 | + } |
|
1099 | 1099 | |
1100 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1101 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1102 | - } |
|
1100 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
|
1101 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
1102 | + } |
|
1103 | 1103 | |
1104 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1104 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
1105 | 1105 | |
1106 | - } |
|
1107 | - } |
|
1106 | + } |
|
1107 | + } |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | /** |
@@ -1118,35 +1118,35 @@ discard block |
||
1118 | 1118 | */ |
1119 | 1119 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
1120 | 1120 | { |
1121 | - global $exclude_cats; |
|
1121 | + global $exclude_cats; |
|
1122 | 1122 | |
1123 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1123 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats)); |
|
1124 | 1124 | |
1125 | - if (!empty($cat_terms)) { |
|
1126 | - $onchange = ''; |
|
1127 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1125 | + if (!empty($cat_terms)) { |
|
1126 | + $onchange = ''; |
|
1127 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
1128 | 1128 | |
1129 | - $option_selected = ''; |
|
1130 | - if (!$selected) |
|
1131 | - $option_slected = ' selected="selected" '; |
|
1129 | + $option_selected = ''; |
|
1130 | + if (!$selected) |
|
1131 | + $option_slected = ' selected="selected" '; |
|
1132 | 1132 | |
1133 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1133 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1134 | 1134 | |
1135 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1135 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1136 | 1136 | |
1137 | - foreach ($cat_terms as $cat_term) { |
|
1138 | - $option_selected = ''; |
|
1139 | - if ($selected == $cat_term->term_id) |
|
1140 | - $option_selected = ' selected="selected" '; |
|
1137 | + foreach ($cat_terms as $cat_term) { |
|
1138 | + $option_selected = ''; |
|
1139 | + if ($selected == $cat_term->term_id) |
|
1140 | + $option_selected = ' selected="selected" '; |
|
1141 | 1141 | |
1142 | - // Count child terms |
|
1143 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1144 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1142 | + // Count child terms |
|
1143 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1144 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1145 | 1145 | |
1146 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
1147 | - } |
|
1148 | - echo '</select>'; |
|
1149 | - } |
|
1146 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
1147 | + } |
|
1148 | + echo '</select>'; |
|
1149 | + } |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | /** |
@@ -1162,28 +1162,28 @@ discard block |
||
1162 | 1162 | */ |
1163 | 1163 | function geodir_custom_update_messages($messages) |
1164 | 1164 | { |
1165 | - global $post, $post_ID; |
|
1166 | - |
|
1167 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1168 | - |
|
1169 | - foreach ($post_types as $post_type => $post_object) { |
|
1170 | - |
|
1171 | - $messages[$post_type] = array( |
|
1172 | - 0 => '', // Unused. Messages start at index 1. |
|
1173 | - 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1174 | - 2 => __('Custom field updated.', 'geodirectory'), |
|
1175 | - 3 => __('Custom field deleted.', 'geodirectory'), |
|
1176 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1177 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1178 | - 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1179 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1180 | - 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1181 | - 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1182 | - 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1183 | - ); |
|
1184 | - } |
|
1185 | - |
|
1186 | - return $messages; |
|
1165 | + global $post, $post_ID; |
|
1166 | + |
|
1167 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects'); |
|
1168 | + |
|
1169 | + foreach ($post_types as $post_type => $post_object) { |
|
1170 | + |
|
1171 | + $messages[$post_type] = array( |
|
1172 | + 0 => '', // Unused. Messages start at index 1. |
|
1173 | + 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1174 | + 2 => __('Custom field updated.', 'geodirectory'), |
|
1175 | + 3 => __('Custom field deleted.', 'geodirectory'), |
|
1176 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
|
1177 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1178 | + 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1179 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
|
1180 | + 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1181 | + 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
|
1182 | + 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
|
1183 | + ); |
|
1184 | + } |
|
1185 | + |
|
1186 | + return $messages; |
|
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | |
@@ -1198,181 +1198,181 @@ discard block |
||
1198 | 1198 | function geodir_register_defaults() |
1199 | 1199 | { |
1200 | 1200 | |
1201 | - global $wpdb; |
|
1202 | - |
|
1203 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1204 | - |
|
1205 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1206 | - $listing_slug = 'places'; |
|
1207 | - |
|
1208 | - /** |
|
1209 | - * Taxonomies |
|
1210 | - **/ |
|
1211 | - //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1212 | - { |
|
1213 | - |
|
1214 | - $gd_placetags = array(); |
|
1215 | - $gd_placetags['object_type'] = 'gd_place'; |
|
1216 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1217 | - $gd_placetags['args'] = array( |
|
1218 | - 'public' => true, |
|
1219 | - 'hierarchical' => false, |
|
1220 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1221 | - 'query_var' => true, |
|
1222 | - |
|
1223 | - 'labels' => array( |
|
1224 | - 'name' => __('Place Tags', 'geodirectory'), |
|
1225 | - 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1226 | - 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1227 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1228 | - 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1229 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1230 | - 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1231 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1232 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1233 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1234 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1235 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1236 | - ), |
|
1237 | - ); |
|
1238 | - |
|
1239 | - |
|
1240 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1241 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1242 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1243 | - |
|
1244 | - |
|
1245 | - // Update post types and delete tmp options |
|
1246 | - flush_rewrite_rules(); |
|
1247 | - |
|
1248 | - } |
|
1249 | - |
|
1250 | - //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1251 | - { |
|
1252 | - |
|
1253 | - $gd_placecategory = array(); |
|
1254 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
1255 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
1256 | - $gd_placecategory['args'] = array( |
|
1257 | - 'public' => true, |
|
1258 | - 'hierarchical' => true, |
|
1259 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1260 | - 'query_var' => true, |
|
1261 | - 'labels' => array( |
|
1262 | - 'name' => __('Place Categories', 'geodirectory'), |
|
1263 | - 'singular_name' => __('Place Category', 'geodirectory'), |
|
1264 | - 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1265 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1266 | - 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1267 | - 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1268 | - 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1269 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1270 | - 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1271 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1272 | - ), |
|
1273 | - ); |
|
1274 | - |
|
1275 | - |
|
1276 | - $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1277 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1278 | - update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1279 | - |
|
1280 | - |
|
1281 | - flush_rewrite_rules(); |
|
1282 | - } |
|
1283 | - |
|
1284 | - /** |
|
1285 | - * Post Types |
|
1286 | - **/ |
|
1287 | - |
|
1288 | - //if ( ! post_type_exists('gd_place') ) |
|
1289 | - { |
|
1290 | - |
|
1291 | - $labels = array( |
|
1292 | - 'name' => __('Places', 'geodirectory'), |
|
1293 | - 'singular_name' => __('Place', 'geodirectory'), |
|
1294 | - 'add_new' => __('Add New', 'geodirectory'), |
|
1295 | - 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1296 | - 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1297 | - 'new_item' => __('New Place', 'geodirectory'), |
|
1298 | - 'view_item' => __('View Place', 'geodirectory'), |
|
1299 | - 'search_items' => __('Search Places', 'geodirectory'), |
|
1300 | - 'not_found' => __('No Place Found', 'geodirectory'), |
|
1301 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1302 | - |
|
1303 | - $place_default = array( |
|
1304 | - 'labels' => $labels, |
|
1305 | - 'can_export' => true, |
|
1306 | - 'capability_type' => 'post', |
|
1307 | - 'description' => 'Place post type.', |
|
1308 | - 'has_archive' => $listing_slug, |
|
1309 | - 'hierarchical' => false, |
|
1310 | - 'map_meta_cap' => true, |
|
1311 | - 'menu_icon' => $menu_icon, |
|
1312 | - 'public' => true, |
|
1313 | - 'query_var' => true, |
|
1314 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true), |
|
1315 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1316 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1317 | - |
|
1318 | - //Update custom post types |
|
1319 | - $geodir_post_types = get_option('geodir_post_types'); |
|
1320 | - $geodir_post_types['gd_place'] = $place_default; |
|
1321 | - update_option('geodir_post_types', $geodir_post_types); |
|
1322 | - |
|
1323 | - // Update post types and delete tmp options |
|
1324 | - flush_rewrite_rules(); |
|
1325 | - } |
|
1326 | - |
|
1327 | - |
|
1328 | - geodir_register_taxonomies(); |
|
1329 | - geodir_register_post_types(); |
|
1330 | - |
|
1331 | - //die; |
|
1201 | + global $wpdb; |
|
1202 | + |
|
1203 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1204 | + |
|
1205 | + if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1206 | + $listing_slug = 'places'; |
|
1207 | + |
|
1208 | + /** |
|
1209 | + * Taxonomies |
|
1210 | + **/ |
|
1211 | + //if ( ! taxonomy_exists('gd_place_tags') ) |
|
1212 | + { |
|
1213 | + |
|
1214 | + $gd_placetags = array(); |
|
1215 | + $gd_placetags['object_type'] = 'gd_place'; |
|
1216 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1217 | + $gd_placetags['args'] = array( |
|
1218 | + 'public' => true, |
|
1219 | + 'hierarchical' => false, |
|
1220 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1221 | + 'query_var' => true, |
|
1222 | + |
|
1223 | + 'labels' => array( |
|
1224 | + 'name' => __('Place Tags', 'geodirectory'), |
|
1225 | + 'singular_name' => __('Place Tag', 'geodirectory'), |
|
1226 | + 'search_items' => __('Search Place Tags', 'geodirectory'), |
|
1227 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'), |
|
1228 | + 'all_items' => __('All Place Tags', 'geodirectory'), |
|
1229 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'), |
|
1230 | + 'update_item' => __('Update Place Tag', 'geodirectory'), |
|
1231 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'), |
|
1232 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'), |
|
1233 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'), |
|
1234 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'), |
|
1235 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'), |
|
1236 | + ), |
|
1237 | + ); |
|
1238 | + |
|
1239 | + |
|
1240 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1241 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
1242 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1243 | + |
|
1244 | + |
|
1245 | + // Update post types and delete tmp options |
|
1246 | + flush_rewrite_rules(); |
|
1247 | + |
|
1248 | + } |
|
1249 | + |
|
1250 | + //if ( ! taxonomy_exists('gd_placecategory') ) |
|
1251 | + { |
|
1252 | + |
|
1253 | + $gd_placecategory = array(); |
|
1254 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
1255 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
1256 | + $gd_placecategory['args'] = array( |
|
1257 | + 'public' => true, |
|
1258 | + 'hierarchical' => true, |
|
1259 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1260 | + 'query_var' => true, |
|
1261 | + 'labels' => array( |
|
1262 | + 'name' => __('Place Categories', 'geodirectory'), |
|
1263 | + 'singular_name' => __('Place Category', 'geodirectory'), |
|
1264 | + 'search_items' => __('Search Place Categories', 'geodirectory'), |
|
1265 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'), |
|
1266 | + 'all_items' => __('All Place Categories', 'geodirectory'), |
|
1267 | + 'edit_item' => __('Edit Place Category', 'geodirectory'), |
|
1268 | + 'update_item' => __('Update Place Category', 'geodirectory'), |
|
1269 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'), |
|
1270 | + 'new_item_name' => __('New Place Category', 'geodirectory'), |
|
1271 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'), |
|
1272 | + ), |
|
1273 | + ); |
|
1274 | + |
|
1275 | + |
|
1276 | + $geodir_taxonomies = get_option('geodir_taxonomies'); |
|
1277 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
1278 | + update_option('geodir_taxonomies', $geodir_taxonomies); |
|
1279 | + |
|
1280 | + |
|
1281 | + flush_rewrite_rules(); |
|
1282 | + } |
|
1283 | + |
|
1284 | + /** |
|
1285 | + * Post Types |
|
1286 | + **/ |
|
1287 | + |
|
1288 | + //if ( ! post_type_exists('gd_place') ) |
|
1289 | + { |
|
1290 | + |
|
1291 | + $labels = array( |
|
1292 | + 'name' => __('Places', 'geodirectory'), |
|
1293 | + 'singular_name' => __('Place', 'geodirectory'), |
|
1294 | + 'add_new' => __('Add New', 'geodirectory'), |
|
1295 | + 'add_new_item' => __('Add New Place', 'geodirectory'), |
|
1296 | + 'edit_item' => __('Edit Place', 'geodirectory'), |
|
1297 | + 'new_item' => __('New Place', 'geodirectory'), |
|
1298 | + 'view_item' => __('View Place', 'geodirectory'), |
|
1299 | + 'search_items' => __('Search Places', 'geodirectory'), |
|
1300 | + 'not_found' => __('No Place Found', 'geodirectory'), |
|
1301 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory')); |
|
1302 | + |
|
1303 | + $place_default = array( |
|
1304 | + 'labels' => $labels, |
|
1305 | + 'can_export' => true, |
|
1306 | + 'capability_type' => 'post', |
|
1307 | + 'description' => 'Place post type.', |
|
1308 | + 'has_archive' => $listing_slug, |
|
1309 | + 'hierarchical' => false, |
|
1310 | + 'map_meta_cap' => true, |
|
1311 | + 'menu_icon' => $menu_icon, |
|
1312 | + 'public' => true, |
|
1313 | + 'query_var' => true, |
|
1314 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true), |
|
1315 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
|
1316 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
|
1317 | + |
|
1318 | + //Update custom post types |
|
1319 | + $geodir_post_types = get_option('geodir_post_types'); |
|
1320 | + $geodir_post_types['gd_place'] = $place_default; |
|
1321 | + update_option('geodir_post_types', $geodir_post_types); |
|
1322 | + |
|
1323 | + // Update post types and delete tmp options |
|
1324 | + flush_rewrite_rules(); |
|
1325 | + } |
|
1326 | + |
|
1327 | + |
|
1328 | + geodir_register_taxonomies(); |
|
1329 | + geodir_register_post_types(); |
|
1330 | + |
|
1331 | + //die; |
|
1332 | 1332 | |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | $gd_wpml_get_languages = ""; |
1336 | 1336 | function gd_wpml_get_lang_from_url($url){ |
1337 | 1337 | |
1338 | - global $gd_wpml_get_languages; |
|
1339 | - if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];} |
|
1338 | + global $gd_wpml_get_languages; |
|
1339 | + if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];} |
|
1340 | 1340 | |
1341 | 1341 | |
1342 | - // |
|
1343 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1344 | - $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url')); |
|
1342 | + // |
|
1343 | + $url = str_replace(array("http://","https://"),"",$url); |
|
1344 | + $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url')); |
|
1345 | 1345 | |
1346 | - $url = str_replace($site_url,"",$url); |
|
1346 | + $url = str_replace($site_url,"",$url); |
|
1347 | 1347 | |
1348 | 1348 | |
1349 | - $segments = explode('/', trim($url, '/')); |
|
1349 | + $segments = explode('/', trim($url, '/')); |
|
1350 | 1350 | |
1351 | - //print_r( $segments); |
|
1352 | - if($gd_wpml_get_languages){ |
|
1353 | - $langs = $gd_wpml_get_languages; |
|
1354 | - }else{ |
|
1355 | - global $sitepress; |
|
1356 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1357 | - } |
|
1351 | + //print_r( $segments); |
|
1352 | + if($gd_wpml_get_languages){ |
|
1353 | + $langs = $gd_wpml_get_languages; |
|
1354 | + }else{ |
|
1355 | + global $sitepress; |
|
1356 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
1357 | + } |
|
1358 | 1358 | |
1359 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1360 | - return $segments[0]; |
|
1361 | - } |
|
1359 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) { |
|
1360 | + return $segments[0]; |
|
1361 | + } |
|
1362 | 1362 | |
1363 | - return false; |
|
1363 | + return false; |
|
1364 | 1364 | |
1365 | 1365 | |
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | function gd_wpml_slug_translation_turned_on($post_type) { |
1369 | 1369 | |
1370 | - global $sitepress; |
|
1371 | - $settings = $sitepress->get_settings(); |
|
1372 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1373 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
1374 | - && isset($settings['posts_slug_translation']['on']) |
|
1375 | - && $settings['posts_slug_translation']['on']; |
|
1370 | + global $sitepress; |
|
1371 | + $settings = $sitepress->get_settings(); |
|
1372 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
1373 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
1374 | + && isset($settings['posts_slug_translation']['on']) |
|
1375 | + && $settings['posts_slug_translation']['on']; |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | |
@@ -1395,142 +1395,142 @@ discard block |
||
1395 | 1395 | */ |
1396 | 1396 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
1397 | 1397 | { |
1398 | - //echo $post_link."<br />".$sample ; |
|
1398 | + //echo $post_link."<br />".$sample ; |
|
1399 | 1399 | |
1400 | 1400 | |
1401 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
1402 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1403 | - } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') { |
|
1404 | - return $post_link; |
|
1405 | - } else { |
|
1406 | - $orig_post = $post; |
|
1407 | - $post = $post_obj; |
|
1408 | - } |
|
1401 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
1402 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) { |
|
1403 | + } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') { |
|
1404 | + return $post_link; |
|
1405 | + } else { |
|
1406 | + $orig_post = $post; |
|
1407 | + $post = $post_obj; |
|
1408 | + } |
|
1409 | 1409 | |
1410 | - if (in_array($post->post_type, geodir_get_posttypes())) { |
|
1410 | + if (in_array($post->post_type, geodir_get_posttypes())) { |
|
1411 | 1411 | |
1412 | 1412 | |
1413 | - $post_types = get_option('geodir_post_types'); |
|
1414 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1413 | + $post_types = get_option('geodir_post_types'); |
|
1414 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
1415 | 1415 | |
1416 | - // Alter the CPT slug if WPML is set to do so |
|
1417 | - if(function_exists('icl_object_id')){ |
|
1418 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1416 | + // Alter the CPT slug if WPML is set to do so |
|
1417 | + if(function_exists('icl_object_id')){ |
|
1418 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1419 | 1419 | |
1420 | - $org_slug = $slug; |
|
1421 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1422 | - $slug, |
|
1423 | - 'WordPress', |
|
1424 | - 'URL slug: ' . $slug, |
|
1425 | - $language_code); |
|
1420 | + $org_slug = $slug; |
|
1421 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
1422 | + $slug, |
|
1423 | + 'WordPress', |
|
1424 | + 'URL slug: ' . $slug, |
|
1425 | + $language_code); |
|
1426 | 1426 | |
1427 | - if(!$slug){$slug = $org_slug;} |
|
1427 | + if(!$slug){$slug = $org_slug;} |
|
1428 | 1428 | |
1429 | - } |
|
1430 | - } |
|
1429 | + } |
|
1430 | + } |
|
1431 | 1431 | |
1432 | 1432 | // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
1433 | - $site_url = trailingslashit(get_bloginfo('url')); |
|
1433 | + $site_url = trailingslashit(get_bloginfo('url')); |
|
1434 | 1434 | |
1435 | 1435 | $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
1436 | 1436 | if ($fix_url) { |
1437 | 1437 | $post_link = str_replace($site_url, '', $post_link); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | - $post_link = trailingslashit( |
|
1441 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1442 | - ); |
|
1440 | + $post_link = trailingslashit( |
|
1441 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1442 | + ); |
|
1443 | 1443 | |
1444 | 1444 | if ($fix_url) { |
1445 | 1445 | $post_link = $site_url . $post_link; |
1446 | 1446 | } |
1447 | 1447 | |
1448 | - if (isset($comment_post_cache[$post->ID])) { |
|
1449 | - $post = $comment_post_cache[$post->ID]; |
|
1450 | - } |
|
1451 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1452 | - $post_id = $post->ID; |
|
1453 | - if (isset($orig_post)) { |
|
1454 | - $post = $orig_post; |
|
1455 | - } |
|
1456 | - return $gd_permalink_cache[$post_id]; |
|
1457 | - } |
|
1458 | - |
|
1459 | - if (!isset($post->post_locations)) { |
|
1460 | - $post_type = $post->post_type; |
|
1461 | - $ID = $post->ID; |
|
1462 | - $post2 = $wpdb->get_row( |
|
1463 | - $wpdb->prepare( |
|
1464 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1465 | - array($post->ID) |
|
1466 | - ) |
|
1467 | - ); |
|
1448 | + if (isset($comment_post_cache[$post->ID])) { |
|
1449 | + $post = $comment_post_cache[$post->ID]; |
|
1450 | + } |
|
1451 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) { |
|
1452 | + $post_id = $post->ID; |
|
1453 | + if (isset($orig_post)) { |
|
1454 | + $post = $orig_post; |
|
1455 | + } |
|
1456 | + return $gd_permalink_cache[$post_id]; |
|
1457 | + } |
|
1468 | 1458 | |
1469 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1459 | + if (!isset($post->post_locations)) { |
|
1460 | + $post_type = $post->post_type; |
|
1461 | + $ID = $post->ID; |
|
1462 | + $post2 = $wpdb->get_row( |
|
1463 | + $wpdb->prepare( |
|
1464 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1465 | + array($post->ID) |
|
1466 | + ) |
|
1467 | + ); |
|
1470 | 1468 | |
1471 | - $comment_post_cache[$post->ID] = $post; |
|
1472 | - } |
|
1469 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
1473 | 1470 | |
1471 | + $comment_post_cache[$post->ID] = $post; |
|
1472 | + } |
|
1474 | 1473 | |
1475 | 1474 | |
1476 | - if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1477 | 1475 | |
1478 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1479 | - $location_request = ''; |
|
1476 | + if (false !== strpos($post_link, '%gd_taxonomy%')) { |
|
1480 | 1477 | |
1478 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1479 | + $location_request = ''; |
|
1481 | 1480 | |
1482 | - if (!empty($post->post_locations)) { |
|
1483 | - $geodir_arr_locations = explode(',', $post->post_locations); |
|
1484 | - if (count($geodir_arr_locations) == 3) { |
|
1485 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1486 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1487 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1488 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1489 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1490 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1491 | 1481 | |
1492 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1493 | - 'region_slug' => $post->region_slug, |
|
1494 | - 'city_slug' => $post->city_slug |
|
1495 | - ); |
|
1482 | + if (!empty($post->post_locations)) { |
|
1483 | + $geodir_arr_locations = explode(',', $post->post_locations); |
|
1484 | + if (count($geodir_arr_locations) == 3) { |
|
1485 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1486 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1487 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1488 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1489 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1490 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1496 | 1491 | |
1497 | - } else |
|
1498 | - $post_location = geodir_get_location(); |
|
1492 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1493 | + 'region_slug' => $post->region_slug, |
|
1494 | + 'city_slug' => $post->city_slug |
|
1495 | + ); |
|
1499 | 1496 | |
1497 | + } else |
|
1498 | + $post_location = geodir_get_location(); |
|
1500 | 1499 | |
1501 | - } else { |
|
1502 | 1500 | |
1503 | - $post_location_sql = $wpdb->get_results( |
|
1504 | - $wpdb->prepare( |
|
1505 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1506 | - array($post->ID) |
|
1507 | - ) |
|
1508 | - ); |
|
1509 | - |
|
1510 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1511 | - |
|
1512 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1513 | - if (count($geodir_arr_locations) == 3) { |
|
1514 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1515 | - $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1516 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1517 | - $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1518 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1519 | - $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1520 | - |
|
1521 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1522 | - 'region_slug' => $post->region_slug, |
|
1523 | - 'city_slug' => $post->city_slug |
|
1524 | - ); |
|
1501 | + } else { |
|
1525 | 1502 | |
1526 | - } |
|
1527 | - } else |
|
1528 | - $post_location = geodir_get_location(); |
|
1529 | - } |
|
1503 | + $post_location_sql = $wpdb->get_results( |
|
1504 | + $wpdb->prepare( |
|
1505 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1506 | + array($post->ID) |
|
1507 | + ) |
|
1508 | + ); |
|
1509 | + |
|
1510 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) { |
|
1511 | + |
|
1512 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations); |
|
1513 | + if (count($geodir_arr_locations) == 3) { |
|
1514 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]); |
|
1515 | + $post->city_slug = str_replace(']', '', $post->city_slug); |
|
1516 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]); |
|
1517 | + $post->region_slug = str_replace(']', '', $post->region_slug); |
|
1518 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
|
1519 | + $post->country_slug = str_replace(']', '', $post->country_slug); |
|
1520 | + |
|
1521 | + $post_location = (object)array('country_slug' => $post->country_slug, |
|
1522 | + 'region_slug' => $post->region_slug, |
|
1523 | + 'city_slug' => $post->city_slug |
|
1524 | + ); |
|
1525 | + |
|
1526 | + } |
|
1527 | + } else |
|
1528 | + $post_location = geodir_get_location(); |
|
1529 | + } |
|
1530 | 1530 | |
1531 | 1531 | |
1532 | - if (!empty($post_location)) { |
|
1533 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1532 | + if (!empty($post_location)) { |
|
1533 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
1534 | 1534 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
1535 | 1535 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
1536 | 1536 | |
@@ -1548,78 +1548,78 @@ discard block |
||
1548 | 1548 | $location_slug[] = $city_slug; |
1549 | 1549 | |
1550 | 1550 | $location_request .= implode('/', $location_slug) . '/'; |
1551 | - } |
|
1552 | - } |
|
1551 | + } |
|
1552 | + } |
|
1553 | 1553 | |
1554 | - if (get_option('geodir_add_categories_url')) { |
|
1554 | + if (get_option('geodir_add_categories_url')) { |
|
1555 | 1555 | |
1556 | - $term_request = ''; |
|
1557 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1556 | + $term_request = ''; |
|
1557 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
1558 | 1558 | |
1559 | - $taxonomies = end($taxonomies); |
|
1559 | + $taxonomies = end($taxonomies); |
|
1560 | 1560 | |
1561 | - if (!empty($post->default_category)) { |
|
1562 | - $post_terms = $post->default_category; |
|
1563 | - } else { |
|
1564 | - $post_terms = ''; |
|
1561 | + if (!empty($post->default_category)) { |
|
1562 | + $post_terms = $post->default_category; |
|
1563 | + } else { |
|
1564 | + $post_terms = ''; |
|
1565 | 1565 | |
1566 | - if (isset($post->$taxonomies)) { |
|
1567 | - $post_terms = explode(",", trim($post->$taxonomies, ",")); |
|
1568 | - $post_terms = $post_terms[0]; |
|
1569 | - } |
|
1566 | + if (isset($post->$taxonomies)) { |
|
1567 | + $post_terms = explode(",", trim($post->$taxonomies, ",")); |
|
1568 | + $post_terms = $post_terms[0]; |
|
1569 | + } |
|
1570 | 1570 | |
1571 | - if (!$post_terms) |
|
1572 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1571 | + if (!$post_terms) |
|
1572 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1573 | 1573 | |
1574 | - if (!$post_terms) { |
|
1575 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1574 | + if (!$post_terms) { |
|
1575 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
1576 | 1576 | |
1577 | - if ($post_terms) { |
|
1578 | - $post_terms = explode(",", trim($post_terms, ",")); |
|
1579 | - $post_terms = $post_terms[0]; |
|
1580 | - } |
|
1581 | - } |
|
1582 | - } |
|
1577 | + if ($post_terms) { |
|
1578 | + $post_terms = explode(",", trim($post_terms, ",")); |
|
1579 | + $post_terms = $post_terms[0]; |
|
1580 | + } |
|
1581 | + } |
|
1582 | + } |
|
1583 | 1583 | |
1584 | - $term = get_term_by('id', $post_terms, $taxonomies); |
|
1584 | + $term = get_term_by('id', $post_terms, $taxonomies); |
|
1585 | 1585 | |
1586 | - if (!empty($term)) |
|
1587 | - $term_request = $term->slug; |
|
1588 | - //$term_request = $term->slug.'/'; |
|
1589 | - } |
|
1586 | + if (!empty($term)) |
|
1587 | + $term_request = $term->slug; |
|
1588 | + //$term_request = $term->slug.'/'; |
|
1589 | + } |
|
1590 | 1590 | |
1591 | - $request_term = ''; |
|
1592 | - $listingurl_separator = ''; |
|
1593 | - //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1594 | - $detailurl_separator = ''; |
|
1595 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1596 | - $request_term = $location_request; |
|
1597 | - //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1598 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1599 | - $request_term .= $term_request; |
|
1591 | + $request_term = ''; |
|
1592 | + $listingurl_separator = ''; |
|
1593 | + //$detailurl_separator = get_option('geodir_detailurl_separator'); |
|
1594 | + $detailurl_separator = ''; |
|
1595 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') { |
|
1596 | + $request_term = $location_request; |
|
1597 | + //$listingurl_separator = get_option('geodir_listingurl_separator'); |
|
1598 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
1599 | + $request_term .= $term_request; |
|
1600 | 1600 | |
1601 | - } else { |
|
1602 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1601 | + } else { |
|
1602 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1603 | 1603 | |
1604 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1605 | - } |
|
1606 | - $request_term = trim($request_term, '/'); |
|
1607 | - if (!empty($request_term)) |
|
1608 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1609 | - else |
|
1610 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1611 | - //echo $post_link ; |
|
1612 | - } |
|
1613 | - // temp cache the permalink |
|
1614 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1615 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
1616 | - } |
|
1617 | - } |
|
1618 | - if (isset($orig_post)) { |
|
1619 | - $post = $orig_post; |
|
1620 | - } |
|
1621 | - //echo $post_link ; |
|
1622 | - return $post_link; |
|
1604 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1605 | + } |
|
1606 | + $request_term = trim($request_term, '/'); |
|
1607 | + if (!empty($request_term)) |
|
1608 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1609 | + else |
|
1610 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1611 | + //echo $post_link ; |
|
1612 | + } |
|
1613 | + // temp cache the permalink |
|
1614 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) { |
|
1615 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
1616 | + } |
|
1617 | + } |
|
1618 | + if (isset($orig_post)) { |
|
1619 | + $post = $orig_post; |
|
1620 | + } |
|
1621 | + //echo $post_link ; |
|
1622 | + return $post_link; |
|
1623 | 1623 | |
1624 | 1624 | } |
1625 | 1625 | |
@@ -1636,103 +1636,103 @@ discard block |
||
1636 | 1636 | * @return string The term link. |
1637 | 1637 | */ |
1638 | 1638 | function geodir_term_link($termlink, $term, $taxonomy) { |
1639 | - $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1639 | + $geodir_taxonomies = geodir_get_taxonomies('', true); |
|
1640 | 1640 | |
1641 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1642 | - global $geodir_add_location_url, $gd_session; |
|
1643 | - $include_location = false; |
|
1644 | - $request_term = array(); |
|
1641 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) { |
|
1642 | + global $geodir_add_location_url, $gd_session; |
|
1643 | + $include_location = false; |
|
1644 | + $request_term = array(); |
|
1645 | 1645 | |
1646 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1646 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
1647 | 1647 | |
1648 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1649 | - if ($geodir_add_location_url && get_option('geodir_add_location_url')) { |
|
1650 | - $include_location = true; |
|
1651 | - } |
|
1652 | - } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) |
|
1653 | - $include_location = true; |
|
1648 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') { |
|
1649 | + if ($geodir_add_location_url && get_option('geodir_add_location_url')) { |
|
1650 | + $include_location = true; |
|
1651 | + } |
|
1652 | + } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) |
|
1653 | + $include_location = true; |
|
1654 | 1654 | |
1655 | - if ($include_location) { |
|
1656 | - global $post; |
|
1655 | + if ($include_location) { |
|
1656 | + global $post; |
|
1657 | 1657 | |
1658 | 1658 | $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
1659 | 1659 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
1660 | 1660 | |
1661 | 1661 | if(geodir_is_page('detail') && isset($post->country_slug)){ |
1662 | - $location_terms = array( |
|
1663 | - 'gd_country' => $post->country_slug, |
|
1664 | - 'gd_region' => $post->region_slug, |
|
1665 | - 'gd_city' => $post->city_slug |
|
1666 | - ); |
|
1662 | + $location_terms = array( |
|
1663 | + 'gd_country' => $post->country_slug, |
|
1664 | + 'gd_region' => $post->region_slug, |
|
1665 | + 'gd_city' => $post->city_slug |
|
1666 | + ); |
|
1667 | 1667 | |
1668 | 1668 | if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
1669 | 1669 | $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
1670 | 1670 | } |
1671 | - } else { |
|
1672 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1673 | - } |
|
1671 | + } else { |
|
1672 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1673 | + } |
|
1674 | 1674 | |
1675 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1676 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
1675 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1676 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
1677 | 1677 | |
1678 | - if (!empty($location_terms)) { |
|
1678 | + if (!empty($location_terms)) { |
|
1679 | 1679 | |
1680 | - $url_separator = '';//get_option('geodir_listingurl_separator'); |
|
1680 | + $url_separator = '';//get_option('geodir_listingurl_separator'); |
|
1681 | 1681 | |
1682 | - if (get_option('permalink_structure') != '') { |
|
1683 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
1684 | - $request_term = implode("/", $location_terms); |
|
1685 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1682 | + if (get_option('permalink_structure') != '') { |
|
1683 | + $old_listing_slug = '/' . $listing_slug . '/'; |
|
1684 | + $request_term = implode("/", $location_terms); |
|
1685 | + $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1686 | 1686 | |
1687 | - $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
1688 | - } else { |
|
1689 | - $termlink = geodir_getlink($termlink, $request_term); |
|
1690 | - } |
|
1691 | - } |
|
1692 | - } |
|
1687 | + $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
1688 | + } else { |
|
1689 | + $termlink = geodir_getlink($termlink, $request_term); |
|
1690 | + } |
|
1691 | + } |
|
1692 | + } |
|
1693 | 1693 | |
1694 | - // Alter the CPT slug is WPML is set to do so |
|
1695 | - /* we can replace this with the below function |
|
1694 | + // Alter the CPT slug is WPML is set to do so |
|
1695 | + /* we can replace this with the below function |
|
1696 | 1696 | if(function_exists('icl_object_id')){ |
1697 | 1697 | global $sitepress; |
1698 | 1698 | $post_type = str_replace("category","",$taxonomy); |
1699 | 1699 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
1700 | 1700 | }*/ |
1701 | 1701 | |
1702 | - // Alter the CPT slug if WPML is set to do so |
|
1703 | - if(function_exists('icl_object_id')){ |
|
1704 | - $post_types = get_option('geodir_post_types'); |
|
1705 | - $post_type = str_replace("category","",$taxonomy); |
|
1702 | + // Alter the CPT slug if WPML is set to do so |
|
1703 | + if(function_exists('icl_object_id')){ |
|
1704 | + $post_types = get_option('geodir_post_types'); |
|
1705 | + $post_type = str_replace("category","",$taxonomy); |
|
1706 | 1706 | $post_type = str_replace("_tags","",$post_type); |
1707 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1708 | - if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
|
1707 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
1708 | + if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
|
1709 | 1709 | |
1710 | - global $sitepress; |
|
1711 | - $default_lang = $sitepress->get_default_language(); |
|
1712 | - $language_code = gd_wpml_get_lang_from_url($termlink); |
|
1713 | - if(!$language_code ){$language_code = $default_lang;} |
|
1710 | + global $sitepress; |
|
1711 | + $default_lang = $sitepress->get_default_language(); |
|
1712 | + $language_code = gd_wpml_get_lang_from_url($termlink); |
|
1713 | + if(!$language_code ){$language_code = $default_lang;} |
|
1714 | 1714 | |
1715 | - $org_slug = $slug; |
|
1716 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1717 | - $slug, |
|
1718 | - 'WordPress', |
|
1719 | - 'URL slug: ' . $slug, |
|
1720 | - $language_code); |
|
1715 | + $org_slug = $slug; |
|
1716 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
1717 | + $slug, |
|
1718 | + 'WordPress', |
|
1719 | + 'URL slug: ' . $slug, |
|
1720 | + $language_code); |
|
1721 | 1721 | |
1722 | 1722 | |
1723 | - if(!$slug){$slug = $org_slug;} |
|
1723 | + if(!$slug){$slug = $org_slug;} |
|
1724 | 1724 | |
1725 | - $termlink = trailingslashit( |
|
1725 | + $termlink = trailingslashit( |
|
1726 | 1726 | |
1727 | - preg_replace( "/" . preg_quote( $org_slug, "/" ) . "/", $slug ,$termlink, 1 ) |
|
1728 | - ); |
|
1727 | + preg_replace( "/" . preg_quote( $org_slug, "/" ) . "/", $slug ,$termlink, 1 ) |
|
1728 | + ); |
|
1729 | 1729 | |
1730 | - } |
|
1731 | - } |
|
1730 | + } |
|
1731 | + } |
|
1732 | 1732 | |
1733 | - } |
|
1733 | + } |
|
1734 | 1734 | |
1735 | - return $termlink; |
|
1735 | + return $termlink; |
|
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | /** |
@@ -1758,14 +1758,14 @@ discard block |
||
1758 | 1758 | if (in_array($post_type, geodir_get_posttypes())) { |
1759 | 1759 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1760 | 1760 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
1761 | - $location_terms = array( |
|
1762 | - 'gd_country' => $post->country_slug, |
|
1763 | - 'gd_region' => $post->region_slug, |
|
1764 | - 'gd_city' => $post->city_slug |
|
1765 | - ); |
|
1766 | - } else { |
|
1767 | - $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1768 | - } |
|
1761 | + $location_terms = array( |
|
1762 | + 'gd_country' => $post->country_slug, |
|
1763 | + 'gd_region' => $post->region_slug, |
|
1764 | + 'gd_city' => $post->city_slug |
|
1765 | + ); |
|
1766 | + } else { |
|
1767 | + $location_terms = geodir_get_current_location_terms('query_vars'); |
|
1768 | + } |
|
1769 | 1769 | |
1770 | 1770 | $location_terms = geodir_remove_location_terms($location_terms); |
1771 | 1771 | |
@@ -1796,14 +1796,14 @@ discard block |
||
1796 | 1796 | */ |
1797 | 1797 | function get_post_type_singular_label($post_type, $echo = false) |
1798 | 1798 | { |
1799 | - $obj_post_type = get_post_type_object($post_type); |
|
1800 | - if (!is_object($obj_post_type)) { |
|
1801 | - return; |
|
1802 | - } |
|
1803 | - if ($echo) |
|
1804 | - echo $obj_post_type->labels->singular_name; |
|
1805 | - else |
|
1806 | - return $obj_post_type->labels->singular_name; |
|
1799 | + $obj_post_type = get_post_type_object($post_type); |
|
1800 | + if (!is_object($obj_post_type)) { |
|
1801 | + return; |
|
1802 | + } |
|
1803 | + if ($echo) |
|
1804 | + echo $obj_post_type->labels->singular_name; |
|
1805 | + else |
|
1806 | + return $obj_post_type->labels->singular_name; |
|
1807 | 1807 | |
1808 | 1808 | } |
1809 | 1809 | |
@@ -1818,16 +1818,16 @@ discard block |
||
1818 | 1818 | */ |
1819 | 1819 | function get_post_type_plural_label($post_type, $echo = false) |
1820 | 1820 | { |
1821 | - $all_postypes = geodir_get_posttypes(); |
|
1821 | + $all_postypes = geodir_get_posttypes(); |
|
1822 | 1822 | |
1823 | - if (!in_array($post_type, $all_postypes)) |
|
1824 | - return false; |
|
1823 | + if (!in_array($post_type, $all_postypes)) |
|
1824 | + return false; |
|
1825 | 1825 | |
1826 | - $obj_post_type = get_post_type_object($post_type); |
|
1827 | - if ($echo) |
|
1828 | - echo $obj_post_type->labels->name; |
|
1829 | - else |
|
1830 | - return $obj_post_type->labels->name; |
|
1826 | + $obj_post_type = get_post_type_object($post_type); |
|
1827 | + if ($echo) |
|
1828 | + echo $obj_post_type->labels->name; |
|
1829 | + else |
|
1830 | + return $obj_post_type->labels->name; |
|
1831 | 1831 | |
1832 | 1832 | } |
1833 | 1833 | |
@@ -1846,51 +1846,51 @@ discard block |
||
1846 | 1846 | */ |
1847 | 1847 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
1848 | 1848 | { |
1849 | - global $wpdb; |
|
1850 | - |
|
1851 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1852 | - $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1853 | - |
|
1854 | - if (is_int($term)) { |
|
1855 | - if (0 == $term) |
|
1856 | - return 0; |
|
1857 | - $where = 't.term_id = %d'; |
|
1858 | - if (!empty($taxonomy)) |
|
1859 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1860 | - else |
|
1861 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1862 | - } |
|
1849 | + global $wpdb; |
|
1850 | + |
|
1851 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
1852 | + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
1853 | + |
|
1854 | + if (is_int($term)) { |
|
1855 | + if (0 == $term) |
|
1856 | + return 0; |
|
1857 | + $where = 't.term_id = %d'; |
|
1858 | + if (!empty($taxonomy)) |
|
1859 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1860 | + else |
|
1861 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1862 | + } |
|
1863 | 1863 | |
1864 | - $term = trim(wp_unslash($term)); |
|
1864 | + $term = trim(wp_unslash($term)); |
|
1865 | 1865 | |
1866 | - if ('' === $slug = sanitize_title($term)) |
|
1867 | - return 0; |
|
1866 | + if ('' === $slug = sanitize_title($term)) |
|
1867 | + return 0; |
|
1868 | 1868 | |
1869 | - $where = 't.slug = %s'; |
|
1869 | + $where = 't.slug = %s'; |
|
1870 | 1870 | |
1871 | - $where_fields = array($slug); |
|
1872 | - if (!empty($taxonomy)) { |
|
1873 | - $parent = (int)$parent; |
|
1874 | - if ($parent > 0) { |
|
1875 | - $where_fields[] = $parent; |
|
1876 | - $else_where_fields[] = $parent; |
|
1877 | - $where .= ' AND tt.parent = %d'; |
|
1871 | + $where_fields = array($slug); |
|
1872 | + if (!empty($taxonomy)) { |
|
1873 | + $parent = (int)$parent; |
|
1874 | + if ($parent > 0) { |
|
1875 | + $where_fields[] = $parent; |
|
1876 | + $else_where_fields[] = $parent; |
|
1877 | + $where .= ' AND tt.parent = %d'; |
|
1878 | 1878 | |
1879 | - } |
|
1879 | + } |
|
1880 | 1880 | |
1881 | - $where_fields[] = $taxonomy; |
|
1881 | + $where_fields[] = $taxonomy; |
|
1882 | 1882 | |
1883 | 1883 | |
1884 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
1885 | - return $result; |
|
1884 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
1885 | + return $result; |
|
1886 | 1886 | |
1887 | - return false; |
|
1888 | - } |
|
1887 | + return false; |
|
1888 | + } |
|
1889 | 1889 | |
1890 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
1891 | - return $result; |
|
1890 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
1891 | + return $result; |
|
1892 | 1892 | |
1893 | - return false; |
|
1893 | + return false; |
|
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | /** |
@@ -1902,7 +1902,7 @@ discard block |
||
1902 | 1902 | function geodir_get_term_icon_rebuild() |
1903 | 1903 | { |
1904 | 1904 | |
1905 | - update_option('gd_term_icons', ''); |
|
1905 | + update_option('gd_term_icons', ''); |
|
1906 | 1906 | |
1907 | 1907 | } |
1908 | 1908 | |
@@ -1920,60 +1920,60 @@ discard block |
||
1920 | 1920 | */ |
1921 | 1921 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
1922 | 1922 | { |
1923 | - global $wpdb; |
|
1924 | - if (!$rebuild) { |
|
1925 | - $terms_icons = get_option('gd_term_icons'); |
|
1926 | - } else { |
|
1927 | - $terms_icons = ''; |
|
1928 | - } |
|
1929 | - |
|
1930 | - if (empty($terms_icons)) { |
|
1931 | - $default_icon_url = get_option('geodir_default_marker_icon'); |
|
1932 | - $taxonomy = geodir_get_taxonomies(); |
|
1933 | - $post_types = geodir_get_posttypes(); |
|
1934 | - $tax_arr = array(); |
|
1935 | - foreach ($post_types as $post_type) { |
|
1936 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
1937 | - } |
|
1938 | - $tax_c = implode(',', $tax_arr); |
|
1939 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
1940 | - //$terms = get_terms( $taxonomy ); |
|
1941 | - |
|
1942 | - if($terms) { |
|
1943 | - foreach ($terms as $term) { |
|
1944 | - $post_type = str_replace("category", "", $term->taxonomy); |
|
1945 | - $a_terms[$post_type][] = $term; |
|
1923 | + global $wpdb; |
|
1924 | + if (!$rebuild) { |
|
1925 | + $terms_icons = get_option('gd_term_icons'); |
|
1926 | + } else { |
|
1927 | + $terms_icons = ''; |
|
1928 | + } |
|
1946 | 1929 | |
1947 | - } |
|
1948 | - } |
|
1930 | + if (empty($terms_icons)) { |
|
1931 | + $default_icon_url = get_option('geodir_default_marker_icon'); |
|
1932 | + $taxonomy = geodir_get_taxonomies(); |
|
1933 | + $post_types = geodir_get_posttypes(); |
|
1934 | + $tax_arr = array(); |
|
1935 | + foreach ($post_types as $post_type) { |
|
1936 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
1937 | + } |
|
1938 | + $tax_c = implode(',', $tax_arr); |
|
1939 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
|
1940 | + //$terms = get_terms( $taxonomy ); |
|
1949 | 1941 | |
1950 | - if($a_terms) { |
|
1951 | - foreach ($a_terms as $pt => $t2) { |
|
1942 | + if($terms) { |
|
1943 | + foreach ($terms as $term) { |
|
1944 | + $post_type = str_replace("category", "", $term->taxonomy); |
|
1945 | + $a_terms[$post_type][] = $term; |
|
1952 | 1946 | |
1953 | - foreach ($t2 as $term) { |
|
1954 | - $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
1955 | - if ($term_icon) { |
|
1956 | - $term_icon_url = $term_icon["src"]; |
|
1957 | - } else { |
|
1958 | - $term_icon_url = $default_icon_url; |
|
1959 | - } |
|
1960 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
1961 | - } |
|
1962 | - } |
|
1963 | - } |
|
1947 | + } |
|
1948 | + } |
|
1964 | 1949 | |
1965 | - update_option('gd_term_icons', $terms_icons); |
|
1966 | - } |
|
1950 | + if($a_terms) { |
|
1951 | + foreach ($a_terms as $pt => $t2) { |
|
1967 | 1952 | |
1968 | - if ($term_id && isset($terms_icons[$term_id])) { |
|
1969 | - return $terms_icons[$term_id]; |
|
1970 | - } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
1971 | - return get_option('geodir_default_marker_icon'); |
|
1972 | - } |
|
1953 | + foreach ($t2 as $term) { |
|
1954 | + $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
1955 | + if ($term_icon) { |
|
1956 | + $term_icon_url = $term_icon["src"]; |
|
1957 | + } else { |
|
1958 | + $term_icon_url = $default_icon_url; |
|
1959 | + } |
|
1960 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
1961 | + } |
|
1962 | + } |
|
1963 | + } |
|
1964 | + |
|
1965 | + update_option('gd_term_icons', $terms_icons); |
|
1966 | + } |
|
1973 | 1967 | |
1974 | - if (is_ssl()) { |
|
1975 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
1976 | - } |
|
1968 | + if ($term_id && isset($terms_icons[$term_id])) { |
|
1969 | + return $terms_icons[$term_id]; |
|
1970 | + } elseif ($term_id && !isset($terms_icons[$term_id])) { |
|
1971 | + return get_option('geodir_default_marker_icon'); |
|
1972 | + } |
|
1973 | + |
|
1974 | + if (is_ssl()) { |
|
1975 | + $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
1976 | + } |
|
1977 | 1977 | |
1978 | - return $terms_icons; |
|
1978 | + return $terms_icons; |
|
1979 | 1979 | } |
1980 | 1980 | \ No newline at end of file |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | if (get_option('geodir_show_listing_nav')) { |
40 | 40 | |
41 | 41 | $menu_class = ''; |
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
42 | + if (geodir_is_page('listing')) { |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | |
46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) { |
53 | 54 | if (get_post_type_archive_link($post_type)) { |
54 | 55 | $menu_class = ''; |
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
57 | + $menu_class = 'current-menu-item'; |
|
58 | + } |
|
57 | 59 | /** |
58 | 60 | * Filter the menu li class. |
59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | if (get_post_type_archive_link($post_type)) { |
131 | 133 | |
132 | 134 | $menu_class = ''; |
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
136 | + $menu_class = 'current-menu-item'; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -153,8 +156,9 @@ discard block |
||
153 | 156 | if (get_option('geodir_show_addlisting_nav')) { |
154 | 157 | |
155 | 158 | $menu_class = ''; |
156 | - if (geodir_is_page('add-listing')) |
|
157 | - $menu_class = 'current-menu-item'; |
|
159 | + if (geodir_is_page('add-listing')) { |
|
160 | + $menu_class = 'current-menu-item'; |
|
161 | + } |
|
158 | 162 | |
159 | 163 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
160 | 164 | $post_types = geodir_get_posttypes('object'); |
@@ -170,8 +174,9 @@ discard block |
||
170 | 174 | if (geodir_get_addlisting_link($post_type)) { |
171 | 175 | |
172 | 176 | $menu_class = ''; |
173 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
174 | - $menu_class = 'current-menu-item'; |
|
177 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
178 | + $menu_class = 'current-menu-item'; |
|
179 | + } |
|
175 | 180 | /** |
176 | 181 | * Filter the menu li class. |
177 | 182 | * |
@@ -255,8 +260,9 @@ discard block |
||
255 | 260 | if (geodir_get_addlisting_link($post_type)) { |
256 | 261 | |
257 | 262 | $menu_class = ''; |
258 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
259 | - $menu_class = 'current-menu-item'; |
|
263 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
264 | + $menu_class = 'current-menu-item'; |
|
265 | + } |
|
260 | 266 | /** |
261 | 267 | * Filter the menu li class. |
262 | 268 | * |
@@ -311,8 +317,9 @@ discard block |
||
311 | 317 | } |
312 | 318 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
313 | 319 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
314 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
315 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
320 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
321 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
322 | + } |
|
316 | 323 | |
317 | 324 | return $menu; |
318 | 325 | |
@@ -398,24 +405,28 @@ discard block |
||
398 | 405 | $geodir_post_type = get_query_var('post_type'); |
399 | 406 | |
400 | 407 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
401 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
402 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
403 | - elseif (isset($_REQUEST['listing_type'])) |
|
404 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
408 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
409 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
410 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
411 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
412 | + } |
|
405 | 413 | } |
406 | 414 | |
407 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
408 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
415 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
416 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
417 | + } |
|
409 | 418 | |
410 | - if (is_tax()) |
|
411 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
419 | + if (is_tax()) { |
|
420 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
421 | + } |
|
412 | 422 | |
413 | 423 | |
414 | 424 | $all_postypes = geodir_get_posttypes(); |
415 | 425 | $all_postypes = stripslashes_deep($all_postypes); |
416 | 426 | |
417 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
418 | - $geodir_post_type = ''; |
|
427 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
428 | + $geodir_post_type = ''; |
|
429 | + } |
|
419 | 430 | |
420 | 431 | |
421 | 432 | return $geodir_post_type; |
@@ -462,11 +473,12 @@ discard block |
||
462 | 473 | endswitch; |
463 | 474 | } |
464 | 475 | |
465 | - if (!empty($post_types)) |
|
466 | - return $post_types; |
|
467 | - else |
|
468 | - return array(); |
|
469 | -} |
|
476 | + if (!empty($post_types)) { |
|
477 | + return $post_types; |
|
478 | + } else { |
|
479 | + return array(); |
|
480 | + } |
|
481 | + } |
|
470 | 482 | |
471 | 483 | /** |
472 | 484 | * Get Custom Post Type info. |
@@ -483,9 +495,10 @@ discard block |
||
483 | 495 | $post_types = stripslashes_deep($post_types); |
484 | 496 | if (!empty($post_types) && $post_type != '') { |
485 | 497 | return $post_types[$post_type]; |
486 | - } else |
|
487 | - return false; |
|
488 | -} |
|
498 | + } else { |
|
499 | + return false; |
|
500 | + } |
|
501 | + } |
|
489 | 502 | |
490 | 503 | if (!function_exists('geodir_get_taxonomies')) { |
491 | 504 | /** |
@@ -509,18 +522,21 @@ discard block |
||
509 | 522 | $gd_taxonomies = array_keys($taxonomies); |
510 | 523 | |
511 | 524 | |
512 | - if ($post_type != '') |
|
513 | - $gd_taxonomies = array(); |
|
525 | + if ($post_type != '') { |
|
526 | + $gd_taxonomies = array(); |
|
527 | + } |
|
514 | 528 | |
515 | 529 | $i = 0; |
516 | 530 | foreach ($taxonomies as $taxonomy => $args) { |
517 | 531 | |
518 | - if ($post_type != '' && $args['object_type'] == $post_type) |
|
519 | - $gd_taxonomies[] = $taxonomy; |
|
532 | + if ($post_type != '' && $args['object_type'] == $post_type) { |
|
533 | + $gd_taxonomies[] = $taxonomy; |
|
534 | + } |
|
520 | 535 | |
521 | 536 | if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) { |
522 | - if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
523 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
537 | + if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
538 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
539 | + } |
|
524 | 540 | } |
525 | 541 | |
526 | 542 | } |
@@ -575,10 +591,11 @@ discard block |
||
575 | 591 | . ucfirst($category_obj->name) . '</option>'; |
576 | 592 | } |
577 | 593 | |
578 | - if ($echo) |
|
579 | - echo $html; |
|
580 | - else |
|
581 | - return $html; |
|
594 | + if ($echo) { |
|
595 | + echo $html; |
|
596 | + } else { |
|
597 | + return $html; |
|
598 | + } |
|
582 | 599 | } |
583 | 600 | } |
584 | 601 | |
@@ -612,11 +629,12 @@ discard block |
||
612 | 629 | |
613 | 630 | } |
614 | 631 | |
615 | - if (!empty($listing_slug)) |
|
616 | - return $listing_slug; |
|
617 | - else |
|
618 | - return false; |
|
619 | -} |
|
632 | + if (!empty($listing_slug)) { |
|
633 | + return $listing_slug; |
|
634 | + } else { |
|
635 | + return false; |
|
636 | + } |
|
637 | + } |
|
620 | 638 | |
621 | 639 | |
622 | 640 | /** |
@@ -647,16 +665,18 @@ discard block |
||
647 | 665 | if (!empty($taxonomies)) { |
648 | 666 | foreach (geodir_get_posttypes() as $pt) { |
649 | 667 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
650 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
651 | - $post_type[] = $pt; |
|
668 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
669 | + $post_type[] = $pt; |
|
670 | + } |
|
652 | 671 | } |
653 | 672 | } |
654 | 673 | |
655 | - if (!empty($post_type)) |
|
656 | - return $post_type[0]; |
|
657 | - else |
|
658 | - return false; |
|
659 | -} |
|
674 | + if (!empty($post_type)) { |
|
675 | + return $post_type[0]; |
|
676 | + } else { |
|
677 | + return false; |
|
678 | + } |
|
679 | + } |
|
660 | 680 | |
661 | 681 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
662 | 682 | /** |
@@ -712,18 +732,18 @@ discard block |
||
712 | 732 | $checked = ''; |
713 | 733 | |
714 | 734 | if (in_array($cat_term->term_id, $search_terms)) { |
715 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
716 | - $checked = 'selected="selected"'; |
|
717 | - else |
|
718 | - $checked = 'checked="checked"'; |
|
735 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
736 | + $checked = 'selected="selected"'; |
|
737 | + } else { |
|
738 | + $checked = 'checked="checked"'; |
|
739 | + } |
|
719 | 740 | } |
720 | 741 | |
721 | - if ($cat_display == 'radio') |
|
722 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
723 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
724 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
725 | - |
|
726 | - else { |
|
742 | + if ($cat_display == 'radio') { |
|
743 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
744 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
745 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
746 | + } else { |
|
727 | 747 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
728 | 748 | } |
729 | 749 | |
@@ -732,8 +752,9 @@ discard block |
||
732 | 752 | |
733 | 753 | } |
734 | 754 | |
735 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
736 | - $out .= '</div>'; |
|
755 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
756 | + $out .= '</div>'; |
|
757 | + } |
|
737 | 758 | |
738 | 759 | return $out; |
739 | 760 | } |
@@ -759,18 +780,21 @@ discard block |
||
759 | 780 | global $exclude_cats, $gd_session; |
760 | 781 | |
761 | 782 | $cat_exclude = ''; |
762 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
763 | - $cat_exclude = serialize($exclude_cats); |
|
783 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
784 | + $cat_exclude = serialize($exclude_cats); |
|
785 | + } |
|
764 | 786 | |
765 | 787 | if (isset($_REQUEST['backandedit'])) { |
766 | 788 | $post = (object)$gd_session->get('listing'); |
767 | 789 | |
768 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
769 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
790 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
791 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
792 | + } |
|
770 | 793 | |
771 | 794 | $post_categories = $post->post_category_str; |
772 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
773 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
795 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
796 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
797 | + } |
|
774 | 798 | |
775 | 799 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
776 | 800 | global $post; |
@@ -961,8 +985,9 @@ discard block |
||
961 | 985 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
962 | 986 | $post_cat_str = $post_categories[$cat_taxonomy]; |
963 | 987 | $post_cat_array = explode("#", $post_cat_str); |
964 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
965 | - $style = "display:none;"; |
|
988 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
989 | + $style = "display:none;"; |
|
990 | + } |
|
966 | 991 | } |
967 | 992 | ?> |
968 | 993 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
@@ -997,7 +1022,7 @@ discard block |
||
997 | 1022 | print_r($exclude_cats); |
998 | 1023 | if(is_array( $exclude_cats)){ |
999 | 1024 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
1000 | - }else{ |
|
1025 | + } else{ |
|
1001 | 1026 | $exclude_cats = intval($exclude_cats); |
1002 | 1027 | } |
1003 | 1028 | |
@@ -1027,7 +1052,10 @@ discard block |
||
1027 | 1052 | |
1028 | 1053 | <div class="post_default_category"> |
1029 | 1054 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
1030 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1055 | + onchange="update_listing_cat()" <?php if ($default) { |
|
1056 | + echo ' checked="checked" '; |
|
1057 | +} |
|
1058 | +?> /> |
|
1031 | 1059 | <span> |
1032 | 1060 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
1033 | 1061 | </span> |
@@ -1127,8 +1155,9 @@ discard block |
||
1127 | 1155 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
1128 | 1156 | |
1129 | 1157 | $option_selected = ''; |
1130 | - if (!$selected) |
|
1131 | - $option_slected = ' selected="selected" '; |
|
1158 | + if (!$selected) { |
|
1159 | + $option_slected = ' selected="selected" '; |
|
1160 | + } |
|
1132 | 1161 | |
1133 | 1162 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
1134 | 1163 | |
@@ -1136,8 +1165,9 @@ discard block |
||
1136 | 1165 | |
1137 | 1166 | foreach ($cat_terms as $cat_term) { |
1138 | 1167 | $option_selected = ''; |
1139 | - if ($selected == $cat_term->term_id) |
|
1140 | - $option_selected = ' selected="selected" '; |
|
1168 | + if ($selected == $cat_term->term_id) { |
|
1169 | + $option_selected = ' selected="selected" '; |
|
1170 | + } |
|
1141 | 1171 | |
1142 | 1172 | // Count child terms |
1143 | 1173 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1202,8 +1232,9 @@ discard block |
||
1202 | 1232 | |
1203 | 1233 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
1204 | 1234 | |
1205 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1206 | - $listing_slug = 'places'; |
|
1235 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
1236 | + $listing_slug = 'places'; |
|
1237 | + } |
|
1207 | 1238 | |
1208 | 1239 | /** |
1209 | 1240 | * Taxonomies |
@@ -1351,7 +1382,7 @@ discard block |
||
1351 | 1382 | //print_r( $segments); |
1352 | 1383 | if($gd_wpml_get_languages){ |
1353 | 1384 | $langs = $gd_wpml_get_languages; |
1354 | - }else{ |
|
1385 | + } else{ |
|
1355 | 1386 | global $sitepress; |
1356 | 1387 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
1357 | 1388 | } |
@@ -1494,8 +1525,9 @@ discard block |
||
1494 | 1525 | 'city_slug' => $post->city_slug |
1495 | 1526 | ); |
1496 | 1527 | |
1497 | - } else |
|
1498 | - $post_location = geodir_get_location(); |
|
1528 | + } else { |
|
1529 | + $post_location = geodir_get_location(); |
|
1530 | + } |
|
1499 | 1531 | |
1500 | 1532 | |
1501 | 1533 | } else { |
@@ -1524,8 +1556,9 @@ discard block |
||
1524 | 1556 | ); |
1525 | 1557 | |
1526 | 1558 | } |
1527 | - } else |
|
1528 | - $post_location = geodir_get_location(); |
|
1559 | + } else { |
|
1560 | + $post_location = geodir_get_location(); |
|
1561 | + } |
|
1529 | 1562 | } |
1530 | 1563 | |
1531 | 1564 | |
@@ -1568,8 +1601,9 @@ discard block |
||
1568 | 1601 | $post_terms = $post_terms[0]; |
1569 | 1602 | } |
1570 | 1603 | |
1571 | - if (!$post_terms) |
|
1572 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1604 | + if (!$post_terms) { |
|
1605 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1606 | + } |
|
1573 | 1607 | |
1574 | 1608 | if (!$post_terms) { |
1575 | 1609 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1583,8 +1617,9 @@ discard block |
||
1583 | 1617 | |
1584 | 1618 | $term = get_term_by('id', $post_terms, $taxonomies); |
1585 | 1619 | |
1586 | - if (!empty($term)) |
|
1587 | - $term_request = $term->slug; |
|
1620 | + if (!empty($term)) { |
|
1621 | + $term_request = $term->slug; |
|
1622 | + } |
|
1588 | 1623 | //$term_request = $term->slug.'/'; |
1589 | 1624 | } |
1590 | 1625 | |
@@ -1599,15 +1634,20 @@ discard block |
||
1599 | 1634 | $request_term .= $term_request; |
1600 | 1635 | |
1601 | 1636 | } else { |
1602 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1637 | + if (isset($location_request) && $location_request != '') { |
|
1638 | + $request_term = $location_request; |
|
1639 | + } |
|
1603 | 1640 | |
1604 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1641 | + if (isset($term_request) && $term_request != '') { |
|
1642 | + $request_term .= $term_request; |
|
1643 | + } |
|
1605 | 1644 | } |
1606 | 1645 | $request_term = trim($request_term, '/'); |
1607 | - if (!empty($request_term)) |
|
1608 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1609 | - else |
|
1610 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1646 | + if (!empty($request_term)) { |
|
1647 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1648 | + } else { |
|
1649 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1650 | + } |
|
1611 | 1651 | //echo $post_link ; |
1612 | 1652 | } |
1613 | 1653 | // temp cache the permalink |
@@ -1649,8 +1689,9 @@ discard block |
||
1649 | 1689 | if ($geodir_add_location_url && get_option('geodir_add_location_url')) { |
1650 | 1690 | $include_location = true; |
1651 | 1691 | } |
1652 | - } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) |
|
1653 | - $include_location = true; |
|
1692 | + } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1693 | + $include_location = true; |
|
1694 | + } |
|
1654 | 1695 | |
1655 | 1696 | if ($include_location) { |
1656 | 1697 | global $post; |
@@ -1800,10 +1841,11 @@ discard block |
||
1800 | 1841 | if (!is_object($obj_post_type)) { |
1801 | 1842 | return; |
1802 | 1843 | } |
1803 | - if ($echo) |
|
1804 | - echo $obj_post_type->labels->singular_name; |
|
1805 | - else |
|
1806 | - return $obj_post_type->labels->singular_name; |
|
1844 | + if ($echo) { |
|
1845 | + echo $obj_post_type->labels->singular_name; |
|
1846 | + } else { |
|
1847 | + return $obj_post_type->labels->singular_name; |
|
1848 | + } |
|
1807 | 1849 | |
1808 | 1850 | } |
1809 | 1851 | |
@@ -1820,14 +1862,16 @@ discard block |
||
1820 | 1862 | { |
1821 | 1863 | $all_postypes = geodir_get_posttypes(); |
1822 | 1864 | |
1823 | - if (!in_array($post_type, $all_postypes)) |
|
1824 | - return false; |
|
1865 | + if (!in_array($post_type, $all_postypes)) { |
|
1866 | + return false; |
|
1867 | + } |
|
1825 | 1868 | |
1826 | 1869 | $obj_post_type = get_post_type_object($post_type); |
1827 | - if ($echo) |
|
1828 | - echo $obj_post_type->labels->name; |
|
1829 | - else |
|
1830 | - return $obj_post_type->labels->name; |
|
1870 | + if ($echo) { |
|
1871 | + echo $obj_post_type->labels->name; |
|
1872 | + } else { |
|
1873 | + return $obj_post_type->labels->name; |
|
1874 | + } |
|
1831 | 1875 | |
1832 | 1876 | } |
1833 | 1877 | |
@@ -1852,19 +1896,22 @@ discard block |
||
1852 | 1896 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
1853 | 1897 | |
1854 | 1898 | if (is_int($term)) { |
1855 | - if (0 == $term) |
|
1856 | - return 0; |
|
1899 | + if (0 == $term) { |
|
1900 | + return 0; |
|
1901 | + } |
|
1857 | 1902 | $where = 't.term_id = %d'; |
1858 | - if (!empty($taxonomy)) |
|
1859 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1860 | - else |
|
1861 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1903 | + if (!empty($taxonomy)) { |
|
1904 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1905 | + } else { |
|
1906 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1907 | + } |
|
1862 | 1908 | } |
1863 | 1909 | |
1864 | 1910 | $term = trim(wp_unslash($term)); |
1865 | 1911 | |
1866 | - if ('' === $slug = sanitize_title($term)) |
|
1867 | - return 0; |
|
1912 | + if ('' === $slug = sanitize_title($term)) { |
|
1913 | + return 0; |
|
1914 | + } |
|
1868 | 1915 | |
1869 | 1916 | $where = 't.slug = %s'; |
1870 | 1917 | |
@@ -1881,14 +1928,16 @@ discard block |
||
1881 | 1928 | $where_fields[] = $taxonomy; |
1882 | 1929 | |
1883 | 1930 | |
1884 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
1885 | - return $result; |
|
1931 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
1932 | + return $result; |
|
1933 | + } |
|
1886 | 1934 | |
1887 | 1935 | return false; |
1888 | 1936 | } |
1889 | 1937 | |
1890 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
1891 | - return $result; |
|
1938 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
1939 | + return $result; |
|
1940 | + } |
|
1892 | 1941 | |
1893 | 1942 | return false; |
1894 | 1943 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | $items .= '<li class="' . $sub_li_class . '"> |
137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
138 | - ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
|
138 | + ' . __(ucfirst($args->labels->name), 'geodirectory') . ' |
|
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | 141 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
189 | 189 | $items .= '<li class="' . $li_class . '"> |
190 | 190 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
191 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
191 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . ' |
|
192 | 192 | </a> |
193 | 193 | </li>'; |
194 | 194 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
268 | 268 | $items .= '<li class="' . $li_class . '"> |
269 | 269 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
270 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
270 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . ' |
|
271 | 271 | </a> |
272 | 272 | </li>'; |
273 | 273 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
401 | 401 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
402 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
402 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
403 | 403 | elseif (isset($_REQUEST['listing_type'])) |
404 | 404 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
405 | 405 | } |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | switch ($output): |
440 | 440 | case 'object': |
441 | 441 | case 'Object': |
442 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
442 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
443 | 443 | break; |
444 | 444 | case 'array': |
445 | 445 | case 'Array': |
446 | - $post_types = (array)$post_types; |
|
446 | + $post_types = (array) $post_types; |
|
447 | 447 | break; |
448 | 448 | case 'options': |
449 | - $post_types = (array)$post_types; |
|
449 | + $post_types = (array) $post_types; |
|
450 | 450 | |
451 | 451 | $options = array(); |
452 | 452 | if (!empty($post_types)) { |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } elseif (isset($wp_query->tax_query->queries)) { |
641 | 641 | $tax_arr = $wp_query->tax_query->queries; |
642 | 642 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
643 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
643 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
644 | 644 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
645 | 645 | } |
646 | 646 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $cat_exclude = serialize($exclude_cats); |
764 | 764 | |
765 | 765 | if (isset($_REQUEST['backandedit'])) { |
766 | - $post = (object)$gd_session->get('listing'); |
|
766 | + $post = (object) $gd_session->get('listing'); |
|
767 | 767 | |
768 | 768 | if (!is_array($post->post_category[$cat_taxonomy])) |
769 | 769 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | |
842 | 842 | function show_subcatlist(main_cat, catObj) { |
843 | 843 | if (main_cat != '') { |
844 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
845 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
846 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
844 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
845 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
846 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
847 | 847 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
848 | - <?php if ((int)$cat_limit > 0) { ?> |
|
848 | + <?php if ((int) $cat_limit > 0) { ?> |
|
849 | 849 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
850 | 850 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
851 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
851 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
852 | 852 | return false; |
853 | 853 | } |
854 | 854 | <?php } ?> |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | } |
888 | 888 | |
889 | 889 | function update_listing_cat(el) { |
890 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
890 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
891 | 891 | var cat_ids = ''; |
892 | 892 | var main_cat = ''; |
893 | 893 | var sub_cat = ''; |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
969 | 969 | echo $style; |
970 | 970 | }?> "> |
971 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
971 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
972 | 972 | ?> |
973 | 973 | </div> |
974 | 974 | <?php |
@@ -995,9 +995,9 @@ discard block |
||
995 | 995 | if ($exclude != '') { |
996 | 996 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
997 | 997 | print_r($exclude_cats); |
998 | - if(is_array( $exclude_cats)){ |
|
999 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1000 | - }else{ |
|
998 | + if (is_array($exclude_cats)) { |
|
999 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1000 | + } else { |
|
1001 | 1001 | $exclude_cats = intval($exclude_cats); |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1011,25 +1011,25 @@ discard block |
||
1011 | 1011 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1012 | 1012 | |
1013 | 1013 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1014 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1014 | + <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>" |
|
1015 | 1015 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1016 | 1016 | <?php /* ?> |
1017 | 1017 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1018 | 1018 | <?php */ ?> |
1019 | 1019 | |
1020 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1020 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1021 | 1021 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1022 | 1022 | checked="checked" disabled="disabled"/> |
1023 | 1023 | <span> |
1024 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1024 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1025 | 1025 | </span> |
1026 | 1026 | <br/> |
1027 | 1027 | |
1028 | 1028 | <div class="post_default_category"> |
1029 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1030 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1029 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1030 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1031 | 1031 | <span> |
1032 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1032 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1033 | 1033 | </span> |
1034 | 1034 | </div> |
1035 | 1035 | |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | $post_cat_str = $post_categories[$request_taxonomy]; |
1063 | 1063 | $post_cat_array = explode("#", $post_cat_str); |
1064 | 1064 | if (is_array($post_cat_array)) { |
1065 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1065 | + $post_cat_array = array_unique($post_cat_array); |
|
1066 | 1066 | |
1067 | 1067 | foreach ($post_cat_array as $post_cat_html) { |
1068 | 1068 | |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | } |
1078 | 1078 | $post_sub_catid = ''; |
1079 | 1079 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1080 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1080 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1101 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1101 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | $option_selected = ' selected="selected" '; |
1141 | 1141 | |
1142 | 1142 | // Count child terms |
1143 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1144 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1143 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1144 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1145 | 1145 | |
1146 | 1146 | echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
1147 | 1147 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | 2 => __('Custom field updated.', 'geodirectory'), |
1175 | 1175 | 3 => __('Custom field deleted.', 'geodirectory'), |
1176 | 1176 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1177 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1177 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1178 | 1178 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1179 | 1179 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1180 | 1180 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | 'menu_icon' => $menu_icon, |
1312 | 1312 | 'public' => true, |
1313 | 1313 | 'query_var' => true, |
1314 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true), |
|
1314 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1315 | 1315 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1316 | 1316 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1317 | 1317 | |
@@ -1333,25 +1333,25 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | $gd_wpml_get_languages = ""; |
1336 | -function gd_wpml_get_lang_from_url($url){ |
|
1336 | +function gd_wpml_get_lang_from_url($url) { |
|
1337 | 1337 | |
1338 | 1338 | global $gd_wpml_get_languages; |
1339 | - if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];} |
|
1339 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; } |
|
1340 | 1340 | |
1341 | 1341 | |
1342 | 1342 | // |
1343 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1344 | - $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url')); |
|
1343 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1344 | + $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url')); |
|
1345 | 1345 | |
1346 | - $url = str_replace($site_url,"",$url); |
|
1346 | + $url = str_replace($site_url, "", $url); |
|
1347 | 1347 | |
1348 | 1348 | |
1349 | 1349 | $segments = explode('/', trim($url, '/')); |
1350 | 1350 | |
1351 | 1351 | //print_r( $segments); |
1352 | - if($gd_wpml_get_languages){ |
|
1352 | + if ($gd_wpml_get_languages) { |
|
1353 | 1353 | $langs = $gd_wpml_get_languages; |
1354 | - }else{ |
|
1354 | + } else { |
|
1355 | 1355 | global $sitepress; |
1356 | 1356 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
1357 | 1357 | } |
@@ -1414,17 +1414,17 @@ discard block |
||
1414 | 1414 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1415 | 1415 | |
1416 | 1416 | // Alter the CPT slug if WPML is set to do so |
1417 | - if(function_exists('icl_object_id')){ |
|
1418 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1417 | + if (function_exists('icl_object_id')) { |
|
1418 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1419 | 1419 | |
1420 | 1420 | $org_slug = $slug; |
1421 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1421 | + $slug = apply_filters('wpml_translate_single_string', |
|
1422 | 1422 | $slug, |
1423 | 1423 | 'WordPress', |
1424 | 1424 | 'URL slug: ' . $slug, |
1425 | 1425 | $language_code); |
1426 | 1426 | |
1427 | - if(!$slug){$slug = $org_slug;} |
|
1427 | + if (!$slug) {$slug = $org_slug; } |
|
1428 | 1428 | |
1429 | 1429 | } |
1430 | 1430 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | $post_link = trailingslashit( |
1441 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1441 | + preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1) |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | if ($fix_url) { |
@@ -1466,7 +1466,7 @@ discard block |
||
1466 | 1466 | ) |
1467 | 1467 | ); |
1468 | 1468 | |
1469 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1469 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1470 | 1470 | |
1471 | 1471 | $comment_post_cache[$post->ID] = $post; |
1472 | 1472 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | |
1476 | 1476 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1477 | 1477 | |
1478 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1478 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1479 | 1479 | $location_request = ''; |
1480 | 1480 | |
1481 | 1481 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1490 | 1490 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1491 | 1491 | |
1492 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1492 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1493 | 1493 | 'region_slug' => $post->region_slug, |
1494 | 1494 | 'city_slug' => $post->city_slug |
1495 | 1495 | ); |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1519 | 1519 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1520 | 1520 | |
1521 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1521 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1522 | 1522 | 'region_slug' => $post->region_slug, |
1523 | 1523 | 'city_slug' => $post->city_slug |
1524 | 1524 | ); |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
1659 | 1659 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
1660 | 1660 | |
1661 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1661 | + if (geodir_is_page('detail') && isset($post->country_slug)) { |
|
1662 | 1662 | $location_terms = array( |
1663 | 1663 | 'gd_country' => $post->country_slug, |
1664 | 1664 | 'gd_region' => $post->region_slug, |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | |
1678 | 1678 | if (!empty($location_terms)) { |
1679 | 1679 | |
1680 | - $url_separator = '';//get_option('geodir_listingurl_separator'); |
|
1680 | + $url_separator = ''; //get_option('geodir_listingurl_separator'); |
|
1681 | 1681 | |
1682 | 1682 | if (get_option('permalink_structure') != '') { |
1683 | 1683 | $old_listing_slug = '/' . $listing_slug . '/'; |
@@ -1700,31 +1700,31 @@ discard block |
||
1700 | 1700 | }*/ |
1701 | 1701 | |
1702 | 1702 | // Alter the CPT slug if WPML is set to do so |
1703 | - if(function_exists('icl_object_id')){ |
|
1703 | + if (function_exists('icl_object_id')) { |
|
1704 | 1704 | $post_types = get_option('geodir_post_types'); |
1705 | - $post_type = str_replace("category","",$taxonomy); |
|
1706 | - $post_type = str_replace("_tags","",$post_type); |
|
1705 | + $post_type = str_replace("category", "", $taxonomy); |
|
1706 | + $post_type = str_replace("_tags", "", $post_type); |
|
1707 | 1707 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1708 | - if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
|
1708 | + if (gd_wpml_slug_translation_turned_on($post_type)) { |
|
1709 | 1709 | |
1710 | 1710 | global $sitepress; |
1711 | 1711 | $default_lang = $sitepress->get_default_language(); |
1712 | 1712 | $language_code = gd_wpml_get_lang_from_url($termlink); |
1713 | - if(!$language_code ){$language_code = $default_lang;} |
|
1713 | + if (!$language_code) {$language_code = $default_lang; } |
|
1714 | 1714 | |
1715 | 1715 | $org_slug = $slug; |
1716 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1716 | + $slug = apply_filters('wpml_translate_single_string', |
|
1717 | 1717 | $slug, |
1718 | 1718 | 'WordPress', |
1719 | 1719 | 'URL slug: ' . $slug, |
1720 | 1720 | $language_code); |
1721 | 1721 | |
1722 | 1722 | |
1723 | - if(!$slug){$slug = $org_slug;} |
|
1723 | + if (!$slug) {$slug = $org_slug; } |
|
1724 | 1724 | |
1725 | 1725 | $termlink = trailingslashit( |
1726 | 1726 | |
1727 | - preg_replace( "/" . preg_quote( $org_slug, "/" ) . "/", $slug ,$termlink, 1 ) |
|
1727 | + preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1) |
|
1728 | 1728 | ); |
1729 | 1729 | |
1730 | 1730 | } |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | if (in_array($post_type, geodir_get_posttypes())) { |
1759 | 1759 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1760 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1760 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1761 | 1761 | $location_terms = array( |
1762 | 1762 | 'gd_country' => $post->country_slug, |
1763 | 1763 | 'gd_region' => $post->region_slug, |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | |
1871 | 1871 | $where_fields = array($slug); |
1872 | 1872 | if (!empty($taxonomy)) { |
1873 | - $parent = (int)$parent; |
|
1873 | + $parent = (int) $parent; |
|
1874 | 1874 | if ($parent > 0) { |
1875 | 1875 | $where_fields[] = $parent; |
1876 | 1876 | $else_where_fields[] = $parent; |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
1940 | 1940 | //$terms = get_terms( $taxonomy ); |
1941 | 1941 | |
1942 | - if($terms) { |
|
1942 | + if ($terms) { |
|
1943 | 1943 | foreach ($terms as $term) { |
1944 | 1944 | $post_type = str_replace("category", "", $term->taxonomy); |
1945 | 1945 | $a_terms[$post_type][] = $term; |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
1950 | - if($a_terms) { |
|
1950 | + if ($a_terms) { |
|
1951 | 1951 | foreach ($a_terms as $pt => $t2) { |
1952 | 1952 | |
1953 | 1953 | foreach ($t2 as $term) { |
@@ -1972,7 +1972,7 @@ discard block |
||
1972 | 1972 | } |
1973 | 1973 | |
1974 | 1974 | if (is_ssl()) { |
1975 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
1975 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | return $terms_icons; |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Template for add listings page |
|
4 | - * |
|
5 | - * You can make most changes via hooks or see the link below for info on how to replace the template in your theme. |
|
6 | - * |
|
7 | - * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/ |
|
8 | - * @since 1.0.0 |
|
9 | - * @package GeoDirectory |
|
10 | - */ |
|
3 | + * Template for add listings page |
|
4 | + * |
|
5 | + * You can make most changes via hooks or see the link below for info on how to replace the template in your theme. |
|
6 | + * |
|
7 | + * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/ |
|
8 | + * @since 1.0.0 |
|
9 | + * @package GeoDirectory |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | global $gd_session; |
13 | 13 | |
14 | 14 | if (!isset($_REQUEST['backandedit'])) { |
15 | - $gd_session->un_set('listing'); |
|
15 | + $gd_session->un_set('listing'); |
|
16 | 16 | } |
17 | 17 | // call header |
18 | 18 | get_header(); |
@@ -12,24 +12,24 @@ |
||
12 | 12 | <div class="clearfix"> |
13 | 13 | <div id="geodir_content"> |
14 | 14 | <?php |
15 | - global $information; |
|
16 | - echo '<h5 class="geodir_information">'; |
|
17 | - echo $information; |
|
18 | - echo '</h5>'; |
|
15 | + global $information; |
|
16 | + echo '<h5 class="geodir_information">'; |
|
17 | + echo $information; |
|
18 | + echo '</h5>'; |
|
19 | 19 | |
20 | - ?> |
|
20 | + ?> |
|
21 | 21 | </div> |
22 | 22 | <!-- geodir_content ends here--> |
23 | 23 | <div id="gd-sidebar-wrapper"> |
24 | 24 | <div class="geodir-sidebar-main"> |
25 | 25 | <div class="geodir-gd-sidebar"> |
26 | 26 | <?php |
27 | - /** |
|
28 | - * Calls the standard sidebar. |
|
29 | - * |
|
30 | - * @since 1.0.0 |
|
31 | - */ |
|
32 | - do_action('geodir_sidebar'); ?> |
|
27 | + /** |
|
28 | + * Calls the standard sidebar. |
|
29 | + * |
|
30 | + * @since 1.0.0 |
|
31 | + */ |
|
32 | + do_action('geodir_sidebar'); ?> |
|
33 | 33 | </div> |
34 | 34 | </div> |
35 | 35 | </div> |