@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | function geodir_activation() |
| 25 | 25 | {
|
| 26 | 26 | |
| 27 | - geodir_install(); |
|
| 28 | - add_action('wp_loaded', 'geodir_flush_activation');
|
|
| 27 | + geodir_install(); |
|
| 28 | + add_action('wp_loaded', 'geodir_flush_activation');
|
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function geodir_flush_activation() |
| 38 | 38 | {
|
| 39 | - // Remove rewrite rules and then recreate rewrite rules. |
|
| 40 | - // flush late so everything is loaded |
|
| 41 | - flush_rewrite_rules(); |
|
| 39 | + // Remove rewrite rules and then recreate rewrite rules. |
|
| 40 | + // flush late so everything is loaded |
|
| 41 | + flush_rewrite_rules(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,44 +50,44 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function geodir_install() |
| 52 | 52 | {
|
| 53 | - global $geodir_settings; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Called before the GD installation scripts have run. |
|
| 57 | - * |
|
| 58 | - * @since 1.0.0 |
|
| 59 | - * @see 'geodir_installation_end' |
|
| 60 | - */ |
|
| 61 | - do_action('geodir_installation_start');
|
|
| 62 | - |
|
| 63 | - // Do install |
|
| 64 | - if (!get_option('geodir_default_data_installed')) {
|
|
| 65 | - geodir_create_tables(); // in admin db install.php |
|
| 66 | - geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
| 67 | - geodir_create_default_fields(); |
|
| 68 | - //geodir_default_taxonomies(); |
|
| 69 | - geodir_set_default_options(); |
|
| 70 | - geodir_create_pages(); |
|
| 71 | - geodir_set_default_widgets(); |
|
| 72 | - gd_install_theme_compat(); |
|
| 73 | - |
|
| 74 | - update_option('geodir_default_data_installed', 1);
|
|
| 75 | - |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if (!get_option('geodir_default_data_installed_1.2.8')) {
|
|
| 79 | - //geodir_create_tables(); // in admin db install.php |
|
| 80 | - update_option('geodir_default_data_installed_1.2.8', 1);
|
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - geodir_installation_end(); |
|
| 84 | - /** |
|
| 85 | - * Called after the GD installation scripts have run. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @see 'geodir_installation_start' |
|
| 89 | - */ |
|
| 90 | - do_action('geodir_installation_end');
|
|
| 53 | + global $geodir_settings; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Called before the GD installation scripts have run. |
|
| 57 | + * |
|
| 58 | + * @since 1.0.0 |
|
| 59 | + * @see 'geodir_installation_end' |
|
| 60 | + */ |
|
| 61 | + do_action('geodir_installation_start');
|
|
| 62 | + |
|
| 63 | + // Do install |
|
| 64 | + if (!get_option('geodir_default_data_installed')) {
|
|
| 65 | + geodir_create_tables(); // in admin db install.php |
|
| 66 | + geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
| 67 | + geodir_create_default_fields(); |
|
| 68 | + //geodir_default_taxonomies(); |
|
| 69 | + geodir_set_default_options(); |
|
| 70 | + geodir_create_pages(); |
|
| 71 | + geodir_set_default_widgets(); |
|
| 72 | + gd_install_theme_compat(); |
|
| 73 | + |
|
| 74 | + update_option('geodir_default_data_installed', 1);
|
|
| 75 | + |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if (!get_option('geodir_default_data_installed_1.2.8')) {
|
|
| 79 | + //geodir_create_tables(); // in admin db install.php |
|
| 80 | + update_option('geodir_default_data_installed_1.2.8', 1);
|
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + geodir_installation_end(); |
|
| 84 | + /** |
|
| 85 | + * Called after the GD installation scripts have run. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @see 'geodir_installation_start' |
|
| 89 | + */ |
|
| 90 | + do_action('geodir_installation_end');
|
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | } |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | function geodir_create_pages() |
| 105 | 105 | {
|
| 106 | 106 | |
| 107 | - //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
|
|
| 108 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 109 | - geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
|
|
| 110 | - geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
|
|
| 111 | - geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
|
|
| 112 | - geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
|
|
| 107 | + //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
|
|
| 108 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 109 | + geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
|
|
| 110 | + geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
|
|
| 111 | + geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
|
|
| 112 | + geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
|
|
| 113 | 113 | |
| 114 | - //New since 1.5.3 |
|
| 115 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 116 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 114 | + //New since 1.5.3 |
|
| 115 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 116 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | function geodir_installation_end() |
| 131 | 131 | {
|
| 132 | - //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
| 132 | + //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
| 133 | 133 | |
| 134 | - update_option("geodir_installed", 1);
|
|
| 135 | - update_option("geodir_installation_redirect", 1);
|
|
| 136 | - update_option('skip_install_geodir_pages', 0);
|
|
| 134 | + update_option("geodir_installed", 1);
|
|
| 135 | + update_option("geodir_installation_redirect", 1);
|
|
| 136 | + update_option('skip_install_geodir_pages', 0);
|
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -147,45 +147,45 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function geodir_set_default_options() |
| 149 | 149 | {
|
| 150 | - global $geodir_settings; |
|
| 151 | - /** |
|
| 152 | - * Contains settings array for general tab. |
|
| 153 | - * |
|
| 154 | - * @since 1.0.0 |
|
| 155 | - * @package GeoDirectory |
|
| 156 | - */ |
|
| 157 | - include_once("option-pages/general_settings_array.php");
|
|
| 158 | - /** |
|
| 159 | - * Contains settings array for design tab. |
|
| 160 | - * |
|
| 161 | - * @since 1.0.0 |
|
| 162 | - * @package GeoDirectory |
|
| 163 | - */ |
|
| 164 | - include_once("option-pages/design_settings_array.php");
|
|
| 165 | - /** |
|
| 166 | - * Contains settings array for notifications tab. |
|
| 167 | - * |
|
| 168 | - * @since 1.0.0 |
|
| 169 | - * @package GeoDirectory |
|
| 170 | - */ |
|
| 171 | - include_once("option-pages/notifications_settings_array.php");
|
|
| 172 | - /** |
|
| 173 | - * Contains settings array for permalink tab. |
|
| 174 | - * |
|
| 175 | - * @since 1.0.0 |
|
| 176 | - * @package GeoDirectory |
|
| 177 | - */ |
|
| 178 | - include_once("option-pages/permalink_settings_array.php");
|
|
| 179 | - /** |
|
| 180 | - * Contains settings array for title / meta tab. |
|
| 181 | - * |
|
| 182 | - * @since 1.5.4 |
|
| 183 | - * @package GeoDirectory |
|
| 184 | - */ |
|
| 185 | - include_once("option-pages/title_meta_settings_array.php");
|
|
| 186 | - foreach ($geodir_settings as $value) {
|
|
| 187 | - geodir_update_options($value, true); |
|
| 188 | - } |
|
| 150 | + global $geodir_settings; |
|
| 151 | + /** |
|
| 152 | + * Contains settings array for general tab. |
|
| 153 | + * |
|
| 154 | + * @since 1.0.0 |
|
| 155 | + * @package GeoDirectory |
|
| 156 | + */ |
|
| 157 | + include_once("option-pages/general_settings_array.php");
|
|
| 158 | + /** |
|
| 159 | + * Contains settings array for design tab. |
|
| 160 | + * |
|
| 161 | + * @since 1.0.0 |
|
| 162 | + * @package GeoDirectory |
|
| 163 | + */ |
|
| 164 | + include_once("option-pages/design_settings_array.php");
|
|
| 165 | + /** |
|
| 166 | + * Contains settings array for notifications tab. |
|
| 167 | + * |
|
| 168 | + * @since 1.0.0 |
|
| 169 | + * @package GeoDirectory |
|
| 170 | + */ |
|
| 171 | + include_once("option-pages/notifications_settings_array.php");
|
|
| 172 | + /** |
|
| 173 | + * Contains settings array for permalink tab. |
|
| 174 | + * |
|
| 175 | + * @since 1.0.0 |
|
| 176 | + * @package GeoDirectory |
|
| 177 | + */ |
|
| 178 | + include_once("option-pages/permalink_settings_array.php");
|
|
| 179 | + /** |
|
| 180 | + * Contains settings array for title / meta tab. |
|
| 181 | + * |
|
| 182 | + * @since 1.5.4 |
|
| 183 | + * @package GeoDirectory |
|
| 184 | + */ |
|
| 185 | + include_once("option-pages/title_meta_settings_array.php");
|
|
| 186 | + foreach ($geodir_settings as $value) {
|
|
| 187 | + geodir_update_options($value, true); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
@@ -199,103 +199,103 @@ discard block |
||
| 199 | 199 | function geodir_set_default_widgets() |
| 200 | 200 | {
|
| 201 | 201 | |
| 202 | - $widget_option_list = array(); |
|
| 203 | - $widgetinfo = array(); |
|
| 204 | - $sidebarvalue_array = array(); |
|
| 205 | - $sidebars_widgets = array(); |
|
| 202 | + $widget_option_list = array(); |
|
| 203 | + $widgetinfo = array(); |
|
| 204 | + $sidebarvalue_array = array(); |
|
| 205 | + $sidebars_widgets = array(); |
|
| 206 | 206 | |
| 207 | - /*===========================*/ |
|
| 208 | - /* Widgets ON HOME PAGE */ |
|
| 209 | - /*===========================*/ |
|
| 207 | + /*===========================*/ |
|
| 208 | + /* Widgets ON HOME PAGE */ |
|
| 209 | + /*===========================*/ |
|
| 210 | 210 | |
| 211 | - $widget_option_list['geodir_home_top'] = |
|
| 212 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 213 | - 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
|
|
| 214 | - 'geodir_advance_search' => array()); |
|
| 211 | + $widget_option_list['geodir_home_top'] = |
|
| 212 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 213 | + 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
|
|
| 214 | + 'geodir_advance_search' => array()); |
|
| 215 | 215 | |
| 216 | - $widget_option_list['geodir_home_content'] = |
|
| 217 | - array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
|
|
| 216 | + $widget_option_list['geodir_home_content'] = |
|
| 217 | + array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
|
|
| 218 | 218 | |
| 219 | - $widget_option_list['geodir_home_right'] = |
|
| 220 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 221 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 219 | + $widget_option_list['geodir_home_right'] = |
|
| 220 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 221 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 222 | 222 | |
| 223 | - /*===========================*/ |
|
| 224 | - /* Widgets ON LISTING PAGE */ |
|
| 225 | - /*===========================*/ |
|
| 223 | + /*===========================*/ |
|
| 224 | + /* Widgets ON LISTING PAGE */ |
|
| 225 | + /*===========================*/ |
|
| 226 | 226 | |
| 227 | - $widget_option_list['geodir_listing_top'] = |
|
| 228 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 229 | - 'geodir_advance_search' => array()); |
|
| 227 | + $widget_option_list['geodir_listing_top'] = |
|
| 228 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 229 | + 'geodir_advance_search' => array()); |
|
| 230 | 230 | |
| 231 | - $widget_option_list['geodir_listing_right_sidebar'] = |
|
| 232 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 233 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 234 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 231 | + $widget_option_list['geodir_listing_right_sidebar'] = |
|
| 232 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 233 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 234 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 235 | 235 | |
| 236 | 236 | |
| 237 | - /*===========================*/ |
|
| 238 | - /* Widgets ON SEARCH PAGE */ |
|
| 239 | - /*===========================*/ |
|
| 237 | + /*===========================*/ |
|
| 238 | + /* Widgets ON SEARCH PAGE */ |
|
| 239 | + /*===========================*/ |
|
| 240 | 240 | |
| 241 | - $widget_option_list['geodir_search_top'] = |
|
| 242 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 243 | - 'geodir_advance_search' => array()); |
|
| 241 | + $widget_option_list['geodir_search_top'] = |
|
| 242 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 243 | + 'geodir_advance_search' => array()); |
|
| 244 | 244 | |
| 245 | - $widget_option_list['geodir_search_right_sidebar'] = |
|
| 246 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 247 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 248 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 245 | + $widget_option_list['geodir_search_right_sidebar'] = |
|
| 246 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 247 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 248 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 249 | 249 | |
| 250 | - /*===========================*/ |
|
| 251 | - /* Widgets ON DETAIL/SINGLE PAGE */ |
|
| 252 | - /*===========================*/ |
|
| 250 | + /*===========================*/ |
|
| 251 | + /* Widgets ON DETAIL/SINGLE PAGE */ |
|
| 252 | + /*===========================*/ |
|
| 253 | 253 | |
| 254 | - $widget_option_list['geodir_detail_sidebar'] = |
|
| 255 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 256 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 257 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 254 | + $widget_option_list['geodir_detail_sidebar'] = |
|
| 255 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 256 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 257 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 258 | 258 | |
| 259 | 259 | |
| 260 | - /*===========================*/ |
|
| 261 | - /* Widgets ON AUTHOR PAGE */ |
|
| 262 | - /*===========================*/ |
|
| 260 | + /*===========================*/ |
|
| 261 | + /* Widgets ON AUTHOR PAGE */ |
|
| 262 | + /*===========================*/ |
|
| 263 | 263 | |
| 264 | 264 | |
| 265 | - $widget_option_list['geodir_author_right_sidebar'] = |
|
| 266 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
|
|
| 265 | + $widget_option_list['geodir_author_right_sidebar'] = |
|
| 266 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
|
|
| 267 | 267 | |
| 268 | 268 | |
| 269 | - $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 269 | + $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 270 | 270 | |
| 271 | - foreach ($widget_option_list as $key => $widget_options) {
|
|
| 271 | + foreach ($widget_option_list as $key => $widget_options) {
|
|
| 272 | 272 | |
| 273 | - foreach ($widget_options as $key2 => $widget_options_obj) {
|
|
| 274 | - $widgetid = 'widget_' . $key2; |
|
| 273 | + foreach ($widget_options as $key2 => $widget_options_obj) {
|
|
| 274 | + $widgetid = 'widget_' . $key2; |
|
| 275 | 275 | |
| 276 | - $widgetinfo[$widgetid][] = $widget_options_obj; |
|
| 276 | + $widgetinfo[$widgetid][] = $widget_options_obj; |
|
| 277 | 277 | |
| 278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 278 | + $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 279 | 279 | |
| 280 | - $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
| 280 | + $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
| 281 | 281 | |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - if (!empty($sidebarvalue_array[$key])) {
|
|
| 284 | + if (!empty($sidebarvalue_array[$key])) {
|
|
| 285 | 285 | |
| 286 | - $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 287 | - $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
| 288 | - update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 286 | + $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 287 | + $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
| 288 | + update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 289 | 289 | |
| 290 | - foreach ($widget_update as $key => $value) {
|
|
| 290 | + foreach ($widget_update as $key => $value) {
|
|
| 291 | 291 | |
| 292 | - update_option($key, $value); |
|
| 292 | + update_option($key, $value); |
|
| 293 | 293 | |
| 294 | - } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - } |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - } |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | 300 | |
| 301 | 301 | } |
@@ -271,11 +271,11 @@ |
||
| 271 | 271 | foreach ($widget_option_list as $key => $widget_options) {
|
| 272 | 272 | |
| 273 | 273 | foreach ($widget_options as $key2 => $widget_options_obj) {
|
| 274 | - $widgetid = 'widget_' . $key2; |
|
| 274 | + $widgetid = 'widget_'.$key2; |
|
| 275 | 275 | |
| 276 | 276 | $widgetinfo[$widgetid][] = $widget_options_obj; |
| 277 | 277 | |
| 278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 278 | + $sidebarvalue_array[$key][] = $key2."-".(count($widgetinfo[$widgetid])); |
|
| 279 | 279 | |
| 280 | 280 | $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
| 281 | 281 | |
@@ -16,28 +16,28 @@ discard block |
||
| 16 | 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 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $delimiter = ' / '; |
| 159 | 159 | |
| 160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
| 160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner '.$breadcrumb_skin_class.'-skin">'; |
|
| 161 | 161 | |
| 162 | 162 | echo implode($delimiter, $item); |
| 163 | 163 | echo "</div></div>"; |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | $align = !empty($align) ? $align : 'left'; |
| 186 | 186 | |
| 187 | 187 | //$title = 'xxxx'; |
| 188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
| 188 | + echo '<section id="mk-page-introduce" class="intro-'.$align.'">'; |
|
| 189 | 189 | echo '<div class="mk-grid">'; |
| 190 | 190 | if (!empty($title)) { |
| 191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
| 191 | + echo '<h1 class="page-introduce-title '.$shadow_css.'">'.$title.'</h1>'; |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID;?>"/> |
| 30 | 30 | |
| 31 | 31 | <h3><?php |
| 32 | - /** |
|
| 33 | - * Filter the title for the send to friend popup form. |
|
| 34 | - * |
|
| 35 | - * @since 1.0.0 |
|
| 36 | - * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
|
| 37 | - */ |
|
| 38 | - echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 32 | + /** |
|
| 33 | + * Filter the title for the send to friend popup form. |
|
| 34 | + * |
|
| 35 | + * @since 1.0.0 |
|
| 36 | + * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
|
| 37 | + */ |
|
| 38 | + echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 39 | 39 | |
| 40 | 40 | <p id="reply_send_success" class="sucess_msg" style="display:none;"></p> |
| 41 | 41 | <?php |
| 42 | - /** |
|
| 43 | - * Called before each field in the send to friend popup template. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @param string $field The field name the actions is called before. |
|
| 47 | - */ |
|
| 48 | - do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 42 | + /** |
|
| 43 | + * Called before each field in the send to friend popup template. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @param string $field The field name the actions is called before. |
|
| 47 | + */ |
|
| 48 | + do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 49 | 49 | <div class="row clearfix"> |
| 50 | 50 | <div class="geodir_popup_heading"> |
| 51 | 51 | <label><?php _e('Friend Name', 'geodirectory');?> : <span>*</span></label></div> |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | <span class="message_error2" id="to_nameInfo"></span></div> |
| 55 | 55 | </div> |
| 56 | 56 | <?php |
| 57 | - /** |
|
| 58 | - * Called after each field in the send to friend popup template. |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @param string $field The field name the actions is called after. |
|
| 62 | - */ |
|
| 63 | - do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 57 | + /** |
|
| 58 | + * Called after each field in the send to friend popup template. |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @param string $field The field name the actions is called after. |
|
| 62 | + */ |
|
| 63 | + do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 64 | 64 | <?php |
| 65 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 66 | - do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 65 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 66 | + do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 67 | 67 | <div class="row clearfix"> |
| 68 | 68 | <div class="geodir_popup_heading"> |
| 69 | 69 | <label> <?php _e('Email', 'geodirectory');?> : <span>*</span></label></div> |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | <span class="message_error2" id="to_emailInfo"></span></div> |
| 73 | 73 | </div> |
| 74 | 74 | <?php |
| 75 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 76 | - do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 75 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 76 | + do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 77 | 77 | <?php |
| 78 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 79 | - do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 78 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 79 | + do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 80 | 80 | <div class="row clearfix"> |
| 81 | 81 | <div class="geodir_popup_heading"> |
| 82 | 82 | <label><?php _e('Your Name', 'geodirectory');?> : <span>*</span></label></div> |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | <span class="message_error2" id="yournameInfo"></span></div> |
| 86 | 86 | </div> |
| 87 | 87 | <?php |
| 88 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 89 | - do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 88 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 89 | + do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 90 | 90 | <?php |
| 91 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 92 | - do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 91 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 92 | + do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 93 | 93 | <div class="row clearfix"> |
| 94 | 94 | <div class="geodir_popup_heading"> |
| 95 | 95 | <label> <?php _e('Email', 'geodirectory');?> : <span>*</span></label></div> |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | <span class="message_error2" id="youremailInfo"></span></div> |
| 99 | 99 | </div> |
| 100 | 100 | <?php |
| 101 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 102 | - do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 101 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 102 | + do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 103 | 103 | <?php |
| 104 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 105 | - do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 104 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 105 | + do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 106 | 106 | <div class="row clearfix"> |
| 107 | 107 | <div class="geodir_popup_heading"> |
| 108 | 108 | <label><?php _e('Subject', 'geodirectory');?> : <span>*</span></label></div> |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | <span class="message_error2" id="frnd_subjectInfo"></span></div> |
| 114 | 114 | </div> |
| 115 | 115 | <?php |
| 116 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 117 | - do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 116 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 117 | + do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 118 | 118 | <?php |
| 119 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 120 | - do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 119 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 120 | + do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 121 | 121 | <div class="row clearfix"> |
| 122 | 122 | <div class="geodir_popup_heading"> |
| 123 | 123 | <label><?php _e('Comments', 'geodirectory');?> : <span>*</span></label></div> |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | <span class="message_error2" id="frnd_commentsInfo"></span></div> |
| 128 | 128 | </div> |
| 129 | 129 | <?php |
| 130 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 131 | - do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 130 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 131 | + do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 132 | 132 | <?php if (function_exists('geodir_get_captch')) { |
| 133 | - geodir_get_captch('-1'); |
|
| 134 | - }?> |
|
| 133 | + geodir_get_captch('-1'); |
|
| 134 | + }?> |
|
| 135 | 135 | <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory')?> " class="button "/> |
| 136 | 136 | </form> |
| 137 | 137 | </div> <?php |
@@ -145,23 +145,23 @@ discard block |
||
| 145 | 145 | <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
| 146 | 146 | |
| 147 | 147 | <h3><?php |
| 148 | - /** |
|
| 149 | - * Filter the title for the send inquiry popup form. |
|
| 150 | - * |
|
| 151 | - * @since 1.0.0 |
|
| 152 | - * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
| 153 | - */ |
|
| 154 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 148 | + /** |
|
| 149 | + * Filter the title for the send inquiry popup form. |
|
| 150 | + * |
|
| 151 | + * @since 1.0.0 |
|
| 152 | + * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
|
| 153 | + */ |
|
| 154 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 155 | 155 | |
| 156 | 156 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
| 157 | 157 | <?php |
| 158 | - /** |
|
| 159 | - * Called before each field in the send to friend inquiry template. |
|
| 160 | - * |
|
| 161 | - * @since 1.0.0 |
|
| 162 | - * @param string $field The field name the actions is called before. |
|
| 163 | - */ |
|
| 164 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 158 | + /** |
|
| 159 | + * Called before each field in the send to friend inquiry template. |
|
| 160 | + * |
|
| 161 | + * @since 1.0.0 |
|
| 162 | + * @param string $field The field name the actions is called before. |
|
| 163 | + */ |
|
| 164 | + do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 165 | 165 | <div class="row clearfix"> |
| 166 | 166 | <div class="geodir_popup_heading"><label><?php _e('Your Name', 'geodirectory');?> : |
| 167 | 167 | <span>*</span></label></div> |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | <span class="message_error2" id="span_agt_mail_name"></span></div> |
| 171 | 171 | </div> |
| 172 | 172 | <?php |
| 173 | - /** |
|
| 174 | - * Called after each field in the send to friend inquiry template. |
|
| 175 | - * |
|
| 176 | - * @since 1.0.0 |
|
| 177 | - * @param string $field The field name the actions is called after. |
|
| 178 | - */ |
|
| 179 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 173 | + /** |
|
| 174 | + * Called after each field in the send to friend inquiry template. |
|
| 175 | + * |
|
| 176 | + * @since 1.0.0 |
|
| 177 | + * @param string $field The field name the actions is called after. |
|
| 178 | + */ |
|
| 179 | + do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 180 | 180 | <?php |
| 181 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 182 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 181 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 182 | + do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 183 | 183 | <div class="row clearfix"> |
| 184 | 184 | <div class="geodir_popup_heading"> |
| 185 | 185 | <label><?php _e('Email', 'geodirectory');?> : <span>*</span></label></div> |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | </div> |
| 190 | 190 | </div> |
| 191 | 191 | <?php |
| 192 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 193 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 192 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 193 | + do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 194 | 194 | <?php |
| 195 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 196 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 195 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 196 | + do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 197 | 197 | <div class="row clearfix"> |
| 198 | 198 | <div class="geodir_popup_heading"> |
| 199 | 199 | <label><?php _e('Contact Info', 'geodirectory');?> :</label></div> |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | </div> |
| 203 | 203 | </div> |
| 204 | 204 | <?php |
| 205 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 206 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 205 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 206 | + do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 207 | 207 | <?php |
| 208 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 209 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 208 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 209 | + do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 210 | 210 | <div class="row clearfix"> |
| 211 | 211 | <div class="geodir_popup_heading"> |
| 212 | 212 | <label><?php _e('Comments', 'geodirectory');?> : <span>*</span></label></div> |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | <span class="message_error2" id="span_agt_mail_msg"></span></div> |
| 217 | 217 | </div> |
| 218 | 218 | <?php |
| 219 | - /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 220 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 219 | + /** This action is documented in geodirectory-templates/popup-forms.php */ |
|
| 220 | + do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 221 | 221 | <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
| 222 | 222 | class="button clearfix"/> |
| 223 | 223 | </form> |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | * @param int $post_id The post id requested by the popup. |
| 20 | 20 | * @param object $post_info The post object requested by the popup. |
| 21 | 21 | */ |
| 22 | -do_action('geodir_popup_forms_template_start',$post_id,$post_info); |
|
| 22 | +do_action('geodir_popup_forms_template_start', $post_id, $post_info); |
|
| 23 | 23 | |
| 24 | 24 | if ($_REQUEST['popuptype'] == 'b_sendtofriend') { ?> |
| 25 | 25 | |
| 26 | 26 | <div id="basic-modal-content" class="clearfix"> |
| 27 | 27 | <form name="send_to_frnd" id="send_to_frnd" action="<?php echo get_permalink($post_info->ID); ?>" method="post"> |
| 28 | 28 | <input type="hidden" name="sendact" value="email_frnd"/> |
| 29 | - <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID;?>"/> |
|
| 29 | + <input type="hidden" id="send_to_Frnd_pid" name="pid" value="<?php echo $post_info->ID; ?>"/> |
|
| 30 | 30 | |
| 31 | 31 | <h3><?php |
| 32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @since 1.0.0 |
| 36 | 36 | * @param string $title The title for the form, defaults to global `SEND_TO_FRIEND` text. |
| 37 | 37 | */ |
| 38 | - echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND);?></h3> |
|
| 38 | + echo apply_filters('geodir_send_to_friend_page_title', SEND_TO_FRIEND); ?></h3> |
|
| 39 | 39 | |
| 40 | 40 | <p id="reply_send_success" class="sucess_msg" style="display:none;"></p> |
| 41 | 41 | <?php |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @since 1.0.0 |
| 46 | 46 | * @param string $field The field name the actions is called before. |
| 47 | 47 | */ |
| 48 | - do_action('geodir_before_stf_form_field', 'to_name');?> |
|
| 48 | + do_action('geodir_before_stf_form_field', 'to_name'); ?> |
|
| 49 | 49 | <div class="row clearfix"> |
| 50 | - <input required field_type="text" name="to_name" id="to_name" type="text" value="" placeholder="<?php _e('Friend Name', 'geodirectory');?>"/> |
|
| 50 | + <input required field_type="text" name="to_name" id="to_name" type="text" value="" placeholder="<?php _e('Friend Name', 'geodirectory'); ?>"/> |
|
| 51 | 51 | </div> |
| 52 | 52 | <?php |
| 53 | 53 | /** |
@@ -56,55 +56,55 @@ discard block |
||
| 56 | 56 | * @since 1.0.0 |
| 57 | 57 | * @param string $field The field name the actions is called after. |
| 58 | 58 | */ |
| 59 | - do_action('geodir_after_stf_form_field', 'to_name');?> |
|
| 59 | + do_action('geodir_after_stf_form_field', 'to_name'); ?> |
|
| 60 | 60 | <?php |
| 61 | 61 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 62 | - do_action('geodir_before_stf_form_field', 'to_email');?> |
|
| 62 | + do_action('geodir_before_stf_form_field', 'to_email'); ?> |
|
| 63 | 63 | <div class="row clearfix"> |
| 64 | - <input required field_type="email" name="to_email" id="to_email" type="email" value="" placeholder="<?php _e('Friend Email', 'geodirectory');?>"/> |
|
| 64 | + <input required field_type="email" name="to_email" id="to_email" type="email" value="" placeholder="<?php _e('Friend Email', 'geodirectory'); ?>"/> |
|
| 65 | 65 | </div> |
| 66 | 66 | <?php |
| 67 | 67 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 68 | - do_action('geodir_after_stf_form_field', 'to_email');?> |
|
| 68 | + do_action('geodir_after_stf_form_field', 'to_email'); ?> |
|
| 69 | 69 | <?php |
| 70 | 70 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 71 | - do_action('geodir_before_stf_form_field', 'yourname');?> |
|
| 71 | + do_action('geodir_before_stf_form_field', 'yourname'); ?> |
|
| 72 | 72 | <div class="row clearfix"> |
| 73 | - <input required field_type="text" name="yourname" id="yourname" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
|
| 73 | + <input required field_type="text" name="yourname" id="yourname" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory'); ?>"/> |
|
| 74 | 74 | </div> |
| 75 | 75 | <?php |
| 76 | 76 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 77 | - do_action('geodir_after_stf_form_field', 'yourname');?> |
|
| 77 | + do_action('geodir_after_stf_form_field', 'yourname'); ?> |
|
| 78 | 78 | <?php |
| 79 | 79 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 80 | - do_action('geodir_before_stf_form_field', 'youremail');?> |
|
| 80 | + do_action('geodir_before_stf_form_field', 'youremail'); ?> |
|
| 81 | 81 | <div class="row clearfix"> |
| 82 | - <input required field_type="email" name="youremail" id="youremail" type="email" value="" placeholder="<?php _e('Your Email', 'geodirectory');?>"/> |
|
| 82 | + <input required field_type="email" name="youremail" id="youremail" type="email" value="" placeholder="<?php _e('Your Email', 'geodirectory'); ?>"/> |
|
| 83 | 83 | </div> |
| 84 | 84 | <?php |
| 85 | 85 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 86 | - do_action('geodir_after_stf_form_field', 'youremail');?> |
|
| 86 | + do_action('geodir_after_stf_form_field', 'youremail'); ?> |
|
| 87 | 87 | <?php |
| 88 | 88 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 89 | - do_action('geodir_before_stf_form_field', 'frnd_subject');?> |
|
| 89 | + do_action('geodir_before_stf_form_field', 'frnd_subject'); ?> |
|
| 90 | 90 | <div class="row clearfix"> |
| 91 | 91 | <input required field_type="text" name="frnd_subject" |
| 92 | - value="<?php echo __('About', 'geodirectory') . ' ' . $post_info->post_title;?>" |
|
| 93 | - id="frnd_subject" type="text" placeholder="<?php _e('Subject', 'geodirectory');?>"/> |
|
| 92 | + value="<?php echo __('About', 'geodirectory').' '.$post_info->post_title; ?>" |
|
| 93 | + id="frnd_subject" type="text" placeholder="<?php _e('Subject', 'geodirectory'); ?>"/> |
|
| 94 | 94 | </div> |
| 95 | 95 | <?php |
| 96 | 96 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 97 | - do_action('geodir_after_stf_form_field', 'frnd_subject');?> |
|
| 97 | + do_action('geodir_after_stf_form_field', 'frnd_subject'); ?> |
|
| 98 | 98 | <?php |
| 99 | 99 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 100 | - do_action('geodir_before_stf_form_field', 'frnd_comments');?> |
|
| 100 | + do_action('geodir_before_stf_form_field', 'frnd_comments'); ?> |
|
| 101 | 101 | <div class="row clearfix"> |
| 102 | 102 | <textarea required field_type="textarea" name="frnd_comments" id="frnd_comments" cols="" |
| 103 | - rows="" placeholder="<?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?>"><?php echo SEND_TO_FRIEND_SAMPLE_CONTENT;?></textarea> |
|
| 103 | + rows="" placeholder="<?php echo SEND_TO_FRIEND_SAMPLE_CONTENT; ?>"><?php echo SEND_TO_FRIEND_SAMPLE_CONTENT; ?></textarea> |
|
| 104 | 104 | </div> |
| 105 | 105 | <?php |
| 106 | 106 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 107 | - do_action('geodir_after_stf_form_field', 'frnd_comments');?> |
|
| 107 | + do_action('geodir_after_stf_form_field', 'frnd_comments'); ?> |
|
| 108 | 108 | <?php if (function_exists('geodir_get_captch')) { |
| 109 | 109 | geodir_get_captch('-1'); |
| 110 | 110 | }?> |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | <form method="post" name="agt_mail_agent" id="agt_mail_agent" |
| 119 | 119 | action="<?php echo get_permalink($post_info->ID); ?>"> |
| 120 | 120 | <input type="hidden" name="sendact" value="send_inqury"/> |
| 121 | - <input type="hidden" name="pid" value="<?php echo $post_info->ID;?>"/> |
|
| 121 | + <input type="hidden" name="pid" value="<?php echo $post_info->ID; ?>"/> |
|
| 122 | 122 | |
| 123 | 123 | <h3><?php |
| 124 | 124 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @since 1.0.0 |
| 128 | 128 | * @param string $title The title for the form, defaults to global `SEND_INQUIRY` text. |
| 129 | 129 | */ |
| 130 | - echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY);?> </h3> |
|
| 130 | + echo apply_filters('geodir_send_inquiry_page_title', SEND_INQUIRY); ?> </h3> |
|
| 131 | 131 | |
| 132 | 132 | <p id="inquiry_send_success" class="sucess_msg" style="display:none;"></p> |
| 133 | 133 | <?php |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | * @since 1.0.0 |
| 138 | 138 | * @param string $field The field name the actions is called before. |
| 139 | 139 | */ |
| 140 | - do_action('geodir_before_inquiry_form_field', 'inq_name');?> |
|
| 140 | + do_action('geodir_before_inquiry_form_field', 'inq_name'); ?> |
|
| 141 | 141 | <div class="row clearfix"> |
| 142 | - <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory');?>"/> |
|
| 142 | + <input required field_type="text" name="inq_name" type="text" value="" placeholder="<?php _e('Your Name', 'geodirectory'); ?>"/> |
|
| 143 | 143 | </div> |
| 144 | 144 | <?php |
| 145 | 145 | /** |
@@ -148,36 +148,36 @@ discard block |
||
| 148 | 148 | * @since 1.0.0 |
| 149 | 149 | * @param string $field The field name the actions is called after. |
| 150 | 150 | */ |
| 151 | - do_action('geodir_after_inquiry_form_field', 'inq_name');?> |
|
| 151 | + do_action('geodir_after_inquiry_form_field', 'inq_name'); ?> |
|
| 152 | 152 | <?php |
| 153 | 153 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 154 | - do_action('geodir_before_inquiry_form_field', 'inq_email');?> |
|
| 154 | + do_action('geodir_before_inquiry_form_field', 'inq_email'); ?> |
|
| 155 | 155 | <div class="row clearfix"> |
| 156 | - <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory');?>"/> |
|
| 156 | + <input required field_type="email" name="inq_email" type="email" value="" placeholder="<?php _e('Email', 'geodirectory'); ?>"/> |
|
| 157 | 157 | </div> |
| 158 | 158 | <?php |
| 159 | 159 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 160 | - do_action('geodir_after_inquiry_form_field', 'inq_email');?> |
|
| 160 | + do_action('geodir_after_inquiry_form_field', 'inq_email'); ?> |
|
| 161 | 161 | <?php |
| 162 | 162 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 163 | - do_action('geodir_before_inquiry_form_field', 'inq_phone');?> |
|
| 163 | + do_action('geodir_before_inquiry_form_field', 'inq_phone'); ?> |
|
| 164 | 164 | <div class="row clearfix"> |
| 165 | - <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory');?>"/> |
|
| 165 | + <input name="inq_phone" id="agt_mail_phone" type="text" value="" placeholder="<?php _e('Phone number', 'geodirectory'); ?>"/> |
|
| 166 | 166 | </div> |
| 167 | 167 | <?php |
| 168 | 168 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 169 | - do_action('geodir_after_inquiry_form_field', 'inq_phone');?> |
|
| 169 | + do_action('geodir_after_inquiry_form_field', 'inq_phone'); ?> |
|
| 170 | 170 | <?php |
| 171 | 171 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 172 | - do_action('geodir_before_inquiry_form_field', 'inq_msg');?> |
|
| 172 | + do_action('geodir_before_inquiry_form_field', 'inq_msg'); ?> |
|
| 173 | 173 | <div class="row clearfix"> |
| 174 | 174 | <textarea required field_type="textarea" name="inq_msg" cols="" |
| 175 | - rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT;?>"></textarea> |
|
| 175 | + rows="" placeholder="<?php echo SEND_INQUIRY_SAMPLE_CONTENT; ?>"></textarea> |
|
| 176 | 176 | </div> |
| 177 | 177 | <?php |
| 178 | 178 | /** This action is documented in geodirectory-templates/popup-forms.php */ |
| 179 | - do_action('geodir_after_inquiry_form_field', 'inq_msg');?> |
|
| 180 | - <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory');?>" |
|
| 179 | + do_action('geodir_after_inquiry_form_field', 'inq_msg'); ?> |
|
| 180 | + <input name="Send" type="submit" value="<?php _e('Send', 'geodirectory'); ?>" |
|
| 181 | 181 | class="button clearfix"/> |
| 182 | 182 | </form> |
| 183 | 183 | </div> <?php |
@@ -12,7 +12,7 @@ |
||
| 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(); |
@@ -198,7 +198,9 @@ discard block |
||
| 198 | 198 | $mapview = $maptype; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 201 | + if (empty($mapzoom)) { |
|
| 202 | + $mapzoom = $zoom; |
|
| 203 | + } |
|
| 202 | 204 | |
| 203 | 205 | // Set default map options |
| 204 | 206 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -326,8 +328,9 @@ discard block |
||
| 326 | 328 | |
| 327 | 329 | foreach ($map_zoom_level as $level) {
|
| 328 | 330 | $selected = ''; |
| 329 | - if ($level == $zoom) |
|
| 330 | - $selected = 'selected="selected"'; |
|
| 331 | + if ($level == $zoom) { |
|
| 332 | + $selected = 'selected="selected"'; |
|
| 333 | + } |
|
| 331 | 334 | |
| 332 | 335 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
| 333 | 336 | |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function init_listing_map_script() |
| 20 | 20 | {
|
| 21 | - global $list_map_json; |
|
| 21 | + global $list_map_json; |
|
| 22 | 22 | |
| 23 | - $list_map_json = array(); |
|
| 23 | + $list_map_json = array(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function create_list_jsondata($post) |
| 37 | 37 | {
|
| 38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
| 39 | - |
|
| 40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
|
|
| 41 | - /** |
|
| 42 | - * Filter the json data for search listing map. |
|
| 43 | - * |
|
| 44 | - * @since 1.5.7 |
|
| 45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
| 46 | - * @param object $post The post object. |
|
| 47 | - */ |
|
| 48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 49 | - } |
|
| 38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
| 39 | + |
|
| 40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
|
|
| 41 | + /** |
|
| 42 | + * Filter the json data for search listing map. |
|
| 43 | + * |
|
| 44 | + * @since 1.5.7 |
|
| 45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
| 46 | + * @param object $post The post object. |
|
| 47 | + */ |
|
| 48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | function show_listing_widget_map() |
| 61 | 61 | {
|
| 62 | - global $list_map_json; |
|
| 62 | + global $list_map_json; |
|
| 63 | 63 | |
| 64 | - if (!empty($list_map_json)) {
|
|
| 65 | - $list_map_json = array_unique($list_map_json); |
|
| 66 | - $cat_content_info[] = implode(',', $list_map_json);
|
|
| 67 | - } |
|
| 64 | + if (!empty($list_map_json)) {
|
|
| 65 | + $list_map_json = array_unique($list_map_json); |
|
| 66 | + $cat_content_info[] = implode(',', $list_map_json);
|
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $totalcount = count(array_unique($list_map_json)); |
|
| 69 | + $totalcount = count(array_unique($list_map_json)); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - if (!empty($cat_content_info)) {
|
|
| 73 | - $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 77 | - } else {
|
|
| 78 | - $list_json = '[{"totalcount":"0"}]';
|
|
| 79 | - } |
|
| 72 | + if (!empty($cat_content_info)) {
|
|
| 73 | + $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 77 | + } else {
|
|
| 78 | + $list_json = '[{"totalcount":"0"}]';
|
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - $listing_map_args = array('list_json' => $list_json);
|
|
| 81 | + $listing_map_args = array('list_json' => $list_json);
|
|
| 82 | 82 | |
| 83 | - // Pass the json data in listing map script |
|
| 84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
|
|
| 83 | + // Pass the json data in listing map script |
|
| 84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
|
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,187 +93,187 @@ discard block |
||
| 93 | 93 | class geodir_map_listingpage extends WP_Widget |
| 94 | 94 | {
|
| 95 | 95 | |
| 96 | - /** |
|
| 96 | + /** |
|
| 97 | 97 | * Register the listing page map widget. |
| 98 | 98 | * |
| 99 | 99 | * @since 1.0.0 |
| 100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 101 | 101 | */ |
| 102 | - public function __construct() {
|
|
| 103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
|
|
| 104 | - parent::__construct( |
|
| 105 | - 'geodir_map_v3_listing_map', // Base ID |
|
| 106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name
|
|
| 107 | - $widget_ops// Args |
|
| 108 | - ); |
|
| 102 | + public function __construct() {
|
|
| 103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
|
|
| 104 | + parent::__construct( |
|
| 105 | + 'geodir_map_v3_listing_map', // Base ID |
|
| 106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name
|
|
| 107 | + $widget_ops// Args |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
|
|
| 110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
|
|
| 111 | 111 | |
| 112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array
|
|
| 112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array
|
|
| 113 | 113 | |
| 114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
|
|
| 115 | - } |
|
| 114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
|
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Front-end display content for listing page map widget. |
| 119 | 119 | * |
| 120 | 120 | * @since 1.0.0 |
| 121 | - * @since 1.5.1 Declare function public. |
|
| 121 | + * @since 1.5.1 Declare function public. |
|
| 122 | + * |
|
| 123 | + * @global object $post The current post object. |
|
| 122 | 124 | * |
| 123 | - * @global object $post The current post object. |
|
| 124 | - * |
|
| 125 | 125 | * @param array $args Widget arguments. |
| 126 | 126 | * @param array $instance Saved values from database. |
| 127 | 127 | */ |
| 128 | - public function widget($args, $instance) |
|
| 129 | - {
|
|
| 130 | - |
|
| 131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
|
|
| 132 | - || geodir_is_page('detail')
|
|
| 133 | - ) : |
|
| 134 | - |
|
| 135 | - extract($args, EXTR_SKIP); |
|
| 136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
|
|
| 138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 146 | - /** |
|
| 147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @param bool $sticky True if should be sticky, false if not |
|
| 151 | - */ |
|
| 152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
|
|
| 153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
|
|
| 128 | + public function widget($args, $instance) |
|
| 129 | + {
|
|
| 130 | + |
|
| 131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
|
|
| 132 | + || geodir_is_page('detail')
|
|
| 133 | + ) : |
|
| 134 | + |
|
| 135 | + extract($args, EXTR_SKIP); |
|
| 136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
|
|
| 138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 146 | + /** |
|
| 147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @param bool $sticky True if should be sticky, false if not |
|
| 151 | + */ |
|
| 152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
|
|
| 153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
|
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * Filter the listing map should to be displayed or not. |
|
| 159 | - * |
|
| 160 | - * @since 1.4.6 |
|
| 158 | + * Filter the listing map should to be displayed or not. |
|
| 161 | 159 | * |
| 162 | - * @param bool $display true if map should be displayed, false if not. |
|
| 163 | - */ |
|
| 160 | + * @since 1.4.6 |
|
| 161 | + * |
|
| 162 | + * @param bool $display true if map should be displayed, false if not. |
|
| 163 | + */ |
|
| 164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
| 165 | 165 | if ( !$show_map ) {
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $map_args = array(); |
|
| 170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
|
|
| 171 | - $map_args['width'] = $width; |
|
| 172 | - $map_args['height'] = $height; |
|
| 173 | - |
|
| 174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
| 175 | - $map_args['showall'] = $showall; |
|
| 176 | - $map_args['child_collapse'] = '0'; |
|
| 177 | - $map_args['sticky'] = $sticky; |
|
| 178 | - $map_args['enable_cat_filters'] = false; |
|
| 179 | - $map_args['enable_text_search'] = false; |
|
| 180 | - $map_args['enable_post_type_filters'] = false; |
|
| 181 | - $map_args['enable_location_filters'] = false; |
|
| 182 | - $map_args['enable_jason_on_load'] = true; |
|
| 169 | + $map_args = array(); |
|
| 170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
|
|
| 171 | + $map_args['width'] = $width; |
|
| 172 | + $map_args['height'] = $height; |
|
| 173 | + |
|
| 174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
| 175 | + $map_args['showall'] = $showall; |
|
| 176 | + $map_args['child_collapse'] = '0'; |
|
| 177 | + $map_args['sticky'] = $sticky; |
|
| 178 | + $map_args['enable_cat_filters'] = false; |
|
| 179 | + $map_args['enable_text_search'] = false; |
|
| 180 | + $map_args['enable_post_type_filters'] = false; |
|
| 181 | + $map_args['enable_location_filters'] = false; |
|
| 182 | + $map_args['enable_jason_on_load'] = true; |
|
| 183 | 183 | |
| 184 | - if (is_single()) {
|
|
| 185 | - |
|
| 186 | - global $post; |
|
| 187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 189 | - $mapview = $post->post_mapview; |
|
| 190 | - $mapzoom = $post->post_mapzoom; |
|
| 191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 192 | - |
|
| 193 | - } else {
|
|
| 194 | - $default_location = geodir_get_default_location(); |
|
| 195 | - |
|
| 196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 199 | - $mapview = $maptype; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 203 | - |
|
| 204 | - // Set default map options |
|
| 205 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 206 | - $map_args['latitude'] = $map_default_lat; |
|
| 207 | - $map_args['longitude'] = $map_default_lng; |
|
| 208 | - $map_args['zoom'] = $zoom; |
|
| 209 | - //$map_args['scrollwheel'] = true; |
|
| 210 | - $map_args['scrollwheel'] = $scrollwheel; |
|
| 211 | - $map_args['showall'] = $showall; |
|
| 212 | - $map_args['streetViewControl'] = true; |
|
| 213 | - $map_args['maptype'] = $maptype; |
|
| 214 | - $map_args['showPreview'] = '0'; |
|
| 215 | - $map_args['maxZoom'] = 21; |
|
| 216 | - $map_args['autozoom'] = $autozoom; |
|
| 217 | - $map_args['bubble_size'] = 'small'; |
|
| 184 | + if (is_single()) {
|
|
| 185 | + |
|
| 186 | + global $post; |
|
| 187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 189 | + $mapview = $post->post_mapview; |
|
| 190 | + $mapzoom = $post->post_mapzoom; |
|
| 191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 192 | + |
|
| 193 | + } else {
|
|
| 194 | + $default_location = geodir_get_default_location(); |
|
| 195 | + |
|
| 196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 199 | + $mapview = $maptype; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 203 | + |
|
| 204 | + // Set default map options |
|
| 205 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 206 | + $map_args['latitude'] = $map_default_lat; |
|
| 207 | + $map_args['longitude'] = $map_default_lng; |
|
| 208 | + $map_args['zoom'] = $zoom; |
|
| 209 | + //$map_args['scrollwheel'] = true; |
|
| 210 | + $map_args['scrollwheel'] = $scrollwheel; |
|
| 211 | + $map_args['showall'] = $showall; |
|
| 212 | + $map_args['streetViewControl'] = true; |
|
| 213 | + $map_args['maptype'] = $maptype; |
|
| 214 | + $map_args['showPreview'] = '0'; |
|
| 215 | + $map_args['maxZoom'] = 21; |
|
| 216 | + $map_args['autozoom'] = $autozoom; |
|
| 217 | + $map_args['bubble_size'] = 'small'; |
|
| 218 | 218 | |
| 219 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
|
|
| 219 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
|
|
| 220 | 220 | |
| 221 | - echo $before_widget; |
|
| 222 | - geodir_draw_map($map_args); |
|
| 223 | - echo $after_widget; |
|
| 221 | + echo $before_widget; |
|
| 222 | + geodir_draw_map($map_args); |
|
| 223 | + echo $after_widget; |
|
| 224 | 224 | |
| 225 | - endif; |
|
| 226 | - } |
|
| 225 | + endif; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * Sanitize listing page map widget form values as they are saved. |
| 230 | 230 | * |
| 231 | 231 | * @since 1.0.0 |
| 232 | - * @since 1.5.1 Declare function public. |
|
| 232 | + * @since 1.5.1 Declare function public. |
|
| 233 | 233 | * |
| 234 | 234 | * @param array $new_instance Values just sent to be saved. |
| 235 | 235 | * @param array $old_instance Previously saved values from database. |
| 236 | 236 | * |
| 237 | 237 | * @return array Updated safe values to be saved. |
| 238 | 238 | */ |
| 239 | - public function update($new_instance, $old_instance) {
|
|
| 240 | - //save the widget |
|
| 241 | - $instance = $old_instance; |
|
| 242 | - $instance['width'] = strip_tags($new_instance['width']); |
|
| 243 | - $instance['heigh'] = ($new_instance['heigh']); |
|
| 244 | - $instance['maptype'] = ($new_instance['maptype']); |
|
| 245 | - $instance['zoom'] = ($new_instance['zoom']); |
|
| 246 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 247 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
| 248 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 249 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
| 250 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
|
|
| 251 | - |
|
| 252 | - return $instance; |
|
| 253 | - } |
|
| 239 | + public function update($new_instance, $old_instance) {
|
|
| 240 | + //save the widget |
|
| 241 | + $instance = $old_instance; |
|
| 242 | + $instance['width'] = strip_tags($new_instance['width']); |
|
| 243 | + $instance['heigh'] = ($new_instance['heigh']); |
|
| 244 | + $instance['maptype'] = ($new_instance['maptype']); |
|
| 245 | + $instance['zoom'] = ($new_instance['zoom']); |
|
| 246 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 247 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
| 248 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 249 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
| 250 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
|
|
| 251 | + |
|
| 252 | + return $instance; |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Back-end listing page map widget settings form. |
| 257 | 257 | * |
| 258 | 258 | * @since 1.0.0 |
| 259 | - * @since 1.5.1 Declare function public. |
|
| 259 | + * @since 1.5.1 Declare function public. |
|
| 260 | 260 | * |
| 261 | 261 | * @param array $instance Previously saved values from database. |
| 262 | 262 | */ |
| 263 | - public function form($instance) {
|
|
| 264 | - // widget form in backend |
|
| 265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 263 | + public function form($instance) {
|
|
| 264 | + // widget form in backend |
|
| 265 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 266 | 266 | |
| 267 | - $width = strip_tags($instance['width']); |
|
| 268 | - $heigh = strip_tags($instance['heigh']); |
|
| 269 | - $maptype = strip_tags($instance['maptype']); |
|
| 270 | - $zoom = strip_tags($instance['zoom']); |
|
| 271 | - $autozoom = strip_tags($instance['autozoom']); |
|
| 272 | - $sticky = strip_tags($instance['sticky']); |
|
| 273 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 274 | - $showall = strip_tags($instance['showall']); |
|
| 275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
| 276 | - ?> |
|
| 267 | + $width = strip_tags($instance['width']); |
|
| 268 | + $heigh = strip_tags($instance['heigh']); |
|
| 269 | + $maptype = strip_tags($instance['maptype']); |
|
| 270 | + $zoom = strip_tags($instance['zoom']); |
|
| 271 | + $autozoom = strip_tags($instance['autozoom']); |
|
| 272 | + $sticky = strip_tags($instance['sticky']); |
|
| 273 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 274 | + $showall = strip_tags($instance['showall']); |
|
| 275 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
| 276 | + ?> |
|
| 277 | 277 | <p> |
| 278 | 278 | <label |
| 279 | 279 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
|
@@ -302,14 +302,14 @@ discard block |
||
| 302 | 302 | name="<?php echo $this->get_field_name('maptype'); ?>">
|
| 303 | 303 | |
| 304 | 304 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
|
| 305 | - echo 'selected="selected"'; |
|
| 306 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 305 | + echo 'selected="selected"'; |
|
| 306 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 307 | 307 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
|
| 308 | - echo 'selected="selected"'; |
|
| 309 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 308 | + echo 'selected="selected"'; |
|
| 309 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 311 | - echo 'selected="selected"'; |
|
| 312 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 311 | + echo 'selected="selected"'; |
|
| 312 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 313 | 313 | <option <?php selected($maptype, 'TERRAIN');?> |
| 314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 315 | 315 | </select> |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | </p> |
| 318 | 318 | |
| 319 | 319 | <?php |
| 320 | - $map_zoom_level = geodir_map_zoom_level(); |
|
| 321 | - ?> |
|
| 320 | + $map_zoom_level = geodir_map_zoom_level(); |
|
| 321 | + ?> |
|
| 322 | 322 | |
| 323 | 323 | <p> |
| 324 | 324 | <label |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
|
| 329 | 329 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
|
| 330 | 330 | |
| 331 | - foreach ($map_zoom_level as $level) {
|
|
| 332 | - $selected = ''; |
|
| 333 | - if ($level == $zoom) |
|
| 334 | - $selected = 'selected="selected"'; |
|
| 331 | + foreach ($map_zoom_level as $level) {
|
|
| 332 | + $selected = ''; |
|
| 333 | + if ($level == $zoom) |
|
| 334 | + $selected = 'selected="selected"'; |
|
| 335 | 335 | |
| 336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 336 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 337 | 337 | |
| 338 | - } ?> |
|
| 338 | + } ?> |
|
| 339 | 339 | |
| 340 | 340 | </select> |
| 341 | 341 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | for="<?php echo $this->get_field_id('autozoom'); ?>">
|
| 348 | 348 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
|
| 349 | 349 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
|
| 350 | - echo 'checked="checked"'; |
|
| 351 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
|
|
| 350 | + echo 'checked="checked"'; |
|
| 351 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
|
|
| 352 | 352 | </p> |
| 353 | 353 | |
| 354 | 354 | <p> |
@@ -356,8 +356,8 @@ discard block |
||
| 356 | 356 | for="<?php echo $this->get_field_id('sticky'); ?>">
|
| 357 | 357 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
|
| 358 | 358 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
|
| 359 | - echo 'checked="checked"'; |
|
| 360 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
|
|
| 359 | + echo 'checked="checked"'; |
|
| 360 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
|
|
| 361 | 361 | </label> |
| 362 | 362 | </p> |
| 363 | 363 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | </p> --> |
| 384 | 384 | |
| 385 | 385 | <?php |
| 386 | - } |
|
| 386 | + } |
|
| 387 | 387 | } // class geodir_map_listingpage |
| 388 | 388 | |
| 389 | 389 | register_widget('geodir_map_listingpage');
|
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
| 46 | 46 | * @param object $post The post object. |
| 47 | 47 | */ |
| 48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
|
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1);
|
| 74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
| 75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
| 76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
|
|
| 77 | 77 | } else {
|
| 78 | 78 | $list_json = '[{"totalcount":"0"}]';
|
| 79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @param bool $display true if map should be displayed, false if not. |
| 163 | 163 | */ |
| 164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
| 165 | - if ( !$show_map ) {
|
|
| 164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true);
|
|
| 165 | + if (!$show_map) {
|
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function form($instance) {
|
| 264 | 264 | // widget form in backend |
| 265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 265 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 266 | 266 | |
| 267 | 267 | $width = strip_tags($instance['width']); |
| 268 | 268 | $heigh = strip_tags($instance['heigh']); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $sticky = strip_tags($instance['sticky']); |
| 273 | 273 | $scrollwheel = strip_tags($instance['scrollwheel']); |
| 274 | 274 | $showall = strip_tags($instance['showall']); |
| 275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
| 275 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
| 276 | 276 | ?> |
| 277 | 277 | <p> |
| 278 | 278 | <label |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 311 | 311 | echo 'selected="selected"'; |
| 312 | 312 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
| 313 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
| 313 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
| 314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 315 | 315 | </select> |
| 316 | 316 | </label> |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if ($level == $zoom) |
| 334 | 334 | $selected = 'selected="selected"'; |
| 335 | 335 | |
| 336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 336 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
| 337 | 337 | |
| 338 | 338 | } ?> |
| 339 | 339 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | for="<?php echo $this->get_field_id('scrollwheel'); ?>">
|
| 367 | 367 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
|
| 368 | 368 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
|
| 369 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
|
|
| 369 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
|
|
| 370 | 370 | </label> |
| 371 | 371 | </p> |
| 372 | 372 | <?php if (defined('GDCLUSTER_VERSION')) { ?>
|
@@ -80,7 +80,10 @@ discard block |
||
| 80 | 80 | echo ' geodir-listview '; |
| 81 | 81 | } ?> <?php if ($post_view_class) {
|
| 82 | 82 | echo $post_view_class; |
| 83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
|
|
| 83 | + } ?>" <?php if (isset($listing_width) && $listing_width) { |
|
| 84 | + echo "style='width:{$listing_width}%;'"; |
|
| 85 | + } |
|
| 86 | + // Width for widget listing |
|
| 84 | 87 | |
| 85 | 88 | echo " data-post-id='$post->ID' "; |
| 86 | 89 | /** |
@@ -402,8 +405,10 @@ discard block |
||
| 402 | 405 | */ |
| 403 | 406 | do_action('geodir_after_listing_post_listview');
|
| 404 | 407 | |
| 405 | - else: |
|
| 406 | - $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
| 408 | + else { |
|
| 409 | + : |
|
| 410 | + $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
|
| 411 | + } |
|
| 407 | 412 | |
| 408 | 413 | /** |
| 409 | 414 | * Called inside the `ul` of the listings template, when no listing found. |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ?> |
| 76 | 76 | |
| 77 | 77 | <li class="clearfix <?php if ($grid_view_class) {
|
| 78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
| 78 | + echo 'geodir-gridview '.$grid_view_class; |
|
| 79 | 79 | } else {
|
| 80 | 80 | echo ' geodir-listview '; |
| 81 | 81 | } ?> <?php if ($post_view_class) {
|
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 119 | + $geodir_days_new = (int) get_option('geodir_listing_new_days');
|
|
| 120 | 120 | |
| 121 | 121 | if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
| 122 | 122 | echo geodir_show_badges_on_image('new', $post, get_permalink());
|
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | } else {
|
| 195 | 195 | $uom = __('meters', 'geodirectory');
|
| 196 | 196 | } |
| 197 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
| 197 | + echo round($distance).' '.$uom.'<br />'; |
|
| 198 | 198 | } else {
|
| 199 | 199 | if ($uom == 'miles') {
|
| 200 | 200 | $uom = __('miles', 'geodirectory');
|
| 201 | 201 | } else {
|
| 202 | 202 | $uom = __('km', 'geodirectory');
|
| 203 | 203 | } |
| 204 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
| 204 | + echo round($distance, 2).' '.$uom.'<br />'; |
|
| 205 | 205 | } |
| 206 | 206 | ?> |
| 207 | 207 | </h3> |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
|
| 233 | 233 | if ($show_listing_excerpt) {
|
| 234 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 235 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 234 | + if (isset($character_count) && ($character_count || $character_count == '0')) {
|
|
| 235 | + $content_out = geodir_max_excerpt($character_count); |
|
| 236 | 236 | } else {
|
| 237 | 237 | $content_out = get_the_excerpt(); |
| 238 | 238 | } |
| 239 | - if ( ! empty( $content_out ) ) {
|
|
| 240 | - echo "<p>" . $content_out . "</p>"; |
|
| 239 | + if (!empty($content_out)) {
|
|
| 240 | + echo "<p>".$content_out."</p>"; |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | ?></div> |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @param object $post The post object. |
| 262 | 262 | * @param string $view The view type, default 'listing'. |
| 263 | 263 | */ |
| 264 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
| 264 | + do_action('geodir_after_listing_content', $post, 'listing'); ?>
|
|
| 265 | 265 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
|
| 266 | 266 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
|
| 267 | 267 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param object $post The post object. |
| 274 | 274 | * @param string $view The view type, default 'listing'. |
| 275 | 275 | */ |
| 276 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
| 276 | + do_action('geodir_before_review_html', $post, 'listing');
|
|
| 277 | 277 | |
| 278 | 278 | $review_show = geodir_is_reviews_show('listview');
|
| 279 | 279 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @since 1.0.0 |
| 318 | 318 | */ |
| 319 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
| 319 | + do_action('geodir_after_favorite_html', $post->ID, 'listing');
|
|
| 320 | 320 | |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @param int $post->ID The post id. |
| 328 | 328 | * @param object $post The post object. |
| 329 | 329 | */ |
| 330 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
| 330 | + do_action('geodir_listing_after_pinpoint', $post->ID, $post);
|
|
| 331 | 331 | |
| 332 | 332 | if ($post->post_author == get_current_user_id()) { ?>
|
| 333 | 333 | <?php |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 357 | 357 | <?php |
| 358 | 358 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
| 359 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 359 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
| 360 | 360 | ?> |
| 361 | 361 | <?php _e('Edit', 'geodirectory'); ?>
|
| 362 | 362 | </a> |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 365 | 365 | <?php |
| 366 | 366 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
| 367 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 367 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
| 368 | 368 | ?> |
| 369 | 369 | <?php _e('Delete', 'geodirectory'); ?>
|
| 370 | 370 | </a> |
@@ -44,57 +44,57 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <?php if (have_posts()) : |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Called inside the `ul` of the listings template, but before any `li` elements. |
|
| 49 | - * |
|
| 50 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
| 51 | - * |
|
| 52 | - * @since 1.0.0 |
|
| 53 | - * @see 'geodir_after_listing_post_listview' |
|
| 54 | - */ |
|
| 55 | - do_action('geodir_before_listing_post_listview');
|
|
| 56 | - |
|
| 57 | - while (have_posts()) : the_post(); |
|
| 58 | - global $post, $wpdb, $preview; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Add a class to the `li` element of the listings list template. |
|
| 62 | - * |
|
| 63 | - * @since 1.0.0 |
|
| 64 | - * @param string $class The extra class for the `li` element, default empty. |
|
| 65 | - */ |
|
| 66 | - $post_view_class = apply_filters('geodir_post_view_extra_class', '');
|
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
| 70 | - * |
|
| 71 | - * @since 1.0.0 |
|
| 72 | - * @param string $class The extra class for the `article` element, default empty. |
|
| 73 | - */ |
|
| 74 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
|
|
| 75 | - ?> |
|
| 47 | + /** |
|
| 48 | + * Called inside the `ul` of the listings template, but before any `li` elements. |
|
| 49 | + * |
|
| 50 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
| 51 | + * |
|
| 52 | + * @since 1.0.0 |
|
| 53 | + * @see 'geodir_after_listing_post_listview' |
|
| 54 | + */ |
|
| 55 | + do_action('geodir_before_listing_post_listview');
|
|
| 56 | + |
|
| 57 | + while (have_posts()) : the_post(); |
|
| 58 | + global $post, $wpdb, $preview; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Add a class to the `li` element of the listings list template. |
|
| 62 | + * |
|
| 63 | + * @since 1.0.0 |
|
| 64 | + * @param string $class The extra class for the `li` element, default empty. |
|
| 65 | + */ |
|
| 66 | + $post_view_class = apply_filters('geodir_post_view_extra_class', '');
|
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * Add a class to the `article` tag inside the `li` element on the listings list template. |
|
| 70 | + * |
|
| 71 | + * @since 1.0.0 |
|
| 72 | + * @param string $class The extra class for the `article` element, default empty. |
|
| 73 | + */ |
|
| 74 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
|
|
| 75 | + ?> |
|
| 76 | 76 | |
| 77 | 77 | <li class="clearfix <?php if ($grid_view_class) {
|
| 78 | - echo 'geodir-gridview ' . $grid_view_class; |
|
| 79 | - } else {
|
|
| 80 | - echo ' geodir-listview '; |
|
| 81 | - } ?> <?php if ($post_view_class) {
|
|
| 82 | - echo $post_view_class; |
|
| 83 | - } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
|
|
| 84 | - |
|
| 85 | - echo " data-post-id='$post->ID' "; |
|
| 86 | - /** |
|
| 87 | - * Called inside the `<li>` tag for listing outputs. |
|
| 88 | - * |
|
| 89 | - * @since 1.5.9 |
|
| 90 | - * @param object $post The post object. |
|
| 91 | - * @param string $string If called on the listing or widget template. |
|
| 92 | - */ |
|
| 93 | - do_action('geodir_listview_inside_li', $post, 'listing');
|
|
| 94 | - ?> > |
|
| 78 | + echo 'geodir-gridview ' . $grid_view_class; |
|
| 79 | + } else {
|
|
| 80 | + echo ' geodir-listview '; |
|
| 81 | + } ?> <?php if ($post_view_class) {
|
|
| 82 | + echo $post_view_class; |
|
| 83 | + } ?>" <?php if (isset($listing_width) && $listing_width) echo "style='width:{$listing_width}%;'"; // Width for widget listing
|
|
| 84 | + |
|
| 85 | + echo " data-post-id='$post->ID' "; |
|
| 86 | + /** |
|
| 87 | + * Called inside the `<li>` tag for listing outputs. |
|
| 88 | + * |
|
| 89 | + * @since 1.5.9 |
|
| 90 | + * @param object $post The post object. |
|
| 91 | + * @param string $string If called on the listing or widget template. |
|
| 92 | + */ |
|
| 93 | + do_action('geodir_listview_inside_li', $post, 'listing');
|
|
| 94 | + ?> > |
|
| 95 | 95 | <article class="geodir-category-listing <?php if ($post_view_article_class) {
|
| 96 | - echo $post_view_article_class; |
|
| 97 | - } ?>"> |
|
| 96 | + echo $post_view_article_class; |
|
| 97 | + } ?>"> |
|
| 98 | 98 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'listing'); ?>">
|
| 99 | 99 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
|
| 100 | 100 | |
@@ -102,37 +102,37 @@ discard block |
||
| 102 | 102 | <?php echo $fimage; ?> |
| 103 | 103 | </a> |
| 104 | 104 | <?php |
| 105 | - /** |
|
| 106 | - * Called before badges are output. |
|
| 107 | - * |
|
| 108 | - * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
| 109 | - * |
|
| 110 | - * @since 1.0.0 |
|
| 111 | - * @param object $post The post object. |
|
| 112 | - * @see 'geodir_after_badge_on_image' |
|
| 113 | - */ |
|
| 114 | - do_action('geodir_before_badge_on_image', $post);
|
|
| 115 | - if (isset($post->is_featured) && $post->is_featured) {
|
|
| 116 | - echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 120 | - |
|
| 121 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 122 | - echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * Called after badges are output. |
|
| 127 | - * |
|
| 128 | - * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
| 129 | - * |
|
| 130 | - * @since 1.0.0 |
|
| 131 | - * @param object $post The post object. |
|
| 132 | - * @see 'geodir_before_badge_on_image' |
|
| 133 | - */ |
|
| 134 | - do_action('geodir_after_badge_on_image', $post);
|
|
| 135 | - ?> |
|
| 105 | + /** |
|
| 106 | + * Called before badges are output. |
|
| 107 | + * |
|
| 108 | + * Called on the listings template after the image has been output and before the badges like `new` or `featured` are output. |
|
| 109 | + * |
|
| 110 | + * @since 1.0.0 |
|
| 111 | + * @param object $post The post object. |
|
| 112 | + * @see 'geodir_after_badge_on_image' |
|
| 113 | + */ |
|
| 114 | + do_action('geodir_before_badge_on_image', $post);
|
|
| 115 | + if (isset($post->is_featured) && $post->is_featured) {
|
|
| 116 | + echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 120 | + |
|
| 121 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 122 | + echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * Called after badges are output. |
|
| 127 | + * |
|
| 128 | + * Called on the listings template after the image and badges like `new` or `featured` have been output. |
|
| 129 | + * |
|
| 130 | + * @since 1.0.0 |
|
| 131 | + * @param object $post The post object. |
|
| 132 | + * @see 'geodir_before_badge_on_image' |
|
| 133 | + */ |
|
| 134 | + do_action('geodir_after_badge_on_image', $post);
|
|
| 135 | + ?> |
|
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | <?php } ?> |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'listing'); ?>">
|
| 143 | 143 | |
| 144 | 144 | <?php |
| 145 | - /** |
|
| 146 | - * Called before the post title on the listings view template. |
|
| 147 | - * |
|
| 148 | - * @since 1.0.0 |
|
| 149 | - * @param string $type The template type, default 'listview'. |
|
| 150 | - * @param object $post The post object. |
|
| 151 | - * @see 'geodir_after_listing_post_title' |
|
| 152 | - */ |
|
| 153 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 145 | + /** |
|
| 146 | + * Called before the post title on the listings view template. |
|
| 147 | + * |
|
| 148 | + * @since 1.0.0 |
|
| 149 | + * @param string $type The template type, default 'listview'. |
|
| 150 | + * @param object $post The post object. |
|
| 151 | + * @see 'geodir_after_listing_post_title' |
|
| 152 | + */ |
|
| 153 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 154 | 154 | |
| 155 | 155 | <header class="geodir-entry-header"><h3 class="geodir-entry-title"> |
| 156 | 156 | <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> |
@@ -162,226 +162,226 @@ discard block |
||
| 162 | 162 | <!-- .entry-header --> |
| 163 | 163 | |
| 164 | 164 | <?php |
| 165 | - /** |
|
| 166 | - * Called after the post title on the listings view template. |
|
| 167 | - * |
|
| 168 | - * @since 1.0.0 |
|
| 169 | - * @param string $type The template type, default 'listview'. |
|
| 170 | - * @param object $post The post object. |
|
| 171 | - * @see 'geodir_before_listing_post_title' |
|
| 172 | - */ |
|
| 173 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 165 | + /** |
|
| 166 | + * Called after the post title on the listings view template. |
|
| 167 | + * |
|
| 168 | + * @since 1.0.0 |
|
| 169 | + * @param string $type The template type, default 'listview'. |
|
| 170 | + * @param object $post The post object. |
|
| 171 | + * @see 'geodir_before_listing_post_title' |
|
| 172 | + */ |
|
| 173 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 174 | 174 | |
| 175 | 175 | <?php /// Print Distance |
| 176 | - if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) {
|
|
| 177 | - |
|
| 178 | - if ($related_nearest) {
|
|
| 179 | - $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon);
|
|
| 180 | - } else {
|
|
| 181 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $endLat = $post->post_latitude; |
|
| 185 | - $endLon = $post->post_longitude; |
|
| 186 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 187 | - $uom = get_option('geodir_search_dist_1');
|
|
| 188 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
| 176 | + if ((isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') || $related_nearest) {
|
|
| 177 | + |
|
| 178 | + if ($related_nearest) {
|
|
| 179 | + $startPoint = array('latitude' => $related_parent_lat, 'longitude' => $related_parent_lon);
|
|
| 180 | + } else {
|
|
| 181 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $endLat = $post->post_latitude; |
|
| 185 | + $endLon = $post->post_longitude; |
|
| 186 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 187 | + $uom = get_option('geodir_search_dist_1');
|
|
| 188 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); ?> |
|
| 189 | 189 | <h3> |
| 190 | 190 | <?php |
| 191 | 191 | |
| 192 | - if (round($distance, 2) == 0) {
|
|
| 193 | - $uom = get_option('geodir_search_dist_2');
|
|
| 194 | - |
|
| 195 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 196 | - if ($uom == 'feet') {
|
|
| 197 | - $uom = __('feet', 'geodirectory');
|
|
| 198 | - } else {
|
|
| 199 | - $uom = __('meters', 'geodirectory');
|
|
| 200 | - } |
|
| 201 | - echo round($distance) . ' ' . $uom . '<br />'; |
|
| 202 | - } else {
|
|
| 203 | - if ($uom == 'miles') {
|
|
| 204 | - $uom = __('miles', 'geodirectory');
|
|
| 205 | - } else {
|
|
| 206 | - $uom = __('km', 'geodirectory');
|
|
| 207 | - } |
|
| 208 | - echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
| 209 | - } |
|
| 210 | - ?> |
|
| 192 | + if (round($distance, 2) == 0) {
|
|
| 193 | + $uom = get_option('geodir_search_dist_2');
|
|
| 194 | + |
|
| 195 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 196 | + if ($uom == 'feet') {
|
|
| 197 | + $uom = __('feet', 'geodirectory');
|
|
| 198 | + } else {
|
|
| 199 | + $uom = __('meters', 'geodirectory');
|
|
| 200 | + } |
|
| 201 | + echo round($distance) . ' ' . $uom . '<br />'; |
|
| 202 | + } else {
|
|
| 203 | + if ($uom == 'miles') {
|
|
| 204 | + $uom = __('miles', 'geodirectory');
|
|
| 205 | + } else {
|
|
| 206 | + $uom = __('km', 'geodirectory');
|
|
| 207 | + } |
|
| 208 | + echo round($distance, 2) . ' ' . $uom . '<br />'; |
|
| 209 | + } |
|
| 210 | + ?> |
|
| 211 | 211 | </h3> |
| 212 | 212 | <?php } ?> |
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | <?php |
| 216 | - /** |
|
| 217 | - * Called before the post excerpt on the listings view template. |
|
| 218 | - * |
|
| 219 | - * @since 1.0.0 |
|
| 220 | - * @param object $post The post object. |
|
| 221 | - * @see 'geodir_after_listing_post_excerpt' |
|
| 222 | - */ |
|
| 223 | - do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 216 | + /** |
|
| 217 | + * Called before the post excerpt on the listings view template. |
|
| 218 | + * |
|
| 219 | + * @since 1.0.0 |
|
| 220 | + * @param object $post The post object. |
|
| 221 | + * @see 'geodir_after_listing_post_excerpt' |
|
| 222 | + */ |
|
| 223 | + do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 224 | 224 | <?php echo geodir_show_listing_info('listing'); ?>
|
| 225 | 225 | <div class="geodir-entry-content"> |
| 226 | 226 | |
| 227 | 227 | <?php |
| 228 | - /** |
|
| 229 | - * Filter to hide the listing excerpt |
|
| 230 | - * |
|
| 231 | - * @since 1.5.3 |
|
| 232 | - * @param bool $display Display the excerpt or not. Default true. |
|
| 233 | - * @param string $view The view type, default 'listview'. |
|
| 234 | - * @param object $post The post object. |
|
| 235 | - */ |
|
| 236 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
|
|
| 237 | - if ($show_listing_excerpt) {
|
|
| 238 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 239 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 240 | - } else {
|
|
| 241 | - $content_out = get_the_excerpt(); |
|
| 242 | - } |
|
| 243 | - if ( ! empty( $content_out ) ) {
|
|
| 244 | - echo "<p>" . $content_out . "</p>"; |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - ?></div> |
|
| 228 | + /** |
|
| 229 | + * Filter to hide the listing excerpt |
|
| 230 | + * |
|
| 231 | + * @since 1.5.3 |
|
| 232 | + * @param bool $display Display the excerpt or not. Default true. |
|
| 233 | + * @param string $view The view type, default 'listview'. |
|
| 234 | + * @param object $post The post object. |
|
| 235 | + */ |
|
| 236 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'listview', $post);
|
|
| 237 | + if ($show_listing_excerpt) {
|
|
| 238 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 239 | + $content_out = geodir_max_excerpt( $character_count ); |
|
| 240 | + } else {
|
|
| 241 | + $content_out = get_the_excerpt(); |
|
| 242 | + } |
|
| 243 | + if ( ! empty( $content_out ) ) {
|
|
| 244 | + echo "<p>" . $content_out . "</p>"; |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + ?></div> |
|
| 248 | 248 | |
| 249 | 249 | <?php |
| 250 | - /** |
|
| 251 | - * Called after the post excerpt on the listings view template. |
|
| 252 | - * |
|
| 253 | - * @since 1.0.0 |
|
| 254 | - * @param object $post The post object. |
|
| 255 | - * @see 'geodir_before_listing_post_excerpt' |
|
| 256 | - */ |
|
| 257 | - do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 250 | + /** |
|
| 251 | + * Called after the post excerpt on the listings view template. |
|
| 252 | + * |
|
| 253 | + * @since 1.0.0 |
|
| 254 | + * @param object $post The post object. |
|
| 255 | + * @see 'geodir_before_listing_post_excerpt' |
|
| 256 | + */ |
|
| 257 | + do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 258 | 258 | </div> |
| 259 | 259 | <!-- gd-content ends here--> |
| 260 | 260 | <?php |
| 261 | - /** |
|
| 262 | - * Called after printing listing content. |
|
| 263 | - * |
|
| 264 | - * @since 1.5.3 |
|
| 265 | - * @param object $post The post object. |
|
| 266 | - * @param string $view The view type, default 'listing'. |
|
| 267 | - */ |
|
| 268 | - do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
| 261 | + /** |
|
| 262 | + * Called after printing listing content. |
|
| 263 | + * |
|
| 264 | + * @since 1.5.3 |
|
| 265 | + * @param object $post The post object. |
|
| 266 | + * @param string $view The view type, default 'listing'. |
|
| 267 | + */ |
|
| 268 | + do_action( 'geodir_after_listing_content', $post, 'listing' ); ?> |
|
| 269 | 269 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'listing'); ?>">
|
| 270 | 270 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'listing'); ?>">
|
| 271 | 271 | |
| 272 | 272 | <?php |
| 273 | - /** |
|
| 274 | - * Called before printing review stars html. |
|
| 275 | - * |
|
| 276 | - * @since 1.5.3 |
|
| 277 | - * @param object $post The post object. |
|
| 278 | - * @param string $view The view type, default 'listing'. |
|
| 279 | - */ |
|
| 280 | - do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
| 281 | - |
|
| 282 | - $review_show = geodir_is_reviews_show('listview');
|
|
| 283 | - |
|
| 284 | - if ($review_show) {
|
|
| 285 | - |
|
| 286 | - if (!$preview) {
|
|
| 287 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 288 | - /** |
|
| 289 | - * Called before the rating stars are output on the listings view template. |
|
| 290 | - * |
|
| 291 | - * @since 1.0.0 |
|
| 292 | - * @param float $post_avgratings The average rating for the post. |
|
| 293 | - * @param int $post->ID The post ID. |
|
| 294 | - * @see 'geodir_after_review_rating_stars_on_listview' |
|
| 295 | - */ |
|
| 296 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 297 | - |
|
| 298 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * Called after the rating stars are output on the listings view template. |
|
| 302 | - * |
|
| 303 | - * @since 1.0.0 |
|
| 304 | - * @param float $post_avgratings The average rating for the post. |
|
| 305 | - * @param int $post->ID The post ID. |
|
| 306 | - * @see 'geodir_before_review_rating_stars_on_listview' |
|
| 307 | - */ |
|
| 308 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 309 | - } |
|
| 310 | - ?> |
|
| 273 | + /** |
|
| 274 | + * Called before printing review stars html. |
|
| 275 | + * |
|
| 276 | + * @since 1.5.3 |
|
| 277 | + * @param object $post The post object. |
|
| 278 | + * @param string $view The view type, default 'listing'. |
|
| 279 | + */ |
|
| 280 | + do_action( 'geodir_before_review_html', $post, 'listing' ); |
|
| 281 | + |
|
| 282 | + $review_show = geodir_is_reviews_show('listview');
|
|
| 283 | + |
|
| 284 | + if ($review_show) {
|
|
| 285 | + |
|
| 286 | + if (!$preview) {
|
|
| 287 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 288 | + /** |
|
| 289 | + * Called before the rating stars are output on the listings view template. |
|
| 290 | + * |
|
| 291 | + * @since 1.0.0 |
|
| 292 | + * @param float $post_avgratings The average rating for the post. |
|
| 293 | + * @param int $post->ID The post ID. |
|
| 294 | + * @see 'geodir_after_review_rating_stars_on_listview' |
|
| 295 | + */ |
|
| 296 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 297 | + |
|
| 298 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * Called after the rating stars are output on the listings view template. |
|
| 302 | + * |
|
| 303 | + * @since 1.0.0 |
|
| 304 | + * @param float $post_avgratings The average rating for the post. |
|
| 305 | + * @param int $post->ID The post ID. |
|
| 306 | + * @see 'geodir_before_review_rating_stars_on_listview' |
|
| 307 | + */ |
|
| 308 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 309 | + } |
|
| 310 | + ?> |
|
| 311 | 311 | <a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
| 312 | 312 | class="fa fa-comments"></i> |
| 313 | 313 | <?php geodir_comments_number($post->rating_count); ?></a> |
| 314 | 314 | <?php |
| 315 | - } |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | 317 | |
| 318 | - /** |
|
| 319 | - * Called after printing favorite html. |
|
| 320 | - * |
|
| 321 | - * @since 1.0.0 |
|
| 322 | - */ |
|
| 323 | - do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
| 318 | + /** |
|
| 319 | + * Called after printing favorite html. |
|
| 320 | + * |
|
| 321 | + * @since 1.0.0 |
|
| 322 | + */ |
|
| 323 | + do_action( 'geodir_after_favorite_html', $post->ID, 'listing' ); |
|
| 324 | 324 | |
| 325 | 325 | |
| 326 | - /** |
|
| 327 | - * Called after printing map pin point. |
|
| 328 | - * |
|
| 329 | - * @since 1.0.0 |
|
| 330 | - * @since 1.5.9 Added $post as second param. |
|
| 331 | - * @param int $post->ID The post id. |
|
| 332 | - * @param object $post The post object. |
|
| 333 | - */ |
|
| 334 | - do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
| 326 | + /** |
|
| 327 | + * Called after printing map pin point. |
|
| 328 | + * |
|
| 329 | + * @since 1.0.0 |
|
| 330 | + * @since 1.5.9 Added $post as second param. |
|
| 331 | + * @param int $post->ID The post id. |
|
| 332 | + * @param object $post The post object. |
|
| 333 | + */ |
|
| 334 | + do_action( 'geodir_listing_after_pinpoint', $post->ID ,$post); |
|
| 335 | 335 | |
| 336 | - if ($post->post_author == get_current_user_id()) { ?>
|
|
| 336 | + if ($post->post_author == get_current_user_id()) { ?>
|
|
| 337 | 337 | <?php |
| 338 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 339 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 340 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 338 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 339 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 340 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 341 | 341 | |
| 342 | - $ajaxlink = geodir_get_ajax_url(); |
|
| 343 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 342 | + $ajaxlink = geodir_get_ajax_url(); |
|
| 343 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 344 | 344 | |
| 345 | - ?> |
|
| 345 | + ?> |
|
| 346 | 346 | |
| 347 | 347 | <span class="geodir-authorlink clearfix"> |
| 348 | 348 | |
| 349 | 349 | <?php if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
|
| 350 | - /** |
|
| 351 | - * Called before the edit post link on the listings view template used on the author page. |
|
| 352 | - * |
|
| 353 | - * @since 1.0.0 |
|
| 354 | - * @see 'geodir_after_edit_post_link_on_listing' |
|
| 355 | - */ |
|
| 356 | - do_action('geodir_before_edit_post_link_on_listing');
|
|
| 357 | - ?> |
|
| 350 | + /** |
|
| 351 | + * Called before the edit post link on the listings view template used on the author page. |
|
| 352 | + * |
|
| 353 | + * @since 1.0.0 |
|
| 354 | + * @see 'geodir_after_edit_post_link_on_listing' |
|
| 355 | + */ |
|
| 356 | + do_action('geodir_before_edit_post_link_on_listing');
|
|
| 357 | + ?> |
|
| 358 | 358 | |
| 359 | 359 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
| 360 | 360 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 361 | 361 | <?php |
| 362 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 363 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 364 | - ?> |
|
| 362 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 363 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 364 | + ?> |
|
| 365 | 365 | <?php _e('Edit', 'geodirectory'); ?>
|
| 366 | 366 | </a> |
| 367 | 367 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
| 368 | 368 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 369 | 369 | <?php |
| 370 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 371 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 372 | - ?> |
|
| 370 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 371 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 372 | + ?> |
|
| 373 | 373 | <?php _e('Delete', 'geodirectory'); ?>
|
| 374 | 374 | </a> |
| 375 | 375 | <?php |
| 376 | 376 | |
| 377 | - /** |
|
| 378 | - * Called after the edit post link on the listings view template used on the author page. |
|
| 379 | - * |
|
| 380 | - * @since 1.0.0 |
|
| 381 | - * @see 'geodir_before_edit_post_link_on_listing' |
|
| 382 | - */ |
|
| 383 | - do_action('geodir_after_edit_post_link_on_listing');
|
|
| 384 | - } ?> |
|
| 377 | + /** |
|
| 378 | + * Called after the edit post link on the listings view template used on the author page. |
|
| 379 | + * |
|
| 380 | + * @since 1.0.0 |
|
| 381 | + * @see 'geodir_before_edit_post_link_on_listing' |
|
| 382 | + */ |
|
| 383 | + do_action('geodir_after_edit_post_link_on_listing');
|
|
| 384 | + } ?> |
|
| 385 | 385 | </span> |
| 386 | 386 | |
| 387 | 387 | <?php } ?> |
@@ -394,32 +394,32 @@ discard block |
||
| 394 | 394 | </li> |
| 395 | 395 | |
| 396 | 396 | <?php |
| 397 | - endwhile; |
|
| 398 | - |
|
| 399 | - /** |
|
| 400 | - * Called inside the `ul` of the listings template, but after all `li` elements. |
|
| 401 | - * |
|
| 402 | - * When used by the widget view template then it will only show if there are listings to be shown. |
|
| 403 | - * |
|
| 404 | - * @since 1.0.0 |
|
| 405 | - * @see 'geodir_before_listing_post_listview' |
|
| 406 | - */ |
|
| 407 | - do_action('geodir_after_listing_post_listview');
|
|
| 408 | - |
|
| 409 | - else: |
|
| 397 | + endwhile; |
|
| 398 | + |
|
| 399 | + /** |
|
| 400 | + * Called inside the `ul` of the listings template, but after all `li` elements. |
|
| 401 | + * |
|
| 402 | + * When used by the widget view template then it will only show if there are listings to be shown. |
|
| 403 | + * |
|
| 404 | + * @since 1.0.0 |
|
| 405 | + * @see 'geodir_before_listing_post_listview' |
|
| 406 | + */ |
|
| 407 | + do_action('geodir_after_listing_post_listview');
|
|
| 408 | + |
|
| 409 | + else: |
|
| 410 | 410 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | - * Called inside the `ul` of the listings template, when no listing found. |
|
| 414 | - * |
|
| 415 | - * @since 1.5.5 |
|
| 413 | + * Called inside the `ul` of the listings template, when no listing found. |
|
| 414 | + * |
|
| 415 | + * @since 1.5.5 |
|
| 416 | 416 | * @param string 'listing-listview' Listing listview template. |
| 417 | 417 | * @param bool $favorite Are favorite listings results? |
| 418 | - */ |
|
| 419 | - do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
|
|
| 420 | - endif; |
|
| 418 | + */ |
|
| 419 | + do_action('geodir_message_not_found_on_listing', 'listing-listview', $favorite);
|
|
| 420 | + endif; |
|
| 421 | 421 | |
| 422 | - ?> |
|
| 422 | + ?> |
|
| 423 | 423 | </ul> <!-- geodir_category_list_view ends here--> |
| 424 | 424 | |
| 425 | 425 | <div class="clear"></div> |
@@ -20,72 +20,72 @@ discard block |
||
| 20 | 20 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 21 | 21 | $grid_view_class = apply_filters('geodir_grid_view_widget_columns', $gridview_columns_widget);
|
| 22 | 22 | if ($gd_session->get('gd_listing_view') && !isset($before_widget)) {
|
| 23 | - $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
|
|
| 23 | + $grid_view_class = geodir_convert_listing_view_class($gd_session->get('gd_listing_view'));
|
|
| 24 | 24 | } |
| 25 | 25 | ?> |
| 26 | 26 | <ul class="geodir_category_list_view clearfix <?php echo apply_filters('geodir_listing_listview_ul_extra_class', '', 'widget'); ?>">
|
| 27 | 27 | <?php |
| 28 | - if (!empty($widget_listings)) {
|
|
| 29 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 30 | - do_action('geodir_before_listing_post_listview');
|
|
| 31 | - $all_postypes = geodir_get_posttypes(); |
|
| 32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 33 | - foreach ($widget_listings as $widget_listing) {
|
|
| 34 | - global $gd_widget_listing_type; |
|
| 35 | - $post = $widget_listing; |
|
| 28 | + if (!empty($widget_listings)) {
|
|
| 29 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 30 | + do_action('geodir_before_listing_post_listview');
|
|
| 31 | + $all_postypes = geodir_get_posttypes(); |
|
| 32 | + $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 33 | + foreach ($widget_listings as $widget_listing) {
|
|
| 34 | + global $gd_widget_listing_type; |
|
| 35 | + $post = $widget_listing; |
|
| 36 | 36 | |
| 37 | - $GLOBALS['post'] = $post; |
|
| 38 | - setup_postdata($post); |
|
| 37 | + $GLOBALS['post'] = $post; |
|
| 38 | + setup_postdata($post); |
|
| 39 | 39 | |
| 40 | - $gd_widget_listing_type = $post->post_type; |
|
| 40 | + $gd_widget_listing_type = $post->post_type; |
|
| 41 | 41 | |
| 42 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 43 | - $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
|
|
| 42 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 43 | + $post_view_class = apply_filters('geodir_post_view_extra_class', '', $all_postypes);
|
|
| 44 | 44 | |
| 45 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 46 | - $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
|
|
| 47 | - ?> |
|
| 45 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 46 | + $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
|
|
| 47 | + ?> |
|
| 48 | 48 | <li class="clearfix <?php if ($grid_view_class) {
|
| 49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
| 50 | - } else {
|
|
| 51 | - echo ' geodir-listview '; |
|
| 52 | - } ?> <?php if ($post_view_class) {
|
|
| 53 | - echo $post_view_class; |
|
| 54 | - } ?>" <?php if (isset($listing_width) && $listing_width) {
|
|
| 55 | - echo "style='width:{$listing_width}%;'";
|
|
| 56 | - } |
|
| 49 | + echo 'geodir-gridview ' . $grid_view_class; |
|
| 50 | + } else {
|
|
| 51 | + echo ' geodir-listview '; |
|
| 52 | + } ?> <?php if ($post_view_class) {
|
|
| 53 | + echo $post_view_class; |
|
| 54 | + } ?>" <?php if (isset($listing_width) && $listing_width) {
|
|
| 55 | + echo "style='width:{$listing_width}%;'";
|
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - echo " data-post-id='$post->ID' "; |
|
| 59 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 60 | - do_action('geodir_listview_inside_li', $post, 'widget');
|
|
| 61 | - ?>> |
|
| 58 | + echo " data-post-id='$post->ID' "; |
|
| 59 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 60 | + do_action('geodir_listview_inside_li', $post, 'widget');
|
|
| 61 | + ?>> |
|
| 62 | 62 | <article class="geodir-category-listing <?php if ($post_view_article_class) {
|
| 63 | - echo $post_view_article_class; |
|
| 64 | - } ?>"> |
|
| 63 | + echo $post_view_article_class; |
|
| 64 | + } ?>"> |
|
| 65 | 65 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>">
|
| 66 | 66 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
|
| 67 | 67 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
| 68 | 68 | <?php |
| 69 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 70 | - do_action('geodir_before_badge_on_image', $post);
|
|
| 71 | - if ($post->is_featured) {
|
|
| 72 | - echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 73 | - } |
|
| 69 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 70 | + do_action('geodir_before_badge_on_image', $post);
|
|
| 71 | + if ($post->is_featured) {
|
|
| 72 | + echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 77 | - echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 78 | - } |
|
| 76 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 77 | + echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 81 | - do_action('geodir_after_badge_on_image', $post);
|
|
| 82 | - } |
|
| 83 | - ?> |
|
| 80 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 81 | + do_action('geodir_after_badge_on_image', $post);
|
|
| 82 | + } |
|
| 83 | + ?> |
|
| 84 | 84 | </div> |
| 85 | 85 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>">
|
| 86 | 86 | <?php |
| 87 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 88 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 87 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 88 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 89 | 89 | <header class="geodir-entry-header"> |
| 90 | 90 | <h3 class="geodir-entry-title"> |
| 91 | 91 | <a href="<?php the_permalink(); ?>" |
@@ -94,158 +94,158 @@ discard block |
||
| 94 | 94 | </header> |
| 95 | 95 | <!-- .entry-header --> |
| 96 | 96 | <?php |
| 97 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 98 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 97 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 98 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 99 | 99 | <?php /// Print Distance |
| 100 | - if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
|
|
| 101 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 100 | + if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
|
|
| 101 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 102 | 102 | |
| 103 | - $endLat = $post->post_latitude; |
|
| 104 | - $endLon = $post->post_longitude; |
|
| 105 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 106 | - $uom = get_option('geodir_search_dist_1');
|
|
| 107 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 108 | - ?> |
|
| 103 | + $endLat = $post->post_latitude; |
|
| 104 | + $endLon = $post->post_longitude; |
|
| 105 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 106 | + $uom = get_option('geodir_search_dist_1');
|
|
| 107 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 108 | + ?> |
|
| 109 | 109 | <h3> |
| 110 | 110 | <?php |
| 111 | - if (round($distance, 2) == 0) {
|
|
| 112 | - $uom = get_option('geodir_search_dist_2');
|
|
| 113 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 114 | - if ($uom == 'feet') {
|
|
| 115 | - $uom = __('feet', 'geodirectory');
|
|
| 116 | - } else {
|
|
| 117 | - $uom = __('meters', 'geodirectory');
|
|
| 118 | - } |
|
| 119 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
| 111 | + if (round($distance, 2) == 0) {
|
|
| 112 | + $uom = get_option('geodir_search_dist_2');
|
|
| 113 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 114 | + if ($uom == 'feet') {
|
|
| 115 | + $uom = __('feet', 'geodirectory');
|
|
| 116 | + } else {
|
|
| 117 | + $uom = __('meters', 'geodirectory');
|
|
| 118 | + } |
|
| 119 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
| 120 | 120 | <br /> |
| 121 | 121 | '; |
| 122 | - } else {
|
|
| 123 | - if ($uom == 'miles') {
|
|
| 124 | - $uom = __('miles', 'geodirectory');
|
|
| 125 | - } else {
|
|
| 126 | - $uom = __('km', 'geodirectory');
|
|
| 127 | - } |
|
| 128 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
| 122 | + } else {
|
|
| 123 | + if ($uom == 'miles') {
|
|
| 124 | + $uom = __('miles', 'geodirectory');
|
|
| 125 | + } else {
|
|
| 126 | + $uom = __('km', 'geodirectory');
|
|
| 127 | + } |
|
| 128 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
| 129 | 129 | <br /> |
| 130 | 130 | '; |
| 131 | - } |
|
| 132 | - ?> |
|
| 131 | + } |
|
| 132 | + ?> |
|
| 133 | 133 | </h3> |
| 134 | 134 | <?php } ?> |
| 135 | 135 | <?php |
| 136 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 137 | - do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 136 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 137 | + do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 138 | 138 | <?php echo geodir_show_listing_info('listing'); ?>
|
| 139 | 139 | <?php if (isset($character_count) && $character_count == '0') {
|
| 140 | - } else { ?>
|
|
| 140 | + } else { ?>
|
|
| 141 | 141 | <div class="geodir-entry-content"> |
| 142 | 142 | <?php |
| 143 | - /** |
|
| 144 | - * Filter to hide the listing excerpt |
|
| 145 | - * |
|
| 146 | - * @since 1.5.3 |
|
| 147 | - * @param bool $display Display the excerpt or not. Default true. |
|
| 148 | - * @param object $post The post object. |
|
| 149 | - */ |
|
| 150 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
|
| 151 | - if ($show_listing_excerpt) {
|
|
| 152 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 153 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 154 | - } else {
|
|
| 155 | - $content_out = get_the_excerpt(); |
|
| 156 | - } |
|
| 157 | - if ( ! empty( $content_out ) ) {
|
|
| 158 | - echo "<p>" . $content_out . "</p>"; |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - ?> |
|
| 143 | + /** |
|
| 144 | + * Filter to hide the listing excerpt |
|
| 145 | + * |
|
| 146 | + * @since 1.5.3 |
|
| 147 | + * @param bool $display Display the excerpt or not. Default true. |
|
| 148 | + * @param object $post The post object. |
|
| 149 | + */ |
|
| 150 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
|
| 151 | + if ($show_listing_excerpt) {
|
|
| 152 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 153 | + $content_out = geodir_max_excerpt( $character_count ); |
|
| 154 | + } else {
|
|
| 155 | + $content_out = get_the_excerpt(); |
|
| 156 | + } |
|
| 157 | + if ( ! empty( $content_out ) ) {
|
|
| 158 | + echo "<p>" . $content_out . "</p>"; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + ?> |
|
| 162 | 162 | </div> |
| 163 | 163 | <?php } ?> |
| 164 | 164 | <?php |
| 165 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 166 | - do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 165 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 166 | + do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 167 | 167 | </div> |
| 168 | 168 | <!-- gd-content ends here--> |
| 169 | 169 | <?php |
| 170 | - /** |
|
| 171 | - * Called after printing listing content. |
|
| 172 | - * |
|
| 173 | - * @since 1.5.3 |
|
| 174 | - * @param object $post The post object. |
|
| 175 | - * @param string $view The view type, default 'widget'. |
|
| 176 | - */ |
|
| 177 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 170 | + /** |
|
| 171 | + * Called after printing listing content. |
|
| 172 | + * |
|
| 173 | + * @since 1.5.3 |
|
| 174 | + * @param object $post The post object. |
|
| 175 | + * @param string $view The view type, default 'widget'. |
|
| 176 | + */ |
|
| 177 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 178 | 178 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
|
| 179 | 179 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
|
| 180 | 180 | <?php |
| 181 | - /** |
|
| 182 | - * Called before printing review stars html. |
|
| 183 | - * |
|
| 184 | - * @since 1.5.3 |
|
| 185 | - * @param object $post The post object. |
|
| 186 | - * @param string $view The view type, default 'widget'. |
|
| 187 | - */ |
|
| 188 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 189 | - $review_show = geodir_is_reviews_show('listview');
|
|
| 190 | - if ($review_show) {
|
|
| 181 | + /** |
|
| 182 | + * Called before printing review stars html. |
|
| 183 | + * |
|
| 184 | + * @since 1.5.3 |
|
| 185 | + * @param object $post The post object. |
|
| 186 | + * @param string $view The view type, default 'widget'. |
|
| 187 | + */ |
|
| 188 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 189 | + $review_show = geodir_is_reviews_show('listview');
|
|
| 190 | + if ($review_show) {
|
|
| 191 | 191 | |
| 192 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 192 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 193 | 193 | |
| 194 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 195 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 194 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 195 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 196 | 196 | |
| 197 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 197 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 198 | 198 | |
| 199 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 200 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 201 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
| 199 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 200 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 201 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
| 202 | 202 | class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
| 203 | 203 | </a> |
| 204 | 204 | <?php |
| 205 | - } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Called after printing favorite html. |
|
| 210 | - * |
|
| 211 | - * @since 1.0.0 |
|
| 212 | - */ |
|
| 213 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 208 | + /** |
|
| 209 | + * Called after printing favorite html. |
|
| 210 | + * |
|
| 211 | + * @since 1.0.0 |
|
| 212 | + */ |
|
| 213 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 214 | 214 | |
| 215 | - if ($post->post_author == get_current_user_id()) {
|
|
| 216 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 217 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 218 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 215 | + if ($post->post_author == get_current_user_id()) {
|
|
| 216 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 217 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 218 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 219 | 219 | |
| 220 | - $ajaxlink = geodir_get_ajax_url(); |
|
| 221 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 222 | - ?> |
|
| 220 | + $ajaxlink = geodir_get_ajax_url(); |
|
| 221 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 222 | + ?> |
|
| 223 | 223 | <span class="geodir-authorlink clearfix"> |
| 224 | 224 | <?php |
| 225 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
|
|
| 226 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 227 | - do_action('geodir_before_edit_post_link_on_listing');
|
|
| 228 | - ?> |
|
| 225 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
|
|
| 226 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 227 | + do_action('geodir_before_edit_post_link_on_listing');
|
|
| 228 | + ?> |
|
| 229 | 229 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
| 230 | 230 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 231 | 231 | <?php |
| 232 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 233 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 234 | - ?> |
|
| 232 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 233 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 234 | + ?> |
|
| 235 | 235 | <?php _e('Edit', 'geodirectory'); ?>
|
| 236 | 236 | </a> |
| 237 | 237 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
| 238 | 238 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 239 | 239 | <?php |
| 240 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 241 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 242 | - ?> |
|
| 240 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 241 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 242 | + ?> |
|
| 243 | 243 | <?php _e('Delete', 'geodirectory'); ?>
|
| 244 | 244 | </a> |
| 245 | 245 | <?php |
| 246 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 247 | - do_action('geodir_after_edit_post_link_on_listing');
|
|
| 248 | - } ?> |
|
| 246 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 247 | + do_action('geodir_after_edit_post_link_on_listing');
|
|
| 248 | + } ?> |
|
| 249 | 249 | </span> |
| 250 | 250 | <?php } ?> |
| 251 | 251 | </div> |
@@ -255,17 +255,17 @@ discard block |
||
| 255 | 255 | </article> |
| 256 | 256 | </li> |
| 257 | 257 | <?php |
| 258 | - unset($gd_widget_listing_type); |
|
| 259 | - } |
|
| 260 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 261 | - do_action('geodir_after_listing_post_listview');
|
|
| 262 | - } else {
|
|
| 258 | + unset($gd_widget_listing_type); |
|
| 259 | + } |
|
| 260 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 261 | + do_action('geodir_after_listing_post_listview');
|
|
| 262 | + } else {
|
|
| 263 | 263 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
| 264 | 264 | |
| 265 | 265 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 266 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
|
|
| 267 | - } |
|
| 268 | - ?> |
|
| 266 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
|
|
| 267 | + } |
|
| 268 | + ?> |
|
| 269 | 269 | </ul> <!-- geodir_category_list_view ends here--> |
| 270 | 270 | <div class="clear"></div> |
| 271 | 271 | <?php |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 30 | 30 | do_action('geodir_before_listing_post_listview');
|
| 31 | 31 | $all_postypes = geodir_get_posttypes(); |
| 32 | - $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 32 | + $geodir_days_new = (int) get_option('geodir_listing_new_days');
|
|
| 33 | 33 | foreach ($widget_listings as $widget_listing) {
|
| 34 | 34 | global $gd_widget_listing_type; |
| 35 | 35 | $post = $widget_listing; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $post_view_article_class = apply_filters('geodir_post_view_article_extra_class', '');
|
| 47 | 47 | ?> |
| 48 | 48 | <li class="clearfix <?php if ($grid_view_class) {
|
| 49 | - echo 'geodir-gridview ' . $grid_view_class; |
|
| 49 | + echo 'geodir-gridview '.$grid_view_class; |
|
| 50 | 50 | } else {
|
| 51 | 51 | echo ' geodir-listview '; |
| 52 | 52 | } ?> <?php if ($post_view_class) {
|
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } else {
|
| 117 | 117 | $uom = __('meters', 'geodirectory');
|
| 118 | 118 | } |
| 119 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
| 119 | + echo round($distance).' '.__($uom, 'geodirectory').' |
|
| 120 | 120 | <br /> |
| 121 | 121 | '; |
| 122 | 122 | } else {
|
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | } else {
|
| 126 | 126 | $uom = __('km', 'geodirectory');
|
| 127 | 127 | } |
| 128 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
| 128 | + echo round($distance, 2).' '.__($uom, 'geodirectory').' |
|
| 129 | 129 | <br /> |
| 130 | 130 | '; |
| 131 | 131 | } |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
| 151 | 151 | if ($show_listing_excerpt) {
|
| 152 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 153 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 152 | + if (isset($character_count) && ($character_count || $character_count == '0')) {
|
|
| 153 | + $content_out = geodir_max_excerpt($character_count); |
|
| 154 | 154 | } else {
|
| 155 | 155 | $content_out = get_the_excerpt(); |
| 156 | 156 | } |
| 157 | - if ( ! empty( $content_out ) ) {
|
|
| 158 | - echo "<p>" . $content_out . "</p>"; |
|
| 157 | + if (!empty($content_out)) {
|
|
| 158 | + echo "<p>".$content_out."</p>"; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | ?> |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param object $post The post object. |
| 175 | 175 | * @param string $view The view type, default 'widget'. |
| 176 | 176 | */ |
| 177 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 177 | + do_action('geodir_after_listing_content', $post, 'widget'); ?>
|
|
| 178 | 178 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
|
| 179 | 179 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
|
| 180 | 180 | <?php |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param object $post The post object. |
| 186 | 186 | * @param string $view The view type, default 'widget'. |
| 187 | 187 | */ |
| 188 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 188 | + do_action('geodir_before_review_html', $post, 'widget');
|
|
| 189 | 189 | $review_show = geodir_is_reviews_show('listview');
|
| 190 | 190 | if ($review_show) {
|
| 191 | 191 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @since 1.0.0 |
| 212 | 212 | */ |
| 213 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 213 | + do_action('geodir_after_favorite_html', $post->ID, 'widget');
|
|
| 214 | 214 | |
| 215 | 215 | if ($post->post_author == get_current_user_id()) {
|
| 216 | 216 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 231 | 231 | <?php |
| 232 | 232 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
| 233 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 233 | + echo '<i class="'.$geodir_listing_edit_icon.'"></i>'; |
|
| 234 | 234 | ?> |
| 235 | 235 | <?php _e('Edit', 'geodirectory'); ?>
|
| 236 | 236 | </a> |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 239 | 239 | <?php |
| 240 | 240 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
| 241 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 241 | + echo '<i class="'.$geodir_listing_delete_icon.'"></i>'; |
|
| 242 | 242 | ?> |
| 243 | 243 | <?php _e('Delete', 'geodirectory'); ?>
|
| 244 | 244 | </a> |
@@ -64,6 +64,9 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing { |
| 66 | 66 | |
| 67 | + /** |
|
| 68 | + * @param WP_UnitTest_Factory $factory |
|
| 69 | + */ |
|
| 67 | 70 | function __construct( $factory = null ) { |
| 68 | 71 | parent::__construct( $factory ); |
| 69 | 72 | $this->default_generation_definitions = array( |
@@ -127,6 +130,9 @@ discard block |
||
| 127 | 130 | |
| 128 | 131 | class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing { |
| 129 | 132 | |
| 133 | + /** |
|
| 134 | + * @param WP_UnitTest_Factory $factory |
|
| 135 | + */ |
|
| 130 | 136 | function __construct( $factory = null ) { |
| 131 | 137 | parent::__construct( $factory ); |
| 132 | 138 | $this->default_generation_definitions = array( |
@@ -152,6 +158,9 @@ discard block |
||
| 152 | 158 | |
| 153 | 159 | class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing { |
| 154 | 160 | |
| 161 | + /** |
|
| 162 | + * @param WP_UnitTest_Factory $factory |
|
| 163 | + */ |
|
| 155 | 164 | function __construct( $factory = null ) { |
| 156 | 165 | parent::__construct( $factory ); |
| 157 | 166 | $this->default_generation_definitions = array( |
@@ -183,6 +192,9 @@ discard block |
||
| 183 | 192 | |
| 184 | 193 | class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { |
| 185 | 194 | |
| 195 | + /** |
|
| 196 | + * @param WP_UnitTest_Factory $factory |
|
| 197 | + */ |
|
| 186 | 198 | function __construct( $factory = null ) { |
| 187 | 199 | global $current_site, $base; |
| 188 | 200 | parent::__construct( $factory ); |
@@ -219,6 +231,9 @@ discard block |
||
| 219 | 231 | |
| 220 | 232 | class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing { |
| 221 | 233 | |
| 234 | + /** |
|
| 235 | + * @param WP_UnitTest_Factory $factory |
|
| 236 | + */ |
|
| 222 | 237 | function __construct( $factory = null ) { |
| 223 | 238 | parent::__construct( $factory ); |
| 224 | 239 | $this->default_generation_definitions = array( |
@@ -255,6 +270,10 @@ discard block |
||
| 255 | 270 | private $taxonomy; |
| 256 | 271 | const DEFAULT_TAXONOMY = 'post_tag'; |
| 257 | 272 | |
| 273 | + /** |
|
| 274 | + * @param WP_UnitTest_Factory $factory |
|
| 275 | + * @param string $taxonomy |
|
| 276 | + */ |
|
| 258 | 277 | function __construct( $factory = null, $taxonomy = null ) { |
| 259 | 278 | parent::__construct( $factory ); |
| 260 | 279 | $this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY; |
@@ -342,6 +361,9 @@ discard block |
||
| 342 | 361 | |
| 343 | 362 | abstract function get_object_by_id( $object_id ); |
| 344 | 363 | |
| 364 | + /** |
|
| 365 | + * @param integer $count |
|
| 366 | + */ |
|
| 345 | 367 | function create_many( $count, $args = array(), $generation_definitions = null ) { |
| 346 | 368 | $results = array(); |
| 347 | 369 | for ( $i = 0; $i < $count; $i++ ) { |
@@ -405,6 +427,9 @@ discard block |
||
| 405 | 427 | public $next; |
| 406 | 428 | public $template_string; |
| 407 | 429 | |
| 430 | + /** |
|
| 431 | + * @param integer $start |
|
| 432 | + */ |
|
| 408 | 433 | function __construct( $template_string = '%s', $start = null ) { |
| 409 | 434 | if ( $start ) { |
| 410 | 435 | $this->next = $start; |
@@ -104,8 +104,9 @@ discard block |
||
| 104 | 104 | $type = $upload['type']; |
| 105 | 105 | } else { |
| 106 | 106 | $mime = wp_check_filetype( $upload['file'] ); |
| 107 | - if ($mime) |
|
| 108 | - $type = $mime['type']; |
|
| 107 | + if ($mime) { |
|
| 108 | + $type = $mime['type']; |
|
| 109 | + } |
|
| 109 | 110 | } |
| 110 | 111 | |
| 111 | 112 | $attachment = array( |
@@ -268,15 +269,17 @@ discard block |
||
| 268 | 269 | function create_object( $args ) { |
| 269 | 270 | $args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args ); |
| 270 | 271 | $term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args ); |
| 271 | - if ( is_wp_error( $term_id_pair ) ) |
|
| 272 | - return $term_id_pair; |
|
| 272 | + if ( is_wp_error( $term_id_pair ) ) { |
|
| 273 | + return $term_id_pair; |
|
| 274 | + } |
|
| 273 | 275 | return $term_id_pair['term_id']; |
| 274 | 276 | } |
| 275 | 277 | |
| 276 | 278 | function update_object( $term, $fields ) { |
| 277 | 279 | $fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields ); |
| 278 | - if ( is_object( $term ) ) |
|
| 279 | - $taxonomy = $term->taxonomy; |
|
| 280 | + if ( is_object( $term ) ) { |
|
| 281 | + $taxonomy = $term->taxonomy; |
|
| 282 | + } |
|
| 280 | 283 | $term_id_pair = wp_update_term( $term, $taxonomy, $fields ); |
| 281 | 284 | return $term_id_pair['term_id']; |
| 282 | 285 | } |
@@ -318,19 +321,22 @@ discard block |
||
| 318 | 321 | abstract function update_object( $object, $fields ); |
| 319 | 322 | |
| 320 | 323 | function create( $args = array(), $generation_definitions = null ) { |
| 321 | - if ( is_null( $generation_definitions ) ) |
|
| 322 | - $generation_definitions = $this->default_generation_definitions; |
|
| 324 | + if ( is_null( $generation_definitions ) ) { |
|
| 325 | + $generation_definitions = $this->default_generation_definitions; |
|
| 326 | + } |
|
| 323 | 327 | |
| 324 | 328 | $generated_args = $this->generate_args( $args, $generation_definitions, $callbacks ); |
| 325 | 329 | $created = $this->create_object( $generated_args ); |
| 326 | - if ( !$created || is_wp_error( $created ) ) |
|
| 327 | - return $created; |
|
| 330 | + if ( !$created || is_wp_error( $created ) ) { |
|
| 331 | + return $created; |
|
| 332 | + } |
|
| 328 | 333 | |
| 329 | 334 | if ( $callbacks ) { |
| 330 | 335 | $updated_fields = $this->apply_callbacks( $callbacks, $created ); |
| 331 | 336 | $save_result = $this->update_object( $created, $updated_fields ); |
| 332 | - if ( !$save_result || is_wp_error( $save_result ) ) |
|
| 333 | - return $save_result; |
|
| 337 | + if ( !$save_result || is_wp_error( $save_result ) ) { |
|
| 338 | + return $save_result; |
|
| 339 | + } |
|
| 334 | 340 | } |
| 335 | 341 | return $created; |
| 336 | 342 | } |
@@ -352,20 +358,22 @@ discard block |
||
| 352 | 358 | |
| 353 | 359 | function generate_args( $args = array(), $generation_definitions = null, &$callbacks = null ) { |
| 354 | 360 | $callbacks = array(); |
| 355 | - if ( is_null( $generation_definitions ) ) |
|
| 356 | - $generation_definitions = $this->default_generation_definitions; |
|
| 361 | + if ( is_null( $generation_definitions ) ) { |
|
| 362 | + $generation_definitions = $this->default_generation_definitions; |
|
| 363 | + } |
|
| 357 | 364 | |
| 358 | 365 | foreach( array_keys( $generation_definitions ) as $field_name ) { |
| 359 | 366 | if ( !isset( $args[$field_name] ) ) { |
| 360 | 367 | $generator = $generation_definitions[$field_name]; |
| 361 | - if ( is_scalar( $generator ) ) |
|
| 362 | - $args[$field_name] = $generator; |
|
| 363 | - elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) { |
|
| 368 | + if ( is_scalar( $generator ) ) { |
|
| 369 | + $args[$field_name] = $generator; |
|
| 370 | + } elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) { |
|
| 364 | 371 | $callbacks[$field_name] = $generator; |
| 365 | - } elseif ( is_object( $generator ) ) |
|
| 366 | - $args[$field_name] = $generator->next(); |
|
| 367 | - else |
|
| 368 | - return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' ); |
|
| 372 | + } elseif ( is_object( $generator ) ) { |
|
| 373 | + $args[$field_name] = $generator->next(); |
|
| 374 | + } else { |
|
| 375 | + return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' ); |
|
| 376 | + } |
|
| 369 | 377 | } |
| 370 | 378 | } |
| 371 | 379 | return $args; |
@@ -48,78 +48,78 @@ discard block |
||
| 48 | 48 | public $network; |
| 49 | 49 | |
| 50 | 50 | function __construct() { |
| 51 | - $this->post = new WP_UnitTest_Factory_For_Post( $this ); |
|
| 52 | - $this->attachment = new WP_UnitTest_Factory_For_Attachment( $this ); |
|
| 53 | - $this->comment = new WP_UnitTest_Factory_For_Comment( $this ); |
|
| 54 | - $this->user = new WP_UnitTest_Factory_For_User( $this ); |
|
| 55 | - $this->term = new WP_UnitTest_Factory_For_Term( $this ); |
|
| 56 | - $this->category = new WP_UnitTest_Factory_For_Term( $this, 'category' ); |
|
| 57 | - $this->tag = new WP_UnitTest_Factory_For_Term( $this, 'post_tag' ); |
|
| 58 | - if ( is_multisite() ) { |
|
| 59 | - $this->blog = new WP_UnitTest_Factory_For_Blog( $this ); |
|
| 60 | - $this->network = new WP_UnitTest_Factory_For_Network( $this ); |
|
| 51 | + $this->post = new WP_UnitTest_Factory_For_Post($this); |
|
| 52 | + $this->attachment = new WP_UnitTest_Factory_For_Attachment($this); |
|
| 53 | + $this->comment = new WP_UnitTest_Factory_For_Comment($this); |
|
| 54 | + $this->user = new WP_UnitTest_Factory_For_User($this); |
|
| 55 | + $this->term = new WP_UnitTest_Factory_For_Term($this); |
|
| 56 | + $this->category = new WP_UnitTest_Factory_For_Term($this, 'category'); |
|
| 57 | + $this->tag = new WP_UnitTest_Factory_For_Term($this, 'post_tag'); |
|
| 58 | + if (is_multisite()) { |
|
| 59 | + $this->blog = new WP_UnitTest_Factory_For_Blog($this); |
|
| 60 | + $this->network = new WP_UnitTest_Factory_For_Network($this); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing { |
| 66 | 66 | |
| 67 | - function __construct( $factory = null ) { |
|
| 68 | - parent::__construct( $factory ); |
|
| 67 | + function __construct($factory = null) { |
|
| 68 | + parent::__construct($factory); |
|
| 69 | 69 | $this->default_generation_definitions = array( |
| 70 | 70 | 'post_status' => 'publish', |
| 71 | - 'post_title' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ), |
|
| 72 | - 'post_content' => new WP_UnitTest_Generator_Sequence( 'Post content %s' ), |
|
| 73 | - 'post_excerpt' => new WP_UnitTest_Generator_Sequence( 'Post excerpt %s' ), |
|
| 71 | + 'post_title' => new WP_UnitTest_Generator_Sequence('Post title %s'), |
|
| 72 | + 'post_content' => new WP_UnitTest_Generator_Sequence('Post content %s'), |
|
| 73 | + 'post_excerpt' => new WP_UnitTest_Generator_Sequence('Post excerpt %s'), |
|
| 74 | 74 | 'post_type' => 'post' |
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - function create_object( $args ) { |
|
| 79 | - return wp_insert_post( $args ); |
|
| 78 | + function create_object($args) { |
|
| 79 | + return wp_insert_post($args); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - function update_object( $post_id, $fields ) { |
|
| 82 | + function update_object($post_id, $fields) { |
|
| 83 | 83 | $fields['ID'] = $post_id; |
| 84 | - return wp_update_post( $fields ); |
|
| 84 | + return wp_update_post($fields); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - function get_object_by_id( $post_id ) { |
|
| 88 | - return get_post( $post_id ); |
|
| 87 | + function get_object_by_id($post_id) { |
|
| 88 | + return get_post($post_id); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post { |
| 93 | 93 | |
| 94 | - function create_object( $file, $parent = 0, $args = array() ) { |
|
| 95 | - return wp_insert_attachment( $args, $file, $parent ); |
|
| 94 | + function create_object($file, $parent = 0, $args = array()) { |
|
| 95 | + return wp_insert_attachment($args, $file, $parent); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - function create_upload_object( $file, $parent = 0 ) { |
|
| 98 | + function create_upload_object($file, $parent = 0) { |
|
| 99 | 99 | $contents = file_get_contents($file); |
| 100 | 100 | $upload = wp_upload_bits(basename($file), null, $contents); |
| 101 | 101 | |
| 102 | 102 | $type = ''; |
| 103 | - if ( ! empty($upload['type']) ) { |
|
| 103 | + if (!empty($upload['type'])) { |
|
| 104 | 104 | $type = $upload['type']; |
| 105 | 105 | } else { |
| 106 | - $mime = wp_check_filetype( $upload['file'] ); |
|
| 106 | + $mime = wp_check_filetype($upload['file']); |
|
| 107 | 107 | if ($mime) |
| 108 | 108 | $type = $mime['type']; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $attachment = array( |
| 112 | - 'post_title' => basename( $upload['file'] ), |
|
| 112 | + 'post_title' => basename($upload['file']), |
|
| 113 | 113 | 'post_content' => '', |
| 114 | 114 | 'post_type' => 'attachment', |
| 115 | 115 | 'post_parent' => $parent, |
| 116 | 116 | 'post_mime_type' => $type, |
| 117 | - 'guid' => $upload[ 'url' ], |
|
| 117 | + 'guid' => $upload['url'], |
|
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | 120 | // Save the data |
| 121 | - $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent ); |
|
| 122 | - wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); |
|
| 121 | + $id = wp_insert_attachment($attachment, $upload['file'], $parent); |
|
| 122 | + wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $upload['file'])); |
|
| 123 | 123 | |
| 124 | 124 | return $id; |
| 125 | 125 | } |
@@ -127,126 +127,126 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing { |
| 129 | 129 | |
| 130 | - function __construct( $factory = null ) { |
|
| 131 | - parent::__construct( $factory ); |
|
| 130 | + function __construct($factory = null) { |
|
| 131 | + parent::__construct($factory); |
|
| 132 | 132 | $this->default_generation_definitions = array( |
| 133 | - 'user_login' => new WP_UnitTest_Generator_Sequence( 'User %s' ), |
|
| 133 | + 'user_login' => new WP_UnitTest_Generator_Sequence('User %s'), |
|
| 134 | 134 | 'user_pass' => 'password', |
| 135 | - 'user_email' => new WP_UnitTest_Generator_Sequence( 'user_%[email protected]' ), |
|
| 135 | + 'user_email' => new WP_UnitTest_Generator_Sequence('user_%[email protected]'), |
|
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - function create_object( $args ) { |
|
| 140 | - return wp_insert_user( $args ); |
|
| 139 | + function create_object($args) { |
|
| 140 | + return wp_insert_user($args); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - function update_object( $user_id, $fields ) { |
|
| 143 | + function update_object($user_id, $fields) { |
|
| 144 | 144 | $fields['ID'] = $user_id; |
| 145 | - return wp_update_user( $fields ); |
|
| 145 | + return wp_update_user($fields); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - function get_object_by_id( $user_id ) { |
|
| 149 | - return new WP_User( $user_id ); |
|
| 148 | + function get_object_by_id($user_id) { |
|
| 149 | + return new WP_User($user_id); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing { |
| 154 | 154 | |
| 155 | - function __construct( $factory = null ) { |
|
| 156 | - parent::__construct( $factory ); |
|
| 155 | + function __construct($factory = null) { |
|
| 156 | + parent::__construct($factory); |
|
| 157 | 157 | $this->default_generation_definitions = array( |
| 158 | - 'comment_author' => new WP_UnitTest_Generator_Sequence( 'Commenter %s' ), |
|
| 159 | - 'comment_author_url' => new WP_UnitTest_Generator_Sequence( 'http://example.com/%s/' ), |
|
| 158 | + 'comment_author' => new WP_UnitTest_Generator_Sequence('Commenter %s'), |
|
| 159 | + 'comment_author_url' => new WP_UnitTest_Generator_Sequence('http://example.com/%s/'), |
|
| 160 | 160 | 'comment_approved' => 1, |
| 161 | 161 | 'comment_content' => 'This is a comment' |
| 162 | 162 | ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - function create_object( $args ) { |
|
| 166 | - return wp_insert_comment( $this->addslashes_deep( $args ) ); |
|
| 165 | + function create_object($args) { |
|
| 166 | + return wp_insert_comment($this->addslashes_deep($args)); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - function update_object( $comment_id, $fields ) { |
|
| 169 | + function update_object($comment_id, $fields) { |
|
| 170 | 170 | $fields['comment_ID'] = $comment_id; |
| 171 | - return wp_update_comment( $this->addslashes_deep( $fields ) ); |
|
| 171 | + return wp_update_comment($this->addslashes_deep($fields)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) { |
|
| 174 | + function create_post_comments($post_id, $count = 1, $args = array(), $generation_definitions = null) { |
|
| 175 | 175 | $args['comment_post_ID'] = $post_id; |
| 176 | - return $this->create_many( $count, $args, $generation_definitions ); |
|
| 176 | + return $this->create_many($count, $args, $generation_definitions); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - function get_object_by_id( $comment_id ) { |
|
| 180 | - return get_comment( $comment_id ); |
|
| 179 | + function get_object_by_id($comment_id) { |
|
| 180 | + return get_comment($comment_id); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { |
| 185 | 185 | |
| 186 | - function __construct( $factory = null ) { |
|
| 186 | + function __construct($factory = null) { |
|
| 187 | 187 | global $current_site, $base; |
| 188 | - parent::__construct( $factory ); |
|
| 188 | + parent::__construct($factory); |
|
| 189 | 189 | $this->default_generation_definitions = array( |
| 190 | 190 | 'domain' => $current_site->domain, |
| 191 | - 'path' => new WP_UnitTest_Generator_Sequence( $base . 'testpath%s' ), |
|
| 192 | - 'title' => new WP_UnitTest_Generator_Sequence( 'Site %s' ), |
|
| 191 | + 'path' => new WP_UnitTest_Generator_Sequence($base.'testpath%s'), |
|
| 192 | + 'title' => new WP_UnitTest_Generator_Sequence('Site %s'), |
|
| 193 | 193 | 'site_id' => $current_site->id, |
| 194 | 194 | ); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - function create_object( $args ) { |
|
| 197 | + function create_object($args) { |
|
| 198 | 198 | global $wpdb; |
| 199 | - $meta = isset( $args['meta'] ) ? $args['meta'] : array(); |
|
| 200 | - $user_id = isset( $args['user_id'] ) ? $args['user_id'] : get_current_user_id(); |
|
| 199 | + $meta = isset($args['meta']) ? $args['meta'] : array(); |
|
| 200 | + $user_id = isset($args['user_id']) ? $args['user_id'] : get_current_user_id(); |
|
| 201 | 201 | // temp tables will trigger db errors when we attempt to reference them as new temp tables |
| 202 | 202 | $suppress = $wpdb->suppress_errors(); |
| 203 | - $blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] ); |
|
| 204 | - $wpdb->suppress_errors( $suppress ); |
|
| 203 | + $blog = wpmu_create_blog($args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id']); |
|
| 204 | + $wpdb->suppress_errors($suppress); |
|
| 205 | 205 | |
| 206 | 206 | // Tell WP we're done installing. |
| 207 | - wp_installing( false ); |
|
| 207 | + wp_installing(false); |
|
| 208 | 208 | |
| 209 | 209 | return $blog; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - function update_object( $blog_id, $fields ) {} |
|
| 212 | + function update_object($blog_id, $fields) {} |
|
| 213 | 213 | |
| 214 | - function get_object_by_id( $blog_id ) { |
|
| 215 | - return get_blog_details( $blog_id, false ); |
|
| 214 | + function get_object_by_id($blog_id) { |
|
| 215 | + return get_blog_details($blog_id, false); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing { |
| 221 | 221 | |
| 222 | - function __construct( $factory = null ) { |
|
| 223 | - parent::__construct( $factory ); |
|
| 222 | + function __construct($factory = null) { |
|
| 223 | + parent::__construct($factory); |
|
| 224 | 224 | $this->default_generation_definitions = array( |
| 225 | 225 | 'domain' => WP_TESTS_DOMAIN, |
| 226 | - 'title' => new WP_UnitTest_Generator_Sequence( 'Network %s' ), |
|
| 227 | - 'path' => new WP_UnitTest_Generator_Sequence( '/testpath%s/' ), |
|
| 228 | - 'network_id' => new WP_UnitTest_Generator_Sequence( '%s', 2 ), |
|
| 226 | + 'title' => new WP_UnitTest_Generator_Sequence('Network %s'), |
|
| 227 | + 'path' => new WP_UnitTest_Generator_Sequence('/testpath%s/'), |
|
| 228 | + 'network_id' => new WP_UnitTest_Generator_Sequence('%s', 2), |
|
| 229 | 229 | 'subdomain_install' => false, |
| 230 | 230 | ); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - function create_object( $args ) { |
|
| 234 | - require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
|
| 233 | + function create_object($args) { |
|
| 234 | + require_once ABSPATH.'wp-admin/includes/upgrade.php'; |
|
| 235 | 235 | |
| 236 | - if ( ! isset( $args['user'] ) ) { |
|
| 236 | + if (!isset($args['user'])) { |
|
| 237 | 237 | $email = WP_TESTS_EMAIL; |
| 238 | 238 | } else { |
| 239 | - $email = get_userdata( $args['user'] )->user_email; |
|
| 239 | + $email = get_userdata($args['user'])->user_email; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - populate_network( $args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install'] ); |
|
| 242 | + populate_network($args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install']); |
|
| 243 | 243 | return $args['network_id']; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - function update_object( $network_id, $fields ) {} |
|
| 246 | + function update_object($network_id, $fields) {} |
|
| 247 | 247 | |
| 248 | - function get_object_by_id( $network_id ) { |
|
| 249 | - return wp_get_network( $network_id ); |
|
| 248 | + function get_object_by_id($network_id) { |
|
| 249 | + return wp_get_network($network_id); |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
@@ -255,44 +255,44 @@ discard block |
||
| 255 | 255 | private $taxonomy; |
| 256 | 256 | const DEFAULT_TAXONOMY = 'post_tag'; |
| 257 | 257 | |
| 258 | - function __construct( $factory = null, $taxonomy = null ) { |
|
| 259 | - parent::__construct( $factory ); |
|
| 258 | + function __construct($factory = null, $taxonomy = null) { |
|
| 259 | + parent::__construct($factory); |
|
| 260 | 260 | $this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY; |
| 261 | 261 | $this->default_generation_definitions = array( |
| 262 | - 'name' => new WP_UnitTest_Generator_Sequence( 'Term %s' ), |
|
| 262 | + 'name' => new WP_UnitTest_Generator_Sequence('Term %s'), |
|
| 263 | 263 | 'taxonomy' => $this->taxonomy, |
| 264 | - 'description' => new WP_UnitTest_Generator_Sequence( 'Term description %s' ), |
|
| 264 | + 'description' => new WP_UnitTest_Generator_Sequence('Term description %s'), |
|
| 265 | 265 | ); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - function create_object( $args ) { |
|
| 269 | - $args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args ); |
|
| 270 | - $term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args ); |
|
| 271 | - if ( is_wp_error( $term_id_pair ) ) |
|
| 268 | + function create_object($args) { |
|
| 269 | + $args = array_merge(array('taxonomy' => $this->taxonomy), $args); |
|
| 270 | + $term_id_pair = wp_insert_term($args['name'], $args['taxonomy'], $args); |
|
| 271 | + if (is_wp_error($term_id_pair)) |
|
| 272 | 272 | return $term_id_pair; |
| 273 | 273 | return $term_id_pair['term_id']; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - function update_object( $term, $fields ) { |
|
| 277 | - $fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields ); |
|
| 278 | - if ( is_object( $term ) ) |
|
| 276 | + function update_object($term, $fields) { |
|
| 277 | + $fields = array_merge(array('taxonomy' => $this->taxonomy), $fields); |
|
| 278 | + if (is_object($term)) |
|
| 279 | 279 | $taxonomy = $term->taxonomy; |
| 280 | - $term_id_pair = wp_update_term( $term, $taxonomy, $fields ); |
|
| 280 | + $term_id_pair = wp_update_term($term, $taxonomy, $fields); |
|
| 281 | 281 | return $term_id_pair['term_id']; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) { |
|
| 285 | - return wp_set_post_terms( $post_id, $terms, $taxonomy, $append ); |
|
| 284 | + function add_post_terms($post_id, $terms, $taxonomy, $append = true) { |
|
| 285 | + return wp_set_post_terms($post_id, $terms, $taxonomy, $append); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - function create_and_get( $args = array(), $generation_definitions = null ) { |
|
| 289 | - $term_id = $this->create( $args, $generation_definitions ); |
|
| 290 | - $taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] : $this->taxonomy; |
|
| 291 | - return get_term( $term_id, $taxonomy ); |
|
| 288 | + function create_and_get($args = array(), $generation_definitions = null) { |
|
| 289 | + $term_id = $this->create($args, $generation_definitions); |
|
| 290 | + $taxonomy = isset($args['taxonomy']) ? $args['taxonomy'] : $this->taxonomy; |
|
| 291 | + return get_term($term_id, $taxonomy); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - function get_object_by_id( $term_id ) { |
|
| 295 | - return get_term( $term_id, $this->taxonomy ); |
|
| 294 | + function get_object_by_id($term_id) { |
|
| 295 | + return get_term($term_id, $this->taxonomy); |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
@@ -309,90 +309,90 @@ discard block |
||
| 309 | 309 | * can be generators -- an object with next() method. There are some default generators: {@link WP_UnitTest_Generator_Sequence}, |
| 310 | 310 | * {@link WP_UnitTest_Generator_Locale_Name}, {@link WP_UnitTest_Factory_Callback_After_Create}. |
| 311 | 311 | */ |
| 312 | - function __construct( $factory, $default_generation_definitions = array() ) { |
|
| 312 | + function __construct($factory, $default_generation_definitions = array()) { |
|
| 313 | 313 | $this->factory = $factory; |
| 314 | 314 | $this->default_generation_definitions = $default_generation_definitions; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - abstract function create_object( $args ); |
|
| 318 | - abstract function update_object( $object, $fields ); |
|
| 317 | + abstract function create_object($args); |
|
| 318 | + abstract function update_object($object, $fields); |
|
| 319 | 319 | |
| 320 | - function create( $args = array(), $generation_definitions = null ) { |
|
| 321 | - if ( is_null( $generation_definitions ) ) |
|
| 320 | + function create($args = array(), $generation_definitions = null) { |
|
| 321 | + if (is_null($generation_definitions)) |
|
| 322 | 322 | $generation_definitions = $this->default_generation_definitions; |
| 323 | 323 | |
| 324 | - $generated_args = $this->generate_args( $args, $generation_definitions, $callbacks ); |
|
| 325 | - $created = $this->create_object( $generated_args ); |
|
| 326 | - if ( !$created || is_wp_error( $created ) ) |
|
| 324 | + $generated_args = $this->generate_args($args, $generation_definitions, $callbacks); |
|
| 325 | + $created = $this->create_object($generated_args); |
|
| 326 | + if (!$created || is_wp_error($created)) |
|
| 327 | 327 | return $created; |
| 328 | 328 | |
| 329 | - if ( $callbacks ) { |
|
| 330 | - $updated_fields = $this->apply_callbacks( $callbacks, $created ); |
|
| 331 | - $save_result = $this->update_object( $created, $updated_fields ); |
|
| 332 | - if ( !$save_result || is_wp_error( $save_result ) ) |
|
| 329 | + if ($callbacks) { |
|
| 330 | + $updated_fields = $this->apply_callbacks($callbacks, $created); |
|
| 331 | + $save_result = $this->update_object($created, $updated_fields); |
|
| 332 | + if (!$save_result || is_wp_error($save_result)) |
|
| 333 | 333 | return $save_result; |
| 334 | 334 | } |
| 335 | 335 | return $created; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - function create_and_get( $args = array(), $generation_definitions = null ) { |
|
| 339 | - $object_id = $this->create( $args, $generation_definitions ); |
|
| 340 | - return $this->get_object_by_id( $object_id ); |
|
| 338 | + function create_and_get($args = array(), $generation_definitions = null) { |
|
| 339 | + $object_id = $this->create($args, $generation_definitions); |
|
| 340 | + return $this->get_object_by_id($object_id); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - abstract function get_object_by_id( $object_id ); |
|
| 343 | + abstract function get_object_by_id($object_id); |
|
| 344 | 344 | |
| 345 | - function create_many( $count, $args = array(), $generation_definitions = null ) { |
|
| 345 | + function create_many($count, $args = array(), $generation_definitions = null) { |
|
| 346 | 346 | $results = array(); |
| 347 | - for ( $i = 0; $i < $count; $i++ ) { |
|
| 348 | - $results[] = $this->create( $args, $generation_definitions ); |
|
| 347 | + for ($i = 0; $i < $count; $i++) { |
|
| 348 | + $results[] = $this->create($args, $generation_definitions); |
|
| 349 | 349 | } |
| 350 | 350 | return $results; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - function generate_args( $args = array(), $generation_definitions = null, &$callbacks = null ) { |
|
| 353 | + function generate_args($args = array(), $generation_definitions = null, &$callbacks = null) { |
|
| 354 | 354 | $callbacks = array(); |
| 355 | - if ( is_null( $generation_definitions ) ) |
|
| 355 | + if (is_null($generation_definitions)) |
|
| 356 | 356 | $generation_definitions = $this->default_generation_definitions; |
| 357 | 357 | |
| 358 | - foreach( array_keys( $generation_definitions ) as $field_name ) { |
|
| 359 | - if ( !isset( $args[$field_name] ) ) { |
|
| 358 | + foreach (array_keys($generation_definitions) as $field_name) { |
|
| 359 | + if (!isset($args[$field_name])) { |
|
| 360 | 360 | $generator = $generation_definitions[$field_name]; |
| 361 | - if ( is_scalar( $generator ) ) |
|
| 361 | + if (is_scalar($generator)) |
|
| 362 | 362 | $args[$field_name] = $generator; |
| 363 | - elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) { |
|
| 363 | + elseif (is_object($generator) && method_exists($generator, 'call')) { |
|
| 364 | 364 | $callbacks[$field_name] = $generator; |
| 365 | - } elseif ( is_object( $generator ) ) |
|
| 365 | + } elseif (is_object($generator)) |
|
| 366 | 366 | $args[$field_name] = $generator->next(); |
| 367 | 367 | else |
| 368 | - return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' ); |
|
| 368 | + return new WP_Error('invalid_argument', 'Factory default value should be either a scalar or an generator object.'); |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | return $args; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - function apply_callbacks( $callbacks, $created ) { |
|
| 374 | + function apply_callbacks($callbacks, $created) { |
|
| 375 | 375 | $updated_fields = array(); |
| 376 | - foreach( $callbacks as $field_name => $generator ) { |
|
| 377 | - $updated_fields[$field_name] = $generator->call( $created ); |
|
| 376 | + foreach ($callbacks as $field_name => $generator) { |
|
| 377 | + $updated_fields[$field_name] = $generator->call($created); |
|
| 378 | 378 | } |
| 379 | 379 | return $updated_fields; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - function callback( $function ) { |
|
| 383 | - return new WP_UnitTest_Factory_Callback_After_Create( $function ); |
|
| 382 | + function callback($function) { |
|
| 383 | + return new WP_UnitTest_Factory_Callback_After_Create($function); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | function addslashes_deep($value) { |
| 387 | - if ( is_array( $value ) ) { |
|
| 388 | - $value = array_map( array( $this, 'addslashes_deep' ), $value ); |
|
| 389 | - } elseif ( is_object( $value ) ) { |
|
| 390 | - $vars = get_object_vars( $value ); |
|
| 387 | + if (is_array($value)) { |
|
| 388 | + $value = array_map(array($this, 'addslashes_deep'), $value); |
|
| 389 | + } elseif (is_object($value)) { |
|
| 390 | + $vars = get_object_vars($value); |
|
| 391 | 391 | foreach ($vars as $key=>$data) { |
| 392 | - $value->{$key} = $this->addslashes_deep( $data ); |
|
| 392 | + $value->{$key} = $this->addslashes_deep($data); |
|
| 393 | 393 | } |
| 394 | - } elseif ( is_string( $value ) ) { |
|
| 395 | - $value = addslashes( $value ); |
|
| 394 | + } elseif (is_string($value)) { |
|
| 395 | + $value = addslashes($value); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | return $value; |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | public $next; |
| 406 | 406 | public $template_string; |
| 407 | 407 | |
| 408 | - function __construct( $template_string = '%s', $start = null ) { |
|
| 409 | - if ( $start ) { |
|
| 408 | + function __construct($template_string = '%s', $start = null) { |
|
| 409 | + if ($start) { |
|
| 410 | 410 | $this->next = $start; |
| 411 | 411 | } else { |
| 412 | 412 | self::$incr++; |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | function next() { |
| 419 | - $generated = sprintf( $this->template_string , $this->next ); |
|
| 419 | + $generated = sprintf($this->template_string, $this->next); |
|
| 420 | 420 | $this->next++; |
| 421 | 421 | return $generated; |
| 422 | 422 | } |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | class WP_UnitTest_Factory_Callback_After_Create { |
| 426 | 426 | var $callback; |
| 427 | 427 | |
| 428 | - function __construct( $callback ) { |
|
| 428 | + function __construct($callback) { |
|
| 429 | 429 | $this->callback = $callback; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - function call( $object ) { |
|
| 433 | - return call_user_func( $this->callback, $object ); |
|
| 432 | + function call($object) { |
|
| 433 | + return call_user_func($this->callback, $object); |
|
| 434 | 434 | } |
| 435 | 435 | } |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | return true; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | +/** |
|
| 14 | + * @param integer $priority |
|
| 15 | + */ |
|
| 13 | 16 | function _test_filter_build_unique_id($tag, $function, $priority) { |
| 14 | 17 | global $wp_filter; |
| 15 | 18 | static $filter_id_count = 0; |
@@ -92,6 +95,9 @@ discard block |
||
| 92 | 95 | return '_wp_die_handler'; |
| 93 | 96 | } |
| 94 | 97 | |
| 98 | +/** |
|
| 99 | + * @param string $title |
|
| 100 | + */ |
|
| 95 | 101 | function _wp_die_handler_txt( $message, $title, $args ) { |
| 96 | 102 | echo "\nwp_die called\n"; |
| 97 | 103 | echo "Message : $message\n"; |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | global $wp_filter; |
| 15 | 15 | static $filter_id_count = 0; |
| 16 | 16 | |
| 17 | - if ( is_string($function) ) |
|
| 18 | - return $function; |
|
| 17 | + if ( is_string($function) ) { |
|
| 18 | + return $function; |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | if ( is_object($function) ) { |
| 21 | 22 | // Closures are currently implemented as objects |
@@ -37,8 +38,9 @@ discard block |
||
| 37 | 38 | |
| 38 | 39 | $all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}"); |
| 39 | 40 | if ($all_posts) { |
| 40 | - foreach ($all_posts as $id) |
|
| 41 | - wp_delete_post( $id, true ); |
|
| 41 | + foreach ($all_posts as $id) { |
|
| 42 | + wp_delete_post( $id, true ); |
|
| 43 | + } |
|
| 42 | 44 | } |
| 43 | 45 | } |
| 44 | 46 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | $idx = _test_filter_build_unique_id($tag, $function_to_add, $priority); |
| 8 | 8 | $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); |
| 9 | - unset( $merged_filters[ $tag ] ); |
|
| 9 | + unset($merged_filters[$tag]); |
|
| 10 | 10 | return true; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | global $wp_filter; |
| 15 | 15 | static $filter_id_count = 0; |
| 16 | 16 | |
| 17 | - if ( is_string($function) ) |
|
| 17 | + if (is_string($function)) |
|
| 18 | 18 | return $function; |
| 19 | 19 | |
| 20 | - if ( is_object($function) ) { |
|
| 20 | + if (is_object($function)) { |
|
| 21 | 21 | // Closures are currently implemented as objects |
| 22 | - $function = array( $function, '' ); |
|
| 22 | + $function = array($function, ''); |
|
| 23 | 23 | } else { |
| 24 | 24 | $function = (array) $function; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (is_object($function[0]) ) { |
|
| 28 | - return spl_object_hash($function[0]) . $function[1]; |
|
| 29 | - } else if ( is_string($function[0]) ) { |
|
| 27 | + if (is_object($function[0])) { |
|
| 28 | + return spl_object_hash($function[0]).$function[1]; |
|
| 29 | + } else if (is_string($function[0])) { |
|
| 30 | 30 | // Static Calling |
| 31 | 31 | return $function[0].$function[1]; |
| 32 | 32 | } |
@@ -38,31 +38,31 @@ discard block |
||
| 38 | 38 | $all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}"); |
| 39 | 39 | if ($all_posts) { |
| 40 | 40 | foreach ($all_posts as $id) |
| 41 | - wp_delete_post( $id, true ); |
|
| 41 | + wp_delete_post($id, true); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | class Basic_Object { |
| 46 | 46 | private $foo = 'bar'; |
| 47 | 47 | |
| 48 | - public function __get( $name ) { |
|
| 48 | + public function __get($name) { |
|
| 49 | 49 | return $this->{$name}; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function __set( $name, $value ) { |
|
| 52 | + public function __set($name, $value) { |
|
| 53 | 53 | return $this->{$name} = $value; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function __isset( $name ) { |
|
| 57 | - return isset( $this->{$name} ); |
|
| 56 | + public function __isset($name) { |
|
| 57 | + return isset($this->{$name} ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function __unset( $name ) { |
|
| 61 | - unset( $this->{$name} ); |
|
| 60 | + public function __unset($name) { |
|
| 61 | + unset($this->{$name} ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function __call( $name, $arguments ) { |
|
| 65 | - return call_user_func_array( array( $this, $name ), $arguments ); |
|
| 64 | + public function __call($name, $arguments) { |
|
| 65 | + return call_user_func_array(array($this, $name), $arguments); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | private function callMe() { |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | class Basic_Subclass extends Basic_Object {} |
| 74 | 74 | |
| 75 | -function _wp_die_handler( $message, $title = '', $args = array() ) { |
|
| 76 | - if ( !$GLOBALS['_wp_die_disabled'] ) { |
|
| 77 | - _wp_die_handler_txt( $message, $title, $args); |
|
| 75 | +function _wp_die_handler($message, $title = '', $args = array()) { |
|
| 76 | + if (!$GLOBALS['_wp_die_disabled']) { |
|
| 77 | + _wp_die_handler_txt($message, $title, $args); |
|
| 78 | 78 | } else { |
| 79 | 79 | //Ignore at our peril |
| 80 | 80 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | return '_wp_die_handler'; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | -function _wp_die_handler_txt( $message, $title, $args ) { |
|
| 95 | +function _wp_die_handler_txt($message, $title, $args) { |
|
| 96 | 96 | echo "\nwp_die called\n"; |
| 97 | 97 | echo "Message : $message\n"; |
| 98 | 98 | echo "Title : $title\n"; |
| 99 | - if ( ! empty( $args ) ) { |
|
| 99 | + if (!empty($args)) { |
|
| 100 | 100 | echo "Args: \n"; |
| 101 | - foreach( $args as $k => $v ){ |
|
| 101 | + foreach ($args as $k => $v) { |
|
| 102 | 102 | echo "\t $k : $v\n"; |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -113,5 +113,5 @@ discard block |
||
| 113 | 113 | * @since 4.2.0 |
| 114 | 114 | */ |
| 115 | 115 | function _set_default_permalink_structure_for_tests() { |
| 116 | - update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); |
|
| 116 | + update_option('permalink_structure', '/%year%/%monthnum%/%day%/%postname%/'); |
|
| 117 | 117 | } |