@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $username = $user_info->user_login; |
| 36 | 36 | $user_email = $user_info->user_email; |
| 37 | 37 | |
| 38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
|
|
| 38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')), 'geodirectory'));
|
|
| 39 | 39 | |
| 40 | 40 | /* |
| 41 | 41 | * Filter the success page message before variable replacements. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param object $post_info Post object. |
| 46 | 46 | * @param object $user_info User object. |
| 47 | 47 | */ |
| 48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
|
|
| 48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message, $post_info, $user_info);
|
|
| 49 | 49 | |
| 50 | 50 | $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
|
| 51 | 51 | $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @param object $post_info Post object. |
| 60 | 60 | * @param object $user_info User object. |
| 61 | 61 | */ |
| 62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
|
|
| 62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message, $post_info, $user_info);
|
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param object $post_info Post object. |
| 76 | 76 | * @param object $user_info User object. |
| 77 | 77 | */ |
| 78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 78 | + do_action('geodir_before_success_page_msg_wrapper', $message, $post_info, $user_info);
|
|
| 79 | 79 | echo '<h5 class="geodir_information">'; |
| 80 | 80 | echo $message; |
| 81 | 81 | echo '</h5>'; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param object $post_info Post object. |
| 88 | 88 | * @param object $user_info User object. |
| 89 | 89 | */ |
| 90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 90 | + do_action('geodir_after_success_page_msg_wrapper', $message, $post_info, $user_info);
|
|
| 91 | 91 | |
| 92 | 92 | ?> |
| 93 | 93 | |
@@ -15,29 +15,29 @@ discard block |
||
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - global $wpdb; |
|
| 18 | + global $wpdb; |
|
| 19 | 19 | |
| 20 | - $post_id = $_REQUEST['pid']; |
|
| 21 | - $post_info = get_post($post_id); |
|
| 20 | + $post_id = $_REQUEST['pid']; |
|
| 21 | + $post_info = get_post($post_id); |
|
| 22 | 22 | |
| 23 | - $posted_date = $post_info->post_date; |
|
| 24 | - $productlink = get_permalink($post_id); |
|
| 25 | - $siteName = get_bloginfo('name');
|
|
| 26 | - $siteurl = home_url(); |
|
| 27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 23 | + $posted_date = $post_info->post_date; |
|
| 24 | + $productlink = get_permalink($post_id); |
|
| 25 | + $siteName = get_bloginfo('name');
|
|
| 26 | + $siteurl = home_url(); |
|
| 27 | + $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 28 | 28 | |
| 29 | - $loginurl = geodir_login_url(); |
|
| 30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 29 | + $loginurl = geodir_login_url(); |
|
| 30 | + $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 31 | 31 | |
| 32 | - $post_author = $post_info->post_author; |
|
| 32 | + $post_author = $post_info->post_author; |
|
| 33 | 33 | |
| 34 | - $user_info = get_userdata($post_author); |
|
| 35 | - $username = $user_info->user_login; |
|
| 36 | - $user_email = $user_info->user_email; |
|
| 34 | + $user_info = get_userdata($post_author); |
|
| 35 | + $username = $user_info->user_login; |
|
| 36 | + $user_email = $user_info->user_email; |
|
| 37 | 37 | |
| 38 | - $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
|
|
| 38 | + $message = wpautop(__(stripslashes_deep(get_option('geodir_post_added_success_msg_content')),'geodirectory'));
|
|
| 39 | 39 | |
| 40 | - /* |
|
| 40 | + /* |
|
| 41 | 41 | * Filter the success page message before variable replacements. |
| 42 | 42 | * |
| 43 | 43 | * @since 1.5.7 |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | * @param object $post_info Post object. |
| 46 | 46 | * @param object $user_info User object. |
| 47 | 47 | */ |
| 48 | - $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
|
|
| 48 | + $message = apply_filters('geodir_success_page_msg_before_var_replace', $message,$post_info, $user_info);
|
|
| 49 | 49 | |
| 50 | - $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
|
|
| 51 | - $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
| 52 | - $message = str_replace($search_array, $replace_array, $message); |
|
| 50 | + $search_array = array('[#submited_information_link#]', '[#listing_link#]', '[#site_name_url#]', '[#post_id#]', '[#site_name#]', '[#user_email#]', '[#username#]', '[#login_url#]', '[#posted_date#]');
|
|
| 51 | + $replace_array = array($productlink, $productlink, $siteurl_link, $post_id, $siteName, $user_email, $username, $loginurl_link, $posted_date); |
|
| 52 | + $message = str_replace($search_array, $replace_array, $message); |
|
| 53 | 53 | |
| 54 | - /* |
|
| 54 | + /* |
|
| 55 | 55 | * Filter the success page message after variable replacements. |
| 56 | 56 | * |
| 57 | 57 | * @since 1.5.7 |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | * @param object $post_info Post object. |
| 60 | 60 | * @param object $user_info User object. |
| 61 | 61 | */ |
| 62 | - $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
|
|
| 62 | + $message = apply_filters('geodir_success_page_msg_after_var_replace', $message,$post_info, $user_info);
|
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - ?> |
|
| 66 | + ?> |
|
| 67 | 67 | |
| 68 | 68 | <?php |
| 69 | 69 | |
| 70 | - /* |
|
| 70 | + /* |
|
| 71 | 71 | * Action called before the success page message wrapper. |
| 72 | 72 | * |
| 73 | 73 | * @since 1.5.7 |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | * @param object $post_info Post object. |
| 76 | 76 | * @param object $user_info User object. |
| 77 | 77 | */ |
| 78 | - do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 79 | - echo '<h5 class="geodir_information">'; |
|
| 80 | - echo $message; |
|
| 81 | - echo '</h5>'; |
|
| 82 | - /* |
|
| 78 | + do_action('geodir_before_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 79 | + echo '<h5 class="geodir_information">'; |
|
| 80 | + echo $message; |
|
| 81 | + echo '</h5>'; |
|
| 82 | + /* |
|
| 83 | 83 | * Action called after the success page message wrapper. |
| 84 | 84 | * |
| 85 | 85 | * @since 1.5.7 |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * @param object $post_info Post object. |
| 88 | 88 | * @param object $user_info User object. |
| 89 | 89 | */ |
| 90 | - do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 90 | + do_action('geodir_after_success_page_msg_wrapper', $message,$post_info, $user_info);
|
|
| 91 | 91 | |
| 92 | - ?> |
|
| 92 | + ?> |
|
| 93 | 93 | |
| 94 | 94 | </div> |
| 95 | 95 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 31 | 31 | do_action('geodir_before_listing_post_listview');
|
| 32 | 32 | $all_postypes = geodir_get_posttypes(); |
| 33 | - $geodir_days_new = (int)get_option('geodir_listing_new_days');
|
|
| 33 | + $geodir_days_new = (int) get_option('geodir_listing_new_days');
|
|
| 34 | 34 | foreach ($widget_listings as $widget_listing) {
|
| 35 | 35 | global $gd_widget_listing_type; |
| 36 | 36 | $post = $widget_listing; |
@@ -145,12 +145,12 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
| 147 | 147 | if ($show_listing_excerpt) {
|
| 148 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 149 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 148 | + if (isset($character_count) && ($character_count || $character_count == '0')) {
|
|
| 149 | + $content_out = geodir_max_excerpt($character_count); |
|
| 150 | 150 | } else {
|
| 151 | 151 | $content_out = get_the_excerpt(); |
| 152 | 152 | } |
| 153 | - if ( ! empty( $content_out ) ) {
|
|
| 153 | + if (!empty($content_out)) {
|
|
| 154 | 154 | echo "<p>" . $content_out . "</p>"; |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param object $post The post object. |
| 171 | 171 | * @param string $view The view type, default 'widget'. |
| 172 | 172 | */ |
| 173 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 173 | + do_action('geodir_after_listing_content', $post, 'widget'); ?>
|
|
| 174 | 174 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
|
| 175 | 175 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
|
| 176 | 176 | <?php |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param object $post The post object. |
| 182 | 182 | * @param string $view The view type, default 'widget'. |
| 183 | 183 | */ |
| 184 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 184 | + do_action('geodir_before_review_html', $post, 'widget');
|
|
| 185 | 185 | $review_show = geodir_is_reviews_show('listview');
|
| 186 | 186 | if ($review_show) {
|
| 187 | 187 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @since 1.0.0 |
| 208 | 208 | */ |
| 209 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 209 | + do_action('geodir_after_favorite_html', $post->ID, 'widget');
|
|
| 210 | 210 | |
| 211 | 211 | if ($post->post_author == get_current_user_id()) {
|
| 212 | 212 | $addplacelink = get_permalink(geodir_add_listing_page_id()); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 228 | 228 | <?php |
| 229 | 229 | $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
| 230 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 230 | + echo '<i class="' . $geodir_listing_edit_icon . '"></i>'; |
|
| 231 | 231 | ?> |
| 232 | 232 | <?php _e('Edit', 'geodirectory'); ?>
|
| 233 | 233 | </a> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 236 | 236 | <?php |
| 237 | 237 | $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
| 238 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 238 | + echo '<i class="' . $geodir_listing_delete_icon . '"></i>'; |
|
| 239 | 239 | ?> |
| 240 | 240 | <?php _e('Delete', 'geodirectory'); ?>
|
| 241 | 241 | </a> |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Template for the list of places |
|
| 4 | - * |
|
| 5 | - * This is used mostly by widgets that produce a list of listings and outputs the actual grid or list of listings. |
|
| 6 | - * See the link below for info on how to replace the template in your theme. |
|
| 7 | - * |
|
| 8 | - * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/ |
|
| 9 | - * @since 1.0.0 |
|
| 10 | - * @package GeoDirectory |
|
| 11 | - * @global string $gridview_columns_widget The girdview style of the listings for widget. |
|
| 12 | - * @global object $gd_session GeoDirectory Session object. |
|
| 13 | - */ |
|
| 3 | + * Template for the list of places |
|
| 4 | + * |
|
| 5 | + * This is used mostly by widgets that produce a list of listings and outputs the actual grid or list of listings. |
|
| 6 | + * See the link below for info on how to replace the template in your theme. |
|
| 7 | + * |
|
| 8 | + * @link http://docs.wpgeodirectory.com/customizing-geodirectory-templates/ |
|
| 9 | + * @since 1.0.0 |
|
| 10 | + * @package GeoDirectory |
|
| 11 | + * @global string $gridview_columns_widget The girdview style of the listings for widget. |
|
| 12 | + * @global object $gd_session GeoDirectory Session object. |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 16 | 16 | do_action('geodir_before_listing_listview');
|
@@ -20,67 +20,67 @@ 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 | <article class="geodir-category-listing <?php if ($post_view_article_class) {
|
| 58 | - echo $post_view_article_class; |
|
| 59 | - } ?>"> |
|
| 58 | + echo $post_view_article_class; |
|
| 59 | + } ?>"> |
|
| 60 | 60 | <div class="geodir-post-img <?php echo apply_filters('geodir_listing_listview_thumb_extra_class', '', 'widget'); ?>">
|
| 61 | 61 | <?php if ($fimage = geodir_show_featured_image($post->ID, 'list-thumb', true, false, $post->featured_image)) { ?>
|
| 62 | 62 | <a href="<?php the_permalink(); ?>"><?php echo $fimage; ?></a> |
| 63 | 63 | <?php |
| 64 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 65 | - do_action('geodir_before_badge_on_image', $post);
|
|
| 66 | - if ($post->is_featured) {
|
|
| 67 | - echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 68 | - } |
|
| 64 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 65 | + do_action('geodir_before_badge_on_image', $post);
|
|
| 66 | + if ($post->is_featured) {
|
|
| 67 | + echo geodir_show_badges_on_image('featured', $post, get_permalink());
|
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 72 | - echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 73 | - } |
|
| 71 | + if (round(abs(strtotime($post->post_date) - strtotime(date('Y-m-d'))) / 86400) < $geodir_days_new) {
|
|
| 72 | + echo geodir_show_badges_on_image('new', $post, get_permalink());
|
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 76 | - do_action('geodir_after_badge_on_image', $post);
|
|
| 77 | - } |
|
| 78 | - ?> |
|
| 75 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 76 | + do_action('geodir_after_badge_on_image', $post);
|
|
| 77 | + } |
|
| 78 | + ?> |
|
| 79 | 79 | </div> |
| 80 | 80 | <div class="geodir-content <?php echo apply_filters('geodir_listing_listview_content_extra_class', '', 'widget'); ?>">
|
| 81 | 81 | <?php |
| 82 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 83 | - do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 82 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 83 | + do_action('geodir_before_listing_post_title', 'listview', $post); ?>
|
|
| 84 | 84 | <header class="geodir-entry-header"> |
| 85 | 85 | <h3 class="geodir-entry-title"> |
| 86 | 86 | <a href="<?php the_permalink(); ?>" |
@@ -89,158 +89,158 @@ discard block |
||
| 89 | 89 | </header> |
| 90 | 90 | <!-- .entry-header --> |
| 91 | 91 | <?php |
| 92 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 93 | - do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 92 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 93 | + do_action('geodir_after_listing_post_title', 'listview', $post); ?>
|
|
| 94 | 94 | <?php /// Print Distance |
| 95 | - if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
|
|
| 96 | - $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 95 | + if (isset($_REQUEST['sgeo_lat']) && $_REQUEST['sgeo_lat'] != '') {
|
|
| 96 | + $startPoint = array('latitude' => $_REQUEST['sgeo_lat'], 'longitude' => $_REQUEST['sgeo_lon']);
|
|
| 97 | 97 | |
| 98 | - $endLat = $post->post_latitude; |
|
| 99 | - $endLon = $post->post_longitude; |
|
| 100 | - $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 101 | - $uom = get_option('geodir_search_dist_1');
|
|
| 102 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 103 | - ?> |
|
| 98 | + $endLat = $post->post_latitude; |
|
| 99 | + $endLon = $post->post_longitude; |
|
| 100 | + $endPoint = array('latitude' => $endLat, 'longitude' => $endLon);
|
|
| 101 | + $uom = get_option('geodir_search_dist_1');
|
|
| 102 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 103 | + ?> |
|
| 104 | 104 | <h3> |
| 105 | 105 | <?php |
| 106 | - if (round($distance, 2) == 0) {
|
|
| 107 | - $uom = get_option('geodir_search_dist_2');
|
|
| 108 | - $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 109 | - if ($uom == 'feet') {
|
|
| 110 | - $uom = __('feet', 'geodirectory');
|
|
| 111 | - } else {
|
|
| 112 | - $uom = __('meters', 'geodirectory');
|
|
| 113 | - } |
|
| 114 | - echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
| 106 | + if (round($distance, 2) == 0) {
|
|
| 107 | + $uom = get_option('geodir_search_dist_2');
|
|
| 108 | + $distance = geodir_calculateDistanceFromLatLong($startPoint, $endPoint, $uom); |
|
| 109 | + if ($uom == 'feet') {
|
|
| 110 | + $uom = __('feet', 'geodirectory');
|
|
| 111 | + } else {
|
|
| 112 | + $uom = __('meters', 'geodirectory');
|
|
| 113 | + } |
|
| 114 | + echo round($distance) . ' ' . __($uom, 'geodirectory') . ' |
|
| 115 | 115 | <br /> |
| 116 | 116 | '; |
| 117 | - } else {
|
|
| 118 | - if ($uom == 'miles') {
|
|
| 119 | - $uom = __('miles', 'geodirectory');
|
|
| 120 | - } else {
|
|
| 121 | - $uom = __('km', 'geodirectory');
|
|
| 122 | - } |
|
| 123 | - echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
| 117 | + } else {
|
|
| 118 | + if ($uom == 'miles') {
|
|
| 119 | + $uom = __('miles', 'geodirectory');
|
|
| 120 | + } else {
|
|
| 121 | + $uom = __('km', 'geodirectory');
|
|
| 122 | + } |
|
| 123 | + echo round($distance, 2) . ' ' . __($uom, 'geodirectory') . ' |
|
| 124 | 124 | <br /> |
| 125 | 125 | '; |
| 126 | - } |
|
| 127 | - ?> |
|
| 126 | + } |
|
| 127 | + ?> |
|
| 128 | 128 | </h3> |
| 129 | 129 | <?php } ?> |
| 130 | 130 | <?php |
| 131 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 132 | - do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 131 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 132 | + do_action('geodir_before_listing_post_excerpt', $post); ?>
|
|
| 133 | 133 | <?php echo geodir_show_listing_info('listing'); ?>
|
| 134 | 134 | <?php if (isset($character_count) && $character_count == '0') {
|
| 135 | - } else { ?>
|
|
| 135 | + } else { ?>
|
|
| 136 | 136 | <div class="geodir-entry-content"> |
| 137 | 137 | <?php |
| 138 | - /** |
|
| 139 | - * Filter to hide the listing excerpt |
|
| 140 | - * |
|
| 141 | - * @since 1.5.3 |
|
| 142 | - * @param bool $display Display the excerpt or not. Default true. |
|
| 143 | - * @param object $post The post object. |
|
| 144 | - */ |
|
| 145 | - $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
|
| 146 | - if ($show_listing_excerpt) {
|
|
| 147 | - if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 148 | - $content_out = geodir_max_excerpt( $character_count ); |
|
| 149 | - } else {
|
|
| 150 | - $content_out = get_the_excerpt(); |
|
| 151 | - } |
|
| 152 | - if ( ! empty( $content_out ) ) {
|
|
| 153 | - echo "<p>" . $content_out . "</p>"; |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - ?> |
|
| 138 | + /** |
|
| 139 | + * Filter to hide the listing excerpt |
|
| 140 | + * |
|
| 141 | + * @since 1.5.3 |
|
| 142 | + * @param bool $display Display the excerpt or not. Default true. |
|
| 143 | + * @param object $post The post object. |
|
| 144 | + */ |
|
| 145 | + $show_listing_excerpt = apply_filters('geodir_show_listing_post_excerpt', true, 'widget', $post);
|
|
| 146 | + if ($show_listing_excerpt) {
|
|
| 147 | + if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) {
|
|
| 148 | + $content_out = geodir_max_excerpt( $character_count ); |
|
| 149 | + } else {
|
|
| 150 | + $content_out = get_the_excerpt(); |
|
| 151 | + } |
|
| 152 | + if ( ! empty( $content_out ) ) {
|
|
| 153 | + echo "<p>" . $content_out . "</p>"; |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + ?> |
|
| 157 | 157 | </div> |
| 158 | 158 | <?php } ?> |
| 159 | 159 | <?php |
| 160 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 161 | - do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 160 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 161 | + do_action('geodir_after_listing_post_excerpt', $post); ?>
|
|
| 162 | 162 | </div> |
| 163 | 163 | <!-- gd-content ends here--> |
| 164 | 164 | <?php |
| 165 | - /** |
|
| 166 | - * Called after printing listing content. |
|
| 167 | - * |
|
| 168 | - * @since 1.5.3 |
|
| 169 | - * @param object $post The post object. |
|
| 170 | - * @param string $view The view type, default 'widget'. |
|
| 171 | - */ |
|
| 172 | - do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 165 | + /** |
|
| 166 | + * Called after printing listing content. |
|
| 167 | + * |
|
| 168 | + * @since 1.5.3 |
|
| 169 | + * @param object $post The post object. |
|
| 170 | + * @param string $view The view type, default 'widget'. |
|
| 171 | + */ |
|
| 172 | + do_action( 'geodir_after_listing_content', $post, 'widget' ); ?> |
|
| 173 | 173 | <footer class="geodir-entry-meta <?php echo apply_filters('geodir_listing_listview_meta_extra_class', '', 'widget'); ?>">
|
| 174 | 174 | <div class="geodir-addinfo clearfix <?php echo apply_filters('geodir_listing_listview_addinfo_extra_class', '', 'widget'); ?>">
|
| 175 | 175 | <?php |
| 176 | - /** |
|
| 177 | - * Called before printing review stars html. |
|
| 178 | - * |
|
| 179 | - * @since 1.5.3 |
|
| 180 | - * @param object $post The post object. |
|
| 181 | - * @param string $view The view type, default 'widget'. |
|
| 182 | - */ |
|
| 183 | - do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 184 | - $review_show = geodir_is_reviews_show('listview');
|
|
| 185 | - if ($review_show) {
|
|
| 176 | + /** |
|
| 177 | + * Called before printing review stars html. |
|
| 178 | + * |
|
| 179 | + * @since 1.5.3 |
|
| 180 | + * @param object $post The post object. |
|
| 181 | + * @param string $view The view type, default 'widget'. |
|
| 182 | + */ |
|
| 183 | + do_action( 'geodir_before_review_html', $post, 'widget' ); |
|
| 184 | + $review_show = geodir_is_reviews_show('listview');
|
|
| 185 | + if ($review_show) {
|
|
| 186 | 186 | |
| 187 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 187 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 188 | 188 | |
| 189 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 190 | - do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 189 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 190 | + do_action('geodir_before_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 191 | 191 | |
| 192 | - echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 192 | + echo geodir_get_rating_stars($post_avgratings, $post->ID); |
|
| 193 | 193 | |
| 194 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 195 | - do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 196 | - ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
| 194 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 195 | + do_action('geodir_after_review_rating_stars_on_listview', $post_avgratings, $post->ID);
|
|
| 196 | + ?><a href="<?php comments_link(); ?>" class="geodir-pcomments"><i |
|
| 197 | 197 | class="fa fa-comments"></i> <?php geodir_comments_number($post->rating_count); ?> |
| 198 | 198 | </a> |
| 199 | 199 | <?php |
| 200 | - } |
|
| 201 | - geodir_favourite_html($post->post_author, $post->ID); |
|
| 200 | + } |
|
| 201 | + geodir_favourite_html($post->post_author, $post->ID); |
|
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Called after printing favorite html. |
|
| 205 | - * |
|
| 206 | - * @since 1.0.0 |
|
| 207 | - */ |
|
| 208 | - do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 203 | + /** |
|
| 204 | + * Called after printing favorite html. |
|
| 205 | + * |
|
| 206 | + * @since 1.0.0 |
|
| 207 | + */ |
|
| 208 | + do_action( 'geodir_after_favorite_html', $post->ID, 'widget' ); |
|
| 209 | 209 | |
| 210 | - if ($post->post_author == get_current_user_id()) {
|
|
| 211 | - $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 212 | - $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 213 | - $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 210 | + if ($post->post_author == get_current_user_id()) {
|
|
| 211 | + $addplacelink = get_permalink(geodir_add_listing_page_id()); |
|
| 212 | + $editlink = geodir_getlink($addplacelink, array('pid' => $post->ID), false);
|
|
| 213 | + $upgradelink = geodir_getlink($editlink, array('upgrade' => '1'), false);
|
|
| 214 | 214 | |
| 215 | - $ajaxlink = geodir_get_ajax_url(); |
|
| 216 | - $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 217 | - ?> |
|
| 215 | + $ajaxlink = geodir_get_ajax_url(); |
|
| 216 | + $deletelink = geodir_getlink($ajaxlink, array('geodir_ajax' => 'add_listing', 'ajax_action' => 'delete', 'pid' => $post->ID), false);
|
|
| 217 | + ?> |
|
| 218 | 218 | <span class="geodir-authorlink clearfix"> |
| 219 | 219 | <?php |
| 220 | - if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
|
|
| 221 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 222 | - do_action('geodir_before_edit_post_link_on_listing');
|
|
| 223 | - ?> |
|
| 220 | + if (isset($_REQUEST['geodir_dashbord']) && $_REQUEST['geodir_dashbord']) {
|
|
| 221 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 222 | + do_action('geodir_before_edit_post_link_on_listing');
|
|
| 223 | + ?> |
|
| 224 | 224 | <a href="<?php echo esc_url($editlink); ?>" class="geodir-edit" |
| 225 | 225 | title="<?php _e('Edit Listing', 'geodirectory'); ?>">
|
| 226 | 226 | <?php |
| 227 | - $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 228 | - echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 229 | - ?> |
|
| 227 | + $geodir_listing_edit_icon = apply_filters('geodir_listing_edit_icon', 'fa fa-edit');
|
|
| 228 | + echo '<i class="'. $geodir_listing_edit_icon .'"></i>'; |
|
| 229 | + ?> |
|
| 230 | 230 | <?php _e('Edit', 'geodirectory'); ?>
|
| 231 | 231 | </a> |
| 232 | 232 | <a href="<?php echo esc_url($deletelink); ?>" class="geodir-delete" |
| 233 | 233 | title="<?php _e('Delete Listing', 'geodirectory'); ?>">
|
| 234 | 234 | <?php |
| 235 | - $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 236 | - echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 237 | - ?> |
|
| 235 | + $geodir_listing_delete_icon = apply_filters('geodir_listing_delete_icon', 'fa fa-close');
|
|
| 236 | + echo '<i class="'. $geodir_listing_delete_icon .'"></i>'; |
|
| 237 | + ?> |
|
| 238 | 238 | <?php _e('Delete', 'geodirectory'); ?>
|
| 239 | 239 | </a> |
| 240 | 240 | <?php |
| 241 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 242 | - do_action('geodir_after_edit_post_link_on_listing');
|
|
| 243 | - } ?> |
|
| 241 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 242 | + do_action('geodir_after_edit_post_link_on_listing');
|
|
| 243 | + } ?> |
|
| 244 | 244 | </span> |
| 245 | 245 | <?php } ?> |
| 246 | 246 | </div> |
@@ -250,17 +250,17 @@ discard block |
||
| 250 | 250 | </article> |
| 251 | 251 | </li> |
| 252 | 252 | <?php |
| 253 | - unset($gd_widget_listing_type); |
|
| 254 | - } |
|
| 255 | - /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 256 | - do_action('geodir_after_listing_post_listview');
|
|
| 257 | - } else {
|
|
| 253 | + unset($gd_widget_listing_type); |
|
| 254 | + } |
|
| 255 | + /** This action is documented in geodirectory-templates/listing-listview.php */ |
|
| 256 | + do_action('geodir_after_listing_post_listview');
|
|
| 257 | + } else {
|
|
| 258 | 258 | $favorite = isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' ? true : false; |
| 259 | 259 | |
| 260 | 260 | /** This action is documented in geodirectory-templates/listing-listview.php */ |
| 261 | - do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
|
|
| 262 | - } |
|
| 263 | - ?> |
|
| 261 | + do_action('geodir_message_not_found_on_listing', 'widget-listing-listview', $favorite);
|
|
| 262 | + } |
|
| 263 | + ?> |
|
| 264 | 264 | </ul> <!-- geodir_category_list_view ends here--> |
| 265 | 265 | <div class="clear"></div> |
| 266 | 266 | <?php |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @param string $instance['title'] The widget title. |
| 77 | 77 | */ |
| 78 | - $title = empty($instance['title']) ? wp_sprintf( __( 'Best of %s', 'geodirectory' ), get_bloginfo('name') . $cur_location ) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 78 | + $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Filter the post type. |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
| 213 | 213 | |
| 214 | 214 | if ($is_dropdown) { |
| 215 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr( __( 'Select Category', 'geodirectory' ) ).'">'; |
|
| 215 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
| 216 | 216 | } else { |
| 217 | 217 | $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
| 218 | 218 | $nav_html .= '<dt></dt>'; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
| 319 | 319 | |
| 320 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf( __( 'Best of %s', 'geodirectory' ), $first_term->name ) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
| 320 | + echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $first_term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
| 321 | 321 | } |
| 322 | 322 | if ($excerpt_type == 'show-reviews') { |
| 323 | 323 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | public function form($instance) |
| 376 | 376 | { |
| 377 | - $instance = wp_parse_args((array)$instance, |
|
| 377 | + $instance = wp_parse_args((array) $instance, |
|
| 378 | 378 | array( |
| 379 | 379 | 'title' => '', |
| 380 | 380 | 'post_type' => '', |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | ?> |
| 401 | 401 | <p> |
| 402 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
| 402 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
| 403 | 403 | |
| 404 | 404 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
| 405 | 405 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | <p> |
| 411 | 411 | <label |
| 412 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
| 412 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
| 413 | 413 | |
| 414 | 414 | <?php $postypes = geodir_get_posttypes(); |
| 415 | 415 | /** |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | <p> |
| 442 | 442 | |
| 443 | 443 | <label |
| 444 | - for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
| 444 | + for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
| 445 | 445 | |
| 446 | 446 | <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>" |
| 447 | 447 | name="<?php echo $this->get_field_name('post_limit'); ?>" type="text" |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | <p> |
| 453 | 453 | |
| 454 | 454 | <label |
| 455 | - for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?> |
|
| 455 | + for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?> |
|
| 456 | 456 | |
| 457 | 457 | <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>" |
| 458 | 458 | name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text" |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | <p> |
| 464 | 464 | <label |
| 465 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
| 465 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
| 466 | 466 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
| 467 | 467 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
| 468 | 468 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | </p> |
| 471 | 471 | <p> |
| 472 | 472 | <label |
| 473 | - for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?> |
|
| 473 | + for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?> |
|
| 474 | 474 | |
| 475 | 475 | <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>" |
| 476 | 476 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | <p> |
| 493 | 493 | <label |
| 494 | - for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?> |
|
| 494 | + for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?> |
|
| 495 | 495 | |
| 496 | 496 | <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>" |
| 497 | 497 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | <p> |
| 510 | 510 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 511 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
| 511 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
| 512 | 512 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 513 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 513 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
| 514 | 514 | value="1"/> |
| 515 | 515 | </label> |
| 516 | 516 | </p> |
@@ -654,11 +654,11 @@ discard block |
||
| 654 | 654 | $query_args['tax_query'] = array($tax_query); |
| 655 | 655 | if ($term_id && $taxonomy) { |
| 656 | 656 | $term = get_term_by('id', $term_id, $taxonomy); |
| 657 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)) ; |
|
| 657 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)); |
|
| 658 | 658 | /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
| 659 | 659 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
| 660 | 660 | |
| 661 | - echo '<h3 class="bestof-cat-title">' . wp_sprintf( __( 'Best of %s', 'geodirectory' ), $term->name ) . '<a href="' . esc_url( $view_all_link ) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
| 661 | + echo '<h3 class="bestof-cat-title">' . wp_sprintf(__('Best of %s', 'geodirectory'), $term->name) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
|
| 662 | 662 | } |
| 663 | 663 | if ($excerpt_type == 'show-reviews') { |
| 664 | 664 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -765,11 +765,11 @@ discard block |
||
| 765 | 765 | $comments = $wpdb->get_results($request); |
| 766 | 766 | |
| 767 | 767 | if ($comments) { |
| 768 | - foreach($comments as $comment) { |
|
| 768 | + foreach ($comments as $comment) { |
|
| 769 | 769 | // Set the extra comment info needed. |
| 770 | 770 | $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
| 771 | 771 | $comment_content = $comment_extra->comment_content; |
| 772 | - $excerpt = strip_tags( $comment_content ); |
|
| 772 | + $excerpt = strip_tags($comment_content); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | return $excerpt; |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * GeoDirectory Best of widget |
|
| 4 | - * |
|
| 5 | - * @since 1.3.9 |
|
| 6 | - * |
|
| 7 | - * @package GeoDirectory |
|
| 8 | - */ |
|
| 3 | + * GeoDirectory Best of widget |
|
| 4 | + * |
|
| 5 | + * @since 1.3.9 |
|
| 6 | + * |
|
| 7 | + * @package GeoDirectory |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * GeoDirectory Best of widget widget class. |
@@ -14,34 +14,34 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_bestof_widget extends WP_Widget |
| 16 | 16 | { |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Register the best of widget with WordPress. |
| 19 | 19 | * |
| 20 | 20 | * @since 1.3.9 |
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | 22 | */ |
| 23 | - public function __construct() { |
|
| 24 | - $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
| 25 | - parent::__construct( |
|
| 26 | - 'bestof_widget', // Base ID |
|
| 27 | - __('GD > Best of widget', 'geodirectory'), // Name |
|
| 28 | - $widget_ops// Args |
|
| 29 | - ); |
|
| 30 | - } |
|
| 23 | + public function __construct() { |
|
| 24 | + $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
| 25 | + parent::__construct( |
|
| 26 | + 'bestof_widget', // Base ID |
|
| 27 | + __('GD > Best of widget', 'geodirectory'), // Name |
|
| 28 | + $widget_ops// Args |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Front-end display content for best of widget. |
| 34 | 34 | * |
| 35 | 35 | * @since 1.3.9 |
| 36 | - * @since 1.5.1 Added filter to view all link. |
|
| 37 | - * @since 1.5.1 Declare function public. |
|
| 36 | + * @since 1.5.1 Added filter to view all link. |
|
| 37 | + * @since 1.5.1 Declare function public. |
|
| 38 | 38 | * |
| 39 | 39 | * @param array $args Widget arguments. |
| 40 | 40 | * @param array $instance Saved values from database. |
| 41 | 41 | */ |
| 42 | 42 | public function widget($args, $instance) |
| 43 | - { |
|
| 44 | - extract($args); |
|
| 43 | + { |
|
| 44 | + extract($args); |
|
| 45 | 45 | /** |
| 46 | 46 | * Filter the best of widget tab layout. |
| 47 | 47 | * |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * @param string $instance['tab_layout'] Best of widget tab layout name. |
| 51 | 51 | */ |
| 52 | 52 | $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
| 53 | - echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
| 54 | - echo $before_widget; |
|
| 55 | - $loc_terms = geodir_get_current_location_terms(); |
|
| 56 | - if ($loc_terms) { |
|
| 57 | - $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 58 | - } else { |
|
| 59 | - $cur_location = ''; |
|
| 60 | - } |
|
| 53 | + echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
| 54 | + echo $before_widget; |
|
| 55 | + $loc_terms = geodir_get_current_location_terms(); |
|
| 56 | + if ($loc_terms) { |
|
| 57 | + $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 58 | + } else { |
|
| 59 | + $cur_location = ''; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Filter the current location name. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | $cur_location = apply_filters('bestof_widget_cur_location', $cur_location); |
| 70 | 70 | |
| 71 | - /** |
|
| 71 | + /** |
|
| 72 | 72 | * Filter the widget title. |
| 73 | 73 | * |
| 74 | 74 | * @since 1.3.9 |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']); |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Filter the excerpt type. |
|
| 91 | - * |
|
| 92 | - * @since 1.5.4 |
|
| 93 | - * |
|
| 94 | - * @param string $instance['excerpt_type'] The excerpt type. |
|
| 95 | - */ |
|
| 96 | - $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
| 89 | + /** |
|
| 90 | + * Filter the excerpt type. |
|
| 91 | + * |
|
| 92 | + * @since 1.5.4 |
|
| 93 | + * |
|
| 94 | + * @param string $instance['excerpt_type'] The excerpt type. |
|
| 95 | + */ |
|
| 96 | + $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
| 97 | 97 | |
| 98 | 98 | |
| 99 | - /** |
|
| 99 | + /** |
|
| 100 | 100 | * Filter the listing limit. |
| 101 | 101 | * |
| 102 | 102 | * @since 1.3.9 |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param int $instance['categ_limit'] No. of categories to display. |
| 114 | 114 | */ |
| 115 | 115 | $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']); |
| 116 | - $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
| 116 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Filter the use of location filter. |
@@ -124,166 +124,166 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']); |
| 126 | 126 | |
| 127 | - // set post type to current viewing post type |
|
| 128 | - if ($use_viewing_post_type) { |
|
| 129 | - $current_post_type = geodir_get_current_posttype(); |
|
| 130 | - if ($current_post_type != '' && $current_post_type != $post_type) { |
|
| 131 | - $post_type = $current_post_type; |
|
| 132 | - } |
|
| 133 | - } |
|
| 127 | + // set post type to current viewing post type |
|
| 128 | + if ($use_viewing_post_type) { |
|
| 129 | + $current_post_type = geodir_get_current_posttype(); |
|
| 130 | + if ($current_post_type != '' && $current_post_type != $post_type) { |
|
| 131 | + $post_type = $current_post_type; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - if (isset($instance['character_count'])) { |
|
| 135 | + if (isset($instance['character_count'])) { |
|
| 136 | 136 | /** |
| 137 | 137 | * Filter the widget's excerpt character count. |
| 138 | 138 | * |
| 139 | 139 | * @since 1.3.9 |
| 140 | - * |
|
| 140 | + * |
|
| 141 | 141 | * @param int $instance['character_count'] Excerpt character count. |
| 142 | 142 | */ |
| 143 | 143 | $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']); |
| 144 | - } else { |
|
| 145 | - $character_count = ''; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 149 | - |
|
| 150 | - $term_args = array( |
|
| 151 | - 'hide_empty' => true, |
|
| 152 | - 'parent' => 0 |
|
| 153 | - ); |
|
| 154 | - |
|
| 155 | - if (is_tax()) { |
|
| 156 | - $taxonomy = get_query_var('taxonomy'); |
|
| 157 | - $cur_term = get_query_var('term'); |
|
| 158 | - $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
| 159 | - $term_args['parent'] = $term_data->term_id; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $terms = get_terms($category_taxonomy[0], $term_args); |
|
| 163 | - |
|
| 164 | - $term_reviews = geodir_count_reviews_by_terms(); |
|
| 165 | - $a_terms = array(); |
|
| 166 | - foreach ($terms as $term) { |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - if ($term->count > 0) { |
|
| 170 | - if (isset($term_reviews[$term->term_id])) { |
|
| 171 | - $term->review_count = $term_reviews[$term->term_id]; |
|
| 172 | - } else { |
|
| 173 | - $term->review_count = '0'; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - $a_terms[] = $term; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - |
|
| 182 | - $terms = geodir_sort_terms($a_terms, 'review_count'); |
|
| 183 | - |
|
| 184 | - $query_args = array( |
|
| 185 | - 'posts_per_page' => $post_limit, |
|
| 186 | - 'is_geodir_loop' => true, |
|
| 187 | - 'post_type' => $post_type, |
|
| 188 | - 'gd_location' => $add_location_filter ? true : false, |
|
| 189 | - 'order_by' => 'high_review' |
|
| 190 | - ); |
|
| 191 | - if ($character_count >= 0) { |
|
| 192 | - $query_args['excerpt_length'] = $character_count; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - $layout = array(); |
|
| 196 | - if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
| 197 | - $layout[] = $tab_layout; |
|
| 198 | - } else { |
|
| 199 | - $layout[] = 'bestof-tabs-as-dropdown'; |
|
| 200 | - $layout[] = $tab_layout; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - |
|
| 204 | - echo $before_title . __($title) . $after_title; |
|
| 205 | - |
|
| 206 | - //term navigation - start |
|
| 207 | - echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
| 208 | - |
|
| 209 | - $final_html = ''; |
|
| 210 | - foreach ($layout as $tab_layout) { |
|
| 211 | - $nav_html = ''; |
|
| 212 | - $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
| 213 | - |
|
| 214 | - if ($is_dropdown) { |
|
| 215 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr( __( 'Select Category', 'geodirectory' ) ).'">'; |
|
| 216 | - } else { |
|
| 217 | - $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
| 218 | - $nav_html .= '<dt></dt>'; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - |
|
| 222 | - $term_icon = geodir_get_term_icon(); |
|
| 223 | - $cat_count = 0; |
|
| 224 | - foreach ($terms as $cat) { |
|
| 225 | - $cat_count++; |
|
| 226 | - if ($cat_count > $categ_limit) { |
|
| 227 | - break; |
|
| 228 | - } |
|
| 229 | - if ($is_dropdown) { |
|
| 230 | - $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
| 231 | - $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
| 232 | - } else { |
|
| 233 | - if ($cat_count == 1) { |
|
| 234 | - $nav_html .= '<dd class="geodir-tab-active">'; |
|
| 235 | - } else { |
|
| 236 | - $nav_html .= '<dd class="">'; |
|
| 237 | - } |
|
| 238 | - $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
| 239 | - $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
| 240 | - $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
| 241 | - $nav_html .= '<span>'; |
|
| 242 | - $nav_html .= geodir_ucwords($cat->name); |
|
| 243 | - $nav_html .= '<small>'; |
|
| 244 | - if (isset($cat->review_count)) { |
|
| 245 | - $num_reviews = $cat->review_count; |
|
| 246 | - if ($num_reviews == 0) { |
|
| 247 | - $reviews = __('No Reviews', 'geodirectory'); |
|
| 248 | - } elseif ($num_reviews > 1) { |
|
| 249 | - $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
| 250 | - } else { |
|
| 251 | - $reviews = __('1 Review', 'geodirectory'); |
|
| 252 | - } |
|
| 253 | - $nav_html .= $reviews; |
|
| 254 | - } |
|
| 255 | - $nav_html .= '</small>'; |
|
| 256 | - $nav_html .= '</span>'; |
|
| 257 | - $nav_html .= '</a>'; |
|
| 258 | - $nav_html .= '</dd>'; |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - if ($is_dropdown) { |
|
| 262 | - $nav_html .= '</select>'; |
|
| 263 | - } else { |
|
| 264 | - $nav_html .= '</dl>'; |
|
| 265 | - } |
|
| 266 | - $final_html .= $nav_html; |
|
| 267 | - } |
|
| 268 | - if ($terms) { |
|
| 269 | - echo $final_html; |
|
| 270 | - } |
|
| 271 | - echo '</div>'; |
|
| 272 | - //term navigation - end |
|
| 273 | - |
|
| 274 | - //first term listings by default - start |
|
| 275 | - $first_term = ''; |
|
| 276 | - if ($terms) { |
|
| 277 | - $first_term = $terms[0]; |
|
| 278 | - $tax_query = array( |
|
| 279 | - 'taxonomy' => $category_taxonomy[0], |
|
| 280 | - 'field' => 'id', |
|
| 281 | - 'terms' => $first_term->term_id |
|
| 282 | - ); |
|
| 283 | - $query_args['tax_query'] = array($tax_query); |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - ?> |
|
| 144 | + } else { |
|
| 145 | + $character_count = ''; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 149 | + |
|
| 150 | + $term_args = array( |
|
| 151 | + 'hide_empty' => true, |
|
| 152 | + 'parent' => 0 |
|
| 153 | + ); |
|
| 154 | + |
|
| 155 | + if (is_tax()) { |
|
| 156 | + $taxonomy = get_query_var('taxonomy'); |
|
| 157 | + $cur_term = get_query_var('term'); |
|
| 158 | + $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
| 159 | + $term_args['parent'] = $term_data->term_id; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $terms = get_terms($category_taxonomy[0], $term_args); |
|
| 163 | + |
|
| 164 | + $term_reviews = geodir_count_reviews_by_terms(); |
|
| 165 | + $a_terms = array(); |
|
| 166 | + foreach ($terms as $term) { |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + if ($term->count > 0) { |
|
| 170 | + if (isset($term_reviews[$term->term_id])) { |
|
| 171 | + $term->review_count = $term_reviews[$term->term_id]; |
|
| 172 | + } else { |
|
| 173 | + $term->review_count = '0'; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + $a_terms[] = $term; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + |
|
| 182 | + $terms = geodir_sort_terms($a_terms, 'review_count'); |
|
| 183 | + |
|
| 184 | + $query_args = array( |
|
| 185 | + 'posts_per_page' => $post_limit, |
|
| 186 | + 'is_geodir_loop' => true, |
|
| 187 | + 'post_type' => $post_type, |
|
| 188 | + 'gd_location' => $add_location_filter ? true : false, |
|
| 189 | + 'order_by' => 'high_review' |
|
| 190 | + ); |
|
| 191 | + if ($character_count >= 0) { |
|
| 192 | + $query_args['excerpt_length'] = $character_count; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + $layout = array(); |
|
| 196 | + if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
| 197 | + $layout[] = $tab_layout; |
|
| 198 | + } else { |
|
| 199 | + $layout[] = 'bestof-tabs-as-dropdown'; |
|
| 200 | + $layout[] = $tab_layout; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + |
|
| 204 | + echo $before_title . __($title) . $after_title; |
|
| 205 | + |
|
| 206 | + //term navigation - start |
|
| 207 | + echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
| 208 | + |
|
| 209 | + $final_html = ''; |
|
| 210 | + foreach ($layout as $tab_layout) { |
|
| 211 | + $nav_html = ''; |
|
| 212 | + $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
| 213 | + |
|
| 214 | + if ($is_dropdown) { |
|
| 215 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr( __( 'Select Category', 'geodirectory' ) ).'">'; |
|
| 216 | + } else { |
|
| 217 | + $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
| 218 | + $nav_html .= '<dt></dt>'; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + |
|
| 222 | + $term_icon = geodir_get_term_icon(); |
|
| 223 | + $cat_count = 0; |
|
| 224 | + foreach ($terms as $cat) { |
|
| 225 | + $cat_count++; |
|
| 226 | + if ($cat_count > $categ_limit) { |
|
| 227 | + break; |
|
| 228 | + } |
|
| 229 | + if ($is_dropdown) { |
|
| 230 | + $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
| 231 | + $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
| 232 | + } else { |
|
| 233 | + if ($cat_count == 1) { |
|
| 234 | + $nav_html .= '<dd class="geodir-tab-active">'; |
|
| 235 | + } else { |
|
| 236 | + $nav_html .= '<dd class="">'; |
|
| 237 | + } |
|
| 238 | + $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
| 239 | + $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
| 240 | + $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
| 241 | + $nav_html .= '<span>'; |
|
| 242 | + $nav_html .= geodir_ucwords($cat->name); |
|
| 243 | + $nav_html .= '<small>'; |
|
| 244 | + if (isset($cat->review_count)) { |
|
| 245 | + $num_reviews = $cat->review_count; |
|
| 246 | + if ($num_reviews == 0) { |
|
| 247 | + $reviews = __('No Reviews', 'geodirectory'); |
|
| 248 | + } elseif ($num_reviews > 1) { |
|
| 249 | + $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
| 250 | + } else { |
|
| 251 | + $reviews = __('1 Review', 'geodirectory'); |
|
| 252 | + } |
|
| 253 | + $nav_html .= $reviews; |
|
| 254 | + } |
|
| 255 | + $nav_html .= '</small>'; |
|
| 256 | + $nav_html .= '</span>'; |
|
| 257 | + $nav_html .= '</a>'; |
|
| 258 | + $nav_html .= '</dd>'; |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + if ($is_dropdown) { |
|
| 262 | + $nav_html .= '</select>'; |
|
| 263 | + } else { |
|
| 264 | + $nav_html .= '</dl>'; |
|
| 265 | + } |
|
| 266 | + $final_html .= $nav_html; |
|
| 267 | + } |
|
| 268 | + if ($terms) { |
|
| 269 | + echo $final_html; |
|
| 270 | + } |
|
| 271 | + echo '</div>'; |
|
| 272 | + //term navigation - end |
|
| 273 | + |
|
| 274 | + //first term listings by default - start |
|
| 275 | + $first_term = ''; |
|
| 276 | + if ($terms) { |
|
| 277 | + $first_term = $terms[0]; |
|
| 278 | + $tax_query = array( |
|
| 279 | + 'taxonomy' => $category_taxonomy[0], |
|
| 280 | + 'field' => 'id', |
|
| 281 | + 'terms' => $first_term->term_id |
|
| 282 | + ); |
|
| 283 | + $query_args['tax_query'] = array($tax_query); |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + ?> |
|
| 287 | 287 | <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type" |
| 288 | 288 | value="<?php echo $post_type; ?>"> |
| 289 | 289 | <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type" |
@@ -294,18 +294,18 @@ discard block |
||
| 294 | 294 | value="<?php echo $category_taxonomy[0]; ?>"> |
| 295 | 295 | <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter" |
| 296 | 296 | value="<?php if ($add_location_filter) { |
| 297 | - echo 1; |
|
| 298 | - } else { |
|
| 299 | - echo 0; |
|
| 300 | - } ?>"> |
|
| 297 | + echo 1; |
|
| 298 | + } else { |
|
| 299 | + echo 0; |
|
| 300 | + } ?>"> |
|
| 301 | 301 | <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count" |
| 302 | 302 | value="<?php echo $character_count; ?>"> |
| 303 | 303 | <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;"> |
| 304 | 304 | <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fa fa-cog fa-spin"></i></p> |
| 305 | 305 | <?php |
| 306 | - echo '<div id="geodir-bestof-places">'; |
|
| 307 | - if ($terms) { |
|
| 308 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
| 306 | + echo '<div id="geodir-bestof-places">'; |
|
| 307 | + if ($terms) { |
|
| 308 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
| 309 | 309 | /** |
| 310 | 310 | * Filter the page link to view all lisitngs. |
| 311 | 311 | * |
@@ -318,28 +318,28 @@ discard block |
||
| 318 | 318 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
| 319 | 319 | |
| 320 | 320 | echo '<h3 class="bestof-cat-title">' . wp_sprintf( __( 'Best of %s', 'geodirectory' ), $first_term->name ) . '<a href="' . esc_url($view_all_link) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
| 321 | - } |
|
| 322 | - if ($excerpt_type == 'show-reviews') { |
|
| 323 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 324 | - } |
|
| 325 | - geodir_bestof_places_by_term($query_args); |
|
| 326 | - if ($excerpt_type == 'show-reviews') { |
|
| 327 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 328 | - } |
|
| 329 | - echo "</div>"; |
|
| 330 | - ?> |
|
| 321 | + } |
|
| 322 | + if ($excerpt_type == 'show-reviews') { |
|
| 323 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 324 | + } |
|
| 325 | + geodir_bestof_places_by_term($query_args); |
|
| 326 | + if ($excerpt_type == 'show-reviews') { |
|
| 327 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 328 | + } |
|
| 329 | + echo "</div>"; |
|
| 330 | + ?> |
|
| 331 | 331 | </div> |
| 332 | 332 | <?php //first term listings by default - end |
| 333 | - ?> |
|
| 333 | + ?> |
|
| 334 | 334 | <?php echo $after_widget; |
| 335 | - echo "</div>"; |
|
| 336 | - } |
|
| 335 | + echo "</div>"; |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | 338 | /** |
| 339 | 339 | * Sanitize best of widget form values as they are saved. |
| 340 | 340 | * |
| 341 | 341 | * @since 1.3.9 |
| 342 | - * @since 1.5.1 Declare function public. |
|
| 342 | + * @since 1.5.1 Declare function public. |
|
| 343 | 343 | * |
| 344 | 344 | * @param array $new_instance Values just sent to be saved. |
| 345 | 345 | * @param array $old_instance Previously saved values from database. |
@@ -347,57 +347,57 @@ discard block |
||
| 347 | 347 | * @return array Updated safe values to be saved. |
| 348 | 348 | */ |
| 349 | 349 | public function update($new_instance, $old_instance) |
| 350 | - { |
|
| 351 | - $instance = $old_instance; |
|
| 352 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 353 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 354 | - $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
| 355 | - $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
| 356 | - $instance['character_count'] = $new_instance['character_count']; |
|
| 357 | - $instance['tab_layout'] = $new_instance['tab_layout']; |
|
| 358 | - $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
| 359 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 360 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 361 | - else |
|
| 362 | - $instance['add_location_filter'] = '0'; |
|
| 363 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 364 | - return $instance; |
|
| 365 | - } |
|
| 350 | + { |
|
| 351 | + $instance = $old_instance; |
|
| 352 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 353 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 354 | + $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
| 355 | + $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
| 356 | + $instance['character_count'] = $new_instance['character_count']; |
|
| 357 | + $instance['tab_layout'] = $new_instance['tab_layout']; |
|
| 358 | + $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
| 359 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 360 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 361 | + else |
|
| 362 | + $instance['add_location_filter'] = '0'; |
|
| 363 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 364 | + return $instance; |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | 368 | * Back-end best of widget settings form. |
| 369 | 369 | * |
| 370 | 370 | * @since 1.3.9 |
| 371 | - * @since 1.5.1 Declare function public. |
|
| 371 | + * @since 1.5.1 Declare function public. |
|
| 372 | 372 | * |
| 373 | 373 | * @param array $instance Previously saved values from database. |
| 374 | 374 | */ |
| 375 | 375 | public function form($instance) |
| 376 | - { |
|
| 377 | - $instance = wp_parse_args((array)$instance, |
|
| 378 | - array( |
|
| 379 | - 'title' => '', |
|
| 380 | - 'post_type' => '', |
|
| 381 | - 'post_limit' => '5', |
|
| 382 | - 'categ_limit' => '3', |
|
| 383 | - 'character_count' => '20', |
|
| 384 | - 'add_location_filter' => '1', |
|
| 385 | - 'tab_layout' => 'bestof-tabs-on-top', |
|
| 386 | - 'excerpt_type' => 'show-desc', |
|
| 387 | - 'use_viewing_post_type' => '' |
|
| 388 | - ) |
|
| 389 | - ); |
|
| 390 | - $title = strip_tags($instance['title']); |
|
| 391 | - $post_type = strip_tags($instance['post_type']); |
|
| 392 | - $post_limit = strip_tags($instance['post_limit']); |
|
| 393 | - $categ_limit = strip_tags($instance['categ_limit']); |
|
| 394 | - $character_count = strip_tags($instance['character_count']); |
|
| 395 | - $tab_layout = strip_tags($instance['tab_layout']); |
|
| 396 | - $excerpt_type = strip_tags($instance['excerpt_type']); |
|
| 397 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 398 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 399 | - |
|
| 400 | - ?> |
|
| 376 | + { |
|
| 377 | + $instance = wp_parse_args((array)$instance, |
|
| 378 | + array( |
|
| 379 | + 'title' => '', |
|
| 380 | + 'post_type' => '', |
|
| 381 | + 'post_limit' => '5', |
|
| 382 | + 'categ_limit' => '3', |
|
| 383 | + 'character_count' => '20', |
|
| 384 | + 'add_location_filter' => '1', |
|
| 385 | + 'tab_layout' => 'bestof-tabs-on-top', |
|
| 386 | + 'excerpt_type' => 'show-desc', |
|
| 387 | + 'use_viewing_post_type' => '' |
|
| 388 | + ) |
|
| 389 | + ); |
|
| 390 | + $title = strip_tags($instance['title']); |
|
| 391 | + $post_type = strip_tags($instance['post_type']); |
|
| 392 | + $post_limit = strip_tags($instance['post_limit']); |
|
| 393 | + $categ_limit = strip_tags($instance['categ_limit']); |
|
| 394 | + $character_count = strip_tags($instance['character_count']); |
|
| 395 | + $tab_layout = strip_tags($instance['tab_layout']); |
|
| 396 | + $excerpt_type = strip_tags($instance['excerpt_type']); |
|
| 397 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 398 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 399 | + |
|
| 400 | + ?> |
|
| 401 | 401 | <p> |
| 402 | 402 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
| 403 | 403 | |
@@ -428,9 +428,9 @@ discard block |
||
| 428 | 428 | <?php foreach ($postypes as $postypes_obj) { ?> |
| 429 | 429 | |
| 430 | 430 | <option <?php if ($post_type == $postypes_obj) { |
| 431 | - echo 'selected="selected"'; |
|
| 432 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
| 433 | - echo ucfirst($extvalue[1]); ?></option> |
|
| 431 | + echo 'selected="selected"'; |
|
| 432 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
| 433 | + echo ucfirst($extvalue[1]); ?></option> |
|
| 434 | 434 | |
| 435 | 435 | <?php } ?> |
| 436 | 436 | |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
| 477 | 477 | |
| 478 | 478 | <option <?php if ($tab_layout == 'bestof-tabs-on-top') { |
| 479 | - echo 'selected="selected"'; |
|
| 480 | - } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
| 479 | + echo 'selected="selected"'; |
|
| 480 | + } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
| 481 | 481 | <option <?php if ($tab_layout == 'bestof-tabs-on-left') { |
| 482 | - echo 'selected="selected"'; |
|
| 483 | - } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
| 482 | + echo 'selected="selected"'; |
|
| 483 | + } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
| 484 | 484 | <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') { |
| 485 | - echo 'selected="selected"'; |
|
| 486 | - } ?> |
|
| 485 | + echo 'selected="selected"'; |
|
| 486 | + } ?> |
|
| 487 | 487 | value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option> |
| 488 | 488 | </select> |
| 489 | 489 | </label> |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
| 498 | 498 | |
| 499 | 499 | <option <?php if ($excerpt_type == 'show-desc') { |
| 500 | - echo 'selected="selected"'; |
|
| 501 | - } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
| 500 | + echo 'selected="selected"'; |
|
| 501 | + } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
| 502 | 502 | <option <?php if ($excerpt_type == 'show-reviews') { |
| 503 | - echo 'selected="selected"'; |
|
| 504 | - } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
| 503 | + echo 'selected="selected"'; |
|
| 504 | + } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
| 505 | 505 | </select> |
| 506 | 506 | </label> |
| 507 | 507 | </p> |
@@ -520,12 +520,12 @@ discard block |
||
| 520 | 520 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
| 521 | 521 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
| 522 | 522 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
| 523 | - echo 'checked="checked"'; |
|
| 524 | - } ?> value="1"/> |
|
| 523 | + echo 'checked="checked"'; |
|
| 524 | + } ?> value="1"/> |
|
| 525 | 525 | </label> |
| 526 | 526 | </p> |
| 527 | 527 | <?php |
| 528 | - } |
|
| 528 | + } |
|
| 529 | 529 | } // class geodir_bestof_widget |
| 530 | 530 | |
| 531 | 531 | register_widget('geodir_bestof_widget'); |
@@ -544,46 +544,46 @@ discard block |
||
| 544 | 544 | * @param array $query_args The query array. |
| 545 | 545 | */ |
| 546 | 546 | function geodir_bestof_places_by_term($query_args) { |
| 547 | - global $gd_session; |
|
| 547 | + global $gd_session; |
|
| 548 | 548 | |
| 549 | 549 | /** |
| 550 | - * This action called before querying widget listings. |
|
| 551 | - * |
|
| 552 | - * @since 1.0.0 |
|
| 553 | - */ |
|
| 554 | - do_action('geodir_bestof_get_widget_listings_before'); |
|
| 550 | + * This action called before querying widget listings. |
|
| 551 | + * |
|
| 552 | + * @since 1.0.0 |
|
| 553 | + */ |
|
| 554 | + do_action('geodir_bestof_get_widget_listings_before'); |
|
| 555 | 555 | |
| 556 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
| 556 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
| 557 | 557 | |
| 558 | - /** |
|
| 559 | - * This action called after querying widget listings. |
|
| 560 | - * |
|
| 561 | - * @since 1.0.0 |
|
| 562 | - */ |
|
| 563 | - do_action('geodir_bestof_get_widget_listings_after'); |
|
| 558 | + /** |
|
| 559 | + * This action called after querying widget listings. |
|
| 560 | + * |
|
| 561 | + * @since 1.0.0 |
|
| 562 | + */ |
|
| 563 | + do_action('geodir_bestof_get_widget_listings_after'); |
|
| 564 | 564 | |
| 565 | - $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
| 565 | + $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
| 566 | 566 | |
| 567 | - if (!isset($character_count)) { |
|
| 567 | + if (!isset($character_count)) { |
|
| 568 | 568 | /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
| 569 | 569 | $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count); |
| 570 | - } |
|
| 570 | + } |
|
| 571 | 571 | |
| 572 | 572 | /** This filter is documented in geodirectory-functions/general_functions.php */ |
| 573 | 573 | $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
| 574 | 574 | |
| 575 | - global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 576 | - $current_post = $post; |
|
| 577 | - $current_map_jason = $map_jason; |
|
| 578 | - $current_map_canvas_arr = $map_canvas_arr; |
|
| 579 | - $current_grid_view = $gridview_columns_widget; |
|
| 580 | - $gridview_columns_widget = null; |
|
| 575 | + global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 576 | + $current_post = $post; |
|
| 577 | + $current_map_jason = $map_jason; |
|
| 578 | + $current_map_canvas_arr = $map_canvas_arr; |
|
| 579 | + $current_grid_view = $gridview_columns_widget; |
|
| 580 | + $gridview_columns_widget = null; |
|
| 581 | 581 | |
| 582 | 582 | $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false; |
| 583 | 583 | $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : ''; |
| 584 | 584 | |
| 585 | - $gd_session->set('gd_listing_view', '1'); |
|
| 586 | - $geodir_is_widget_listing = true; |
|
| 585 | + $gd_session->set('gd_listing_view', '1'); |
|
| 586 | + $geodir_is_widget_listing = true; |
|
| 587 | 587 | |
| 588 | 588 | /** |
| 589 | 589 | * Includes the template for the listing listview. |
@@ -592,20 +592,20 @@ discard block |
||
| 592 | 592 | */ |
| 593 | 593 | include($template); |
| 594 | 594 | |
| 595 | - $geodir_is_widget_listing = false; |
|
| 595 | + $geodir_is_widget_listing = false; |
|
| 596 | 596 | |
| 597 | - $GLOBALS['post'] = $current_post; |
|
| 597 | + $GLOBALS['post'] = $current_post; |
|
| 598 | 598 | if (!empty($current_post)) { |
| 599 | - setup_postdata($current_post); |
|
| 599 | + setup_postdata($current_post); |
|
| 600 | 600 | } |
| 601 | 601 | if ($gd_listing_view_set) { // Set back previous value |
| 602 | 602 | $gd_session->set('gd_listing_view', $gd_listing_view_old); |
| 603 | 603 | } else { |
| 604 | 604 | $gd_session->un_set('gd_listing_view'); |
| 605 | 605 | } |
| 606 | - $map_jason = $current_map_jason; |
|
| 607 | - $map_canvas_arr = $current_map_canvas_arr; |
|
| 608 | - $gridview_columns_widget = $current_grid_view; |
|
| 606 | + $map_jason = $current_map_jason; |
|
| 607 | + $map_canvas_arr = $current_map_canvas_arr; |
|
| 608 | + $gridview_columns_widget = $current_grid_view; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | //Ajax functions |
@@ -622,52 +622,52 @@ discard block |
||
| 622 | 622 | */ |
| 623 | 623 | function geodir_bestof_callback() |
| 624 | 624 | { |
| 625 | - check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
| 626 | - //set variables |
|
| 627 | - $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
| 628 | - $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
| 629 | - $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
| 630 | - $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
| 631 | - $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
| 632 | - $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
| 633 | - $excerpt_type = ''; |
|
| 634 | - $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
| 635 | - |
|
| 636 | - $query_args = array( |
|
| 637 | - 'posts_per_page' => $post_limit, |
|
| 638 | - 'is_geodir_loop' => true, |
|
| 639 | - 'post_type' => $post_type, |
|
| 640 | - 'gd_location' => $add_location_filter ? true : false, |
|
| 641 | - 'order_by' => 'high_review' |
|
| 642 | - ); |
|
| 643 | - |
|
| 644 | - if ($character_count >= 0) { |
|
| 645 | - $query_args['excerpt_length'] = $character_count; |
|
| 646 | - } |
|
| 647 | - |
|
| 648 | - $tax_query = array( |
|
| 649 | - 'taxonomy' => $taxonomy, |
|
| 650 | - 'field' => 'id', |
|
| 651 | - 'terms' => $term_id |
|
| 652 | - ); |
|
| 653 | - |
|
| 654 | - $query_args['tax_query'] = array($tax_query); |
|
| 655 | - if ($term_id && $taxonomy) { |
|
| 656 | - $term = get_term_by('id', $term_id, $taxonomy); |
|
| 657 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)) ; |
|
| 625 | + check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
| 626 | + //set variables |
|
| 627 | + $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
| 628 | + $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
| 629 | + $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
| 630 | + $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
| 631 | + $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
| 632 | + $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
| 633 | + $excerpt_type = ''; |
|
| 634 | + $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
| 635 | + |
|
| 636 | + $query_args = array( |
|
| 637 | + 'posts_per_page' => $post_limit, |
|
| 638 | + 'is_geodir_loop' => true, |
|
| 639 | + 'post_type' => $post_type, |
|
| 640 | + 'gd_location' => $add_location_filter ? true : false, |
|
| 641 | + 'order_by' => 'high_review' |
|
| 642 | + ); |
|
| 643 | + |
|
| 644 | + if ($character_count >= 0) { |
|
| 645 | + $query_args['excerpt_length'] = $character_count; |
|
| 646 | + } |
|
| 647 | + |
|
| 648 | + $tax_query = array( |
|
| 649 | + 'taxonomy' => $taxonomy, |
|
| 650 | + 'field' => 'id', |
|
| 651 | + 'terms' => $term_id |
|
| 652 | + ); |
|
| 653 | + |
|
| 654 | + $query_args['tax_query'] = array($tax_query); |
|
| 655 | + if ($term_id && $taxonomy) { |
|
| 656 | + $term = get_term_by('id', $term_id, $taxonomy); |
|
| 657 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)) ; |
|
| 658 | 658 | /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
| 659 | 659 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
| 660 | 660 | |
| 661 | 661 | echo '<h3 class="bestof-cat-title">' . wp_sprintf( __( 'Best of %s', 'geodirectory' ), $term->name ) . '<a href="' . esc_url( $view_all_link ) . '">' . __("View all", 'geodirectory') . '</a></h3>'; |
| 662 | - } |
|
| 663 | - if ($excerpt_type == 'show-reviews') { |
|
| 664 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 665 | - } |
|
| 666 | - geodir_bestof_places_by_term($query_args); |
|
| 667 | - if ($excerpt_type == 'show-reviews') { |
|
| 668 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 669 | - } |
|
| 670 | - wp_die(); |
|
| 662 | + } |
|
| 663 | + if ($excerpt_type == 'show-reviews') { |
|
| 664 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 665 | + } |
|
| 666 | + geodir_bestof_places_by_term($query_args); |
|
| 667 | + if ($excerpt_type == 'show-reviews') { |
|
| 668 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 669 | + } |
|
| 670 | + wp_die(); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | //Javascript |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | function best_of_show_review_in_excerpt($excerpt) { |
| 755 | - global $wpdb, $post; |
|
| 755 | + global $wpdb, $post; |
|
| 756 | 756 | // $args = array( |
| 757 | 757 | // 'status' => 'approve', |
| 758 | 758 | // 'number' => 10, |
@@ -760,17 +760,17 @@ discard block |
||
| 760 | 760 | // 'post_id' => $post->ID |
| 761 | 761 | // ); |
| 762 | 762 | |
| 763 | - $review_table = GEODIR_REVIEW_TABLE; |
|
| 764 | - $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
| 765 | - $comments = $wpdb->get_results($request); |
|
| 766 | - |
|
| 767 | - if ($comments) { |
|
| 768 | - foreach($comments as $comment) { |
|
| 769 | - // Set the extra comment info needed. |
|
| 770 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
| 771 | - $comment_content = $comment_extra->comment_content; |
|
| 772 | - $excerpt = strip_tags( $comment_content ); |
|
| 773 | - } |
|
| 774 | - } |
|
| 775 | - return $excerpt; |
|
| 763 | + $review_table = GEODIR_REVIEW_TABLE; |
|
| 764 | + $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
| 765 | + $comments = $wpdb->get_results($request); |
|
| 766 | + |
|
| 767 | + if ($comments) { |
|
| 768 | + foreach($comments as $comment) { |
|
| 769 | + // Set the extra comment info needed. |
|
| 770 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
| 771 | + $comment_content = $comment_extra->comment_content; |
|
| 772 | + $excerpt = strip_tags( $comment_content ); |
|
| 773 | + } |
|
| 774 | + } |
|
| 775 | + return $excerpt; |
|
| 776 | 776 | } |
| 777 | 777 | \ No newline at end of file |
@@ -118,10 +118,11 @@ discard block |
||
| 118 | 118 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
| 119 | 119 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
| 120 | 120 | $instance['character_count'] = $new_instance['character_count']; |
| 121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | - else |
|
| 124 | - $instance['add_location_filter'] = '0'; |
|
| 121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
| 122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | + } else { |
|
| 124 | + $instance['add_location_filter'] = '0'; |
|
| 125 | + } |
|
| 125 | 126 | |
| 126 | 127 | return $instance; |
| 127 | 128 | } |
@@ -279,7 +280,10 @@ discard block |
||
| 279 | 280 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 280 | 281 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
| 281 | 282 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 283 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
| 284 | + echo 'checked="checked"'; |
|
| 285 | +} |
|
| 286 | +?> |
|
| 283 | 287 | value="1"/> |
| 284 | 288 | </label> |
| 285 | 289 | </p> |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $output = geodir_cpt_categories_output($params); |
| 147 | 147 | |
| 148 | 148 | echo $args['before_widget']; |
| 149 | - if ( $params['title'] ) { |
|
| 149 | + if ($params['title']) { |
|
| 150 | 150 | echo '<div class="geodir_list_heading clearfix">'; |
| 151 | 151 | echo $args['before_title'] . $params['title'] . $args['after_title']; |
| 152 | 152 | echo '</div>'; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param array $instance Previously saved values from database. |
| 192 | 192 | */ |
| 193 | 193 | public function form($instance) { |
| 194 | - $instance = wp_parse_args( (array)$instance, |
|
| 194 | + $instance = wp_parse_args((array) $instance, |
|
| 195 | 195 | array( |
| 196 | 196 | 'title' => '', |
| 197 | 197 | 'post_type' => array(), // NULL for all |
@@ -221,42 +221,42 @@ discard block |
||
| 221 | 221 | <p> |
| 222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
| 223 | 223 | <select name="<?php echo $this->get_field_name('post_type'); ?>[]" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat" multiple="multiple"> |
| 224 | - <option value="0" <?php selected( (empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 224 | + <option value="0" <?php selected((empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 225 | 225 | <?php foreach ($post_type_options as $name => $title) { ?> |
| 226 | - <option value="<?php echo $name;?>" <?php selected( is_array($post_type) && in_array($name, $post_type), true ); ?>><?php echo $title; ?></option> |
|
| 226 | + <option value="<?php echo $name; ?>" <?php selected(is_array($post_type) && in_array($name, $post_type), true); ?>><?php echo $title; ?></option> |
|
| 227 | 227 | <?php } ?> |
| 228 | 228 | </select> |
| 229 | 229 | </p> |
| 230 | - <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked( $hide_empty ); ?> value="1" /> |
|
| 231 | - <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e( 'Hide empty categories', 'geodirectory' ); ?></label><br /> |
|
| 232 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked( $show_count ); ?> value="1" /> |
|
| 233 | - <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e( 'Show category count' ); ?></label> <small><?php _e( '( Enabling will slow down page loading for big directories. )', 'geodirectory' ); ?></small><br /> |
|
| 234 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked( $hide_icon ); ?> value="1" /> |
|
| 235 | - <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e( 'Hide category icon', 'geodirectory' ); ?></label><br /> |
|
| 236 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked( $cpt_left ); ?> value="1" /> |
|
| 237 | - <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e( 'Show CPT on same line', 'geodirectory' ); ?></label> |
|
| 230 | + <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked($hide_empty); ?> value="1" /> |
|
| 231 | + <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e('Hide empty categories', 'geodirectory'); ?></label><br /> |
|
| 232 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked($show_count); ?> value="1" /> |
|
| 233 | + <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('Show category count'); ?></label> <small><?php _e('( Enabling will slow down page loading for big directories. )', 'geodirectory'); ?></small><br /> |
|
| 234 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked($hide_icon); ?> value="1" /> |
|
| 235 | + <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e('Hide category icon', 'geodirectory'); ?></label><br /> |
|
| 236 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked($cpt_left); ?> value="1" /> |
|
| 237 | + <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e('Show CPT on same line', 'geodirectory'); ?></label> |
|
| 238 | 238 | <p> |
| 239 | 239 | <label for="<?php echo $this->get_field_id('sort_by'); ?>"><?php _e('Sort by:', 'geodirectory'); ?></label> |
| 240 | 240 | <select name="<?php echo $this->get_field_name('sort_by'); ?>" id="<?php echo $this->get_field_id('sort_by'); ?>" class="widefat"> |
| 241 | - <option value="az" <?php selected( $sort_by, 'az' ); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
| 242 | - <option value="count" <?php selected( $sort_by, 'count' ); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
| 241 | + <option value="az" <?php selected($sort_by, 'az'); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
| 242 | + <option value="count" <?php selected($sort_by, 'count'); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
| 243 | 243 | </select> |
| 244 | 244 | </p> |
| 245 | 245 | <p> |
| 246 | 246 | <label for="<?php echo $this->get_field_id('max_count'); ?>"><?php _e('Max no of sub-categories:', 'geodirectory'); ?></label> |
| 247 | 247 | <select name="<?php echo $this->get_field_name('max_count'); ?>" id="<?php echo $this->get_field_id('max_count'); ?>" class="widefat"> |
| 248 | - <option value="all" <?php selected( $max_count, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 248 | + <option value="all" <?php selected($max_count, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 249 | 249 | <?php for ($n = 10; $n >= 0; $n--) { ?> |
| 250 | - <option value="<?php echo $n;?>" <?php selected( $max_count, $n ); ?>><?php echo $n; ?></option> |
|
| 250 | + <option value="<?php echo $n; ?>" <?php selected($max_count, $n); ?>><?php echo $n; ?></option> |
|
| 251 | 251 | <?php } ?> |
| 252 | 252 | </select> |
| 253 | 253 | </p> |
| 254 | 254 | <p> |
| 255 | 255 | <label for="<?php echo $this->get_field_id('max_level'); ?>"><?php _e('Show max sub-categories depth:', 'geodirectory'); ?></label> |
| 256 | 256 | <select name="<?php echo $this->get_field_name('max_level'); ?>" id="<?php echo $this->get_field_id('max_level'); ?>" class="widefat"> |
| 257 | - <option value="all" <?php selected( $max_level, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 257 | + <option value="all" <?php selected($max_level, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
| 258 | 258 | <?php for ($n = 0; $n <= 10; $n++) { ?> |
| 259 | - <option value="<?php echo $n;?>" <?php selected( $max_level, $n ); ?>><?php echo $n; ?></option> |
|
| 259 | + <option value="<?php echo $n; ?>" <?php selected($max_level, $n); ?>><?php echo $n; ?></option> |
|
| 260 | 260 | <?php } ?> |
| 261 | 261 | </select> |
| 262 | 262 | </p> |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @return string CPT categories content. |
| 276 | 276 | */ |
| 277 | 277 | function geodir_cpt_categories_output($params) { |
| 278 | - $args = wp_parse_args((array)$params, |
|
| 278 | + $args = wp_parse_args((array) $params, |
|
| 279 | 279 | array( |
| 280 | 280 | 'title' => '', |
| 281 | 281 | 'post_type' => array(), // NULL for all |
@@ -345,15 +345,15 @@ discard block |
||
| 345 | 345 | $hide_empty = !empty($args['hide_empty']) ? true : false; |
| 346 | 346 | $max_count = strip_tags($args['max_count']); |
| 347 | 347 | $all_childs = $max_count == 'all' ? true : false; |
| 348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 348 | + $max_count = $max_count > 0 ? (int) $max_count : 0; |
|
| 349 | 349 | $max_level = strip_tags($args['max_level']); |
| 350 | 350 | $show_count = !empty($args['show_count']) ? true : false; |
| 351 | 351 | $hide_icon = !empty($args['hide_icon']) ? true : false; |
| 352 | 352 | $cpt_left = !empty($args['cpt_left']) ? true : false; |
| 353 | 353 | |
| 354 | - if(!$cpt_left){ |
|
| 354 | + if (!$cpt_left) { |
|
| 355 | 355 | $cpt_left = "gd-cpt-flat"; |
| 356 | - }else{ |
|
| 356 | + } else { |
|
| 357 | 357 | $cpt_left = ''; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | if ($is_listing) { |
| 384 | 384 | $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
| 385 | 385 | } |
| 386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' ' . $cpt_left . '">'; |
|
| 387 | 387 | |
| 388 | 388 | if ($is_category) { |
| 389 | 389 | $term_info = get_term($current_term_id, $cat_taxonomy); |
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
| 401 | 401 | $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
| 402 | 402 | |
| 403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 403 | + $term_link = get_term_link($category, $category->taxonomy); |
|
| 404 | 404 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 405 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
| 406 | 406 | |
| 407 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
| 407 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent ' . $cpt_left . '">'; |
|
| 408 | 408 | $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
| 409 | 409 | $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
| 410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) { |
|
| 412 | 412 | $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
| 413 | 413 | } |
| 414 | 414 | $cpt_row .= '</li>'; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $order = 'ASC'; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 452 | + if ($max_level != 'all' && $depth > (int) $max_level) { |
|
| 453 | 453 | return ''; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | foreach ($child_cats as $category) { |
| 472 | 472 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
| 473 | 473 | $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
| 474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 474 | + $term_link = get_term_link($category, $category->taxonomy); |
|
| 475 | 475 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 476 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
| 477 | 477 | $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
| 478 | 478 | |
| 479 | 479 | $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
@@ -353,7 +353,7 @@ |
||
| 353 | 353 | |
| 354 | 354 | if(!$cpt_left){ |
| 355 | 355 | $cpt_left = "gd-cpt-flat"; |
| 356 | - }else{ |
|
| 356 | + } else{ |
|
| 357 | 357 | $cpt_left = ''; |
| 358 | 358 | } |
| 359 | 359 | |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * GeoDirectory cpt categories widget. |
|
| 4 | - * |
|
| 5 | - * @package GeoDirectory |
|
| 6 | - * @since 1.5.4 |
|
| 7 | - */ |
|
| 3 | + * GeoDirectory cpt categories widget. |
|
| 4 | + * |
|
| 5 | + * @package GeoDirectory |
|
| 6 | + * @since 1.5.4 |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * GeoDirectory CPT categories widget class. |
@@ -13,210 +13,210 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | class geodir_cpt_categories_widget extends WP_Widget { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Register the cpt categories with WordPress. |
|
| 18 | - * |
|
| 19 | - * @since 1.5.4 |
|
| 20 | - */ |
|
| 21 | - public function __construct() { |
|
| 22 | - $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
| 23 | - parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Front-end display content for cpt categories widget. |
|
| 28 | - * |
|
| 29 | - * @since 1.5.4 |
|
| 30 | - * |
|
| 31 | - * @param array $args Widget arguments. |
|
| 32 | - * @param array $instance Saved values from database. |
|
| 33 | - */ |
|
| 34 | - public function widget($args, $instance) { |
|
| 35 | - $params = array(); |
|
| 36 | - /** |
|
| 37 | - * Filter the widget title. |
|
| 38 | - * |
|
| 39 | - * @since 1.5.4 |
|
| 40 | - * |
|
| 41 | - * @param string $title The widget title. Default empty. |
|
| 42 | - * @param array $instance An array of the widget's settings. |
|
| 43 | - * @param mixed $id_base The widget ID. |
|
| 44 | - */ |
|
| 45 | - $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Filter the widget setting post type. |
|
| 49 | - * |
|
| 50 | - * @since 1.5.4 |
|
| 51 | - * |
|
| 52 | - * @param array $post_type The post types to display categories. |
|
| 53 | - * @param array $instance An array of the widget's settings. |
|
| 54 | - * @param mixed $id_base The widget ID. |
|
| 55 | - */ |
|
| 56 | - $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Filter the widget setting to hide empty categories. |
|
| 60 | - * |
|
| 61 | - * @since 1.5.4 |
|
| 62 | - * |
|
| 63 | - * @param bool $hide_empty If true then empty category will be not displayed. |
|
| 64 | - * @param array $instance An array of the widget's settings. |
|
| 65 | - * @param mixed $id_base The widget ID. |
|
| 66 | - */ |
|
| 67 | - $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * Filter the widget setting to show/hide category count. |
|
| 71 | - * |
|
| 72 | - * @since 1.5.4 |
|
| 73 | - * |
|
| 74 | - * @param bool $show_count If true then category count will be displayed. |
|
| 75 | - * @param array $instance An array of the widget's settings. |
|
| 76 | - * @param mixed $id_base The widget ID. |
|
| 77 | - */ |
|
| 78 | - $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Filter the widget setting to show/hide category icon. |
|
| 82 | - * |
|
| 83 | - * @since 1.5.4 |
|
| 84 | - * |
|
| 85 | - * @param bool $hide_icon If true then category icon will be not displayed. |
|
| 86 | - * @param array $instance An array of the widget's settings. |
|
| 87 | - * @param mixed $id_base The widget ID. |
|
| 88 | - */ |
|
| 89 | - $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Filter the widget setting to show CPT inline or not. |
|
| 93 | - * |
|
| 94 | - * @since 1.5.4 |
|
| 95 | - * |
|
| 96 | - * @param bool $cpt_left If true then CPT will be displayed inline. |
|
| 97 | - * @param array $instance An array of the widget's settings. |
|
| 98 | - * @param mixed $id_base The widget ID. |
|
| 99 | - */ |
|
| 100 | - $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Filter the widget categories sorting order settings. |
|
| 104 | - * |
|
| 105 | - * @since 1.5.4 |
|
| 106 | - * |
|
| 107 | - * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
| 108 | - * @param array $instance An array of the widget's settings. |
|
| 109 | - * @param mixed $id_base The widget ID. |
|
| 110 | - */ |
|
| 111 | - $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Filter the widget max no of sub-categories count. |
|
| 115 | - * |
|
| 116 | - * @since 1.5.4 |
|
| 117 | - * |
|
| 118 | - * @param bool|string $max_count Widget max no of sub-categories count. |
|
| 119 | - * @param array $instance An array of the widget's settings. |
|
| 120 | - * @param mixed $id_base The widget ID. |
|
| 121 | - */ |
|
| 122 | - $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Filter the widget max sub-categories depth. |
|
| 126 | - * |
|
| 127 | - * @since 1.5.4 |
|
| 128 | - * |
|
| 129 | - * @param bool|string $max_level Widget max sub-categories depth. |
|
| 130 | - * @param array $instance An array of the widget's settings. |
|
| 131 | - * @param mixed $id_base The widget ID. |
|
| 132 | - */ |
|
| 133 | - $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * Filter the widget parameters. |
|
| 137 | - * |
|
| 138 | - * @since 1.5.4 |
|
| 139 | - * |
|
| 140 | - * @param array $params The widget parameters. |
|
| 141 | - * @param array $instance An array of the widget's settings. |
|
| 142 | - * @param mixed $id_base The widget ID. |
|
| 143 | - */ |
|
| 144 | - $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
| 145 | - |
|
| 146 | - $output = geodir_cpt_categories_output($params); |
|
| 147 | - |
|
| 148 | - echo $args['before_widget']; |
|
| 149 | - if ( $params['title'] ) { |
|
| 150 | - echo '<div class="geodir_list_heading clearfix">'; |
|
| 151 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
| 152 | - echo '</div>'; |
|
| 153 | - } |
|
| 154 | - echo '<div class="gd-cptcats-widget">'; |
|
| 155 | - echo $output; |
|
| 156 | - echo '</div>'; |
|
| 157 | - echo $args['after_widget']; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Sanitize cpt categories widget values as they are saved. |
|
| 162 | - * |
|
| 163 | - * @since 1.5.4 |
|
| 164 | - * |
|
| 165 | - * @param array $new_instance Values just sent to be saved. |
|
| 166 | - * @param array $old_instance Previously saved values from database. |
|
| 167 | - * |
|
| 168 | - * @return array Updated safe values to be saved. |
|
| 169 | - */ |
|
| 170 | - public function update($new_instance, $old_instance) { |
|
| 171 | - $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
| 172 | - $instance = $old_instance; |
|
| 173 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 174 | - $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
| 175 | - $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
| 176 | - $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
| 177 | - $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
| 178 | - $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
| 179 | - $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
| 180 | - $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
| 181 | - $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
| 182 | - |
|
| 183 | - return $instance; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Back-end cpt categories settings form. |
|
| 188 | - * |
|
| 189 | - * @since 1.5.4 |
|
| 190 | - * |
|
| 191 | - * @param array $instance Previously saved values from database. |
|
| 192 | - */ |
|
| 193 | - public function form($instance) { |
|
| 194 | - $instance = wp_parse_args( (array)$instance, |
|
| 195 | - array( |
|
| 196 | - 'title' => '', |
|
| 197 | - 'post_type' => array(), // NULL for all |
|
| 198 | - 'hide_empty' => '', |
|
| 199 | - 'show_count' => '', |
|
| 200 | - 'hide_icon' => '', |
|
| 201 | - 'cpt_left' => '', |
|
| 202 | - 'sort_by' => 'count', |
|
| 203 | - 'max_count' => 'all', |
|
| 204 | - 'max_level' => '1' |
|
| 205 | - ) |
|
| 206 | - ); |
|
| 207 | - |
|
| 208 | - $title = strip_tags($instance['title']); |
|
| 209 | - $post_type = $instance['post_type']; |
|
| 210 | - $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
| 211 | - $show_count = !empty($instance['show_count']) ? true : false; |
|
| 212 | - $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
| 213 | - $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
| 214 | - $max_count = strip_tags($instance['max_count']); |
|
| 215 | - $max_level = strip_tags($instance['max_level']); |
|
| 216 | - $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
| 217 | - |
|
| 218 | - $post_type_options = geodir_get_posttypes('options'); |
|
| 219 | - ?> |
|
| 16 | + /** |
|
| 17 | + * Register the cpt categories with WordPress. |
|
| 18 | + * |
|
| 19 | + * @since 1.5.4 |
|
| 20 | + */ |
|
| 21 | + public function __construct() { |
|
| 22 | + $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
| 23 | + parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Front-end display content for cpt categories widget. |
|
| 28 | + * |
|
| 29 | + * @since 1.5.4 |
|
| 30 | + * |
|
| 31 | + * @param array $args Widget arguments. |
|
| 32 | + * @param array $instance Saved values from database. |
|
| 33 | + */ |
|
| 34 | + public function widget($args, $instance) { |
|
| 35 | + $params = array(); |
|
| 36 | + /** |
|
| 37 | + * Filter the widget title. |
|
| 38 | + * |
|
| 39 | + * @since 1.5.4 |
|
| 40 | + * |
|
| 41 | + * @param string $title The widget title. Default empty. |
|
| 42 | + * @param array $instance An array of the widget's settings. |
|
| 43 | + * @param mixed $id_base The widget ID. |
|
| 44 | + */ |
|
| 45 | + $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Filter the widget setting post type. |
|
| 49 | + * |
|
| 50 | + * @since 1.5.4 |
|
| 51 | + * |
|
| 52 | + * @param array $post_type The post types to display categories. |
|
| 53 | + * @param array $instance An array of the widget's settings. |
|
| 54 | + * @param mixed $id_base The widget ID. |
|
| 55 | + */ |
|
| 56 | + $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Filter the widget setting to hide empty categories. |
|
| 60 | + * |
|
| 61 | + * @since 1.5.4 |
|
| 62 | + * |
|
| 63 | + * @param bool $hide_empty If true then empty category will be not displayed. |
|
| 64 | + * @param array $instance An array of the widget's settings. |
|
| 65 | + * @param mixed $id_base The widget ID. |
|
| 66 | + */ |
|
| 67 | + $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * Filter the widget setting to show/hide category count. |
|
| 71 | + * |
|
| 72 | + * @since 1.5.4 |
|
| 73 | + * |
|
| 74 | + * @param bool $show_count If true then category count will be displayed. |
|
| 75 | + * @param array $instance An array of the widget's settings. |
|
| 76 | + * @param mixed $id_base The widget ID. |
|
| 77 | + */ |
|
| 78 | + $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Filter the widget setting to show/hide category icon. |
|
| 82 | + * |
|
| 83 | + * @since 1.5.4 |
|
| 84 | + * |
|
| 85 | + * @param bool $hide_icon If true then category icon will be not displayed. |
|
| 86 | + * @param array $instance An array of the widget's settings. |
|
| 87 | + * @param mixed $id_base The widget ID. |
|
| 88 | + */ |
|
| 89 | + $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Filter the widget setting to show CPT inline or not. |
|
| 93 | + * |
|
| 94 | + * @since 1.5.4 |
|
| 95 | + * |
|
| 96 | + * @param bool $cpt_left If true then CPT will be displayed inline. |
|
| 97 | + * @param array $instance An array of the widget's settings. |
|
| 98 | + * @param mixed $id_base The widget ID. |
|
| 99 | + */ |
|
| 100 | + $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Filter the widget categories sorting order settings. |
|
| 104 | + * |
|
| 105 | + * @since 1.5.4 |
|
| 106 | + * |
|
| 107 | + * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
| 108 | + * @param array $instance An array of the widget's settings. |
|
| 109 | + * @param mixed $id_base The widget ID. |
|
| 110 | + */ |
|
| 111 | + $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Filter the widget max no of sub-categories count. |
|
| 115 | + * |
|
| 116 | + * @since 1.5.4 |
|
| 117 | + * |
|
| 118 | + * @param bool|string $max_count Widget max no of sub-categories count. |
|
| 119 | + * @param array $instance An array of the widget's settings. |
|
| 120 | + * @param mixed $id_base The widget ID. |
|
| 121 | + */ |
|
| 122 | + $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Filter the widget max sub-categories depth. |
|
| 126 | + * |
|
| 127 | + * @since 1.5.4 |
|
| 128 | + * |
|
| 129 | + * @param bool|string $max_level Widget max sub-categories depth. |
|
| 130 | + * @param array $instance An array of the widget's settings. |
|
| 131 | + * @param mixed $id_base The widget ID. |
|
| 132 | + */ |
|
| 133 | + $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * Filter the widget parameters. |
|
| 137 | + * |
|
| 138 | + * @since 1.5.4 |
|
| 139 | + * |
|
| 140 | + * @param array $params The widget parameters. |
|
| 141 | + * @param array $instance An array of the widget's settings. |
|
| 142 | + * @param mixed $id_base The widget ID. |
|
| 143 | + */ |
|
| 144 | + $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
| 145 | + |
|
| 146 | + $output = geodir_cpt_categories_output($params); |
|
| 147 | + |
|
| 148 | + echo $args['before_widget']; |
|
| 149 | + if ( $params['title'] ) { |
|
| 150 | + echo '<div class="geodir_list_heading clearfix">'; |
|
| 151 | + echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
| 152 | + echo '</div>'; |
|
| 153 | + } |
|
| 154 | + echo '<div class="gd-cptcats-widget">'; |
|
| 155 | + echo $output; |
|
| 156 | + echo '</div>'; |
|
| 157 | + echo $args['after_widget']; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Sanitize cpt categories widget values as they are saved. |
|
| 162 | + * |
|
| 163 | + * @since 1.5.4 |
|
| 164 | + * |
|
| 165 | + * @param array $new_instance Values just sent to be saved. |
|
| 166 | + * @param array $old_instance Previously saved values from database. |
|
| 167 | + * |
|
| 168 | + * @return array Updated safe values to be saved. |
|
| 169 | + */ |
|
| 170 | + public function update($new_instance, $old_instance) { |
|
| 171 | + $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
| 172 | + $instance = $old_instance; |
|
| 173 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 174 | + $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
| 175 | + $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
| 176 | + $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
| 177 | + $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
| 178 | + $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
| 179 | + $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
| 180 | + $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
| 181 | + $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
| 182 | + |
|
| 183 | + return $instance; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Back-end cpt categories settings form. |
|
| 188 | + * |
|
| 189 | + * @since 1.5.4 |
|
| 190 | + * |
|
| 191 | + * @param array $instance Previously saved values from database. |
|
| 192 | + */ |
|
| 193 | + public function form($instance) { |
|
| 194 | + $instance = wp_parse_args( (array)$instance, |
|
| 195 | + array( |
|
| 196 | + 'title' => '', |
|
| 197 | + 'post_type' => array(), // NULL for all |
|
| 198 | + 'hide_empty' => '', |
|
| 199 | + 'show_count' => '', |
|
| 200 | + 'hide_icon' => '', |
|
| 201 | + 'cpt_left' => '', |
|
| 202 | + 'sort_by' => 'count', |
|
| 203 | + 'max_count' => 'all', |
|
| 204 | + 'max_level' => '1' |
|
| 205 | + ) |
|
| 206 | + ); |
|
| 207 | + |
|
| 208 | + $title = strip_tags($instance['title']); |
|
| 209 | + $post_type = $instance['post_type']; |
|
| 210 | + $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
| 211 | + $show_count = !empty($instance['show_count']) ? true : false; |
|
| 212 | + $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
| 213 | + $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
| 214 | + $max_count = strip_tags($instance['max_count']); |
|
| 215 | + $max_level = strip_tags($instance['max_level']); |
|
| 216 | + $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
| 217 | + |
|
| 218 | + $post_type_options = geodir_get_posttypes('options'); |
|
| 219 | + ?> |
|
| 220 | 220 | <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p> |
| 221 | 221 | <p> |
| 222 | 222 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | </select> |
| 262 | 262 | </p> |
| 263 | 263 | <?php |
| 264 | - } |
|
| 264 | + } |
|
| 265 | 265 | } // class geodir_cpt_categories_widget |
| 266 | 266 | |
| 267 | 267 | register_widget('geodir_cpt_categories_widget'); |
@@ -275,152 +275,152 @@ discard block |
||
| 275 | 275 | * @return string CPT categories content. |
| 276 | 276 | */ |
| 277 | 277 | function geodir_cpt_categories_output($params) { |
| 278 | - $args = wp_parse_args((array)$params, |
|
| 279 | - array( |
|
| 280 | - 'title' => '', |
|
| 281 | - 'post_type' => array(), // NULL for all |
|
| 282 | - 'hide_empty' => '', |
|
| 283 | - 'show_count' => '', |
|
| 284 | - 'hide_icon' => '', |
|
| 285 | - 'cpt_left' => '', |
|
| 286 | - 'sort_by' => 'count', |
|
| 287 | - 'max_count' => 'all', |
|
| 288 | - 'max_level' => '1', |
|
| 289 | - ) |
|
| 290 | - ); |
|
| 291 | - |
|
| 292 | - $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
| 293 | - |
|
| 294 | - $gd_post_types = geodir_get_posttypes('array'); |
|
| 295 | - |
|
| 296 | - $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
| 297 | - $current_posttype = geodir_get_current_posttype(); |
|
| 298 | - |
|
| 299 | - $is_listing = false; |
|
| 300 | - $is_category = false; |
|
| 301 | - if (geodir_is_page('listing')) { |
|
| 302 | - $current_posttype = geodir_get_current_posttype(); |
|
| 303 | - |
|
| 304 | - if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
| 305 | - $is_listing = true; |
|
| 306 | - |
|
| 307 | - if (is_tax()) { // category page |
|
| 308 | - $current_term_id = get_queried_object_id(); |
|
| 309 | - $current_taxonomy = get_query_var('taxonomy'); |
|
| 310 | - $current_posttype = geodir_get_current_posttype(); |
|
| 311 | - |
|
| 312 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
| 313 | - $is_category = true; |
|
| 314 | - } |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - $parent_category = 0; |
|
| 320 | - if ($is_listing) { |
|
| 321 | - $post_type_arr = array($current_posttype); |
|
| 322 | - |
|
| 323 | - if ($is_category) { |
|
| 324 | - $parent_category = $current_term_id; |
|
| 325 | - } |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - $post_types = array(); |
|
| 329 | - if (!empty($post_type_arr)) { |
|
| 330 | - if (in_array('0', $post_type_arr)) { |
|
| 331 | - $post_types = $gd_post_types; |
|
| 332 | - } else { |
|
| 333 | - foreach ($post_type_arr as $cpt) { |
|
| 334 | - if (isset($gd_post_types[$cpt])) { |
|
| 335 | - $post_types[$cpt] = $gd_post_types[$cpt]; |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - } |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - if (empty($post_type_arr)) { |
|
| 342 | - $post_types = $gd_post_types; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
| 346 | - $max_count = strip_tags($args['max_count']); |
|
| 347 | - $all_childs = $max_count == 'all' ? true : false; |
|
| 348 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 349 | - $max_level = strip_tags($args['max_level']); |
|
| 350 | - $show_count = !empty($args['show_count']) ? true : false; |
|
| 351 | - $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
| 352 | - $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
| 353 | - |
|
| 354 | - if(!$cpt_left){ |
|
| 355 | - $cpt_left = "gd-cpt-flat"; |
|
| 356 | - }else{ |
|
| 357 | - $cpt_left = ''; |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - $orderby = 'count'; |
|
| 361 | - $order = 'DESC'; |
|
| 362 | - if ($sort_by == 'az') { |
|
| 363 | - $orderby = 'name'; |
|
| 364 | - $order = 'ASC'; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - $output = ''; |
|
| 368 | - if (!empty($post_types)) { |
|
| 369 | - foreach ($post_types as $cpt => $cpt_info) { |
|
| 370 | - $cat_taxonomy = $cpt . 'category'; |
|
| 371 | - $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
| 372 | - if ($hide_empty) { |
|
| 373 | - $categories = geodir_filter_empty_terms($categories); |
|
| 374 | - } |
|
| 375 | - if ($sort_by == 'count') { |
|
| 376 | - $categories = geodir_sort_terms($categories, 'count'); |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - if (!empty($categories)) { |
|
| 380 | - $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
| 381 | - $row_class = ''; |
|
| 382 | - |
|
| 383 | - if ($is_listing) { |
|
| 384 | - $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
| 385 | - } |
|
| 386 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 387 | - |
|
| 388 | - if ($is_category) { |
|
| 389 | - $term_info = get_term($current_term_id, $cat_taxonomy); |
|
| 390 | - |
|
| 391 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
| 392 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 393 | - |
|
| 394 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
| 395 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
| 396 | - } else { |
|
| 397 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
| 398 | - } |
|
| 399 | - foreach ($categories as $category) { |
|
| 400 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 401 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 402 | - |
|
| 403 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 404 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 405 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 406 | - |
|
| 407 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
| 408 | - $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
| 409 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 410 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 412 | - $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
| 413 | - } |
|
| 414 | - $cpt_row .= '</li>'; |
|
| 415 | - $cpt_row .= '</ul>'; |
|
| 416 | - } |
|
| 417 | - $cpt_row .= '</ul></div>'; |
|
| 418 | - |
|
| 419 | - $output .= $cpt_row; |
|
| 420 | - } |
|
| 421 | - } |
|
| 422 | - } |
|
| 423 | - return $output; |
|
| 278 | + $args = wp_parse_args((array)$params, |
|
| 279 | + array( |
|
| 280 | + 'title' => '', |
|
| 281 | + 'post_type' => array(), // NULL for all |
|
| 282 | + 'hide_empty' => '', |
|
| 283 | + 'show_count' => '', |
|
| 284 | + 'hide_icon' => '', |
|
| 285 | + 'cpt_left' => '', |
|
| 286 | + 'sort_by' => 'count', |
|
| 287 | + 'max_count' => 'all', |
|
| 288 | + 'max_level' => '1', |
|
| 289 | + ) |
|
| 290 | + ); |
|
| 291 | + |
|
| 292 | + $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
| 293 | + |
|
| 294 | + $gd_post_types = geodir_get_posttypes('array'); |
|
| 295 | + |
|
| 296 | + $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
| 297 | + $current_posttype = geodir_get_current_posttype(); |
|
| 298 | + |
|
| 299 | + $is_listing = false; |
|
| 300 | + $is_category = false; |
|
| 301 | + if (geodir_is_page('listing')) { |
|
| 302 | + $current_posttype = geodir_get_current_posttype(); |
|
| 303 | + |
|
| 304 | + if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
| 305 | + $is_listing = true; |
|
| 306 | + |
|
| 307 | + if (is_tax()) { // category page |
|
| 308 | + $current_term_id = get_queried_object_id(); |
|
| 309 | + $current_taxonomy = get_query_var('taxonomy'); |
|
| 310 | + $current_posttype = geodir_get_current_posttype(); |
|
| 311 | + |
|
| 312 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
| 313 | + $is_category = true; |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + $parent_category = 0; |
|
| 320 | + if ($is_listing) { |
|
| 321 | + $post_type_arr = array($current_posttype); |
|
| 322 | + |
|
| 323 | + if ($is_category) { |
|
| 324 | + $parent_category = $current_term_id; |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + $post_types = array(); |
|
| 329 | + if (!empty($post_type_arr)) { |
|
| 330 | + if (in_array('0', $post_type_arr)) { |
|
| 331 | + $post_types = $gd_post_types; |
|
| 332 | + } else { |
|
| 333 | + foreach ($post_type_arr as $cpt) { |
|
| 334 | + if (isset($gd_post_types[$cpt])) { |
|
| 335 | + $post_types[$cpt] = $gd_post_types[$cpt]; |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + if (empty($post_type_arr)) { |
|
| 342 | + $post_types = $gd_post_types; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
| 346 | + $max_count = strip_tags($args['max_count']); |
|
| 347 | + $all_childs = $max_count == 'all' ? true : false; |
|
| 348 | + $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
| 349 | + $max_level = strip_tags($args['max_level']); |
|
| 350 | + $show_count = !empty($args['show_count']) ? true : false; |
|
| 351 | + $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
| 352 | + $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
| 353 | + |
|
| 354 | + if(!$cpt_left){ |
|
| 355 | + $cpt_left = "gd-cpt-flat"; |
|
| 356 | + }else{ |
|
| 357 | + $cpt_left = ''; |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + $orderby = 'count'; |
|
| 361 | + $order = 'DESC'; |
|
| 362 | + if ($sort_by == 'az') { |
|
| 363 | + $orderby = 'name'; |
|
| 364 | + $order = 'ASC'; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + $output = ''; |
|
| 368 | + if (!empty($post_types)) { |
|
| 369 | + foreach ($post_types as $cpt => $cpt_info) { |
|
| 370 | + $cat_taxonomy = $cpt . 'category'; |
|
| 371 | + $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
| 372 | + if ($hide_empty) { |
|
| 373 | + $categories = geodir_filter_empty_terms($categories); |
|
| 374 | + } |
|
| 375 | + if ($sort_by == 'count') { |
|
| 376 | + $categories = geodir_sort_terms($categories, 'count'); |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + if (!empty($categories)) { |
|
| 380 | + $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
| 381 | + $row_class = ''; |
|
| 382 | + |
|
| 383 | + if ($is_listing) { |
|
| 384 | + $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
| 385 | + } |
|
| 386 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
| 387 | + |
|
| 388 | + if ($is_category) { |
|
| 389 | + $term_info = get_term($current_term_id, $cat_taxonomy); |
|
| 390 | + |
|
| 391 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
| 392 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 393 | + |
|
| 394 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
| 395 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
| 396 | + } else { |
|
| 397 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
| 398 | + } |
|
| 399 | + foreach ($categories as $category) { |
|
| 400 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 401 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 402 | + |
|
| 403 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 404 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 405 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 406 | + |
|
| 407 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
| 408 | + $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
| 409 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 410 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
| 411 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
| 412 | + $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
| 413 | + } |
|
| 414 | + $cpt_row .= '</li>'; |
|
| 415 | + $cpt_row .= '</ul>'; |
|
| 416 | + } |
|
| 417 | + $cpt_row .= '</ul></div>'; |
|
| 418 | + |
|
| 419 | + $output .= $cpt_row; |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + } |
|
| 423 | + return $output; |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | /** |
@@ -440,49 +440,49 @@ discard block |
||
| 440 | 440 | * @return string Html content. |
| 441 | 441 | */ |
| 442 | 442 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
| 443 | - $cat_taxonomy = $cpt . 'category'; |
|
| 444 | - |
|
| 445 | - $orderby = 'count'; |
|
| 446 | - $order = 'DESC'; |
|
| 447 | - if ($sort_by == 'az') { |
|
| 448 | - $orderby = 'name'; |
|
| 449 | - $order = 'ASC'; |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 453 | - return ''; |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
| 457 | - if ($hide_empty) { |
|
| 458 | - $child_cats = geodir_filter_empty_terms($child_cats); |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - if (empty($child_cats)) { |
|
| 462 | - return ''; |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - if ($sort_by == 'count') { |
|
| 466 | - $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
| 467 | - } |
|
| 468 | - |
|
| 469 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
| 470 | - $depth++; |
|
| 471 | - foreach ($child_cats as $category) { |
|
| 472 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 473 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 474 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 475 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 476 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 477 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 478 | - |
|
| 479 | - $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
| 480 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
| 481 | - $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
| 482 | - } |
|
| 483 | - $content .= '</li></ul>'; |
|
| 484 | - |
|
| 485 | - return $content; |
|
| 443 | + $cat_taxonomy = $cpt . 'category'; |
|
| 444 | + |
|
| 445 | + $orderby = 'count'; |
|
| 446 | + $order = 'DESC'; |
|
| 447 | + if ($sort_by == 'az') { |
|
| 448 | + $orderby = 'name'; |
|
| 449 | + $order = 'ASC'; |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
| 453 | + return ''; |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
| 457 | + if ($hide_empty) { |
|
| 458 | + $child_cats = geodir_filter_empty_terms($child_cats); |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + if (empty($child_cats)) { |
|
| 462 | + return ''; |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + if ($sort_by == 'count') { |
|
| 466 | + $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
| 470 | + $depth++; |
|
| 471 | + foreach ($child_cats as $category) { |
|
| 472 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
| 473 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
| 474 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
| 475 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 476 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
| 477 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
| 478 | + |
|
| 479 | + $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
| 480 | + $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
| 481 | + $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
| 482 | + } |
|
| 483 | + $content .= '</li></ul>'; |
|
| 484 | + |
|
| 485 | + return $content; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -494,16 +494,16 @@ discard block |
||
| 494 | 494 | * @return array Terms. |
| 495 | 495 | */ |
| 496 | 496 | function geodir_filter_empty_terms($terms) { |
| 497 | - if (empty($terms)) { |
|
| 498 | - return $terms; |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - $return = array(); |
|
| 502 | - foreach ($terms as $term) { |
|
| 503 | - if (isset($term->count) && $term->count > 0) { |
|
| 504 | - $return[] = $term; |
|
| 505 | - } |
|
| 506 | - } |
|
| 507 | - return $return; |
|
| 497 | + if (empty($terms)) { |
|
| 498 | + return $terms; |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + $return = array(); |
|
| 502 | + foreach ($terms as $term) { |
|
| 503 | + if (isset($term->count) && $term->count > 0) { |
|
| 504 | + $return[] = $term; |
|
| 505 | + } |
|
| 506 | + } |
|
| 507 | + return $return; |
|
| 508 | 508 | } |
| 509 | 509 | ?> |
| 510 | 510 | \ No newline at end of file |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | {
|
| 91 | 91 | |
| 92 | 92 | //widgetform in backend |
| 93 | - $instance = wp_parse_args((array)$instance, |
|
| 93 | + $instance = wp_parse_args((array) $instance, |
|
| 94 | 94 | array('title' => '',
|
| 95 | 95 | 'post_type' => '', |
| 96 | 96 | 'category' => '', |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | ?> |
| 147 | 147 | |
| 148 | 148 | <p> |
| 149 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
|
| 149 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
|
|
| 150 | 150 | |
| 151 | 151 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
| 152 | 152 | name="<?php echo $this->get_field_name('title'); ?>" type="text"
|
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | <p> |
| 158 | 158 | <label |
| 159 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
|
|
| 159 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 160 | 160 | |
| 161 | 161 | <?php $postypes = geodir_get_posttypes(); ?> |
| 162 | 162 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | <p> |
| 182 | 182 | <label |
| 183 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
|
| 183 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
|
|
| 184 | 184 | |
| 185 | 185 | <?php |
| 186 | 186 | $category_taxonomy = geodir_get_taxonomies('gd_place');
|
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | </p> |
| 218 | 218 | <p> |
| 219 | 219 | <label |
| 220 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory');?>
|
|
| 220 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts(total):', 'geodirectory'); ?>
|
|
| 221 | 221 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
|
| 222 | 222 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
|
| 223 | 223 | value="<?php echo esc_attr($post_number); ?>"/> |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | <p> |
| 228 | 228 | <label |
| 229 | - for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory');?>
|
|
| 229 | + for="<?php echo $this->get_field_id('max_show'); ?>"><?php _e('Number of posts(shown at one time, requires a slide width to be set):', 'geodirectory'); ?>
|
|
| 230 | 230 | <input class="widefat" id="<?php echo $this->get_field_id('max_show'); ?>"
|
| 231 | 231 | name="<?php echo $this->get_field_name('max_show'); ?>" type="text"
|
| 232 | 232 | value="<?php echo esc_attr($max_show); ?>"/> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | <p> |
| 237 | 237 | <label |
| 238 | - for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory');?>
|
|
| 238 | + for="<?php echo $this->get_field_id('slide_width'); ?>"><?php _e('Slide width(leave blank unless showing more than one slide at a time, ex: 210):', 'geodirectory'); ?>
|
|
| 239 | 239 | <input class="widefat" id="<?php echo $this->get_field_id('slide_width'); ?>"
|
| 240 | 240 | name="<?php echo $this->get_field_name('slide_width'); ?>" type="text"
|
| 241 | 241 | value="<?php echo esc_attr($slide_width); ?>"/> |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | <p> |
| 246 | 246 | <label |
| 247 | - for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory');?>
|
|
| 247 | + for="<?php echo $this->get_field_id('animation'); ?>"><?php _e('Animation:', 'geodirectory'); ?>
|
|
| 248 | 248 | |
| 249 | 249 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
|
| 250 | 250 | name="<?php echo $this->get_field_name('animation'); ?>">
|
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | <p> |
| 264 | 264 | <label |
| 265 | - for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory');?>
|
|
| 265 | + for="<?php echo $this->get_field_id('slideshowSpeed'); ?>"><?php _e('Slide Show Speed: (milliseconds)', 'geodirectory'); ?>
|
|
| 266 | 266 | |
| 267 | 267 | <input class="widefat" id="<?php echo $this->get_field_id('slideshowSpeed'); ?>"
|
| 268 | 268 | name="<?php echo $this->get_field_name('slideshowSpeed'); ?>" type="text"
|
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | <p> |
| 274 | 274 | <label |
| 275 | - for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory');?>
|
|
| 275 | + for="<?php echo $this->get_field_id('animationSpeed'); ?>"><?php _e('Animation Speed: (milliseconds)', 'geodirectory'); ?>
|
|
| 276 | 276 | |
| 277 | 277 | <input class="widefat" id="<?php echo $this->get_field_id('animationSpeed'); ?>"
|
| 278 | 278 | name="<?php echo $this->get_field_name('animationSpeed'); ?>" type="text"
|
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | <p> |
| 284 | 284 | <label |
| 285 | - for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
|
|
| 285 | + for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory'); ?>
|
|
| 286 | 286 | |
| 287 | 287 | <input type="checkbox" <?php if ($slideshow) {
|
| 288 | 288 | echo 'checked="checked"'; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | <p> |
| 296 | 296 | <label |
| 297 | - for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
|
|
| 297 | + for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory'); ?>
|
|
| 298 | 298 | |
| 299 | 299 | <input type="checkbox" <?php if ($animationLoop) {
|
| 300 | 300 | echo 'checked="checked"'; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | <p> |
| 308 | 308 | <label |
| 309 | - for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
|
|
| 309 | + for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory'); ?>
|
|
| 310 | 310 | |
| 311 | 311 | <input type="checkbox" <?php if ($directionNav) {
|
| 312 | 312 | echo 'checked="checked"'; |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | <p> |
| 321 | 321 | <label |
| 322 | - for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
|
|
| 322 | + for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory'); ?>
|
|
| 323 | 323 | |
| 324 | 324 | <input type="checkbox" <?php if ($show_title) {
|
| 325 | 325 | echo 'checked="checked"'; |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
|
|
| 356 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
|
|
| 357 | 357 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
|
| 358 | 358 | |
| 359 | - geodir_change_category_list(post_type, '<?php echo $category;?>'); |
|
| 359 | + geodir_change_category_list(post_type, '<?php echo $category; ?>'); |
|
| 360 | 360 | <?php } ?> |
| 361 | 361 | |
| 362 | 362 | </script> |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * GeoDirectory Listing Slider Widget |
|
| 4 | - * |
|
| 5 | - * @since 1.0.0 |
|
| 6 | - * |
|
| 7 | - * @package GeoDirectory |
|
| 8 | - */ |
|
| 3 | + * GeoDirectory Listing Slider Widget |
|
| 4 | + * |
|
| 5 | + * @since 1.0.0 |
|
| 6 | + * |
|
| 7 | + * @package GeoDirectory |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * GeoDirectory listing slider widget class. |
@@ -15,40 +15,40 @@ discard block |
||
| 15 | 15 | class geodir_listing_slider_widget extends WP_Widget |
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Register the listing slider widget. |
| 20 | 20 | * |
| 21 | 21 | * @since 1.0.0 |
| 22 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 23 | 23 | */ |
| 24 | - public function __construct() {
|
|
| 25 | - $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | - parent::__construct( |
|
| 27 | - 'listing_slider_view', // Base ID |
|
| 28 | - __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | - $widget_ops// Args |
|
| 30 | - ); |
|
| 31 | - } |
|
| 24 | + public function __construct() {
|
|
| 25 | + $widget_ops = array('classname' => 'geodir_listing_slider_view', 'description' => __('GD > Listing Slider', 'geodirectory'));
|
|
| 26 | + parent::__construct( |
|
| 27 | + 'listing_slider_view', // Base ID |
|
| 28 | + __('GD > Listing Slider', 'geodirectory'), // Name
|
|
| 29 | + $widget_ops// Args |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Front-end display content for listing slider widget. |
| 35 | 35 | * |
| 36 | 36 | * @since 1.0.0 |
| 37 | - * @since 1.5.1 Declare function public. |
|
| 37 | + * @since 1.5.1 Declare function public. |
|
| 38 | 38 | * |
| 39 | 39 | * @param array $args Widget arguments. |
| 40 | 40 | * @param array $instance Saved values from database. |
| 41 | 41 | */ |
| 42 | - public function widget($args, $instance) |
|
| 43 | - {
|
|
| 44 | - geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | - } |
|
| 42 | + public function widget($args, $instance) |
|
| 43 | + {
|
|
| 44 | + geodir_listing_slider_widget_output($args, $instance); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Sanitize listing slider widget form values as they are saved. |
| 49 | 49 | * |
| 50 | 50 | * @since 1.0.0 |
| 51 | - * @since 1.5.1 Declare function public. |
|
| 51 | + * @since 1.5.1 Declare function public. |
|
| 52 | 52 | * |
| 53 | 53 | * @param array $new_instance Values just sent to be saved. |
| 54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,94 +56,94 @@ discard block |
||
| 56 | 56 | * @return array Updated safe values to be saved. |
| 57 | 57 | */ |
| 58 | 58 | public function update($new_instance, $old_instance) |
| 59 | - {
|
|
| 60 | - //save the widget |
|
| 61 | - $instance = $old_instance; |
|
| 62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | - $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | - $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | - $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | - $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | - $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | - $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | - $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | - $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | - $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | - $instance['animation'] = $new_instance['animation']; |
|
| 75 | - $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | - |
|
| 78 | - return $instance; |
|
| 79 | - } |
|
| 59 | + {
|
|
| 60 | + //save the widget |
|
| 61 | + $instance = $old_instance; |
|
| 62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 64 | + $instance['category'] = strip_tags($new_instance['category']); |
|
| 65 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 66 | + $instance['max_show'] = strip_tags($new_instance['max_show']); |
|
| 67 | + $instance['slide_width'] = strip_tags($new_instance['slide_width']); |
|
| 68 | + $instance['show_title'] = isset($new_instance['show_title']) ? $new_instance['show_title'] : ''; |
|
| 69 | + $instance['slideshow'] = isset($new_instance['slideshow']) ? $new_instance['slideshow'] : ''; |
|
| 70 | + $instance['animationLoop'] = isset($new_instance['animationLoop']) ? $new_instance['animationLoop'] : ''; |
|
| 71 | + $instance['directionNav'] = isset($new_instance['directionNav']) ? $new_instance['directionNav'] : ''; |
|
| 72 | + $instance['slideshowSpeed'] = $new_instance['slideshowSpeed']; |
|
| 73 | + $instance['animationSpeed'] = $new_instance['animationSpeed']; |
|
| 74 | + $instance['animation'] = $new_instance['animation']; |
|
| 75 | + $instance['list_sort'] = isset($new_instance['list_sort']) ? $new_instance['list_sort'] : ''; |
|
| 76 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 77 | + |
|
| 78 | + return $instance; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Back-end listing slider widget settings form. |
| 83 | 83 | * |
| 84 | 84 | * @since 1.0.0 |
| 85 | - * @since 1.5.1 Declare function public. |
|
| 85 | + * @since 1.5.1 Declare function public. |
|
| 86 | 86 | * |
| 87 | 87 | * @param array $instance Previously saved values from database. |
| 88 | 88 | */ |
| 89 | 89 | public function form($instance) |
| 90 | - {
|
|
| 90 | + {
|
|
| 91 | 91 | |
| 92 | - //widgetform in backend |
|
| 93 | - $instance = wp_parse_args((array)$instance, |
|
| 94 | - array('title' => '',
|
|
| 95 | - 'post_type' => '', |
|
| 96 | - 'category' => '', |
|
| 97 | - 'post_number' => '5', |
|
| 98 | - 'max_show' => '1', |
|
| 99 | - 'slide_width' => '', |
|
| 100 | - 'show_title' => '', |
|
| 101 | - 'slideshow' => '', |
|
| 102 | - 'animationLoop' => '', |
|
| 103 | - 'directionNav' => '', |
|
| 104 | - 'slideshowSpeed' => 5000, |
|
| 105 | - 'animationSpeed' => 600, |
|
| 106 | - 'animation' => '', |
|
| 107 | - 'list_sort' => 'latest', |
|
| 108 | - 'show_featured_only' => '', |
|
| 109 | - ) |
|
| 110 | - ); |
|
| 92 | + //widgetform in backend |
|
| 93 | + $instance = wp_parse_args((array)$instance, |
|
| 94 | + array('title' => '',
|
|
| 95 | + 'post_type' => '', |
|
| 96 | + 'category' => '', |
|
| 97 | + 'post_number' => '5', |
|
| 98 | + 'max_show' => '1', |
|
| 99 | + 'slide_width' => '', |
|
| 100 | + 'show_title' => '', |
|
| 101 | + 'slideshow' => '', |
|
| 102 | + 'animationLoop' => '', |
|
| 103 | + 'directionNav' => '', |
|
| 104 | + 'slideshowSpeed' => 5000, |
|
| 105 | + 'animationSpeed' => 600, |
|
| 106 | + 'animation' => '', |
|
| 107 | + 'list_sort' => 'latest', |
|
| 108 | + 'show_featured_only' => '', |
|
| 109 | + ) |
|
| 110 | + ); |
|
| 111 | 111 | |
| 112 | - $title = strip_tags($instance['title']); |
|
| 112 | + $title = strip_tags($instance['title']); |
|
| 113 | 113 | |
| 114 | - $post_type = strip_tags($instance['post_type']); |
|
| 114 | + $post_type = strip_tags($instance['post_type']); |
|
| 115 | 115 | |
| 116 | - $category = strip_tags($instance['category']); |
|
| 116 | + $category = strip_tags($instance['category']); |
|
| 117 | 117 | |
| 118 | - $post_number = strip_tags($instance['post_number']); |
|
| 118 | + $post_number = strip_tags($instance['post_number']); |
|
| 119 | 119 | |
| 120 | - $max_show = strip_tags($instance['max_show']); |
|
| 120 | + $max_show = strip_tags($instance['max_show']); |
|
| 121 | 121 | |
| 122 | - $slide_width = strip_tags($instance['slide_width']); |
|
| 122 | + $slide_width = strip_tags($instance['slide_width']); |
|
| 123 | 123 | |
| 124 | - $show_title = $instance['show_title']; |
|
| 124 | + $show_title = $instance['show_title']; |
|
| 125 | 125 | |
| 126 | - $slideshow = $instance['slideshow']; |
|
| 126 | + $slideshow = $instance['slideshow']; |
|
| 127 | 127 | |
| 128 | - $animationLoop = $instance['animationLoop']; |
|
| 128 | + $animationLoop = $instance['animationLoop']; |
|
| 129 | 129 | |
| 130 | - $directionNav = $instance['directionNav']; |
|
| 130 | + $directionNav = $instance['directionNav']; |
|
| 131 | 131 | |
| 132 | - $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 132 | + $slideshowSpeed = $instance['slideshowSpeed']; |
|
| 133 | 133 | |
| 134 | - $animationSpeed = $instance['animationSpeed']; |
|
| 134 | + $animationSpeed = $instance['animationSpeed']; |
|
| 135 | 135 | |
| 136 | - $animation = $instance['animation']; |
|
| 137 | - $list_sort = $instance['list_sort']; |
|
| 138 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 136 | + $animation = $instance['animation']; |
|
| 137 | + $list_sort = $instance['list_sort']; |
|
| 138 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 139 | 139 | |
| 140 | - $sort_fields = array(); |
|
| 141 | - $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 142 | - $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 143 | - $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 144 | - $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 145 | - $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 146 | - ?> |
|
| 140 | + $sort_fields = array(); |
|
| 141 | + $sort_fields[] = array('field' => 'latest', 'label' => __('Latest', 'geodirectory'));
|
|
| 142 | + $sort_fields[] = array('field' => 'featured', 'label' => __('Featured', 'geodirectory'));
|
|
| 143 | + $sort_fields[] = array('field' => 'high_review', 'label' => __('Review', 'geodirectory'));
|
|
| 144 | + $sort_fields[] = array('field' => 'high_rating', 'label' => __('Rating', 'geodirectory'));
|
|
| 145 | + $sort_fields[] = array('field' => 'random', 'label' => __('Random', 'geodirectory'));
|
|
| 146 | + ?> |
|
| 147 | 147 | |
| 148 | 148 | <p> |
| 149 | 149 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | <?php foreach ($postypes as $postypes_obj) { ?>
|
| 168 | 168 | |
| 169 | 169 | <option <?php if ($post_type == $postypes_obj) {
|
| 170 | - echo 'selected="selected"'; |
|
| 171 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 172 | - echo ucfirst($extvalue[1]); ?></option> |
|
| 170 | + echo 'selected="selected"'; |
|
| 171 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 172 | + echo ucfirst($extvalue[1]); ?></option> |
|
| 173 | 173 | |
| 174 | 174 | <?php } ?> |
| 175 | 175 | |
@@ -183,20 +183,20 @@ discard block |
||
| 183 | 183 | for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
| 184 | 184 | |
| 185 | 185 | <?php |
| 186 | - $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 187 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 188 | - ?> |
|
| 186 | + $category_taxonomy = geodir_get_taxonomies('gd_place');
|
|
| 187 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 188 | + ?> |
|
| 189 | 189 | |
| 190 | 190 | <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>"
|
| 191 | 191 | name="<?php echo $this->get_field_name('category'); ?>">
|
| 192 | 192 | <option <?php if ($category == '0') {
|
| 193 | - echo 'selected="selected"'; |
|
| 194 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 193 | + echo 'selected="selected"'; |
|
| 194 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 195 | 195 | <?php foreach ($categories as $category_obj) { ?>
|
| 196 | 196 | |
| 197 | 197 | <option <?php if ($category == $category_obj->term_id) {
|
| 198 | - echo 'selected="selected"'; |
|
| 199 | - } ?> |
|
| 198 | + echo 'selected="selected"'; |
|
| 199 | + } ?> |
|
| 200 | 200 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
| 201 | 201 | |
| 202 | 202 | <?php } ?> |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | <select class="widefat" id="<?php echo $this->get_field_id('animation'); ?>"
|
| 250 | 250 | name="<?php echo $this->get_field_name('animation'); ?>">
|
| 251 | 251 | <option <?php if ($animation == 'slide') {
|
| 252 | - echo 'selected="selected"'; |
|
| 253 | - } ?> value="slide">Slide |
|
| 252 | + echo 'selected="selected"'; |
|
| 253 | + } ?> value="slide">Slide |
|
| 254 | 254 | </option> |
| 255 | 255 | <option <?php if ($animation == 'fade') {
|
| 256 | - echo 'selected="selected"'; |
|
| 257 | - } ?> value="fade">Fade |
|
| 256 | + echo 'selected="selected"'; |
|
| 257 | + } ?> value="fade">Fade |
|
| 258 | 258 | </option> |
| 259 | 259 | </select> |
| 260 | 260 | </label> |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | for="<?php echo $this->get_field_id('slideshow'); ?>"><?php _e('SlideShow:', 'geodirectory');?>
|
| 286 | 286 | |
| 287 | 287 | <input type="checkbox" <?php if ($slideshow) {
|
| 288 | - echo 'checked="checked"'; |
|
| 289 | - } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 288 | + echo 'checked="checked"'; |
|
| 289 | + } ?> id="<?php echo $this->get_field_id('slideshow'); ?>" value="1"
|
|
| 290 | 290 | name="<?php echo $this->get_field_name('slideshow'); ?>"/>
|
| 291 | 291 | |
| 292 | 292 | </label> |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | for="<?php echo $this->get_field_id('animationLoop'); ?>"><?php _e('AnimationLoop:', 'geodirectory');?>
|
| 298 | 298 | |
| 299 | 299 | <input type="checkbox" <?php if ($animationLoop) {
|
| 300 | - echo 'checked="checked"'; |
|
| 301 | - } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 300 | + echo 'checked="checked"'; |
|
| 301 | + } ?> id="<?php echo $this->get_field_id('animationLoop'); ?>" value="1"
|
|
| 302 | 302 | name="<?php echo $this->get_field_name('animationLoop'); ?>"/>
|
| 303 | 303 | |
| 304 | 304 | </label> |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | for="<?php echo $this->get_field_id('directionNav'); ?>"><?php _e('DirectionNav:', 'geodirectory');?>
|
| 310 | 310 | |
| 311 | 311 | <input type="checkbox" <?php if ($directionNav) {
|
| 312 | - echo 'checked="checked"'; |
|
| 313 | - } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 312 | + echo 'checked="checked"'; |
|
| 313 | + } ?> id="<?php echo $this->get_field_id('directionNav'); ?>" value="1"
|
|
| 314 | 314 | name="<?php echo $this->get_field_name('directionNav'); ?>"/>
|
| 315 | 315 | |
| 316 | 316 | </label> |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e('Show Title:', 'geodirectory');?>
|
| 323 | 323 | |
| 324 | 324 | <input type="checkbox" <?php if ($show_title) {
|
| 325 | - echo 'checked="checked"'; |
|
| 326 | - } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 325 | + echo 'checked="checked"'; |
|
| 326 | + } ?> id="<?php echo $this->get_field_id('show_title'); ?>" value="1"
|
|
| 327 | 327 | name="<?php echo $this->get_field_name('show_title'); ?>"/>
|
| 328 | 328 | |
| 329 | 329 | </label> |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | |
| 365 | 365 | <?php |
| 366 | - } |
|
| 366 | + } |
|
| 367 | 367 | } // class geodir_listing_slider_widget |
| 368 | 368 | |
| 369 | 369 | register_widget('geodir_listing_slider_widget'); |
| 370 | 370 | \ No newline at end of file |
@@ -332,7 +332,10 @@ |
||
| 332 | 332 | <label |
| 333 | 333 | for="<?php echo $this->get_field_id('show_featured_only'); ?>"><?php _e('Show only featured listings:', 'geodirectory'); ?>
|
| 334 | 334 | <input type="checkbox" id="<?php echo $this->get_field_id('show_featured_only'); ?>"
|
| 335 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
|
|
| 335 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
| 336 | + echo 'checked="checked"'; |
|
| 337 | +} |
|
| 338 | +?> |
|
| 336 | 339 | value="1"/> |
| 337 | 340 | </label> |
| 338 | 341 | </p> |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | //save the widget |
| 61 | 61 | $instance = $old_instance; |
| 62 | 62 | $instance['title'] = strip_tags($new_instance['title']); |
| 63 | - $category_limit = (int)$new_instance['category_limit']; |
|
| 63 | + $category_limit = (int) $new_instance['category_limit']; |
|
| 64 | 64 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
| 65 | 65 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
| 66 | 66 | return $instance; |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | public function form($instance) |
| 79 | 79 | {
|
| 80 | 80 | //widgetform in backend |
| 81 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => ''));
|
|
| 81 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => ''));
|
|
| 82 | 82 | |
| 83 | 83 | $title = strip_tags($instance['title']); |
| 84 | - $category_limit = (int)$instance['category_limit']; |
|
| 84 | + $category_limit = (int) $instance['category_limit']; |
|
| 85 | 85 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
| 86 | 86 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
| 87 | 87 | |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | </p> |
| 97 | 97 | <p> |
| 98 | 98 | <label for="<?php echo $this->get_field_id('post_type'); ?>">
|
| 99 | - <?php _e('Default post type to use (if not set by page)', 'geodirectory');?>
|
|
| 99 | + <?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?>
|
|
| 100 | 100 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>">
|
| 101 | 101 | <?php foreach ($post_type_options as $name => $title) { ?>
|
| 102 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
| 102 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
| 103 | 103 | <?php } ?> |
| 104 | 104 | </select> |
| 105 | 105 | </label> |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?>
|
| 110 | 110 | <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>"
|
| 111 | 111 | name="<?php echo $this->get_field_name('category_limit'); ?>" type="text"
|
| 112 | - value="<?php echo (int)esc_attr($category_limit); ?>"/> |
|
| 112 | + value="<?php echo (int) esc_attr($category_limit); ?>"/> |
|
| 113 | 113 | |
| 114 | 114 | <p class="description" |
| 115 | 115 | style="padding:0"><?php _e('After categories count reaches this limit option More Categories / Less Categoris will be displayed to show/hide categories. Default: 15', 'geodirectory'); ?></p>
|
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | public function form($instance) |
| 216 | 216 | {
|
| 217 | 217 | //widgetform in backend |
| 218 | - $instance = wp_parse_args((array)$instance, |
|
| 218 | + $instance = wp_parse_args((array) $instance, |
|
| 219 | 219 | array('title' => '',
|
| 220 | 220 | 'post_type' => '', |
| 221 | 221 | 'category' => array(), |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | ?> |
| 267 | 267 | |
| 268 | 268 | <p> |
| 269 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
|
| 269 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
|
|
| 270 | 270 | <small>(%posttype_singular_label% , |
| 271 | - %posttype_plural_label% <?php _e('can be used', 'geodirectory');?>)
|
|
| 271 | + %posttype_plural_label% <?php _e('can be used', 'geodirectory'); ?>)
|
|
| 272 | 272 | </small> |
| 273 | 273 | |
| 274 | 274 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | <p> |
| 281 | 281 | <label |
| 282 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?>
|
|
| 282 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?>
|
|
| 283 | 283 | |
| 284 | 284 | <?php $postypes = geodir_get_posttypes(); |
| 285 | 285 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | <p id="post_type_cats"> |
| 313 | 313 | <label |
| 314 | - for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory');?>
|
|
| 314 | + for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Post Category:', 'geodirectory'); ?>
|
|
| 315 | 315 | |
| 316 | 316 | <?php |
| 317 | 317 | |
@@ -350,14 +350,14 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
|
| 352 | 352 | id="<?php echo $this->get_field_id('category_title'); ?>"
|
| 353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
|
|
| 353 | + value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory'); ?>"/>
|
|
| 354 | 354 | |
| 355 | 355 | </label> |
| 356 | 356 | </p> |
| 357 | 357 | |
| 358 | 358 | <p> |
| 359 | 359 | <label |
| 360 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
|
|
| 360 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?>
|
|
| 361 | 361 | |
| 362 | 362 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>"
|
| 363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>">
|
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | <p> |
| 394 | 394 | |
| 395 | 395 | <label |
| 396 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
|
|
| 396 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
|
|
| 397 | 397 | |
| 398 | 398 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
|
| 399 | 399 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
|
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | <p> |
| 405 | 405 | <label for="<?php echo $this->get_field_id('layout'); ?>">
|
| 406 | - <?php _e('Layout:', 'geodirectory');?>
|
|
| 406 | + <?php _e('Layout:', 'geodirectory'); ?>
|
|
| 407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
|
| 408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>">
|
| 409 | 409 | <option <?php if ($layout == 'gridview_onehalf') {
|
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | <p> |
| 434 | 434 | <label |
| 435 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?>
|
|
| 435 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?>
|
|
| 436 | 436 | |
| 437 | 437 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>"
|
| 438 | 438 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text"
|
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | <p> |
| 444 | 444 | <label |
| 445 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
|
|
| 445 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
|
|
| 446 | 446 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
|
| 447 | 447 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
|
| 448 | 448 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -451,41 +451,41 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | <p> |
| 453 | 453 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
|
| 454 | - <?php _e('Enable Location Filter:', 'geodirectory');?>
|
|
| 454 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?>
|
|
| 455 | 455 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
|
| 456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
|
|
| 456 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
|
|
| 457 | 457 | value="1"/> |
| 458 | 458 | </label> |
| 459 | 459 | </p> |
| 460 | 460 | <p> |
| 461 | 461 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
|
| 462 | - <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
|
|
| 462 | + <?php _e('Show only featured listings:', 'geodirectory'); ?> <input type="checkbox"
|
|
| 463 | 463 | id="<?php echo $this->get_field_id('show_featured_only'); ?>"
|
| 464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
|
|
| 464 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"'; ?>
|
|
| 465 | 465 | value="1"/> |
| 466 | 466 | </label> |
| 467 | 467 | </p> |
| 468 | 468 | <p> |
| 469 | 469 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
|
| 470 | - <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
|
|
| 470 | + <?php _e('Show only listings with special offers:', 'geodirectory'); ?> <input type="checkbox"
|
|
| 471 | 471 | id="<?php echo $this->get_field_id('show_special_only'); ?>"
|
| 472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
|
|
| 472 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"'; ?>
|
|
| 473 | 473 | value="1"/> |
| 474 | 474 | </label> |
| 475 | 475 | </p> |
| 476 | 476 | <p> |
| 477 | 477 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
|
| 478 | - <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
|
|
| 478 | + <?php _e('Show only listings with pics:', 'geodirectory'); ?> <input type="checkbox"
|
|
| 479 | 479 | id="<?php echo $this->get_field_id('with_pics_only'); ?>"
|
| 480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
|
|
| 480 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"'; ?>
|
|
| 481 | 481 | value="1"/> |
| 482 | 482 | </label> |
| 483 | 483 | </p> |
| 484 | 484 | <p> |
| 485 | 485 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
|
| 486 | - <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
|
|
| 486 | + <?php _e('Show only listings with videos:', 'geodirectory'); ?> <input type="checkbox"
|
|
| 487 | 487 | id="<?php echo $this->get_field_id('with_videos_only'); ?>"
|
| 488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
|
|
| 488 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"'; ?>
|
|
| 489 | 489 | value="1"/> |
| 490 | 490 | </label> |
| 491 | 491 | </p> |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - <?php if(is_active_widget( false, false, $this->id_base, true )){ ?>
|
|
| 534 | + <?php if (is_active_widget(false, false, $this->id_base, true)) { ?>
|
|
| 535 | 535 | var post_type = jQuery('#<?php echo $this->get_field_id('post_type'); ?>').val();
|
| 536 | 536 | |
| 537 | 537 | <?php } ?> |
@@ -14,41 +14,41 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_popular_post_category extends WP_Widget |
| 16 | 16 | {
|
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Register the popular post category widget. |
| 19 | 19 | * |
| 20 | 20 | * @since 1.0.0 |
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | 22 | */ |
| 23 | - public function __construct() {
|
|
| 24 | - $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
|
|
| 25 | - parent::__construct( |
|
| 26 | - 'popular_post_category', // Base ID |
|
| 27 | - __('GD > Popular Post Category', 'geodirectory'), // Name
|
|
| 28 | - $widget_ops// Args |
|
| 29 | - ); |
|
| 30 | - } |
|
| 23 | + public function __construct() {
|
|
| 24 | + $widget_ops = array('classname' => 'geodir_popular_post_category', 'description' => __('GD > Popular Post Category', 'geodirectory'));
|
|
| 25 | + parent::__construct( |
|
| 26 | + 'popular_post_category', // Base ID |
|
| 27 | + __('GD > Popular Post Category', 'geodirectory'), // Name
|
|
| 28 | + $widget_ops// Args |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Front-end display content for popular post category widget. |
| 34 | 34 | * |
| 35 | 35 | * @since 1.0.0 |
| 36 | - * @since 1.5.1 Declare function public. |
|
| 36 | + * @since 1.5.1 Declare function public. |
|
| 37 | 37 | * |
| 38 | 38 | * @param array $args Widget arguments. |
| 39 | 39 | * @param array $instance Saved values from database. |
| 40 | 40 | */ |
| 41 | 41 | public function widget($args, $instance) |
| 42 | - {
|
|
| 43 | - geodir_popular_post_category_output($args, $instance); |
|
| 44 | - } |
|
| 42 | + {
|
|
| 43 | + geodir_popular_post_category_output($args, $instance); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Sanitize popular post category widget form values as they are saved. |
| 48 | 48 | * |
| 49 | 49 | * @since 1.0.0 |
| 50 | - * @since 1.5.1 Declare function public. |
|
| 51 | - * @since 1.5.1 Added default_post_type parameter. |
|
| 50 | + * @since 1.5.1 Declare function public. |
|
| 51 | + * @since 1.5.1 Added default_post_type parameter. |
|
| 52 | 52 | * |
| 53 | 53 | * @param array $new_instance Values just sent to be saved. |
| 54 | 54 | * @param array $old_instance Previously saved values from database. |
@@ -56,37 +56,37 @@ discard block |
||
| 56 | 56 | * @return array Updated safe values to be saved. |
| 57 | 57 | */ |
| 58 | 58 | public function update($new_instance, $old_instance) |
| 59 | - {
|
|
| 60 | - //save the widget |
|
| 61 | - $instance = $old_instance; |
|
| 62 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | - $category_limit = (int)$new_instance['category_limit']; |
|
| 64 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
| 59 | + {
|
|
| 60 | + //save the widget |
|
| 61 | + $instance = $old_instance; |
|
| 62 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 63 | + $category_limit = (int)$new_instance['category_limit']; |
|
| 64 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
| 65 | 65 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
| 66 | - return $instance; |
|
| 67 | - } |
|
| 66 | + return $instance; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Back-end popular post category widget settings form. |
| 71 | 71 | * |
| 72 | 72 | * @since 1.0.0 |
| 73 | - * @since 1.5.1 Declare function public. |
|
| 74 | - * @since 1.5.1 Added option to set default post type. |
|
| 73 | + * @since 1.5.1 Declare function public. |
|
| 74 | + * @since 1.5.1 Added option to set default post type. |
|
| 75 | 75 | * |
| 76 | 76 | * @param array $instance Previously saved values from database. |
| 77 | 77 | */ |
| 78 | 78 | public function form($instance) |
| 79 | - {
|
|
| 80 | - //widgetform in backend |
|
| 81 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => ''));
|
|
| 79 | + {
|
|
| 80 | + //widgetform in backend |
|
| 81 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => ''));
|
|
| 82 | 82 | |
| 83 | - $title = strip_tags($instance['title']); |
|
| 84 | - $category_limit = (int)$instance['category_limit']; |
|
| 85 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
| 83 | + $title = strip_tags($instance['title']); |
|
| 84 | + $category_limit = (int)$instance['category_limit']; |
|
| 85 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
| 86 | 86 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
| 87 | 87 | |
| 88 | 88 | $post_type_options = geodir_get_posttypes('options');
|
| 89 | - ?> |
|
| 89 | + ?> |
|
| 90 | 90 | <p> |
| 91 | 91 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
|
| 92 | 92 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
|
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | </label> |
| 117 | 117 | </p> |
| 118 | 118 | <?php |
| 119 | - } |
|
| 119 | + } |
|
| 120 | 120 | } // class geodir_popular_post_category |
| 121 | 121 | |
| 122 | 122 | register_widget('geodir_popular_post_category');
|
@@ -130,40 +130,40 @@ discard block |
||
| 130 | 130 | class geodir_popular_postview extends WP_Widget |
| 131 | 131 | {
|
| 132 | 132 | |
| 133 | - /** |
|
| 133 | + /** |
|
| 134 | 134 | * Register the popular posts widget. |
| 135 | 135 | * |
| 136 | 136 | * @since 1.0.0 |
| 137 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 137 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 138 | 138 | */ |
| 139 | - public function __construct() {
|
|
| 140 | - $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
|
|
| 141 | - parent::__construct( |
|
| 142 | - 'popular_post_view', // Base ID |
|
| 143 | - __('GD > Popular Post View', 'geodirectory'), // Name
|
|
| 144 | - $widget_ops// Args |
|
| 145 | - ); |
|
| 146 | - } |
|
| 139 | + public function __construct() {
|
|
| 140 | + $widget_ops = array('classname' => 'geodir_popular_post_view', 'description' => __('GD > Popular Post View', 'geodirectory'));
|
|
| 141 | + parent::__construct( |
|
| 142 | + 'popular_post_view', // Base ID |
|
| 143 | + __('GD > Popular Post View', 'geodirectory'), // Name
|
|
| 144 | + $widget_ops// Args |
|
| 145 | + ); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Front-end display content for popular posts widget. |
| 150 | 150 | * |
| 151 | 151 | * @since 1.0.0 |
| 152 | - * @since 1.5.1 Declare function public. |
|
| 152 | + * @since 1.5.1 Declare function public. |
|
| 153 | 153 | * |
| 154 | 154 | * @param array $args Widget arguments. |
| 155 | 155 | * @param array $instance Saved values from database. |
| 156 | 156 | */ |
| 157 | 157 | public function widget($args, $instance) |
| 158 | - {
|
|
| 159 | - geodir_popular_postview_output($args, $instance); |
|
| 160 | - } |
|
| 158 | + {
|
|
| 159 | + geodir_popular_postview_output($args, $instance); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Sanitize popular posts widget form values as they are saved. |
| 164 | 164 | * |
| 165 | 165 | * @since 1.0.0 |
| 166 | - * @since 1.5.1 Declare function public. |
|
| 166 | + * @since 1.5.1 Declare function public. |
|
| 167 | 167 | * |
| 168 | 168 | * @param array $new_instance Values just sent to be saved. |
| 169 | 169 | * @param array $old_instance Previously saved values from database. |
@@ -171,99 +171,99 @@ discard block |
||
| 171 | 171 | * @return array Updated safe values to be saved. |
| 172 | 172 | */ |
| 173 | 173 | public function update($new_instance, $old_instance) |
| 174 | - {
|
|
| 175 | - //save the widget |
|
| 176 | - $instance = $old_instance; |
|
| 177 | - |
|
| 178 | - if ($new_instance['title'] == '') {
|
|
| 179 | - $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
| 180 | - //$instance['title'] = $title; |
|
| 181 | - } |
|
| 182 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 183 | - |
|
| 184 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 185 | - //$instance['category'] = strip_tags($new_instance['category']); |
|
| 186 | - $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
| 187 | - $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
| 188 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 189 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
| 190 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
| 191 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
| 192 | - $instance['character_count'] = $new_instance['character_count']; |
|
| 193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 195 | - else |
|
| 196 | - $instance['add_location_filter'] = '0'; |
|
| 197 | - |
|
| 198 | - $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 199 | - $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
| 200 | - $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
| 201 | - $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
| 202 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 203 | - |
|
| 204 | - return $instance; |
|
| 205 | - } |
|
| 174 | + {
|
|
| 175 | + //save the widget |
|
| 176 | + $instance = $old_instance; |
|
| 177 | + |
|
| 178 | + if ($new_instance['title'] == '') {
|
|
| 179 | + $title = geodir_ucwords(strip_tags($new_instance['category_title'])); |
|
| 180 | + //$instance['title'] = $title; |
|
| 181 | + } |
|
| 182 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 183 | + |
|
| 184 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 185 | + //$instance['category'] = strip_tags($new_instance['category']); |
|
| 186 | + $instance['category'] = isset($new_instance['category']) ? $new_instance['category'] : ''; |
|
| 187 | + $instance['category_title'] = strip_tags($new_instance['category_title']); |
|
| 188 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 189 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
| 190 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
| 191 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
| 192 | + $instance['character_count'] = $new_instance['character_count']; |
|
| 193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 195 | + else |
|
| 196 | + $instance['add_location_filter'] = '0'; |
|
| 197 | + |
|
| 198 | + $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
|
| 199 | + $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
|
| 200 | + $instance['with_pics_only'] = isset($new_instance['with_pics_only']) && $new_instance['with_pics_only'] ? 1 : 0; |
|
| 201 | + $instance['with_videos_only'] = isset($new_instance['with_videos_only']) && $new_instance['with_videos_only'] ? 1 : 0; |
|
| 202 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 203 | + |
|
| 204 | + return $instance; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * Back-end popular posts widget settings form. |
| 209 | 209 | * |
| 210 | 210 | * @since 1.0.0 |
| 211 | - * @since 1.5.1 Declare function public. |
|
| 211 | + * @since 1.5.1 Declare function public. |
|
| 212 | 212 | * |
| 213 | 213 | * @param array $instance Previously saved values from database. |
| 214 | 214 | */ |
| 215 | 215 | public function form($instance) |
| 216 | - {
|
|
| 217 | - //widgetform in backend |
|
| 218 | - $instance = wp_parse_args((array)$instance, |
|
| 219 | - array('title' => '',
|
|
| 220 | - 'post_type' => '', |
|
| 221 | - 'category' => array(), |
|
| 222 | - 'category_title' => '', |
|
| 223 | - 'list_sort' => '', |
|
| 224 | - 'list_order' => '', |
|
| 225 | - 'post_number' => '5', |
|
| 226 | - 'layout' => 'gridview_onehalf', |
|
| 227 | - 'listing_width' => '', |
|
| 228 | - 'add_location_filter' => '1', |
|
| 229 | - 'character_count' => '20', |
|
| 230 | - 'show_featured_only' => '', |
|
| 231 | - 'show_special_only' => '', |
|
| 232 | - 'with_pics_only' => '', |
|
| 233 | - 'with_videos_only' => '', |
|
| 234 | - 'use_viewing_post_type' => '' |
|
| 235 | - ) |
|
| 236 | - ); |
|
| 216 | + {
|
|
| 217 | + //widgetform in backend |
|
| 218 | + $instance = wp_parse_args((array)$instance, |
|
| 219 | + array('title' => '',
|
|
| 220 | + 'post_type' => '', |
|
| 221 | + 'category' => array(), |
|
| 222 | + 'category_title' => '', |
|
| 223 | + 'list_sort' => '', |
|
| 224 | + 'list_order' => '', |
|
| 225 | + 'post_number' => '5', |
|
| 226 | + 'layout' => 'gridview_onehalf', |
|
| 227 | + 'listing_width' => '', |
|
| 228 | + 'add_location_filter' => '1', |
|
| 229 | + 'character_count' => '20', |
|
| 230 | + 'show_featured_only' => '', |
|
| 231 | + 'show_special_only' => '', |
|
| 232 | + 'with_pics_only' => '', |
|
| 233 | + 'with_videos_only' => '', |
|
| 234 | + 'use_viewing_post_type' => '' |
|
| 235 | + ) |
|
| 236 | + ); |
|
| 237 | 237 | |
| 238 | - $title = strip_tags($instance['title']); |
|
| 238 | + $title = strip_tags($instance['title']); |
|
| 239 | 239 | |
| 240 | - $post_type = strip_tags($instance['post_type']); |
|
| 240 | + $post_type = strip_tags($instance['post_type']); |
|
| 241 | 241 | |
| 242 | - $category = $instance['category']; |
|
| 242 | + $category = $instance['category']; |
|
| 243 | 243 | |
| 244 | - $category_title = strip_tags($instance['category_title']); |
|
| 244 | + $category_title = strip_tags($instance['category_title']); |
|
| 245 | 245 | |
| 246 | - $list_sort = strip_tags($instance['list_sort']); |
|
| 246 | + $list_sort = strip_tags($instance['list_sort']); |
|
| 247 | 247 | |
| 248 | - $list_order = strip_tags($instance['list_order']); |
|
| 248 | + $list_order = strip_tags($instance['list_order']); |
|
| 249 | 249 | |
| 250 | - $post_number = strip_tags($instance['post_number']); |
|
| 250 | + $post_number = strip_tags($instance['post_number']); |
|
| 251 | 251 | |
| 252 | - $layout = strip_tags($instance['layout']); |
|
| 252 | + $layout = strip_tags($instance['layout']); |
|
| 253 | 253 | |
| 254 | - $listing_width = strip_tags($instance['listing_width']); |
|
| 254 | + $listing_width = strip_tags($instance['listing_width']); |
|
| 255 | 255 | |
| 256 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 256 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 257 | 257 | |
| 258 | - $character_count = $instance['character_count']; |
|
| 258 | + $character_count = $instance['character_count']; |
|
| 259 | 259 | |
| 260 | - $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 261 | - $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
| 262 | - $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
| 263 | - $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
| 264 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 260 | + $show_featured_only = isset($instance['show_featured_only']) && $instance['show_featured_only'] ? true : false; |
|
| 261 | + $show_special_only = isset($instance['show_special_only']) && $instance['show_special_only'] ? true : false; |
|
| 262 | + $with_pics_only = isset($instance['with_pics_only']) && $instance['with_pics_only'] ? true : false; |
|
| 263 | + $with_videos_only = isset($instance['with_videos_only']) && $instance['with_videos_only'] ? true : false; |
|
| 264 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 265 | 265 | |
| 266 | - ?> |
|
| 266 | + ?> |
|
| 267 | 267 | |
| 268 | 268 | <p> |
| 269 | 269 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
|
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | <?php foreach ($postypes as $postypes_obj) { ?>
|
| 299 | 299 | |
| 300 | 300 | <option <?php if ($post_type == $postypes_obj) {
|
| 301 | - echo 'selected="selected"'; |
|
| 302 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 303 | - echo ucfirst($extvalue[1]); ?></option> |
|
| 301 | + echo 'selected="selected"'; |
|
| 302 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 303 | + echo ucfirst($extvalue[1]); ?></option> |
|
| 304 | 304 | |
| 305 | 305 | <?php } ?> |
| 306 | 306 | |
@@ -315,30 +315,30 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | <?php |
| 317 | 317 | |
| 318 | - $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
| 318 | + $post_type = ($post_type != '') ? $post_type : 'gd_place'; |
|
| 319 | 319 | |
| 320 | - $all_postypes = geodir_get_posttypes(); |
|
| 320 | + $all_postypes = geodir_get_posttypes(); |
|
| 321 | 321 | |
| 322 | - if (!in_array($post_type, $all_postypes)) |
|
| 323 | - $post_type = 'gd_place'; |
|
| 322 | + if (!in_array($post_type, $all_postypes)) |
|
| 323 | + $post_type = 'gd_place'; |
|
| 324 | 324 | |
| 325 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 326 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 325 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 326 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 327 | 327 | |
| 328 | - ?> |
|
| 328 | + ?> |
|
| 329 | 329 | |
| 330 | 330 | <select multiple="multiple" class="widefat" name="<?php echo $this->get_field_name('category'); ?>[]"
|
| 331 | 331 | onchange="geodir_popular_widget_cat_title(this)"> |
| 332 | 332 | |
| 333 | 333 | <option <?php if (!is_array($category) || (is_array($category) && in_array('0', $category))) {
|
| 334 | - echo 'selected="selected"'; |
|
| 335 | - } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 334 | + echo 'selected="selected"'; |
|
| 335 | + } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
|
| 336 | 336 | <?php foreach ($categories as $category_obj) {
|
| 337 | - $selected = ''; |
|
| 338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
| 339 | - echo $selected = 'selected="selected"'; |
|
| 337 | + $selected = ''; |
|
| 338 | + if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
| 339 | + echo $selected = 'selected="selected"'; |
|
| 340 | 340 | |
| 341 | - ?> |
|
| 341 | + ?> |
|
| 342 | 342 | |
| 343 | 343 | <option <?php echo $selected; ?> |
| 344 | 344 | value="<?php echo $category_obj->term_id; ?>"><?php echo ucfirst($category_obj->name); ?></option> |
@@ -363,28 +363,28 @@ discard block |
||
| 363 | 363 | name="<?php echo $this->get_field_name('list_sort'); ?>">
|
| 364 | 364 | |
| 365 | 365 | <option <?php if ($list_sort == 'az') {
|
| 366 | - echo 'selected="selected"'; |
|
| 367 | - } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option>
|
|
| 366 | + echo 'selected="selected"'; |
|
| 367 | + } ?> value="az"><?php _e('A-Z', 'geodirectory'); ?></option>
|
|
| 368 | 368 | |
| 369 | 369 | <option <?php if ($list_sort == 'latest') {
|
| 370 | - echo 'selected="selected"'; |
|
| 371 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option>
|
|
| 370 | + echo 'selected="selected"'; |
|
| 371 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option>
|
|
| 372 | 372 | |
| 373 | 373 | <option <?php if ($list_sort == 'featured') {
|
| 374 | - echo 'selected="selected"'; |
|
| 375 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option>
|
|
| 374 | + echo 'selected="selected"'; |
|
| 375 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option>
|
|
| 376 | 376 | |
| 377 | 377 | <option <?php if ($list_sort == 'high_review') {
|
| 378 | - echo 'selected="selected"'; |
|
| 379 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option>
|
|
| 378 | + echo 'selected="selected"'; |
|
| 379 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option>
|
|
| 380 | 380 | |
| 381 | 381 | <option <?php if ($list_sort == 'high_rating') {
|
| 382 | - echo 'selected="selected"'; |
|
| 383 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option>
|
|
| 382 | + echo 'selected="selected"'; |
|
| 383 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option>
|
|
| 384 | 384 | |
| 385 | 385 | <option <?php if ($list_sort == 'random') {
|
| 386 | - echo 'selected="selected"'; |
|
| 387 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option>
|
|
| 386 | + echo 'selected="selected"'; |
|
| 387 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option>
|
|
| 388 | 388 | |
| 389 | 389 | </select> |
| 390 | 390 | </label> |
@@ -407,24 +407,24 @@ discard block |
||
| 407 | 407 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
|
| 408 | 408 | name="<?php echo $this->get_field_name('layout'); ?>">
|
| 409 | 409 | <option <?php if ($layout == 'gridview_onehalf') {
|
| 410 | - echo 'selected="selected"'; |
|
| 411 | - } ?> |
|
| 410 | + echo 'selected="selected"'; |
|
| 411 | + } ?> |
|
| 412 | 412 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option>
|
| 413 | 413 | <option <?php if ($layout == 'gridview_onethird') {
|
| 414 | - echo 'selected="selected"'; |
|
| 415 | - } ?> |
|
| 414 | + echo 'selected="selected"'; |
|
| 415 | + } ?> |
|
| 416 | 416 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option>
|
| 417 | 417 | <option <?php if ($layout == 'gridview_onefourth') {
|
| 418 | - echo 'selected="selected"'; |
|
| 419 | - } ?> |
|
| 418 | + echo 'selected="selected"'; |
|
| 419 | + } ?> |
|
| 420 | 420 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option>
|
| 421 | 421 | <option <?php if ($layout == 'gridview_onefifth') {
|
| 422 | - echo 'selected="selected"'; |
|
| 423 | - } ?> |
|
| 422 | + echo 'selected="selected"'; |
|
| 423 | + } ?> |
|
| 424 | 424 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option>
|
| 425 | 425 | <option <?php if ($layout == 'list') {
|
| 426 | - echo 'selected="selected"'; |
|
| 427 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
|
|
| 426 | + echo 'selected="selected"'; |
|
| 427 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
|
|
| 428 | 428 | |
| 429 | 429 | </select> |
| 430 | 430 | </label> |
@@ -494,8 +494,8 @@ discard block |
||
| 494 | 494 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?>
|
| 495 | 495 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"
|
| 496 | 496 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) {
|
| 497 | - echo 'checked="checked"'; |
|
| 498 | - } ?> value="1"/> |
|
| 497 | + echo 'checked="checked"'; |
|
| 498 | + } ?> value="1"/> |
|
| 499 | 499 | </label> |
| 500 | 500 | </p> |
| 501 | 501 | |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | </script> |
| 540 | 540 | |
| 541 | 541 | <?php |
| 542 | - } |
|
| 542 | + } |
|
| 543 | 543 | } // class geodir_popular_postview |
| 544 | 544 | |
| 545 | 545 | register_widget('geodir_popular_postview'); |
| 546 | 546 | \ No newline at end of file |
@@ -190,10 +190,11 @@ discard block |
||
| 190 | 190 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
| 191 | 191 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
| 192 | 192 | $instance['character_count'] = $new_instance['character_count']; |
| 193 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 194 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 195 | - else |
|
| 196 | - $instance['add_location_filter'] = '0'; |
|
| 193 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
| 194 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 195 | + } else { |
|
| 196 | + $instance['add_location_filter'] = '0'; |
|
| 197 | + } |
|
| 197 | 198 | |
| 198 | 199 | $instance['show_featured_only'] = isset($new_instance['show_featured_only']) && $new_instance['show_featured_only'] ? 1 : 0; |
| 199 | 200 | $instance['show_special_only'] = isset($new_instance['show_special_only']) && $new_instance['show_special_only'] ? 1 : 0; |
@@ -319,8 +320,9 @@ discard block |
||
| 319 | 320 | |
| 320 | 321 | $all_postypes = geodir_get_posttypes(); |
| 321 | 322 | |
| 322 | - if (!in_array($post_type, $all_postypes)) |
|
| 323 | - $post_type = 'gd_place'; |
|
| 323 | + if (!in_array($post_type, $all_postypes)) { |
|
| 324 | + $post_type = 'gd_place'; |
|
| 325 | + } |
|
| 324 | 326 | |
| 325 | 327 | $category_taxonomy = geodir_get_taxonomies($post_type); |
| 326 | 328 | $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
|
@@ -335,8 +337,9 @@ discard block |
||
| 335 | 337 | } ?> value="0"><?php _e('All', 'geodirectory'); ?></option>
|
| 336 | 338 | <?php foreach ($categories as $category_obj) {
|
| 337 | 339 | $selected = ''; |
| 338 | - if (is_array($category) && in_array($category_obj->term_id, $category)) |
|
| 339 | - echo $selected = 'selected="selected"'; |
|
| 340 | + if (is_array($category) && in_array($category_obj->term_id, $category)) { |
|
| 341 | + echo $selected = 'selected="selected"'; |
|
| 342 | + } |
|
| 340 | 343 | |
| 341 | 344 | ?> |
| 342 | 345 | |
@@ -350,7 +353,12 @@ discard block |
||
| 350 | 353 | |
| 351 | 354 | <input type="hidden" name="<?php echo $this->get_field_name('category_title'); ?>"
|
| 352 | 355 | id="<?php echo $this->get_field_id('category_title'); ?>"
|
| 353 | - value="<?php if ($category_title != '') echo $category_title; else echo __('All', 'geodirectory');?>"/>
|
|
| 356 | + value="<?php if ($category_title != '') { |
|
| 357 | + echo $category_title; |
|
| 358 | +} else { |
|
| 359 | + echo __('All', 'geodirectory'); |
|
| 360 | +} |
|
| 361 | +?>"/> |
|
| 354 | 362 | |
| 355 | 363 | </label> |
| 356 | 364 | </p> |
@@ -453,7 +461,10 @@ discard block |
||
| 453 | 461 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
|
| 454 | 462 | <?php _e('Enable Location Filter:', 'geodirectory');?>
|
| 455 | 463 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
|
| 456 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
|
|
| 464 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
| 465 | + echo 'checked="checked"'; |
|
| 466 | +} |
|
| 467 | +?> |
|
| 457 | 468 | value="1"/> |
| 458 | 469 | </label> |
| 459 | 470 | </p> |
@@ -461,7 +472,10 @@ discard block |
||
| 461 | 472 | <label for="<?php echo $this->get_field_id('show_featured_only'); ?>">
|
| 462 | 473 | <?php _e('Show only featured listings:', 'geodirectory');?> <input type="checkbox"
|
| 463 | 474 | id="<?php echo $this->get_field_id('show_featured_only'); ?>"
|
| 464 | - name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) echo 'checked="checked"';?>
|
|
| 475 | + name="<?php echo $this->get_field_name('show_featured_only'); ?>" <?php if ($show_featured_only) { |
|
| 476 | + echo 'checked="checked"'; |
|
| 477 | +} |
|
| 478 | +?> |
|
| 465 | 479 | value="1"/> |
| 466 | 480 | </label> |
| 467 | 481 | </p> |
@@ -469,7 +483,10 @@ discard block |
||
| 469 | 483 | <label for="<?php echo $this->get_field_id('show_special_only'); ?>">
|
| 470 | 484 | <?php _e('Show only listings with special offers:', 'geodirectory');?> <input type="checkbox"
|
| 471 | 485 | id="<?php echo $this->get_field_id('show_special_only'); ?>"
|
| 472 | - name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) echo 'checked="checked"';?>
|
|
| 486 | + name="<?php echo $this->get_field_name('show_special_only'); ?>" <?php if ($show_special_only) { |
|
| 487 | + echo 'checked="checked"'; |
|
| 488 | +} |
|
| 489 | +?> |
|
| 473 | 490 | value="1"/> |
| 474 | 491 | </label> |
| 475 | 492 | </p> |
@@ -477,7 +494,10 @@ discard block |
||
| 477 | 494 | <label for="<?php echo $this->get_field_id('with_pics_only'); ?>">
|
| 478 | 495 | <?php _e('Show only listings with pics:', 'geodirectory');?> <input type="checkbox"
|
| 479 | 496 | id="<?php echo $this->get_field_id('with_pics_only'); ?>"
|
| 480 | - name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) echo 'checked="checked"';?>
|
|
| 497 | + name="<?php echo $this->get_field_name('with_pics_only'); ?>" <?php if ($with_pics_only) { |
|
| 498 | + echo 'checked="checked"'; |
|
| 499 | +} |
|
| 500 | +?> |
|
| 481 | 501 | value="1"/> |
| 482 | 502 | </label> |
| 483 | 503 | </p> |
@@ -485,7 +505,10 @@ discard block |
||
| 485 | 505 | <label for="<?php echo $this->get_field_id('with_videos_only'); ?>">
|
| 486 | 506 | <?php _e('Show only listings with videos:', 'geodirectory');?> <input type="checkbox"
|
| 487 | 507 | id="<?php echo $this->get_field_id('with_videos_only'); ?>"
|
| 488 | - name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) echo 'checked="checked"';?>
|
|
| 508 | + name="<?php echo $this->get_field_name('with_videos_only'); ?>" <?php if ($with_videos_only) { |
|
| 509 | + echo 'checked="checked"'; |
|
| 510 | +} |
|
| 511 | +?> |
|
| 489 | 512 | value="1"/> |
| 490 | 513 | </label> |
| 491 | 514 | </p> |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | public function form($instance) |
| 138 | 138 | { |
| 139 | 139 | //widgetform in backend |
| 140 | - $instance = wp_parse_args((array)$instance, |
|
| 140 | + $instance = wp_parse_args((array) $instance, |
|
| 141 | 141 | array('title' => '', |
| 142 | 142 | 'list_sort' => '', |
| 143 | 143 | 'list_order' => '', |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | ?> |
| 171 | 171 | <p> |
| 172 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
| 172 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
| 173 | 173 | |
| 174 | 174 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
| 175 | 175 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | </p> |
| 179 | 179 | <p> |
| 180 | 180 | <label |
| 181 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
| 181 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
| 182 | 182 | |
| 183 | 183 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
| 184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | </p> |
| 209 | 209 | <p> |
| 210 | 210 | <label |
| 211 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
| 211 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
| 212 | 212 | |
| 213 | 213 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
| 214 | 214 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | </p> |
| 218 | 218 | <p> |
| 219 | 219 | <label for="<?php echo $this->get_field_id('relate_to'); ?>"> |
| 220 | - <?php _e('Relate to:', 'geodirectory');?> |
|
| 220 | + <?php _e('Relate to:', 'geodirectory'); ?> |
|
| 221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
| 222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
| 223 | 223 | <option <?php if ($relate_to == 'category') { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | <p> |
| 233 | 233 | <p> |
| 234 | 234 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
| 235 | - <?php _e('Layout:', 'geodirectory');?> |
|
| 235 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
| 236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
| 237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
| 238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | </p> |
| 261 | 261 | <p> |
| 262 | 262 | <label |
| 263 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
| 263 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
| 264 | 264 | |
| 265 | 265 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
| 266 | 266 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | </p> |
| 270 | 270 | <p> |
| 271 | 271 | <label |
| 272 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
| 272 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
| 273 | 273 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
| 274 | 274 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
| 275 | 275 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | </p> |
| 278 | 278 | <p> |
| 279 | 279 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 280 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
| 280 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
| 281 | 281 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 282 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
| 283 | 283 | value="1"/> |
| 284 | 284 | </label> |
| 285 | 285 | </p> |
@@ -14,160 +14,160 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_related_listing_postview extends WP_Widget |
| 16 | 16 | { |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Register the related listing widget. |
| 19 | 19 | * |
| 20 | 20 | * @since 1.0.0 |
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | 22 | */ |
| 23 | - public function __construct() { |
|
| 24 | - $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
| 25 | - parent::__construct( |
|
| 26 | - 'post_related_listing', // Base ID |
|
| 27 | - __('GD > Related Listing', 'geodirectory'), // Name |
|
| 28 | - $widget_ops// Args |
|
| 29 | - ); |
|
| 30 | - } |
|
| 23 | + public function __construct() { |
|
| 24 | + $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
| 25 | + parent::__construct( |
|
| 26 | + 'post_related_listing', // Base ID |
|
| 27 | + __('GD > Related Listing', 'geodirectory'), // Name |
|
| 28 | + $widget_ops// Args |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Front-end display content for related listing widget. |
| 34 | 34 | * |
| 35 | 35 | * @since 1.0.0 |
| 36 | - * @since 1.5.1 Declare function public. |
|
| 36 | + * @since 1.5.1 Declare function public. |
|
| 37 | 37 | * |
| 38 | 38 | * @param array $args Widget arguments. |
| 39 | 39 | * @param array $instance Saved values from database. |
| 40 | 40 | */ |
| 41 | - public function widget($args, $instance) |
|
| 42 | - { |
|
| 41 | + public function widget($args, $instance) |
|
| 42 | + { |
|
| 43 | 43 | |
| 44 | - // prints the widget |
|
| 45 | - extract($args, EXTR_SKIP); |
|
| 44 | + // prints the widget |
|
| 45 | + extract($args, EXTR_SKIP); |
|
| 46 | 46 | |
| 47 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 48 | - $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
| 47 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 48 | + $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
| 49 | 49 | |
| 50 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 50 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 51 | 51 | $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Filter the relation type to get related listing. |
|
| 55 | - * |
|
| 56 | - * @since 1.0.0 |
|
| 57 | - * @param string $instance['relate_to'] Can be tags or category. |
|
| 58 | - */ |
|
| 53 | + /** |
|
| 54 | + * Filter the relation type to get related listing. |
|
| 55 | + * |
|
| 56 | + * @since 1.0.0 |
|
| 57 | + * @param string $instance['relate_to'] Can be tags or category. |
|
| 58 | + */ |
|
| 59 | 59 | $relate_to = empty($instance['relate_to']) ? 'category' : apply_filters('widget_relate_to', $instance['relate_to']); |
| 60 | 60 | |
| 61 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 61 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 62 | 62 | $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
| 63 | 63 | |
| 64 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 64 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 65 | 65 | $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
| 66 | 66 | |
| 67 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 67 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 68 | 68 | $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
| 69 | 69 | |
| 70 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 70 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 71 | 71 | $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
| 72 | 72 | |
| 73 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 73 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 74 | 74 | $character_count = empty($instance['character_count']) ? 20 : apply_filters('widget_list_character_count', $instance['character_count']); |
| 75 | 75 | |
| 76 | - $arr = array( |
|
| 77 | - 'before_title' => $before_title, |
|
| 78 | - 'after_title' => $after_title, |
|
| 79 | - 'title' => $title, |
|
| 80 | - 'post_number' => $post_number, |
|
| 81 | - 'relate_to' => $relate_to, |
|
| 82 | - 'layout' => $layout, |
|
| 83 | - 'add_location_filter' => $add_location_filter, |
|
| 84 | - 'listing_width' => $listing_width, |
|
| 85 | - 'list_sort' => $list_sort, |
|
| 86 | - 'character_count' => $character_count, |
|
| 87 | - 'is_widget' => '1' |
|
| 88 | - ); |
|
| 89 | - |
|
| 90 | - if ($widget_display = geodir_related_posts_display($arr)) { |
|
| 91 | - |
|
| 92 | - echo $before_widget; |
|
| 93 | - echo $widget_display; |
|
| 94 | - echo $after_widget; |
|
| 95 | - } |
|
| 96 | - } |
|
| 76 | + $arr = array( |
|
| 77 | + 'before_title' => $before_title, |
|
| 78 | + 'after_title' => $after_title, |
|
| 79 | + 'title' => $title, |
|
| 80 | + 'post_number' => $post_number, |
|
| 81 | + 'relate_to' => $relate_to, |
|
| 82 | + 'layout' => $layout, |
|
| 83 | + 'add_location_filter' => $add_location_filter, |
|
| 84 | + 'listing_width' => $listing_width, |
|
| 85 | + 'list_sort' => $list_sort, |
|
| 86 | + 'character_count' => $character_count, |
|
| 87 | + 'is_widget' => '1' |
|
| 88 | + ); |
|
| 89 | + |
|
| 90 | + if ($widget_display = geodir_related_posts_display($arr)) { |
|
| 91 | + |
|
| 92 | + echo $before_widget; |
|
| 93 | + echo $widget_display; |
|
| 94 | + echo $after_widget; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Sanitize related listing widget form values as they are saved. |
| 100 | 100 | * |
| 101 | 101 | * @since 1.0.0 |
| 102 | - * @since 1.5.1 Declare function public. |
|
| 102 | + * @since 1.5.1 Declare function public. |
|
| 103 | 103 | * |
| 104 | 104 | * @param array $new_instance Values just sent to be saved. |
| 105 | 105 | * @param array $old_instance Previously saved values from database. |
| 106 | 106 | * |
| 107 | 107 | * @return array Updated safe values to be saved. |
| 108 | 108 | */ |
| 109 | - public function update($new_instance, $old_instance) |
|
| 110 | - { |
|
| 111 | - //save the widget |
|
| 112 | - $instance = $old_instance; |
|
| 113 | - |
|
| 114 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 115 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 116 | - $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
| 117 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
| 118 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
| 119 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
| 120 | - $instance['character_count'] = $new_instance['character_count']; |
|
| 121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | - else |
|
| 124 | - $instance['add_location_filter'] = '0'; |
|
| 125 | - |
|
| 126 | - return $instance; |
|
| 127 | - } |
|
| 109 | + public function update($new_instance, $old_instance) |
|
| 110 | + { |
|
| 111 | + //save the widget |
|
| 112 | + $instance = $old_instance; |
|
| 113 | + |
|
| 114 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 115 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
| 116 | + $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
| 117 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
| 118 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
| 119 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
| 120 | + $instance['character_count'] = $new_instance['character_count']; |
|
| 121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | + else |
|
| 124 | + $instance['add_location_filter'] = '0'; |
|
| 125 | + |
|
| 126 | + return $instance; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Back-end related listing widget settings form. |
| 131 | 131 | * |
| 132 | 132 | * @since 1.0.0 |
| 133 | - * @since 1.5.1 Declare function public. |
|
| 133 | + * @since 1.5.1 Declare function public. |
|
| 134 | 134 | * |
| 135 | 135 | * @param array $instance Previously saved values from database. |
| 136 | 136 | */ |
| 137 | - public function form($instance) |
|
| 138 | - { |
|
| 139 | - //widgetform in backend |
|
| 140 | - $instance = wp_parse_args((array)$instance, |
|
| 141 | - array('title' => '', |
|
| 142 | - 'list_sort' => '', |
|
| 143 | - 'list_order' => '', |
|
| 144 | - 'post_number' => '5', |
|
| 145 | - 'relate_to' => '', |
|
| 146 | - 'layout' => 'gridview_onehalf', |
|
| 147 | - 'listing_width' => '', |
|
| 148 | - 'add_location_filter' => '1', |
|
| 149 | - 'character_count' => '20') |
|
| 150 | - ); |
|
| 137 | + public function form($instance) |
|
| 138 | + { |
|
| 139 | + //widgetform in backend |
|
| 140 | + $instance = wp_parse_args((array)$instance, |
|
| 141 | + array('title' => '', |
|
| 142 | + 'list_sort' => '', |
|
| 143 | + 'list_order' => '', |
|
| 144 | + 'post_number' => '5', |
|
| 145 | + 'relate_to' => '', |
|
| 146 | + 'layout' => 'gridview_onehalf', |
|
| 147 | + 'listing_width' => '', |
|
| 148 | + 'add_location_filter' => '1', |
|
| 149 | + 'character_count' => '20') |
|
| 150 | + ); |
|
| 151 | 151 | |
| 152 | - $title = strip_tags($instance['title']); |
|
| 152 | + $title = strip_tags($instance['title']); |
|
| 153 | 153 | |
| 154 | - $list_sort = strip_tags($instance['list_sort']); |
|
| 154 | + $list_sort = strip_tags($instance['list_sort']); |
|
| 155 | 155 | |
| 156 | - $list_order = strip_tags($instance['list_order']); |
|
| 156 | + $list_order = strip_tags($instance['list_order']); |
|
| 157 | 157 | |
| 158 | - $post_number = strip_tags($instance['post_number']); |
|
| 158 | + $post_number = strip_tags($instance['post_number']); |
|
| 159 | 159 | |
| 160 | - $relate_to = strip_tags($instance['relate_to']); |
|
| 160 | + $relate_to = strip_tags($instance['relate_to']); |
|
| 161 | 161 | |
| 162 | - $layout = strip_tags($instance['layout']); |
|
| 162 | + $layout = strip_tags($instance['layout']); |
|
| 163 | 163 | |
| 164 | - $listing_width = strip_tags($instance['listing_width']); |
|
| 164 | + $listing_width = strip_tags($instance['listing_width']); |
|
| 165 | 165 | |
| 166 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 166 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 167 | 167 | |
| 168 | - $character_count = $instance['character_count']; |
|
| 168 | + $character_count = $instance['character_count']; |
|
| 169 | 169 | |
| 170 | - ?> |
|
| 170 | + ?> |
|
| 171 | 171 | <p> |
| 172 | 172 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
| 173 | 173 | |
@@ -184,24 +184,24 @@ discard block |
||
| 184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
| 185 | 185 | |
| 186 | 186 | <option <?php if ($list_sort == 'latest') { |
| 187 | - echo 'selected="selected"'; |
|
| 188 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
| 187 | + echo 'selected="selected"'; |
|
| 188 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
| 189 | 189 | |
| 190 | 190 | <option <?php if ($list_sort == 'featured') { |
| 191 | - echo 'selected="selected"'; |
|
| 192 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
| 191 | + echo 'selected="selected"'; |
|
| 192 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
| 193 | 193 | |
| 194 | 194 | <option <?php if ($list_sort == 'high_review') { |
| 195 | - echo 'selected="selected"'; |
|
| 196 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
| 195 | + echo 'selected="selected"'; |
|
| 196 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
| 197 | 197 | |
| 198 | 198 | <option <?php if ($list_sort == 'high_rating') { |
| 199 | - echo 'selected="selected"'; |
|
| 200 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
| 199 | + echo 'selected="selected"'; |
|
| 200 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
| 201 | 201 | |
| 202 | 202 | <option <?php if ($list_sort == 'random') { |
| 203 | - echo 'selected="selected"'; |
|
| 204 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
| 203 | + echo 'selected="selected"'; |
|
| 204 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
| 205 | 205 | |
| 206 | 206 | </select> |
| 207 | 207 | </label> |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
| 222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
| 223 | 223 | <option <?php if ($relate_to == 'category') { |
| 224 | - echo 'selected="selected"'; |
|
| 225 | - } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
| 224 | + echo 'selected="selected"'; |
|
| 225 | + } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
| 226 | 226 | <option <?php if ($relate_to == 'tags') { |
| 227 | - echo 'selected="selected"'; |
|
| 228 | - } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
| 227 | + echo 'selected="selected"'; |
|
| 228 | + } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
| 229 | 229 | </select> |
| 230 | 230 | </label> |
| 231 | 231 | </p> |
@@ -236,24 +236,24 @@ discard block |
||
| 236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
| 237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
| 238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
| 239 | - echo 'selected="selected"'; |
|
| 240 | - } ?> |
|
| 239 | + echo 'selected="selected"'; |
|
| 240 | + } ?> |
|
| 241 | 241 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
| 242 | 242 | <option <?php if ($layout == 'gridview_onethird') { |
| 243 | - echo 'selected="selected"'; |
|
| 244 | - } ?> |
|
| 243 | + echo 'selected="selected"'; |
|
| 244 | + } ?> |
|
| 245 | 245 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
| 246 | 246 | <option <?php if ($layout == 'gridview_onefourth') { |
| 247 | - echo 'selected="selected"'; |
|
| 248 | - } ?> |
|
| 247 | + echo 'selected="selected"'; |
|
| 248 | + } ?> |
|
| 249 | 249 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
| 250 | 250 | <option <?php if ($layout == 'gridview_onefifth') { |
| 251 | - echo 'selected="selected"'; |
|
| 252 | - } ?> |
|
| 251 | + echo 'selected="selected"'; |
|
| 252 | + } ?> |
|
| 253 | 253 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
| 254 | 254 | <option <?php if ($layout == 'list') { |
| 255 | - echo 'selected="selected"'; |
|
| 256 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
| 255 | + echo 'selected="selected"'; |
|
| 256 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
| 257 | 257 | |
| 258 | 258 | </select> |
| 259 | 259 | </label> |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | </p> |
| 286 | 286 | |
| 287 | 287 | <?php |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | } // class geodir_related_listing_postview |
| 290 | 290 | |
| 291 | 291 | register_widget('geodir_related_listing_postview'); |
| 292 | 292 | \ No newline at end of file |
@@ -118,10 +118,11 @@ discard block |
||
| 118 | 118 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
| 119 | 119 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
| 120 | 120 | $instance['character_count'] = $new_instance['character_count']; |
| 121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | - else |
|
| 124 | - $instance['add_location_filter'] = '0'; |
|
| 121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
| 122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 123 | + } else { |
|
| 124 | + $instance['add_location_filter'] = '0'; |
|
| 125 | + } |
|
| 125 | 126 | |
| 126 | 127 | return $instance; |
| 127 | 128 | } |
@@ -279,7 +280,10 @@ discard block |
||
| 279 | 280 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 280 | 281 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
| 281 | 282 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 283 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
| 284 | + echo 'checked="checked"'; |
|
| 285 | +} |
|
| 286 | +?> |
|
| 283 | 287 | value="1"/> |
| 284 | 288 | </label> |
| 285 | 289 | </p> |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | public function form($instance) |
| 119 | 119 | {
|
| 120 | 120 | //widgetform in backend |
| 121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
|
|
| 121 | + $instance = wp_parse_args((array) $instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
|
|
| 122 | 122 | $title = strip_tags($instance['title']); |
| 123 | 123 | $count = strip_tags($instance['count']); |
| 124 | 124 | ?> |
@@ -14,37 +14,37 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_recent_reviews_widget extends WP_Widget |
| 16 | 16 | {
|
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Register the recent reviews widget. |
| 19 | 19 | * |
| 20 | 20 | * @since 1.0.0 |
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | 22 | */ |
| 23 | - public function __construct() {
|
|
| 24 | - $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
|
|
| 25 | - parent::__construct( |
|
| 26 | - 'geodir_recent_reviews', // Base ID |
|
| 27 | - __('GD > Recent Reviews', 'geodirectory'), // Name
|
|
| 28 | - $widget_ops// Args |
|
| 29 | - ); |
|
| 30 | - } |
|
| 23 | + public function __construct() {
|
|
| 24 | + $widget_ops = array('classname' => 'geodir_recent_reviews', 'description' => __('GD > Recent Reviews', 'geodirectory'));
|
|
| 25 | + parent::__construct( |
|
| 26 | + 'geodir_recent_reviews', // Base ID |
|
| 27 | + __('GD > Recent Reviews', 'geodirectory'), // Name
|
|
| 28 | + $widget_ops// Args |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Front-end display content for recent reviews widget. |
| 34 | 34 | * |
| 35 | 35 | * @since 1.0.0 |
| 36 | - * @since 1.5.1 Declare function public. |
|
| 36 | + * @since 1.5.1 Declare function public. |
|
| 37 | 37 | * |
| 38 | 38 | * @param array $args Widget arguments. |
| 39 | 39 | * @param array $instance Saved values from database. |
| 40 | 40 | */ |
| 41 | 41 | public function widget($args, $instance) |
| 42 | - {
|
|
| 43 | - // prints the widget |
|
| 44 | - extract($args, EXTR_SKIP); |
|
| 42 | + {
|
|
| 43 | + // prints the widget |
|
| 44 | + extract($args, EXTR_SKIP); |
|
| 45 | 45 | |
| 46 | - /** This filter is documented in geodirectory_widgets.php */ |
|
| 47 | - $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 46 | + /** This filter is documented in geodirectory_widgets.php */ |
|
| 47 | + $title = empty($instance['title']) ? '' : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
|
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Filter the number of reviews to display. |
@@ -63,35 +63,35 @@ discard block |
||
| 63 | 63 | * @param int $g_size Height and width of the avatar image in pixels. Default 30. |
| 64 | 64 | */ |
| 65 | 65 | $g_size = apply_filters('geodir_recent_reviews_g_size', 30);
|
| 66 | - /** |
|
| 67 | - * Filter the excerpt length |
|
| 68 | - * |
|
| 69 | - * @since 1.0.0 |
|
| 70 | - * |
|
| 71 | - * @param int $excerpt_length Excerpt length. Default 100. |
|
| 72 | - */ |
|
| 73 | - $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
|
|
| 74 | - $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
| 66 | + /** |
|
| 67 | + * Filter the excerpt length |
|
| 68 | + * |
|
| 69 | + * @since 1.0.0 |
|
| 70 | + * |
|
| 71 | + * @param int $excerpt_length Excerpt length. Default 100. |
|
| 72 | + */ |
|
| 73 | + $excerpt_length = apply_filters('geodir_recent_reviews_excerpt_length', 100);
|
|
| 74 | + $comments_li = geodir_get_recent_reviews($g_size, $count, $excerpt_length, false); |
|
| 75 | 75 | |
| 76 | - if ($comments_li) {
|
|
| 77 | - echo $before_widget; |
|
| 78 | - ?> |
|
| 76 | + if ($comments_li) {
|
|
| 77 | + echo $before_widget; |
|
| 78 | + ?> |
|
| 79 | 79 | <div class="widget geodir_recent_reviews_section"> |
| 80 | 80 | <?php if ($title) {
|
| 81 | - echo $before_title . $title . $after_title; |
|
| 82 | - } ?> |
|
| 81 | + echo $before_title . $title . $after_title; |
|
| 82 | + } ?> |
|
| 83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
| 84 | 84 | </div> |
| 85 | 85 | <?php |
| 86 | - echo $after_widget; |
|
| 87 | - } |
|
| 88 | - } |
|
| 86 | + echo $after_widget; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Sanitize recent reviews widget form values as they are saved. |
| 92 | 92 | * |
| 93 | 93 | * @since 1.0.0 |
| 94 | - * @since 1.5.1 Declare function public. |
|
| 94 | + * @since 1.5.1 Declare function public. |
|
| 95 | 95 | * |
| 96 | 96 | * @param array $new_instance Values just sent to be saved. |
| 97 | 97 | * @param array $old_instance Previously saved values from database. |
@@ -99,29 +99,29 @@ discard block |
||
| 99 | 99 | * @return array Updated safe values to be saved. |
| 100 | 100 | */ |
| 101 | 101 | public function update($new_instance, $old_instance) |
| 102 | - {
|
|
| 103 | - //save the widget |
|
| 104 | - $instance = $old_instance; |
|
| 105 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 106 | - $instance['count'] = strip_tags($new_instance['count']); |
|
| 107 | - return $instance; |
|
| 108 | - } |
|
| 102 | + {
|
|
| 103 | + //save the widget |
|
| 104 | + $instance = $old_instance; |
|
| 105 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 106 | + $instance['count'] = strip_tags($new_instance['count']); |
|
| 107 | + return $instance; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Back-end recent reviews widget settings form. |
| 112 | 112 | * |
| 113 | 113 | * @since 1.0.0 |
| 114 | - * @since 1.5.1 Declare function public. |
|
| 114 | + * @since 1.5.1 Declare function public. |
|
| 115 | 115 | * |
| 116 | 116 | * @param array $instance Previously saved values from database. |
| 117 | 117 | */ |
| 118 | 118 | public function form($instance) |
| 119 | - {
|
|
| 120 | - //widgetform in backend |
|
| 121 | - $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
|
|
| 122 | - $title = strip_tags($instance['title']); |
|
| 123 | - $count = strip_tags($instance['count']); |
|
| 124 | - ?> |
|
| 119 | + {
|
|
| 120 | + //widgetform in backend |
|
| 121 | + $instance = wp_parse_args((array)$instance, array('title' => '', 't1' => '', 't2' => '', 't3' => '', 'img1' => '', 'count' => ''));
|
|
| 122 | + $title = strip_tags($instance['title']); |
|
| 123 | + $count = strip_tags($instance['count']); |
|
| 124 | + ?> |
|
| 125 | 125 | <p><label for="<?php echo $this->get_field_id('title'); ?>">Widget Title: <input class="widefat"
|
| 126 | 126 | id="<?php echo $this->get_field_id('title'); ?>"
|
| 127 | 127 | name="<?php echo $this->get_field_name('title'); ?>"
|
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | value="<?php echo esc_attr($count); ?>"/></label> |
| 136 | 136 | </p> |
| 137 | 137 | <?php |
| 138 | - } |
|
| 138 | + } |
|
| 139 | 139 | } // class geodir_recent_reviews_widget |
| 140 | 140 | |
| 141 | 141 | register_widget('geodir_recent_reviews_widget'); |
| 142 | 142 | \ No newline at end of file |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | {
|
| 129 | 129 | //widgetform in backend |
| 130 | 130 | |
| 131 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0'));
|
|
| 131 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0'));
|
|
| 132 | 132 | $width = strip_tags($instance['width']); |
| 133 | 133 | $heigh = strip_tags($instance['heigh']); |
| 134 | 134 | $maptype = strip_tags($instance['maptype']); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 174 | 174 | echo 'selected="selected"'; |
| 175 | 175 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
| 176 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
| 176 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
| 177 | 177 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 178 | 178 | </select> |
| 179 | 179 | </label> |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | : |
| 221 | 221 | <input id="<?php echo $this->get_field_id('child_collapse'); ?>"
|
| 222 | 222 | name="<?php echo $this->get_field_name('child_collapse'); ?>" type="checkbox" value="1"
|
| 223 | - <?php if ($child_collapse){ ?>checked="checked" <?php } ?> />
|
|
| 223 | + <?php if ($child_collapse) { ?>checked="checked" <?php } ?> />
|
|
| 224 | 224 | </label> |
| 225 | 225 | </p> |
| 226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | : |
| 231 | 231 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
|
| 232 | 232 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
|
| 233 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> />
|
|
| 233 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> />
|
|
| 234 | 234 | </label> |
| 235 | 235 | </p> |
| 236 | 236 | |
@@ -192,8 +192,9 @@ |
||
| 192 | 192 | |
| 193 | 193 | foreach ($map_zoom_level as $level) {
|
| 194 | 194 | $selected = ''; |
| 195 | - if ($level == $zoom) |
|
| 196 | - $selected = 'selected="selected"'; |
|
| 195 | + if ($level == $zoom) { |
|
| 196 | + $selected = 'selected="selected"'; |
|
| 197 | + } |
|
| 197 | 198 | |
| 198 | 199 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
| 199 | 200 | |
@@ -16,126 +16,126 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class geodir_homepage_map extends WP_Widget |
| 18 | 18 | {
|
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * Register the home page map widget. |
| 21 | 21 | * |
| 22 | 22 | * @since 1.0.0 |
| 23 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 23 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 24 | 24 | */ |
| 25 | - public function __construct() {
|
|
| 26 | - $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory'));
|
|
| 27 | - parent::__construct( |
|
| 28 | - 'geodir_map_v3_home_map', // Base ID |
|
| 29 | - __('GD > GMap - Home page', 'geodirectory'), // Name
|
|
| 30 | - $widget_ops// Args |
|
| 31 | - ); |
|
| 32 | - } |
|
| 25 | + public function __construct() {
|
|
| 26 | + $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory'));
|
|
| 27 | + parent::__construct( |
|
| 28 | + 'geodir_map_v3_home_map', // Base ID |
|
| 29 | + __('GD > GMap - Home page', 'geodirectory'), // Name
|
|
| 30 | + $widget_ops// Args |
|
| 31 | + ); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Front-end display content for home page map widget. |
| 36 | 36 | * |
| 37 | 37 | * @since 1.0.0 |
| 38 | - * @since 1.5.1 Declare function public. |
|
| 38 | + * @since 1.5.1 Declare function public. |
|
| 39 | 39 | * |
| 40 | 40 | * @param array $args Widget arguments. |
| 41 | 41 | * @param array $instance Saved values from database. |
| 42 | 42 | */ |
| 43 | - public function widget($args, $instance) |
|
| 44 | - {
|
|
| 45 | - extract($args, EXTR_SKIP); |
|
| 46 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 47 | - $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']);
|
|
| 48 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 49 | - $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 50 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 51 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 52 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 53 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 54 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 55 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 56 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 57 | - $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']);
|
|
| 58 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 59 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 43 | + public function widget($args, $instance) |
|
| 44 | + {
|
|
| 45 | + extract($args, EXTR_SKIP); |
|
| 46 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 47 | + $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']);
|
|
| 48 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 49 | + $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 50 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 51 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 52 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 53 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 54 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 55 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 56 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 57 | + $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']);
|
|
| 58 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 59 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 60 | 60 | |
| 61 | - $map_args = array(); |
|
| 62 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ;
|
|
| 63 | - $map_args['width'] = $width; |
|
| 64 | - $map_args['height'] = $height; |
|
| 65 | - $map_args['maptype'] = $maptype; |
|
| 66 | - $map_args['scrollwheel'] = $scrollwheel; |
|
| 67 | - $map_args['zoom'] = $zoom; |
|
| 68 | - $map_args['autozoom'] = $autozoom; |
|
| 69 | - $map_args['child_collapse'] = $child_collapse; |
|
| 70 | - $map_args['enable_cat_filters'] = true; |
|
| 71 | - $map_args['enable_text_search'] = true; |
|
| 72 | - $map_args['enable_post_type_filters'] = true; |
|
| 73 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 74 | - $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false);
|
|
| 75 | - $map_args['enable_jason_on_load'] = false; |
|
| 76 | - $map_args['enable_marker_cluster'] = false; |
|
| 77 | - $map_args['enable_map_resize_button'] = true; |
|
| 78 | - $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
| 61 | + $map_args = array(); |
|
| 62 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ;
|
|
| 63 | + $map_args['width'] = $width; |
|
| 64 | + $map_args['height'] = $height; |
|
| 65 | + $map_args['maptype'] = $maptype; |
|
| 66 | + $map_args['scrollwheel'] = $scrollwheel; |
|
| 67 | + $map_args['zoom'] = $zoom; |
|
| 68 | + $map_args['autozoom'] = $autozoom; |
|
| 69 | + $map_args['child_collapse'] = $child_collapse; |
|
| 70 | + $map_args['enable_cat_filters'] = true; |
|
| 71 | + $map_args['enable_text_search'] = true; |
|
| 72 | + $map_args['enable_post_type_filters'] = true; |
|
| 73 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 74 | + $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false);
|
|
| 75 | + $map_args['enable_jason_on_load'] = false; |
|
| 76 | + $map_args['enable_marker_cluster'] = false; |
|
| 77 | + $map_args['enable_map_resize_button'] = true; |
|
| 78 | + $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
| 79 | 79 | |
| 80 | - $is_geodir_home_map_widget = true; |
|
| 81 | - $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
| 80 | + $is_geodir_home_map_widget = true; |
|
| 81 | + $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
| 82 | 82 | |
| 83 | - geodir_draw_map($map_args); |
|
| 83 | + geodir_draw_map($map_args); |
|
| 84 | 84 | |
| 85 | - /* home map post type slider */ |
|
| 86 | - if ($is_geodir_home_map_widget) {
|
|
| 87 | - add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100);
|
|
| 88 | - } |
|
| 85 | + /* home map post type slider */ |
|
| 86 | + if ($is_geodir_home_map_widget) {
|
|
| 87 | + add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100);
|
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * Sanitize home page map widget form values as they are saved. |
| 94 | 94 | * |
| 95 | 95 | * @since 1.0.0 |
| 96 | - * @since 1.5.1 Declare function public. |
|
| 96 | + * @since 1.5.1 Declare function public. |
|
| 97 | 97 | * |
| 98 | 98 | * @param array $new_instance Values just sent to be saved. |
| 99 | 99 | * @param array $old_instance Previously saved values from database. |
| 100 | 100 | * |
| 101 | 101 | * @return array Updated safe values to be saved. |
| 102 | 102 | */ |
| 103 | - public function update($new_instance, $old_instance) |
|
| 104 | - {
|
|
| 105 | - //save the widget |
|
| 106 | - $instance = $old_instance; |
|
| 107 | - $instance['width'] = strip_tags($new_instance['width']); |
|
| 108 | - $instance['heigh'] = ($new_instance['heigh']); |
|
| 109 | - $instance['maptype'] = ($new_instance['maptype']); |
|
| 110 | - $instance['zoom'] = ($new_instance['zoom']); |
|
| 111 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 112 | - $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
| 113 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 103 | + public function update($new_instance, $old_instance) |
|
| 104 | + {
|
|
| 105 | + //save the widget |
|
| 106 | + $instance = $old_instance; |
|
| 107 | + $instance['width'] = strip_tags($new_instance['width']); |
|
| 108 | + $instance['heigh'] = ($new_instance['heigh']); |
|
| 109 | + $instance['maptype'] = ($new_instance['maptype']); |
|
| 110 | + $instance['zoom'] = ($new_instance['zoom']); |
|
| 111 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 112 | + $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
| 113 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 114 | 114 | |
| 115 | - return $instance; |
|
| 116 | - } |
|
| 115 | + return $instance; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Back-end home page map widget settings form. |
| 120 | 120 | * |
| 121 | 121 | * @since 1.0.0 |
| 122 | - * @since 1.5.1 Declare function public. |
|
| 122 | + * @since 1.5.1 Declare function public. |
|
| 123 | 123 | * |
| 124 | 124 | * @param array $instance Previously saved values from database. |
| 125 | 125 | */ |
| 126 | - public function form($instance) |
|
| 127 | - {
|
|
| 128 | - //widgetform in backend |
|
| 126 | + public function form($instance) |
|
| 127 | + {
|
|
| 128 | + //widgetform in backend |
|
| 129 | 129 | |
| 130 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0'));
|
|
| 131 | - $width = strip_tags($instance['width']); |
|
| 132 | - $heigh = strip_tags($instance['heigh']); |
|
| 133 | - $maptype = strip_tags($instance['maptype']); |
|
| 134 | - $zoom = strip_tags($instance['zoom']); |
|
| 135 | - $autozoom = strip_tags($instance['autozoom']); |
|
| 136 | - $child_collapse = strip_tags($instance['child_collapse']); |
|
| 137 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 138 | - ?> |
|
| 130 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0'));
|
|
| 131 | + $width = strip_tags($instance['width']); |
|
| 132 | + $heigh = strip_tags($instance['heigh']); |
|
| 133 | + $maptype = strip_tags($instance['maptype']); |
|
| 134 | + $zoom = strip_tags($instance['zoom']); |
|
| 135 | + $autozoom = strip_tags($instance['autozoom']); |
|
| 136 | + $child_collapse = strip_tags($instance['child_collapse']); |
|
| 137 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 138 | + ?> |
|
| 139 | 139 | |
| 140 | 140 | <p> |
| 141 | 141 | <label |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | name="<?php echo $this->get_field_name('maptype'); ?>">
|
| 165 | 165 | |
| 166 | 166 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
|
| 167 | - echo 'selected="selected"'; |
|
| 168 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 167 | + echo 'selected="selected"'; |
|
| 168 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 169 | 169 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
|
| 170 | - echo 'selected="selected"'; |
|
| 171 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 170 | + echo 'selected="selected"'; |
|
| 171 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 172 | 172 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 173 | - echo 'selected="selected"'; |
|
| 174 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 173 | + echo 'selected="selected"'; |
|
| 174 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 175 | 175 | <option <?php selected($maptype, 'TERRAIN');?> |
| 176 | 176 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 177 | 177 | </select> |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | </p> |
| 180 | 180 | |
| 181 | 181 | <?php |
| 182 | - $map_zoom_level = geodir_map_zoom_level(); |
|
| 183 | - ?> |
|
| 182 | + $map_zoom_level = geodir_map_zoom_level(); |
|
| 183 | + ?> |
|
| 184 | 184 | |
| 185 | 185 | <p> |
| 186 | 186 | <label |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
|
| 190 | 190 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
|
| 191 | 191 | |
| 192 | - foreach ($map_zoom_level as $level) {
|
|
| 193 | - $selected = ''; |
|
| 194 | - if ($level == $zoom) |
|
| 195 | - $selected = 'selected="selected"'; |
|
| 192 | + foreach ($map_zoom_level as $level) {
|
|
| 193 | + $selected = ''; |
|
| 194 | + if ($level == $zoom) |
|
| 195 | + $selected = 'selected="selected"'; |
|
| 196 | 196 | |
| 197 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 197 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 198 | 198 | |
| 199 | - } ?> |
|
| 199 | + } ?> |
|
| 200 | 200 | |
| 201 | 201 | </select> |
| 202 | 202 | </label> |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | : |
| 210 | 210 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
|
| 211 | 211 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
|
| 212 | - echo 'checked="checked"'; |
|
| 213 | - } ?> /></label> |
|
| 212 | + echo 'checked="checked"'; |
|
| 213 | + } ?> /></label> |
|
| 214 | 214 | </p> |
| 215 | 215 | |
| 216 | 216 | <p> |
@@ -234,17 +234,17 @@ discard block |
||
| 234 | 234 | </p> |
| 235 | 235 | |
| 236 | 236 | <?php |
| 237 | - } |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - /** |
|
| 239 | + /** |
|
| 240 | 240 | * Adds the javascript in the footer for home page map widget. |
| 241 | 241 | * |
| 242 | 242 | * @since 1.0.0 |
| 243 | - * @since 1.5.1 Declare function public. |
|
| 243 | + * @since 1.5.1 Declare function public. |
|
| 244 | 244 | */ |
| 245 | - public function geodir_home_map_add_script() |
|
| 246 | - {
|
|
| 247 | - ?> |
|
| 245 | + public function geodir_home_map_add_script() |
|
| 246 | + {
|
|
| 247 | + ?> |
|
| 248 | 248 | <script type="text/javascript"> |
| 249 | 249 | jQuery(document).ready(function () {
|
| 250 | 250 | geoDirMapSlide(); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | </script> |
| 319 | 319 | <?php |
| 320 | - } |
|
| 320 | + } |
|
| 321 | 321 | } // class geodir_homepage_map |
| 322 | 322 | |
| 323 | 323 | register_widget('geodir_homepage_map');
|