Test Failed
Pull Request — master (#405)
by Kiran
20:06
created
geodirectory-functions/template_functions.php 3 patches
Indentation   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -19,132 +19,132 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_locate_template($template = '')
21 21
 {
22
-    global $post_type, $wp, $post;
23
-    $fields = array();
24
-
25
-    switch ($template):
26
-        case 'signup':
27
-            return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
-            break;
29
-        case 'add-listing':
30
-            $gd_post_types = geodir_get_posttypes();
22
+	global $post_type, $wp, $post;
23
+	$fields = array();
24
+
25
+	switch ($template):
26
+		case 'signup':
27
+			return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
+			break;
29
+		case 'add-listing':
30
+			$gd_post_types = geodir_get_posttypes();
31 31
             
32
-            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
-                $post_type = '';
34
-            }
32
+			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
+				$post_type = '';
34
+			}
35 35
             
36
-            $sc_post_type = '';
37
-            if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
38
-                $listing_page_id = $post->ID;
36
+			$sc_post_type = '';
37
+			if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
38
+				$listing_page_id = $post->ID;
39 39
                 
40
-                $regex_pattern = get_shortcode_regex();
41
-                preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
40
+				$regex_pattern = get_shortcode_regex();
41
+				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
42 42
                 
43
-                if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
44
-                    $shortcode_atts = shortcode_parse_atts($regex_matches[3]);
45
-                    $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
46
-                }
47
-            } else {
48
-                $listing_page_id = geodir_add_listing_page_id();
49
-            }
43
+				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
44
+					$shortcode_atts = shortcode_parse_atts($regex_matches[3]);
45
+					$sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
46
+				}
47
+			} else {
48
+				$listing_page_id = geodir_add_listing_page_id();
49
+			}
50 50
             
51
-            $is_wpml = function_exists('icl_object_id') ? true : false;
51
+			$is_wpml = function_exists('icl_object_id') ? true : false;
52 52
 
53
-            if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
54
-                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
55
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
56
-            }
53
+			if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
54
+				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
55
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
56
+			}
57 57
             
58
-            if (empty($post_type) && !isset($_REQUEST['pid'])) {
59
-                $pagename = $wp->query_vars['pagename'];
58
+			if (empty($post_type) && !isset($_REQUEST['pid'])) {
59
+				$pagename = $wp->query_vars['pagename'];
60 60
                 
61
-                if (!empty($gd_post_types)) {
62
-                    $post_type = $gd_post_types[0];
63
-                }
61
+				if (!empty($gd_post_types)) {
62
+					$post_type = $gd_post_types[0];
63
+				}
64 64
                 
65
-                if ($sc_post_type != '') {
66
-                    $post_type = $sc_post_type;
67
-                }
65
+				if ($sc_post_type != '') {
66
+					$post_type = $sc_post_type;
67
+				}
68 68
                 
69
-                if (empty($post_type) && !empty($gd_post_types)) {
70
-                    $post_type = $gd_post_types[0];
71
-                }
69
+				if (empty($post_type) && !empty($gd_post_types)) {
70
+					$post_type = $gd_post_types[0];
71
+				}
72 72
                 
73
-                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
74
-                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
75
-                } else {
76
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
77
-                }
78
-                gd_die();
79
-            }
80
-            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
81
-            break;
82
-        case 'success':
83
-            $success_page_id = geodir_success_page_id();
84
-            if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
85
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
86
-            )
87
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
88
-            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
89
-            break;
90
-        case 'detail':
91
-        case 'preview':
92
-            if (in_array(get_post_type(), geodir_get_posttypes()))
93
-                $post_type = get_post_type();
94
-            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
95
-            break;
96
-        case 'listing':
97
-            $templates = array();
98
-            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
99
-                $post_type = get_post_type();
100
-                $templates[] = "geodirectory/archive-$post_type.php";
101
-            }
102
-
103
-
104
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
105
-                $query_obj = get_queried_object();
106
-                $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
107
-                $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
108
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
109
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
110
-            }
111
-
112
-            $templates[] = "geodirectory/geodir-listing.php";
113
-
114
-            return $template = locate_template($templates);
115
-            break;
116
-        case 'information':
117
-            return $template = locate_template(array("geodirectory/geodir-information.php"));
118
-            break;
119
-        case 'author':
120
-            return $template = locate_template(array("geodirectory/geodir-author.php"));
121
-            break;
122
-        case 'search':
123
-            return $template = locate_template(array("geodirectory/geodir-search.php"));
124
-            break;
125
-        case 'location':
126
-            return $template = locate_template(array("geodirectory/geodir-location.php"));
127
-            break;
128
-        case 'geodir-home':
129
-            return $template = locate_template(array("geodirectory/geodir-home.php"));
130
-            break;
131
-        case 'listing-listview':
132
-            $template = locate_template(array("geodirectory/listing-listview.php"));
133
-            if (!$template) {
134
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
135
-            }
136
-            return $template;
137
-            break;
138
-        case 'widget-listing-listview':
139
-            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
140
-            if (!$template) {
141
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
142
-            }
143
-            return $template;
144
-            break;
145
-    endswitch;
146
-
147
-    return false;
73
+				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
74
+					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
75
+				} else {
76
+					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
77
+				}
78
+				gd_die();
79
+			}
80
+			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
81
+			break;
82
+		case 'success':
83
+			$success_page_id = geodir_success_page_id();
84
+			if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
85
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
86
+			)
87
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
88
+			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
89
+			break;
90
+		case 'detail':
91
+		case 'preview':
92
+			if (in_array(get_post_type(), geodir_get_posttypes()))
93
+				$post_type = get_post_type();
94
+			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
95
+			break;
96
+		case 'listing':
97
+			$templates = array();
98
+			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
99
+				$post_type = get_post_type();
100
+				$templates[] = "geodirectory/archive-$post_type.php";
101
+			}
102
+
103
+
104
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
105
+				$query_obj = get_queried_object();
106
+				$curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
107
+				$curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
108
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
109
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
110
+			}
111
+
112
+			$templates[] = "geodirectory/geodir-listing.php";
113
+
114
+			return $template = locate_template($templates);
115
+			break;
116
+		case 'information':
117
+			return $template = locate_template(array("geodirectory/geodir-information.php"));
118
+			break;
119
+		case 'author':
120
+			return $template = locate_template(array("geodirectory/geodir-author.php"));
121
+			break;
122
+		case 'search':
123
+			return $template = locate_template(array("geodirectory/geodir-search.php"));
124
+			break;
125
+		case 'location':
126
+			return $template = locate_template(array("geodirectory/geodir-location.php"));
127
+			break;
128
+		case 'geodir-home':
129
+			return $template = locate_template(array("geodirectory/geodir-home.php"));
130
+			break;
131
+		case 'listing-listview':
132
+			$template = locate_template(array("geodirectory/listing-listview.php"));
133
+			if (!$template) {
134
+				$template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
135
+			}
136
+			return $template;
137
+			break;
138
+		case 'widget-listing-listview':
139
+			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
140
+			if (!$template) {
141
+				$template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
142
+			}
143
+			return $template;
144
+			break;
145
+	endswitch;
146
+
147
+	return false;
148 148
 
149 149
 }
150 150
 
@@ -163,255 +163,255 @@  discard block
 block discarded – undo
163 163
 function geodir_template_loader($template)
164 164
 {
165 165
 
166
-    global $wp_query;
167
-
168
-    /**
169
-     * Filter the custom page list.
170
-     *
171
-     * @since 1.0.0
172
-     */
173
-    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
174
-        'geodir_signup_page' =>
175
-            apply_filters('geodir_set_custom_signup_page', false),
176
-        'geodir_add_listing_page' =>
177
-            apply_filters('geodir_set_custom_add_listing_page', false),
178
-        'geodir_preview_page' =>
179
-            apply_filters('geodir_set_custom_preview_page', false),
180
-        'geodir_listing_success_page' =>
181
-            apply_filters('geodir_set_custom_listing_success_page', false),
182
-        'geodir_listing_detail_page' =>
183
-            apply_filters('geodir_set_custom_listing_detail_page', false),
184
-        'geodir_listing_page' =>
185
-            apply_filters('geodir_set_custom_listing_page', false),
186
-        'geodir_search_page' =>
187
-            apply_filters('geodir_set_custom_search_page', false),
188
-        'geodir_author_page' =>
189
-            apply_filters('geodir_set_custom_author_page', false),
190
-        'geodir_home_map_page' =>
191
-            apply_filters('geodir_set_custom_home_map_page', false)
192
-    ));
193
-
194
-
195
-    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
196
-
197
-        $template = geodir_locate_template('signup');
198
-
199
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
200
-
201
-        /**
202
-         * Filter the signup template path.
203
-         *
204
-         * @since 1.0.0
205
-         * @param string $template The template path.
206
-         */
207
-        return $template = apply_filters('geodir_template_signup', $template);
208
-    }
209
-
210
-    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
211
-        if (!geodir_is_default_location_set()) {
212
-            global $information;
213
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
214
-
215
-            $template = geodir_locate_template('information');
216
-
217
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
218
-            /**
219
-             * Filter the information template path.
220
-             *
221
-             * @since 1.0.0
222
-             * @param string $template The template path.
223
-             */
224
-            return $template = apply_filters('geodir_template_information', $template);
225
-        }
226
-        // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
227
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
228
-            /// WPML
229
-            if (geodir_is_wpml() && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
230
-                global $sitepress;
166
+	global $wp_query;
167
+
168
+	/**
169
+	 * Filter the custom page list.
170
+	 *
171
+	 * @since 1.0.0
172
+	 */
173
+	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
174
+		'geodir_signup_page' =>
175
+			apply_filters('geodir_set_custom_signup_page', false),
176
+		'geodir_add_listing_page' =>
177
+			apply_filters('geodir_set_custom_add_listing_page', false),
178
+		'geodir_preview_page' =>
179
+			apply_filters('geodir_set_custom_preview_page', false),
180
+		'geodir_listing_success_page' =>
181
+			apply_filters('geodir_set_custom_listing_success_page', false),
182
+		'geodir_listing_detail_page' =>
183
+			apply_filters('geodir_set_custom_listing_detail_page', false),
184
+		'geodir_listing_page' =>
185
+			apply_filters('geodir_set_custom_listing_page', false),
186
+		'geodir_search_page' =>
187
+			apply_filters('geodir_set_custom_search_page', false),
188
+		'geodir_author_page' =>
189
+			apply_filters('geodir_set_custom_author_page', false),
190
+		'geodir_home_map_page' =>
191
+			apply_filters('geodir_set_custom_home_map_page', false)
192
+	));
193
+
194
+
195
+	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
196
+
197
+		$template = geodir_locate_template('signup');
198
+
199
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
200
+
201
+		/**
202
+		 * Filter the signup template path.
203
+		 *
204
+		 * @since 1.0.0
205
+		 * @param string $template The template path.
206
+		 */
207
+		return $template = apply_filters('geodir_template_signup', $template);
208
+	}
209
+
210
+	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
211
+		if (!geodir_is_default_location_set()) {
212
+			global $information;
213
+			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
214
+
215
+			$template = geodir_locate_template('information');
216
+
217
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
218
+			/**
219
+			 * Filter the information template path.
220
+			 *
221
+			 * @since 1.0.0
222
+			 * @param string $template The template path.
223
+			 */
224
+			return $template = apply_filters('geodir_template_information', $template);
225
+		}
226
+		// check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
227
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
228
+			/// WPML
229
+			if (geodir_is_wpml() && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
230
+				global $sitepress;
231 231
                 
232
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
233
-                $sitepress->switch_lang($lang_of_duplicate, true);
232
+				$lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
233
+				$sitepress->switch_lang($lang_of_duplicate, true);
234 234
         
235
-                $redirect_to = get_permalink(geodir_add_listing_page_id());
236
-                $_GET['pid'] = $duplicate_of;
237
-                if (!empty($_GET)) {
238
-                    $redirect_to = add_query_arg($_GET, $redirect_to);
239
-                }
240
-                wp_redirect($redirect_to);
241
-                exit;
242
-            }
243
-            /// WPML
235
+				$redirect_to = get_permalink(geodir_add_listing_page_id());
236
+				$_GET['pid'] = $duplicate_of;
237
+				if (!empty($_GET)) {
238
+					$redirect_to = add_query_arg($_GET, $redirect_to);
239
+				}
240
+				wp_redirect($redirect_to);
241
+				exit;
242
+			}
243
+			/// WPML
244 244
             
245
-            global $information;
246
-            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
247
-            $is_current_user_owner = geodir_listing_belong_to_current_user();
248
-            if (!$is_current_user_owner) {
249
-                $template = geodir_locate_template('information');
250
-
251
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
252
-                /**
253
-                 * Filter the information template path.
254
-                 *
255
-                 * @since 1.0.0
256
-                 * @param string $template The template path.
257
-                 */
258
-                return $template = apply_filters('geodir_template_information', $template);
259
-            }
245
+			global $information;
246
+			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
247
+			$is_current_user_owner = geodir_listing_belong_to_current_user();
248
+			if (!$is_current_user_owner) {
249
+				$template = geodir_locate_template('information');
250
+
251
+				if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
252
+				/**
253
+				 * Filter the information template path.
254
+				 *
255
+				 * @since 1.0.0
256
+				 * @param string $template The template path.
257
+				 */
258
+				return $template = apply_filters('geodir_template_information', $template);
259
+			}
260 260
 
261 261
 
262
-        }
262
+		}
263 263
 
264
-        //geodir_is_login(true);
265
-        global $current_user;
266
-        if (!$current_user->ID) {
267
-            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
268
-            exit;
269
-        }
264
+		//geodir_is_login(true);
265
+		global $current_user;
266
+		if (!$current_user->ID) {
267
+			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
268
+			exit;
269
+		}
270 270
 
271
-        $template = geodir_locate_template('add-listing');
272
-
273
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
274
-        /**
275
-         * Filter the add listing template path.
276
-         *
277
-         * @since 1.0.0
278
-         * @param string $template The template path.
279
-         */
280
-        return $template = apply_filters('geodir_template_add_listing', $template);
281
-    }
271
+		$template = geodir_locate_template('add-listing');
282 272
 
273
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
274
+		/**
275
+		 * Filter the add listing template path.
276
+		 *
277
+		 * @since 1.0.0
278
+		 * @param string $template The template path.
279
+		 */
280
+		return $template = apply_filters('geodir_template_add_listing', $template);
281
+	}
283 282
 
284
-    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
285
-        global $preview;
286
-        $preview = true;
287 283
 
288
-        $template = geodir_locate_template('preview');
284
+	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
285
+		global $preview;
286
+		$preview = true;
289 287
 
290
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
291
-        /**
292
-         * Filter the preview template path.
293
-         *
294
-         * @since 1.0.0
295
-         * @param string $template The template path.
296
-         */
297
-        return $template = apply_filters('geodir_template_preview', $template);
288
+		$template = geodir_locate_template('preview');
298 289
 
299
-    }
290
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
291
+		/**
292
+		 * Filter the preview template path.
293
+		 *
294
+		 * @since 1.0.0
295
+		 * @param string $template The template path.
296
+		 */
297
+		return $template = apply_filters('geodir_template_preview', $template);
300 298
 
299
+	}
301 300
 
302
-    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
303 301
 
304
-        $template = geodir_locate_template('success');
302
+	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
305 303
 
306
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
307
-        /**
308
-         * Filter the success template path.
309
-         *
310
-         * @since 1.0.0
311
-         * @param string $template The template path.
312
-         */
313
-        return $template = apply_filters('geodir_template_success', $template);
304
+		$template = geodir_locate_template('success');
314 305
 
315
-    }
306
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
307
+		/**
308
+		 * Filter the success template path.
309
+		 *
310
+		 * @since 1.0.0
311
+		 * @param string $template The template path.
312
+		 */
313
+		return $template = apply_filters('geodir_template_success', $template);
316 314
 
317
-    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
315
+	}
318 316
 
319
-        $template = geodir_locate_template('detail');
317
+	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
320 318
 
321
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
322
-        /**
323
-         * Filter the detail template path.
324
-         *
325
-         * @since 1.0.0
326
-         * @param string $template The template path.
327
-         */
328
-        return $template = apply_filters('geodir_template_detail', $template);
319
+		$template = geodir_locate_template('detail');
329 320
 
330
-    }
321
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
322
+		/**
323
+		 * Filter the detail template path.
324
+		 *
325
+		 * @since 1.0.0
326
+		 * @param string $template The template path.
327
+		 */
328
+		return $template = apply_filters('geodir_template_detail', $template);
331 329
 
332
-    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
330
+	}
333 331
 
334
-        $template = geodir_locate_template('listing');
332
+	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
335 333
 
336
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
337
-        /**
338
-         * Filter the listing template path.
339
-         *
340
-         * @since 1.0.0
341
-         * @param string $template The template path.
342
-         */
343
-        return $template = apply_filters('geodir_template_listing', $template);
334
+		$template = geodir_locate_template('listing');
344 335
 
345
-    }
336
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
337
+		/**
338
+		 * Filter the listing template path.
339
+		 *
340
+		 * @since 1.0.0
341
+		 * @param string $template The template path.
342
+		 */
343
+		return $template = apply_filters('geodir_template_listing', $template);
346 344
 
347
-    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
345
+	}
348 346
 
349
-        $template = geodir_locate_template('search');
347
+	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
350 348
 
351
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
352
-        /**
353
-         * Filter the search template path.
354
-         *
355
-         * @since 1.0.0
356
-         * @param string $template The template path.
357
-         */
358
-        return $template = apply_filters('geodir_template_search', $template);
349
+		$template = geodir_locate_template('search');
359 350
 
360
-    }
351
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
352
+		/**
353
+		 * Filter the search template path.
354
+		 *
355
+		 * @since 1.0.0
356
+		 * @param string $template The template path.
357
+		 */
358
+		return $template = apply_filters('geodir_template_search', $template);
361 359
 
362
-    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
360
+	}
363 361
 
364
-        $template = geodir_locate_template('author');
362
+	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
365 363
 
366
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
367
-        /**
368
-         * Filter the author template path.
369
-         *
370
-         * @since 1.0.0
371
-         * @param string $template The template path.
372
-         */
373
-        return $template = apply_filters('geodir_template_author', $template);
364
+		$template = geodir_locate_template('author');
374 365
 
375
-    }
366
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
367
+		/**
368
+		 * Filter the author template path.
369
+		 *
370
+		 * @since 1.0.0
371
+		 * @param string $template The template path.
372
+		 */
373
+		return $template = apply_filters('geodir_template_author', $template);
376 374
 
377
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
375
+	}
378 376
 
379
-        global $post, $wp_query;
377
+	if ( geodir_is_page('home') || geodir_is_page('location')) {
380 378
 
381
-        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
382
-            || (is_home() && !$wp_query->is_posts_page)
383
-        ) {
379
+		global $post, $wp_query;
384 380
 
385
-            $template = geodir_locate_template('geodir-home');
381
+		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
382
+			|| (is_home() && !$wp_query->is_posts_page)
383
+		) {
386 384
 
387
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
388
-            /**
389
-             * Filter the home page template path.
390
-             *
391
-             * @since 1.0.0
392
-             * @param string $template The template path.
393
-             */
394
-            return $template = apply_filters('geodir_template_homepage', $template);
385
+			$template = geodir_locate_template('geodir-home');
395 386
 
396
-        } elseif (geodir_is_page('location')) {
387
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
388
+			/**
389
+			 * Filter the home page template path.
390
+			 *
391
+			 * @since 1.0.0
392
+			 * @param string $template The template path.
393
+			 */
394
+			return $template = apply_filters('geodir_template_homepage', $template);
397 395
 
398
-            $template = geodir_locate_template('location');
396
+		} elseif (geodir_is_page('location')) {
399 397
 
400
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
401
-            /**
402
-             * Filter the location template path.
403
-             *
404
-             * @since 1.0.0
405
-             * @param string $template The template path.
406
-             */
407
-            return $template = apply_filters('geodir_template_location', $template);
398
+			$template = geodir_locate_template('location');
408 399
 
409
-        } else
410
-            return $template;
400
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
401
+			/**
402
+			 * Filter the location template path.
403
+			 *
404
+			 * @since 1.0.0
405
+			 * @param string $template The template path.
406
+			 */
407
+			return $template = apply_filters('geodir_template_location', $template);
411 408
 
412
-    }
409
+		} else
410
+			return $template;
413 411
 
414
-    return $template;
412
+	}
413
+
414
+	return $template;
415 415
 }
416 416
 
417 417
 /**
@@ -426,44 +426,44 @@  discard block
 block discarded – undo
426 426
  */
427 427
 function geodir_get_template_part($slug = '', $name = NULL)
428 428
 {
429
-    global $geodirectory, $post;
430
-    /**
431
-     * Called at the start for the geodir_get_template_part() function.
432
-     *
433
-     * Used dynamic hook name: geodir_get_template_part_{$slug}
434
-     *
435
-     * @since 1.0.0
436
-     * @package GeoDirectory
437
-     * @param string $slug The template slug.
438
-     * @param string $name The template name.
439
-     */
440
-    do_action("geodir_get_template_part_{$slug}", $slug, $name);
441
-    $templates = array();
442
-    $name = (string)$name;
443
-    if ('' !== $name) {
444
-        $template_name = "{$slug}-{$name}.php";
445
-
446
-    } else {
447
-        $template_name = "{$slug}.php";
448
-    }
449
-
450
-    if (!locate_template(array("geodirectory/" . $template_name))) :
451
-        /**
452
-         * Filter the template part with slug and name.
453
-         *
454
-         * @since 1.0.0
455
-         * @param string $template_name The template name.
456
-         */
457
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
458
-        /**
459
-         * Includes the template part with slug and name.
460
-         *
461
-         * @since 1.0.0
462
-         */
463
-        include($template);
464
-    else:
465
-        locate_template(array("geodirectory/" . $template_name), true, false);
466
-    endif;
429
+	global $geodirectory, $post;
430
+	/**
431
+	 * Called at the start for the geodir_get_template_part() function.
432
+	 *
433
+	 * Used dynamic hook name: geodir_get_template_part_{$slug}
434
+	 *
435
+	 * @since 1.0.0
436
+	 * @package GeoDirectory
437
+	 * @param string $slug The template slug.
438
+	 * @param string $name The template name.
439
+	 */
440
+	do_action("geodir_get_template_part_{$slug}", $slug, $name);
441
+	$templates = array();
442
+	$name = (string)$name;
443
+	if ('' !== $name) {
444
+		$template_name = "{$slug}-{$name}.php";
445
+
446
+	} else {
447
+		$template_name = "{$slug}.php";
448
+	}
449
+
450
+	if (!locate_template(array("geodirectory/" . $template_name))) :
451
+		/**
452
+		 * Filter the template part with slug and name.
453
+		 *
454
+		 * @since 1.0.0
455
+		 * @param string $template_name The template name.
456
+		 */
457
+		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
458
+		/**
459
+		 * Includes the template part with slug and name.
460
+		 *
461
+		 * @since 1.0.0
462
+		 */
463
+		include($template);
464
+	else:
465
+		locate_template(array("geodirectory/" . $template_name), true, false);
466
+	endif;
467 467
 
468 468
 }
469 469
 
@@ -479,23 +479,23 @@  discard block
 block discarded – undo
479 479
  */
480 480
 function geodir_core_post_view_extra_class($class, $all_postypes = '')
481 481
 {
482
-    global $post;
482
+	global $post;
483 483
 
484
-    if (!$all_postypes) {
485
-        $all_postypes = geodir_get_posttypes();
486
-    }
484
+	if (!$all_postypes) {
485
+		$all_postypes = geodir_get_posttypes();
486
+	}
487 487
 
488
-    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
489
-    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
490
-    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
488
+	$gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
489
+	$gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
490
+	$gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
491 491
 
492
-    if ($gdp_post_id && $gdp_post_type) {
493
-        $append_class = 'gd-post-' . $gdp_post_type;
494
-        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
495
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
496
-    }
492
+	if ($gdp_post_id && $gdp_post_type) {
493
+		$append_class = 'gd-post-' . $gdp_post_type;
494
+		$append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
495
+		$class = $class != '' ? $class . ' ' . $append_class : $append_class;
496
+	}
497 497
 
498
-    return $class;
498
+	return $class;
499 499
 }
500 500
 
501 501
 /**
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
  * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.
510 510
  */
511 511
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
512
-    if ($favorite) {
512
+	if ($favorite) {
513 513
 		$message = __('No favorite listings found which match your selection.', 'geodirectory');
514 514
 	} else {
515 515
 		$message = __('No listings found which match your selection.', 'geodirectory');
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
74 74
                     wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
75 75
                 } else {
76
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
76
+                    wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type);
77 77
                 }
78 78
                 gd_die();
79 79
             }
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
         case 'listing-listview':
132 132
             $template = locate_template(array("geodirectory/listing-listview.php"));
133 133
             if (!$template) {
134
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
134
+                $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php';
135 135
             }
136 136
             return $template;
137 137
             break;
138 138
         case 'widget-listing-listview':
139 139
             $template = locate_template(array("geodirectory/widget-listing-listview.php"));
140 140
             if (!$template) {
141
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
141
+                $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php';
142 142
             }
143 143
             return $template;
144 144
             break;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
         $template = geodir_locate_template('signup');
198 198
 
199
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
199
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php';
200 200
 
201 201
         /**
202 202
          * Filter the signup template path.
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
     if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
211 211
         if (!geodir_is_default_location_set()) {
212 212
             global $information;
213
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
213
+            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
214 214
 
215 215
             $template = geodir_locate_template('information');
216 216
 
217
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
217
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
218 218
             /**
219 219
              * Filter the information template path.
220 220
              *
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
         // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
227 227
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
228 228
             /// WPML
229
-            if (geodir_is_wpml() && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
229
+            if (geodir_is_wpml() && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
230 230
                 global $sitepress;
231 231
                 
232
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
232
+                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of));
233 233
                 $sitepress->switch_lang($lang_of_duplicate, true);
234 234
         
235 235
                 $redirect_to = get_permalink(geodir_add_listing_page_id());
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             if (!$is_current_user_owner) {
249 249
                 $template = geodir_locate_template('information');
250 250
 
251
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
251
+                if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
252 252
                 /**
253 253
                  * Filter the information template path.
254 254
                  *
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
         $template = geodir_locate_template('add-listing');
272 272
 
273
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
273
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php';
274 274
         /**
275 275
          * Filter the add listing template path.
276 276
          *
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
         $template = geodir_locate_template('preview');
289 289
 
290
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
290
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
291 291
         /**
292 292
          * Filter the preview template path.
293 293
          *
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
         $template = geodir_locate_template('success');
305 305
 
306
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
306
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php';
307 307
         /**
308 308
          * Filter the success template path.
309 309
          *
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
         $template = geodir_locate_template('detail');
320 320
 
321
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
321
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
322 322
         /**
323 323
          * Filter the detail template path.
324 324
          *
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
         $template = geodir_locate_template('listing');
335 335
 
336
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
336
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php';
337 337
         /**
338 338
          * Filter the listing template path.
339 339
          *
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
         $template = geodir_locate_template('search');
350 350
 
351
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
351
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php';
352 352
         /**
353 353
          * Filter the search template path.
354 354
          *
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
         $template = geodir_locate_template('author');
365 365
 
366
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
366
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php';
367 367
         /**
368 368
          * Filter the author template path.
369 369
          *
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
     }
376 376
 
377
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
377
+    if (geodir_is_page('home') || geodir_is_page('location')) {
378 378
 
379 379
         global $post, $wp_query;
380 380
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
             $template = geodir_locate_template('geodir-home');
386 386
 
387
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
387
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php';
388 388
             /**
389 389
              * Filter the home page template path.
390 390
              *
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
             $template = geodir_locate_template('location');
399 399
 
400
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
400
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php';
401 401
             /**
402 402
              * Filter the location template path.
403 403
              *
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      */
440 440
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
441 441
     $templates = array();
442
-    $name = (string)$name;
442
+    $name = (string) $name;
443 443
     if ('' !== $name) {
444 444
         $template_name = "{$slug}-{$name}.php";
445 445
 
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
         $template_name = "{$slug}.php";
448 448
     }
449 449
 
450
-    if (!locate_template(array("geodirectory/" . $template_name))) :
450
+    if (!locate_template(array("geodirectory/".$template_name))) :
451 451
         /**
452 452
          * Filter the template part with slug and name.
453 453
          *
454 454
          * @since 1.0.0
455 455
          * @param string $template_name The template name.
456 456
          */
457
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
457
+        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
458 458
         /**
459 459
          * Includes the template part with slug and name.
460 460
          *
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
          */
463 463
         include($template);
464 464
     else:
465
-        locate_template(array("geodirectory/" . $template_name), true, false);
465
+        locate_template(array("geodirectory/".$template_name), true, false);
466 466
     endif;
467 467
 
468 468
 }
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
     $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
491 491
 
492 492
     if ($gdp_post_id && $gdp_post_type) {
493
-        $append_class = 'gd-post-' . $gdp_post_type;
493
+        $append_class = 'gd-post-'.$gdp_post_type;
494 494
         $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
495
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
495
+        $class = $class != '' ? $class.' '.$append_class : $append_class;
496 496
     }
497 497
 
498 498
     return $class;
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 */
525 525
 	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
526 526
 	
527
-	echo '<li class="no-listing">' . $message . '</li>';
527
+	echo '<li class="no-listing">'.$message.'</li>';
528 528
 }
529 529
 
530 530
 /**
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 function geodir_convert_listing_view_class($columns = '') {
554 554
 	$class = '';
555 555
 	
556
-	switch ((int)$columns) {
556
+	switch ((int) $columns) {
557 557
 		case 1:
558 558
 			$class = '';
559 559
 		break;
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 		$html .= '<option value=""></option>';
619 619
 		if (!empty($star_texts) && is_array($star_texts)) {
620 620
 			foreach ($star_texts as $i => $text) {
621
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
621
+				$html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>';
622 622
 			}
623 623
 		} else {
624 624
 			$html .= '<option value="1">1</option>';
@@ -647,14 +647,14 @@  discard block
 block discarded – undo
647 647
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
648 648
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
649 649
 		$rating = min($rating, $star_count);
650
-		$full_stars = floor( $rating );
651
-		$half_stars = ceil( $rating - $full_stars );
650
+		$full_stars = floor($rating);
651
+		$half_stars = ceil($rating - $full_stars);
652 652
 		$empty_stars = $star_count - $full_stars - $half_stars;
653 653
 		
654 654
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
655
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
656
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
657
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
655
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
656
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
657
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
658 658
 		$html .= '</div>';
659 659
 	}
660 660
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
674 674
 		if ($full_color != '#757575') {
675 675
 			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
676
-			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
676
+			.gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
677 677
 		}
678 678
 	}
679 679
 }
680 680
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +49 added lines, -20 removed lines patch added patch discarded remove patch
@@ -83,14 +83,16 @@  discard block
 block discarded – undo
83 83
             $success_page_id = geodir_success_page_id();
84 84
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
85 85
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
86
-            )
87
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
86
+            ) {
87
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
88
+            }
88 89
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
89 90
             break;
90 91
         case 'detail':
91 92
         case 'preview':
92
-            if (in_array(get_post_type(), geodir_get_posttypes()))
93
-                $post_type = get_post_type();
93
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
94
+                            $post_type = get_post_type();
95
+            }
94 96
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
95 97
             break;
96 98
         case 'listing':
@@ -196,7 +198,9 @@  discard block
 block discarded – undo
196 198
 
197 199
         $template = geodir_locate_template('signup');
198 200
 
199
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
201
+        if (!$template) {
202
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
203
+        }
200 204
 
201 205
         /**
202 206
          * Filter the signup template path.
@@ -214,7 +218,9 @@  discard block
 block discarded – undo
214 218
 
215 219
             $template = geodir_locate_template('information');
216 220
 
217
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
221
+            if (!$template) {
222
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
223
+            }
218 224
             /**
219 225
              * Filter the information template path.
220 226
              *
@@ -248,7 +254,9 @@  discard block
 block discarded – undo
248 254
             if (!$is_current_user_owner) {
249 255
                 $template = geodir_locate_template('information');
250 256
 
251
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
257
+                if (!$template) {
258
+                	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
259
+                }
252 260
                 /**
253 261
                  * Filter the information template path.
254 262
                  *
@@ -270,7 +278,9 @@  discard block
 block discarded – undo
270 278
 
271 279
         $template = geodir_locate_template('add-listing');
272 280
 
273
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
281
+        if (!$template) {
282
+        	$template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
283
+        }
274 284
         /**
275 285
          * Filter the add listing template path.
276 286
          *
@@ -287,7 +297,9 @@  discard block
 block discarded – undo
287 297
 
288 298
         $template = geodir_locate_template('preview');
289 299
 
290
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
300
+        if (!$template) {
301
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
302
+        }
291 303
         /**
292 304
          * Filter the preview template path.
293 305
          *
@@ -303,7 +315,9 @@  discard block
 block discarded – undo
303 315
 
304 316
         $template = geodir_locate_template('success');
305 317
 
306
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
318
+        if (!$template) {
319
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
320
+        }
307 321
         /**
308 322
          * Filter the success template path.
309 323
          *
@@ -318,7 +332,9 @@  discard block
 block discarded – undo
318 332
 
319 333
         $template = geodir_locate_template('detail');
320 334
 
321
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
335
+        if (!$template) {
336
+        	$template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
337
+        }
322 338
         /**
323 339
          * Filter the detail template path.
324 340
          *
@@ -333,7 +349,9 @@  discard block
 block discarded – undo
333 349
 
334 350
         $template = geodir_locate_template('listing');
335 351
 
336
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
352
+        if (!$template) {
353
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
354
+        }
337 355
         /**
338 356
          * Filter the listing template path.
339 357
          *
@@ -348,7 +366,9 @@  discard block
 block discarded – undo
348 366
 
349 367
         $template = geodir_locate_template('search');
350 368
 
351
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
369
+        if (!$template) {
370
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
371
+        }
352 372
         /**
353 373
          * Filter the search template path.
354 374
          *
@@ -363,7 +383,9 @@  discard block
 block discarded – undo
363 383
 
364 384
         $template = geodir_locate_template('author');
365 385
 
366
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
386
+        if (!$template) {
387
+        	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
388
+        }
367 389
         /**
368 390
          * Filter the author template path.
369 391
          *
@@ -384,7 +406,9 @@  discard block
 block discarded – undo
384 406
 
385 407
             $template = geodir_locate_template('geodir-home');
386 408
 
387
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
409
+            if (!$template) {
410
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
411
+            }
388 412
             /**
389 413
              * Filter the home page template path.
390 414
              *
@@ -397,7 +421,9 @@  discard block
 block discarded – undo
397 421
 
398 422
             $template = geodir_locate_template('location');
399 423
 
400
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
424
+            if (!$template) {
425
+            	$template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
426
+            }
401 427
             /**
402 428
              * Filter the location template path.
403 429
              *
@@ -406,8 +432,9 @@  discard block
 block discarded – undo
406 432
              */
407 433
             return $template = apply_filters('geodir_template_location', $template);
408 434
 
409
-        } else
410
-            return $template;
435
+        } else {
436
+                    return $template;
437
+        }
411 438
 
412 439
     }
413 440
 
@@ -461,8 +488,10 @@  discard block
 block discarded – undo
461 488
          * @since 1.0.0
462 489
          */
463 490
         include($template);
464
-    else:
465
-        locate_template(array("geodirectory/" . $template_name), true, false);
491
+    else {
492
+    	:
493
+        locate_template(array("geodirectory/" . $template_name), true, false);
494
+    }
466 495
     endif;
467 496
 
468 497
 }
Please login to merge, or discard this patch.