@@ -126,8 +126,10 @@ |
||
| 126 | 126 | $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
| 127 | 127 | if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
| 128 | 128 | return $matches[0]; |
| 129 | - } else return ''; |
|
| 130 | -} |
|
| 129 | + } else { |
|
| 130 | + return ''; |
|
| 131 | + } |
|
| 132 | + } |
|
| 131 | 133 | |
| 132 | 134 | |
| 133 | 135 | /** |
@@ -16,36 +16,36 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function multi_news_action_calls() |
| 18 | 18 | { |
| 19 | - // REMOVE BREADCRUMB |
|
| 20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | - |
|
| 27 | - //ADD BREADCRUMS |
|
| 28 | - add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 29 | - add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 30 | - add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 31 | - add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 32 | - //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 33 | - add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - // fix breadcrums |
|
| 37 | - add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
| 38 | - |
|
| 39 | - // REMOVE PAGE TITLES |
|
| 40 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 41 | - // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
| 42 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 43 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 44 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
| 48 | - add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
| 19 | + // REMOVE BREADCRUMB |
|
| 20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | + |
|
| 27 | + //ADD BREADCRUMS |
|
| 28 | + add_action('geodir_detail_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 29 | + add_action('geodir_listings_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 30 | + add_action('geodir_author_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 31 | + add_action('geodir_search_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 32 | + //add_action('geodir_home_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 33 | + add_action('geodir_location_before_main_content', 'gd_mn_replace_breadcrums', 20); |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + // fix breadcrums |
|
| 37 | + add_filter('breadcrumbs_plus_items', 'gd_breadcrumbs_plus_items', 1); |
|
| 38 | + |
|
| 39 | + // REMOVE PAGE TITLES |
|
| 40 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 41 | + // remove_action( 'geodir_add_listing_page_title', 'geodir_action_add_listing_page_title',10); |
|
| 42 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 43 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 44 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + add_action('geodir_wrapper_content_open', 'gd_mn_extra_wrap', 30, 1); |
|
| 48 | + add_action('geodir_wrapper_content_close', 'gd_mn_extra_wrap_end', 3, 1); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | function gd_mn_extra_wrap($page) |
| 59 | 59 | { |
| 60 | - if ($page == 'add-listing-page') { |
|
| 61 | - echo '<div class="site-content page-wrap">'; |
|
| 62 | - } elseif ($page == 'signup-page') { |
|
| 63 | - echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
| 64 | - } |
|
| 60 | + if ($page == 'add-listing-page') { |
|
| 61 | + echo '<div class="site-content page-wrap">'; |
|
| 62 | + } elseif ($page == 'signup-page') { |
|
| 63 | + echo '</div><div class="section full-width-section" style="float: left;width:100%;">'; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function gd_mn_extra_wrap_end($page) |
| 77 | 77 | { |
| 78 | - if ($page == 'add-listing-page') { |
|
| 79 | - echo '</div>'; |
|
| 80 | - } |
|
| 78 | + if ($page == 'add-listing-page') { |
|
| 79 | + echo '</div>'; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | function gd_mn_replace_breadcrums() |
| 92 | 92 | { |
| 93 | 93 | |
| 94 | - if (mom_option('breadcrumb') != 0) { ?> |
|
| 94 | + if (mom_option('breadcrumb') != 0) { ?> |
|
| 95 | 95 | <?php if (mom_option('cats_bread')) { |
| 96 | - $cclass = ''; |
|
| 97 | - if (mom_option('cat_slider') == false) { |
|
| 98 | - $cclass = 'post-crumbs '; |
|
| 99 | - } |
|
| 100 | - ?> |
|
| 96 | + $cclass = ''; |
|
| 97 | + if (mom_option('cat_slider') == false) { |
|
| 98 | + $cclass = 'post-crumbs '; |
|
| 99 | + } |
|
| 100 | + ?> |
|
| 101 | 101 | <div class="<?php echo $cclass; ?>entry-crumbs" xmlns:v="http://rdf.data-vocabulary.org/#"> |
| 102 | 102 | |
| 103 | 103 | <?php mom_breadcrumb(); ?> |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | function gd_get_breadcrum_links() |
| 121 | 121 | { |
| 122 | - ob_start(); |
|
| 123 | - geodir_breadcrumb(); |
|
| 124 | - $crums = ob_get_contents(); |
|
| 125 | - ob_get_clean(); |
|
| 126 | - $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
| 127 | - if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
| 128 | - return $matches[0]; |
|
| 129 | - } else return ''; |
|
| 122 | + ob_start(); |
|
| 123 | + geodir_breadcrumb(); |
|
| 124 | + $crums = ob_get_contents(); |
|
| 125 | + ob_get_clean(); |
|
| 126 | + $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; |
|
| 127 | + if (preg_match_all("/$regexp/siU", $crums, $matches)) { |
|
| 128 | + return $matches[0]; |
|
| 129 | + } else return ''; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
@@ -140,30 +140,30 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | function gd_breadcrumbs_plus_items($items) |
| 142 | 142 | { //print_r($items);exit; |
| 143 | - $bits = array(); |
|
| 144 | - $pieces = gd_get_breadcrum_links(); |
|
| 145 | - //unset($pieces[0]); |
|
| 146 | - $bits = $pieces; |
|
| 143 | + $bits = array(); |
|
| 144 | + $pieces = gd_get_breadcrum_links(); |
|
| 145 | + //unset($pieces[0]); |
|
| 146 | + $bits = $pieces; |
|
| 147 | 147 | |
| 148 | - $title = $items['last']; |
|
| 149 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 148 | + $title = $items['last']; |
|
| 149 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 150 | 150 | |
| 151 | - } elseif (geodir_is_page('listing')) { |
|
| 151 | + } elseif (geodir_is_page('listing')) { |
|
| 152 | 152 | |
| 153 | - } elseif (geodir_is_page('detail')) { |
|
| 154 | - ob_start(); |
|
| 155 | - geodir_action_page_title(); |
|
| 156 | - $title = ob_get_contents(); |
|
| 157 | - ob_end_clean(); |
|
| 158 | - } elseif (geodir_is_page('search')) { |
|
| 159 | - } elseif (geodir_is_page('author')) { |
|
| 160 | - } |
|
| 153 | + } elseif (geodir_is_page('detail')) { |
|
| 154 | + ob_start(); |
|
| 155 | + geodir_action_page_title(); |
|
| 156 | + $title = ob_get_contents(); |
|
| 157 | + ob_end_clean(); |
|
| 158 | + } elseif (geodir_is_page('search')) { |
|
| 159 | + } elseif (geodir_is_page('author')) { |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - $title = strip_tags($title); |
|
| 163 | - $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
| 162 | + $title = strip_tags($title); |
|
| 163 | + $items = gd_breadcrumbs_plus_items_add($items, $bits, $title); |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | - return $items; |
|
| 166 | + return $items; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
@@ -179,28 +179,28 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | function gd_breadcrumbs_plus_items_add($items, $bits, $last) |
| 181 | 181 | { |
| 182 | - //$pieces = explode("</div>", $items[0]); |
|
| 183 | - if (is_array($bits)) { |
|
| 184 | - $items = array(); |
|
| 185 | - $pieces = ''; |
|
| 186 | - foreach ($bits as $bit) { |
|
| 187 | - $pieces .= $bit; |
|
| 188 | - } |
|
| 189 | - $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
| 190 | - if (isset($last) && $last) { |
|
| 191 | - $items['last'] = $last; |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - //print_r($items); |
|
| 196 | - return $items; |
|
| 182 | + //$pieces = explode("</div>", $items[0]); |
|
| 183 | + if (is_array($bits)) { |
|
| 184 | + $items = array(); |
|
| 185 | + $pieces = ''; |
|
| 186 | + foreach ($bits as $bit) { |
|
| 187 | + $pieces .= $bit; |
|
| 188 | + } |
|
| 189 | + $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
| 190 | + if (isset($last) && $last) { |
|
| 191 | + $items['last'] = $last; |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + //print_r($items); |
|
| 196 | + return $items; |
|
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
| 201 | 201 | add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
| 202 | 202 | function gd_multinews_mobile_menu_caret($html){ |
| 203 | - $html .= '<i class="responsive-caret"></i>'; |
|
| 204 | - return $html; |
|
| 203 | + $html .= '<i class="responsive-caret"></i>'; |
|
| 204 | + return $html; |
|
| 205 | 205 | |
| 206 | 206 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | foreach ($bits as $bit) { |
| 187 | 187 | $pieces .= $bit; |
| 188 | 188 | } |
| 189 | - $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">' . $pieces . "</div>"; |
|
| 189 | + $items[0] = '<div class="vbreadcrumb" typeof="v:Breadcrumb">'.$pieces."</div>"; |
|
| 190 | 190 | if (isset($last) && $last) { |
| 191 | 191 | $items['last'] = $last; |
| 192 | 192 | } |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | -add_filter('geodir_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
|
| 201 | -add_filter('geodir_location_switcher_menu_after_sub_ul','gd_multinews_mobile_menu_caret',10,1); |
|
| 202 | -function gd_multinews_mobile_menu_caret($html){ |
|
| 200 | +add_filter('geodir_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1); |
|
| 201 | +add_filter('geodir_location_switcher_menu_after_sub_ul', 'gd_multinews_mobile_menu_caret', 10, 1); |
|
| 202 | +function gd_multinews_mobile_menu_caret($html) { |
|
| 203 | 203 | $html .= '<i class="responsive-caret"></i>'; |
| 204 | 204 | return $html; |
| 205 | 205 | |
@@ -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 |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | $productlink = get_permalink($post_id); |
| 25 | 25 | $siteName = get_bloginfo('name');
|
| 26 | 26 | $siteurl = home_url(); |
| 27 | - $siteurl_link = '<a href="' . $siteurl . '">' . $siteurl . '</a>'; |
|
| 27 | + $siteurl_link = '<a href="'.$siteurl.'">'.$siteurl.'</a>'; |
|
| 28 | 28 | |
| 29 | 29 | $loginurl = geodir_login_url(); |
| 30 | - $loginurl_link = '<a href="' . $loginurl . '">login</a>'; |
|
| 30 | + $loginurl_link = '<a href="'.$loginurl.'">login</a>'; |
|
| 31 | 31 | |
| 32 | 32 | $post_author = $post_info->post_author; |
| 33 | 33 | |
@@ -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 | |
@@ -356,10 +356,11 @@ discard block |
||
| 356 | 356 | $instance['character_count'] = $new_instance['character_count']; |
| 357 | 357 | $instance['tab_layout'] = $new_instance['tab_layout']; |
| 358 | 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'; |
|
| 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 | + } |
|
| 363 | 364 | $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
| 364 | 365 | return $instance; |
| 365 | 366 | } |
@@ -510,7 +511,10 @@ discard block |
||
| 510 | 511 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 511 | 512 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
| 512 | 513 | <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"';?> |
|
| 514 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
| 515 | + echo 'checked="checked"'; |
|
| 516 | +} |
|
| 517 | +?> |
|
| 514 | 518 | value="1"/> |
| 515 | 519 | </label> |
| 516 | 520 | </p> |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | * @param string $instance ['tab_layout'] Best of widget tab layout name. |
| 52 | 52 | */ |
| 53 | 53 | $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
| 54 | - echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
| 54 | + echo '<div class="bestof-widget-tab-layout '.$tab_layout.'">'; |
|
| 55 | 55 | echo $before_widget; |
| 56 | 56 | $loc_terms = geodir_get_current_location_terms(); |
| 57 | 57 | if (!empty($loc_terms)) { |
| 58 | - $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 58 | + $cur_location = ' : '.geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 59 | 59 | } else { |
| 60 | 60 | $cur_location = ''; |
| 61 | 61 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @param string $instance ['title'] The widget title. |
| 78 | 78 | */ |
| 79 | - $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 79 | + $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name').$cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Filter the post type. |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | - echo $before_title . __($title,'geodirectory') . $after_title; |
|
| 205 | + echo $before_title.__($title, 'geodirectory').$after_title; |
|
| 206 | 206 | |
| 207 | 207 | //term navigation - start |
| 208 | 208 | echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
| 214 | 214 | |
| 215 | 215 | if ($is_dropdown) { |
| 216 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
| 216 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="'.esc_attr(__('Select Category', 'geodirectory')).'">'; |
|
| 217 | 217 | } else { |
| 218 | 218 | $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
| 219 | 219 | $nav_html .= '<dt></dt>'; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | if ($is_dropdown) { |
| 232 | 232 | $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
| 233 | - $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
| 233 | + $nav_html .= '<option '.$selected.' value="'.$cat->term_id.'">'.geodir_ucwords($cat->name).'</option>'; |
|
| 234 | 234 | } else { |
| 235 | 235 | if ($cat_count == 1) { |
| 236 | 236 | $nav_html .= '<dd class="geodir-tab-active">'; |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | $nav_html .= '<dd class="">'; |
| 239 | 239 | } |
| 240 | 240 | $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
| 241 | - $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
| 242 | - $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
| 241 | + $nav_html .= '<a data-termid="'.$cat->term_id.'" href="'.get_term_link($cat, $cat->taxonomy).'">'; |
|
| 242 | + $nav_html .= '<img alt="'.$cat->name.' icon" class="bestof-cat-icon" src="'.$term_icon_url.'"/>'; |
|
| 243 | 243 | $nav_html .= '<span>'; |
| 244 | 244 | $nav_html .= geodir_ucwords($cat->name); |
| 245 | 245 | $nav_html .= '<small>'; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if ($num_reviews == 0) { |
| 249 | 249 | $reviews = __('No Reviews', 'geodirectory'); |
| 250 | 250 | } elseif ($num_reviews > 1) { |
| 251 | - $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
| 251 | + $reviews = $num_reviews.__(' Reviews', 'geodirectory'); |
|
| 252 | 252 | } else { |
| 253 | 253 | $reviews = __('1 Review', 'geodirectory'); |
| 254 | 254 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
| 323 | 323 | |
| 324 | - 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>'; |
|
| 324 | + 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>'; |
|
| 325 | 325 | } |
| 326 | 326 | if ($excerpt_type == 'show-reviews') { |
| 327 | 327 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | public function form($instance) |
| 380 | 380 | { |
| 381 | - $instance = wp_parse_args((array)$instance, |
|
| 381 | + $instance = wp_parse_args((array) $instance, |
|
| 382 | 382 | array( |
| 383 | 383 | 'title' => '', |
| 384 | 384 | 'post_type' => '', |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | ?> |
| 405 | 405 | <p> |
| 406 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
| 406 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
| 407 | 407 | |
| 408 | 408 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
| 409 | 409 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | <p> |
| 415 | 415 | <label |
| 416 | - for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
|
| 416 | + for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory'); ?> |
|
| 417 | 417 | |
| 418 | 418 | <?php $postypes = geodir_get_posttypes(); |
| 419 | 419 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | <p> |
| 446 | 446 | |
| 447 | 447 | <label |
| 448 | - for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
| 448 | + for="<?php echo $this->get_field_id('post_limit'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
| 449 | 449 | |
| 450 | 450 | <input class="widefat" id="<?php echo $this->get_field_id('post_limit'); ?>" |
| 451 | 451 | name="<?php echo $this->get_field_name('post_limit'); ?>" type="text" |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | <p> |
| 457 | 457 | |
| 458 | 458 | <label |
| 459 | - for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory');?> |
|
| 459 | + for="<?php echo $this->get_field_id('categ_limit'); ?>"><?php _e('Number of categories:', 'geodirectory'); ?> |
|
| 460 | 460 | |
| 461 | 461 | <input class="widefat" id="<?php echo $this->get_field_id('categ_limit'); ?>" |
| 462 | 462 | name="<?php echo $this->get_field_name('categ_limit'); ?>" type="text" |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | <p> |
| 468 | 468 | <label |
| 469 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
| 469 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
| 470 | 470 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
| 471 | 471 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
| 472 | 472 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | </p> |
| 475 | 475 | <p> |
| 476 | 476 | <label |
| 477 | - for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory');?> |
|
| 477 | + for="<?php echo $this->get_field_id('tab_layout'); ?>"><?php _e('Tab Layout:', 'geodirectory'); ?> |
|
| 478 | 478 | |
| 479 | 479 | <select class="widefat" id="<?php echo $this->get_field_id('tab_layout'); ?>" |
| 480 | 480 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | <p> |
| 497 | 497 | <label |
| 498 | - for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory');?> |
|
| 498 | + for="<?php echo $this->get_field_id('excerpt_type'); ?>"><?php _e('Excerpt Type:', 'geodirectory'); ?> |
|
| 499 | 499 | |
| 500 | 500 | <select class="widefat" id="<?php echo $this->get_field_id('excerpt_type'); ?>" |
| 501 | 501 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
@@ -512,9 +512,9 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | <p> |
| 514 | 514 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 515 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
| 515 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
| 516 | 516 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 517 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 517 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
| 518 | 518 | value="1"/> |
| 519 | 519 | </label> |
| 520 | 520 | </p> |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
| 663 | 663 | $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
| 664 | 664 | |
| 665 | - 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>'; |
|
| 665 | + 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>'; |
|
| 666 | 666 | } |
| 667 | 667 | if ($excerpt_type == 'show-reviews') { |
| 668 | 668 | add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
@@ -14,282 +14,282 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_bestof_widget extends WP_Widget |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Register the best of widget with WordPress. |
|
| 19 | - * |
|
| 20 | - * @since 1.3.9 |
|
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | - */ |
|
| 23 | - public function __construct() |
|
| 24 | - { |
|
| 25 | - $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
| 26 | - parent::__construct( |
|
| 27 | - 'bestof_widget', // Base ID |
|
| 28 | - __('GD > Best of widget', 'geodirectory'), // Name |
|
| 29 | - $widget_ops// Args |
|
| 30 | - ); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Front-end display content for best of widget. |
|
| 35 | - * |
|
| 36 | - * @since 1.3.9 |
|
| 37 | - * @since 1.5.1 Added filter to view all link. |
|
| 38 | - * @since 1.5.1 Declare function public. |
|
| 39 | - * |
|
| 40 | - * @param array $args Widget arguments. |
|
| 41 | - * @param array $instance Saved values from database. |
|
| 42 | - */ |
|
| 43 | - public function widget($args, $instance) |
|
| 44 | - { |
|
| 45 | - extract($args); |
|
| 46 | - /** |
|
| 47 | - * Filter the best of widget tab layout. |
|
| 48 | - * |
|
| 49 | - * @since 1.3.9 |
|
| 50 | - * |
|
| 51 | - * @param string $instance ['tab_layout'] Best of widget tab layout name. |
|
| 52 | - */ |
|
| 53 | - $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
|
| 54 | - echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
| 55 | - echo $before_widget; |
|
| 56 | - $loc_terms = geodir_get_current_location_terms(); |
|
| 57 | - if (!empty($loc_terms)) { |
|
| 58 | - $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 59 | - } else { |
|
| 60 | - $cur_location = ''; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Filter the current location name. |
|
| 65 | - * |
|
| 66 | - * @since 1.3.9 |
|
| 67 | - * |
|
| 68 | - * @param string $cur_location Current location name. |
|
| 69 | - */ |
|
| 70 | - $cur_location = apply_filters('bestof_widget_cur_location', $cur_location); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Filter the widget title. |
|
| 74 | - * |
|
| 75 | - * @since 1.3.9 |
|
| 76 | - * |
|
| 77 | - * @param string $instance ['title'] The widget title. |
|
| 78 | - */ |
|
| 79 | - $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Filter the post type. |
|
| 83 | - * |
|
| 84 | - * @since 1.3.9 |
|
| 85 | - * |
|
| 86 | - * @param string $instance ['post_type'] The post type. |
|
| 87 | - */ |
|
| 88 | - $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']); |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Filter the excerpt type. |
|
| 92 | - * |
|
| 93 | - * @since 1.5.4 |
|
| 94 | - * |
|
| 95 | - * @param string $instance ['excerpt_type'] The excerpt type. |
|
| 96 | - */ |
|
| 97 | - $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Filter the listing limit. |
|
| 102 | - * |
|
| 103 | - * @since 1.3.9 |
|
| 104 | - * |
|
| 105 | - * @param int $instance ['post_limit'] No. of posts to display. |
|
| 106 | - */ |
|
| 107 | - $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']); |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Filter the category limit. |
|
| 111 | - * |
|
| 112 | - * @since 1.3.9 |
|
| 113 | - * |
|
| 114 | - * @param int $instance ['categ_limit'] No. of categories to display. |
|
| 115 | - */ |
|
| 116 | - $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']); |
|
| 117 | - $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Filter the use of location filter. |
|
| 121 | - * |
|
| 122 | - * @since 1.3.9 |
|
| 123 | - * |
|
| 124 | - * @param int|bool $instance ['add_location_filter'] Filter listings using current location. |
|
| 125 | - */ |
|
| 126 | - $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']); |
|
| 127 | - |
|
| 128 | - // set post type to current viewing post type |
|
| 129 | - if ($use_viewing_post_type) { |
|
| 130 | - $current_post_type = geodir_get_current_posttype(); |
|
| 131 | - if ($current_post_type != '' && $current_post_type != $post_type) { |
|
| 132 | - $post_type = $current_post_type; |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - if (isset($instance['character_count'])) { |
|
| 137 | - /** |
|
| 138 | - * Filter the widget's excerpt character count. |
|
| 139 | - * |
|
| 140 | - * @since 1.3.9 |
|
| 141 | - * |
|
| 142 | - * @param int $instance ['character_count'] Excerpt character count. |
|
| 143 | - */ |
|
| 144 | - $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']); |
|
| 145 | - } else { |
|
| 146 | - $character_count = ''; |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 150 | - |
|
| 151 | - $term_args = array( |
|
| 152 | - 'hide_empty' => true, |
|
| 153 | - 'parent' => 0 |
|
| 154 | - ); |
|
| 155 | - |
|
| 156 | - $term_args = apply_filters('bestof_widget_term_args', $term_args); |
|
| 157 | - |
|
| 158 | - if (is_tax()) { |
|
| 159 | - $taxonomy = get_query_var('taxonomy'); |
|
| 160 | - $cur_term = get_query_var('term'); |
|
| 161 | - $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
| 162 | - $term_args['parent'] = $term_data->term_id; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - $terms = get_terms($category_taxonomy[0], $term_args); |
|
| 166 | - |
|
| 167 | - $term_reviews = geodir_count_reviews_by_terms(); |
|
| 168 | - $a_terms = array(); |
|
| 169 | - foreach ($terms as $term) { |
|
| 170 | - |
|
| 171 | - |
|
| 172 | - if ($term->count > 0) { |
|
| 173 | - if (isset($term_reviews[$term->term_id])) { |
|
| 174 | - $term->review_count = $term_reviews[$term->term_id]; |
|
| 175 | - } else { |
|
| 176 | - $term->review_count = '0'; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - $a_terms[] = $term; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - |
|
| 185 | - $terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms); |
|
| 186 | - |
|
| 187 | - $query_args = array( |
|
| 188 | - 'posts_per_page' => $post_limit, |
|
| 189 | - 'is_geodir_loop' => true, |
|
| 190 | - 'post_type' => $post_type, |
|
| 191 | - 'gd_location' => $add_location_filter ? true : false, |
|
| 192 | - 'order_by' => 'high_review' |
|
| 193 | - ); |
|
| 194 | - if ($character_count >= 0) { |
|
| 195 | - $query_args['excerpt_length'] = $character_count; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - $layout = array(); |
|
| 199 | - if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
| 200 | - $layout[] = $tab_layout; |
|
| 201 | - } else { |
|
| 202 | - $layout[] = 'bestof-tabs-as-dropdown'; |
|
| 203 | - $layout[] = $tab_layout; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - |
|
| 207 | - echo $before_title . __($title,'geodirectory') . $after_title; |
|
| 208 | - |
|
| 209 | - //term navigation - start |
|
| 210 | - echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
| 211 | - |
|
| 212 | - $final_html = ''; |
|
| 213 | - foreach ($layout as $tab_layout) { |
|
| 214 | - $nav_html = ''; |
|
| 215 | - $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
| 216 | - |
|
| 217 | - if ($is_dropdown) { |
|
| 218 | - $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
| 219 | - } else { |
|
| 220 | - $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
| 221 | - $nav_html .= '<dt></dt>'; |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - |
|
| 225 | - $term_icon = geodir_get_term_icon(); |
|
| 226 | - $cat_count = 0; |
|
| 227 | - if (!empty($terms)) { |
|
| 228 | - foreach ($terms as $cat) { |
|
| 229 | - $cat_count++; |
|
| 230 | - if ($cat_count > $categ_limit) { |
|
| 231 | - break; |
|
| 232 | - } |
|
| 233 | - if ($is_dropdown) { |
|
| 234 | - $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
| 235 | - $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
| 236 | - } else { |
|
| 237 | - if ($cat_count == 1) { |
|
| 238 | - $nav_html .= '<dd class="geodir-tab-active">'; |
|
| 239 | - } else { |
|
| 240 | - $nav_html .= '<dd class="">'; |
|
| 241 | - } |
|
| 242 | - $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
| 243 | - $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
| 244 | - $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
| 245 | - $nav_html .= '<span>'; |
|
| 246 | - $nav_html .= geodir_ucwords($cat->name); |
|
| 247 | - $nav_html .= '<small>'; |
|
| 248 | - if (isset($cat->review_count)) { |
|
| 249 | - $num_reviews = $cat->review_count; |
|
| 250 | - if ($num_reviews == 0) { |
|
| 251 | - $reviews = __('No Reviews', 'geodirectory'); |
|
| 252 | - } elseif ($num_reviews > 1) { |
|
| 253 | - $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
| 254 | - } else { |
|
| 255 | - $reviews = __('1 Review', 'geodirectory'); |
|
| 256 | - } |
|
| 257 | - $nav_html .= $reviews; |
|
| 258 | - } |
|
| 259 | - $nav_html .= '</small>'; |
|
| 260 | - $nav_html .= '</span>'; |
|
| 261 | - $nav_html .= '</a>'; |
|
| 262 | - $nav_html .= '</dd>'; |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - if ($is_dropdown) { |
|
| 268 | - $nav_html .= '</select>'; |
|
| 269 | - } else { |
|
| 270 | - $nav_html .= '</dl>'; |
|
| 271 | - } |
|
| 272 | - $final_html .= $nav_html; |
|
| 273 | - } |
|
| 274 | - if ($terms) { |
|
| 275 | - echo $final_html; |
|
| 276 | - } |
|
| 277 | - echo '</div>'; |
|
| 278 | - //term navigation - end |
|
| 279 | - |
|
| 280 | - //first term listings by default - start |
|
| 281 | - $first_term = ''; |
|
| 282 | - if ($terms) { |
|
| 283 | - $first_term = $terms[0]; |
|
| 284 | - $tax_query = array( |
|
| 285 | - 'taxonomy' => $category_taxonomy[0], |
|
| 286 | - 'field' => 'id', |
|
| 287 | - 'terms' => $first_term->term_id |
|
| 288 | - ); |
|
| 289 | - $query_args['tax_query'] = array($tax_query); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - ?> |
|
| 17 | + /** |
|
| 18 | + * Register the best of widget with WordPress. |
|
| 19 | + * |
|
| 20 | + * @since 1.3.9 |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 22 | + */ |
|
| 23 | + public function __construct() |
|
| 24 | + { |
|
| 25 | + $widget_ops = array('classname' => 'geodir_bestof_widget', 'description' => __('GD > Best of widget', 'geodirectory')); |
|
| 26 | + parent::__construct( |
|
| 27 | + 'bestof_widget', // Base ID |
|
| 28 | + __('GD > Best of widget', 'geodirectory'), // Name |
|
| 29 | + $widget_ops// Args |
|
| 30 | + ); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Front-end display content for best of widget. |
|
| 35 | + * |
|
| 36 | + * @since 1.3.9 |
|
| 37 | + * @since 1.5.1 Added filter to view all link. |
|
| 38 | + * @since 1.5.1 Declare function public. |
|
| 39 | + * |
|
| 40 | + * @param array $args Widget arguments. |
|
| 41 | + * @param array $instance Saved values from database. |
|
| 42 | + */ |
|
| 43 | + public function widget($args, $instance) |
|
| 44 | + { |
|
| 45 | + extract($args); |
|
| 46 | + /** |
|
| 47 | + * Filter the best of widget tab layout. |
|
| 48 | + * |
|
| 49 | + * @since 1.3.9 |
|
| 50 | + * |
|
| 51 | + * @param string $instance ['tab_layout'] Best of widget tab layout name. |
|
| 52 | + */ |
|
| 53 | + $tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']); |
|
| 54 | + echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">'; |
|
| 55 | + echo $before_widget; |
|
| 56 | + $loc_terms = geodir_get_current_location_terms(); |
|
| 57 | + if (!empty($loc_terms)) { |
|
| 58 | + $cur_location = ' : ' . geodir_ucwords(str_replace('-', ' ', end($loc_terms))); |
|
| 59 | + } else { |
|
| 60 | + $cur_location = ''; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Filter the current location name. |
|
| 65 | + * |
|
| 66 | + * @since 1.3.9 |
|
| 67 | + * |
|
| 68 | + * @param string $cur_location Current location name. |
|
| 69 | + */ |
|
| 70 | + $cur_location = apply_filters('bestof_widget_cur_location', $cur_location); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Filter the widget title. |
|
| 74 | + * |
|
| 75 | + * @since 1.3.9 |
|
| 76 | + * |
|
| 77 | + * @param string $instance ['title'] The widget title. |
|
| 78 | + */ |
|
| 79 | + $title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory')); |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Filter the post type. |
|
| 83 | + * |
|
| 84 | + * @since 1.3.9 |
|
| 85 | + * |
|
| 86 | + * @param string $instance ['post_type'] The post type. |
|
| 87 | + */ |
|
| 88 | + $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']); |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Filter the excerpt type. |
|
| 92 | + * |
|
| 93 | + * @since 1.5.4 |
|
| 94 | + * |
|
| 95 | + * @param string $instance ['excerpt_type'] The excerpt type. |
|
| 96 | + */ |
|
| 97 | + $excerpt_type = empty($instance['excerpt_type']) ? 'show-desc' : apply_filters('bestof_widget_excerpt_type', $instance['excerpt_type']); |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Filter the listing limit. |
|
| 102 | + * |
|
| 103 | + * @since 1.3.9 |
|
| 104 | + * |
|
| 105 | + * @param int $instance ['post_limit'] No. of posts to display. |
|
| 106 | + */ |
|
| 107 | + $post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']); |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Filter the category limit. |
|
| 111 | + * |
|
| 112 | + * @since 1.3.9 |
|
| 113 | + * |
|
| 114 | + * @param int $instance ['categ_limit'] No. of categories to display. |
|
| 115 | + */ |
|
| 116 | + $categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']); |
|
| 117 | + $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Filter the use of location filter. |
|
| 121 | + * |
|
| 122 | + * @since 1.3.9 |
|
| 123 | + * |
|
| 124 | + * @param int|bool $instance ['add_location_filter'] Filter listings using current location. |
|
| 125 | + */ |
|
| 126 | + $add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']); |
|
| 127 | + |
|
| 128 | + // set post type to current viewing post type |
|
| 129 | + if ($use_viewing_post_type) { |
|
| 130 | + $current_post_type = geodir_get_current_posttype(); |
|
| 131 | + if ($current_post_type != '' && $current_post_type != $post_type) { |
|
| 132 | + $post_type = $current_post_type; |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + if (isset($instance['character_count'])) { |
|
| 137 | + /** |
|
| 138 | + * Filter the widget's excerpt character count. |
|
| 139 | + * |
|
| 140 | + * @since 1.3.9 |
|
| 141 | + * |
|
| 142 | + * @param int $instance ['character_count'] Excerpt character count. |
|
| 143 | + */ |
|
| 144 | + $character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']); |
|
| 145 | + } else { |
|
| 146 | + $character_count = ''; |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + $category_taxonomy = geodir_get_taxonomies($post_type); |
|
| 150 | + |
|
| 151 | + $term_args = array( |
|
| 152 | + 'hide_empty' => true, |
|
| 153 | + 'parent' => 0 |
|
| 154 | + ); |
|
| 155 | + |
|
| 156 | + $term_args = apply_filters('bestof_widget_term_args', $term_args); |
|
| 157 | + |
|
| 158 | + if (is_tax()) { |
|
| 159 | + $taxonomy = get_query_var('taxonomy'); |
|
| 160 | + $cur_term = get_query_var('term'); |
|
| 161 | + $term_data = get_term_by('name', $cur_term, $taxonomy); |
|
| 162 | + $term_args['parent'] = $term_data->term_id; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + $terms = get_terms($category_taxonomy[0], $term_args); |
|
| 166 | + |
|
| 167 | + $term_reviews = geodir_count_reviews_by_terms(); |
|
| 168 | + $a_terms = array(); |
|
| 169 | + foreach ($terms as $term) { |
|
| 170 | + |
|
| 171 | + |
|
| 172 | + if ($term->count > 0) { |
|
| 173 | + if (isset($term_reviews[$term->term_id])) { |
|
| 174 | + $term->review_count = $term_reviews[$term->term_id]; |
|
| 175 | + } else { |
|
| 176 | + $term->review_count = '0'; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + $a_terms[] = $term; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + |
|
| 185 | + $terms = apply_filters('bestof_widget_sort_terms', geodir_sort_terms($a_terms, 'review_count'), $a_terms); |
|
| 186 | + |
|
| 187 | + $query_args = array( |
|
| 188 | + 'posts_per_page' => $post_limit, |
|
| 189 | + 'is_geodir_loop' => true, |
|
| 190 | + 'post_type' => $post_type, |
|
| 191 | + 'gd_location' => $add_location_filter ? true : false, |
|
| 192 | + 'order_by' => 'high_review' |
|
| 193 | + ); |
|
| 194 | + if ($character_count >= 0) { |
|
| 195 | + $query_args['excerpt_length'] = $character_count; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + $layout = array(); |
|
| 199 | + if ($tab_layout == 'bestof-tabs-as-dropdown') { |
|
| 200 | + $layout[] = $tab_layout; |
|
| 201 | + } else { |
|
| 202 | + $layout[] = 'bestof-tabs-as-dropdown'; |
|
| 203 | + $layout[] = $tab_layout; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + |
|
| 207 | + echo $before_title . __($title,'geodirectory') . $after_title; |
|
| 208 | + |
|
| 209 | + //term navigation - start |
|
| 210 | + echo '<div class="geodir-tabs gd-bestof-tabs" id="gd-bestof-tabs" style="position:relative;">'; |
|
| 211 | + |
|
| 212 | + $final_html = ''; |
|
| 213 | + foreach ($layout as $tab_layout) { |
|
| 214 | + $nav_html = ''; |
|
| 215 | + $is_dropdown = ($tab_layout == 'bestof-tabs-as-dropdown') ? true : false; |
|
| 216 | + |
|
| 217 | + if ($is_dropdown) { |
|
| 218 | + $nav_html .= '<select id="geodir_bestof_tab_dd" class="chosen_select" name="geodir_bestof_tab_dd" data-placeholder="' . esc_attr(__('Select Category', 'geodirectory')) . '">'; |
|
| 219 | + } else { |
|
| 220 | + $nav_html .= '<dl class="geodir-tab-head geodir-bestof-cat-list">'; |
|
| 221 | + $nav_html .= '<dt></dt>'; |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + |
|
| 225 | + $term_icon = geodir_get_term_icon(); |
|
| 226 | + $cat_count = 0; |
|
| 227 | + if (!empty($terms)) { |
|
| 228 | + foreach ($terms as $cat) { |
|
| 229 | + $cat_count++; |
|
| 230 | + if ($cat_count > $categ_limit) { |
|
| 231 | + break; |
|
| 232 | + } |
|
| 233 | + if ($is_dropdown) { |
|
| 234 | + $selected = ($cat_count == 1) ? 'selected="selected"' : ''; |
|
| 235 | + $nav_html .= '<option ' . $selected . ' value="' . $cat->term_id . '">' . geodir_ucwords($cat->name) . '</option>'; |
|
| 236 | + } else { |
|
| 237 | + if ($cat_count == 1) { |
|
| 238 | + $nav_html .= '<dd class="geodir-tab-active">'; |
|
| 239 | + } else { |
|
| 240 | + $nav_html .= '<dd class="">'; |
|
| 241 | + } |
|
| 242 | + $term_icon_url = !empty($term_icon) && isset($term_icon[$cat->term_id]) ? $term_icon[$cat->term_id] : ''; |
|
| 243 | + $nav_html .= '<a data-termid="' . $cat->term_id . '" href="' . get_term_link($cat, $cat->taxonomy) . '">'; |
|
| 244 | + $nav_html .= '<img alt="' . $cat->name . ' icon" class="bestof-cat-icon" src="' . $term_icon_url . '"/>'; |
|
| 245 | + $nav_html .= '<span>'; |
|
| 246 | + $nav_html .= geodir_ucwords($cat->name); |
|
| 247 | + $nav_html .= '<small>'; |
|
| 248 | + if (isset($cat->review_count)) { |
|
| 249 | + $num_reviews = $cat->review_count; |
|
| 250 | + if ($num_reviews == 0) { |
|
| 251 | + $reviews = __('No Reviews', 'geodirectory'); |
|
| 252 | + } elseif ($num_reviews > 1) { |
|
| 253 | + $reviews = $num_reviews . __(' Reviews', 'geodirectory'); |
|
| 254 | + } else { |
|
| 255 | + $reviews = __('1 Review', 'geodirectory'); |
|
| 256 | + } |
|
| 257 | + $nav_html .= $reviews; |
|
| 258 | + } |
|
| 259 | + $nav_html .= '</small>'; |
|
| 260 | + $nav_html .= '</span>'; |
|
| 261 | + $nav_html .= '</a>'; |
|
| 262 | + $nav_html .= '</dd>'; |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + if ($is_dropdown) { |
|
| 268 | + $nav_html .= '</select>'; |
|
| 269 | + } else { |
|
| 270 | + $nav_html .= '</dl>'; |
|
| 271 | + } |
|
| 272 | + $final_html .= $nav_html; |
|
| 273 | + } |
|
| 274 | + if ($terms) { |
|
| 275 | + echo $final_html; |
|
| 276 | + } |
|
| 277 | + echo '</div>'; |
|
| 278 | + //term navigation - end |
|
| 279 | + |
|
| 280 | + //first term listings by default - start |
|
| 281 | + $first_term = ''; |
|
| 282 | + if ($terms) { |
|
| 283 | + $first_term = $terms[0]; |
|
| 284 | + $tax_query = array( |
|
| 285 | + 'taxonomy' => $category_taxonomy[0], |
|
| 286 | + 'field' => 'id', |
|
| 287 | + 'terms' => $first_term->term_id |
|
| 288 | + ); |
|
| 289 | + $query_args['tax_query'] = array($tax_query); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + ?> |
|
| 293 | 293 | <input type="hidden" id="bestof_widget_post_type" name="bestof_widget_post_type" |
| 294 | 294 | value="<?php echo $post_type; ?>"> |
| 295 | 295 | <input type="hidden" id="bestof_widget_excerpt_type" name="bestof_widget_excerpt_type" |
@@ -300,110 +300,110 @@ discard block |
||
| 300 | 300 | value="<?php echo $category_taxonomy[0]; ?>"> |
| 301 | 301 | <input type="hidden" id="bestof_widget_location_filter" name="bestof_widget_location_filter" |
| 302 | 302 | value="<?php if ($add_location_filter) { |
| 303 | - echo 1; |
|
| 304 | - } else { |
|
| 305 | - echo 0; |
|
| 306 | - } ?>"> |
|
| 303 | + echo 1; |
|
| 304 | + } else { |
|
| 305 | + echo 0; |
|
| 306 | + } ?>"> |
|
| 307 | 307 | <input type="hidden" id="bestof_widget_char_count" name="bestof_widget_char_count" |
| 308 | 308 | value="<?php echo $character_count; ?>"> |
| 309 | 309 | <div class="geo-bestof-contentwrap geodir-tabs-content" style="position: relative; z-index: 0;"> |
| 310 | 310 | <p id="geodir-bestof-loading" class="geodir-bestof-loading"><i class="fa fa-cog fa-spin"></i></p> |
| 311 | 311 | <?php |
| 312 | - echo '<div id="geodir-bestof-places">'; |
|
| 313 | - if ($terms) { |
|
| 314 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
| 315 | - /** |
|
| 316 | - * Filter the page link to view all lisitngs. |
|
| 317 | - * |
|
| 318 | - * @since 1.5.1 |
|
| 319 | - * |
|
| 320 | - * @param array $view_all_link View all listings page link. |
|
| 321 | - * @param array $post_type The Post type. |
|
| 322 | - * @param array $first_term The category term object. |
|
| 323 | - */ |
|
| 324 | - $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
|
| 325 | - |
|
| 326 | - 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>'; |
|
| 327 | - } |
|
| 328 | - if ($excerpt_type == 'show-reviews') { |
|
| 329 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 330 | - } |
|
| 331 | - geodir_bestof_places_by_term($query_args); |
|
| 332 | - if ($excerpt_type == 'show-reviews') { |
|
| 333 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 334 | - } |
|
| 335 | - echo "</div>"; |
|
| 336 | - ?> |
|
| 312 | + echo '<div id="geodir-bestof-places">'; |
|
| 313 | + if ($terms) { |
|
| 314 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($first_term, $first_term->taxonomy)); |
|
| 315 | + /** |
|
| 316 | + * Filter the page link to view all lisitngs. |
|
| 317 | + * |
|
| 318 | + * @since 1.5.1 |
|
| 319 | + * |
|
| 320 | + * @param array $view_all_link View all listings page link. |
|
| 321 | + * @param array $post_type The Post type. |
|
| 322 | + * @param array $first_term The category term object. |
|
| 323 | + */ |
|
| 324 | + $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $first_term); |
|
| 325 | + |
|
| 326 | + 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>'; |
|
| 327 | + } |
|
| 328 | + if ($excerpt_type == 'show-reviews') { |
|
| 329 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 330 | + } |
|
| 331 | + geodir_bestof_places_by_term($query_args); |
|
| 332 | + if ($excerpt_type == 'show-reviews') { |
|
| 333 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 334 | + } |
|
| 335 | + echo "</div>"; |
|
| 336 | + ?> |
|
| 337 | 337 | </div> |
| 338 | 338 | <?php //first term listings by default - end |
| 339 | - ?> |
|
| 339 | + ?> |
|
| 340 | 340 | <?php echo $after_widget; |
| 341 | - echo "</div>"; |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * Sanitize best of widget form values as they are saved. |
|
| 346 | - * |
|
| 347 | - * @since 1.3.9 |
|
| 348 | - * @since 1.5.1 Declare function public. |
|
| 349 | - * |
|
| 350 | - * @param array $new_instance Values just sent to be saved. |
|
| 351 | - * @param array $old_instance Previously saved values from database. |
|
| 352 | - * |
|
| 353 | - * @return array Updated safe values to be saved. |
|
| 354 | - */ |
|
| 355 | - public function update($new_instance, $old_instance) |
|
| 356 | - { |
|
| 357 | - $instance = $old_instance; |
|
| 358 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 359 | - $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 360 | - $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
| 361 | - $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
| 362 | - $instance['character_count'] = $new_instance['character_count']; |
|
| 363 | - $instance['tab_layout'] = $new_instance['tab_layout']; |
|
| 364 | - $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
| 365 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 366 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 367 | - else |
|
| 368 | - $instance['add_location_filter'] = '0'; |
|
| 369 | - $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 370 | - return $instance; |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * Back-end best of widget settings form. |
|
| 375 | - * |
|
| 376 | - * @since 1.3.9 |
|
| 377 | - * @since 1.5.1 Declare function public. |
|
| 378 | - * |
|
| 379 | - * @param array $instance Previously saved values from database. |
|
| 380 | - */ |
|
| 381 | - public function form($instance) |
|
| 382 | - { |
|
| 383 | - $instance = wp_parse_args((array)$instance, |
|
| 384 | - array( |
|
| 385 | - 'title' => '', |
|
| 386 | - 'post_type' => '', |
|
| 387 | - 'post_limit' => '5', |
|
| 388 | - 'categ_limit' => '3', |
|
| 389 | - 'character_count' => '20', |
|
| 390 | - 'add_location_filter' => '1', |
|
| 391 | - 'tab_layout' => 'bestof-tabs-on-top', |
|
| 392 | - 'excerpt_type' => 'show-desc', |
|
| 393 | - 'use_viewing_post_type' => '' |
|
| 394 | - ) |
|
| 395 | - ); |
|
| 396 | - $title = strip_tags($instance['title']); |
|
| 397 | - $post_type = strip_tags($instance['post_type']); |
|
| 398 | - $post_limit = strip_tags($instance['post_limit']); |
|
| 399 | - $categ_limit = strip_tags($instance['categ_limit']); |
|
| 400 | - $character_count = strip_tags($instance['character_count']); |
|
| 401 | - $tab_layout = strip_tags($instance['tab_layout']); |
|
| 402 | - $excerpt_type = strip_tags($instance['excerpt_type']); |
|
| 403 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 404 | - $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 405 | - |
|
| 406 | - ?> |
|
| 341 | + echo "</div>"; |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * Sanitize best of widget form values as they are saved. |
|
| 346 | + * |
|
| 347 | + * @since 1.3.9 |
|
| 348 | + * @since 1.5.1 Declare function public. |
|
| 349 | + * |
|
| 350 | + * @param array $new_instance Values just sent to be saved. |
|
| 351 | + * @param array $old_instance Previously saved values from database. |
|
| 352 | + * |
|
| 353 | + * @return array Updated safe values to be saved. |
|
| 354 | + */ |
|
| 355 | + public function update($new_instance, $old_instance) |
|
| 356 | + { |
|
| 357 | + $instance = $old_instance; |
|
| 358 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 359 | + $instance['post_type'] = strip_tags($new_instance['post_type']); |
|
| 360 | + $instance['post_limit'] = strip_tags($new_instance['post_limit']); |
|
| 361 | + $instance['categ_limit'] = strip_tags($new_instance['categ_limit']); |
|
| 362 | + $instance['character_count'] = $new_instance['character_count']; |
|
| 363 | + $instance['tab_layout'] = $new_instance['tab_layout']; |
|
| 364 | + $instance['excerpt_type'] = $new_instance['excerpt_type']; |
|
| 365 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
| 366 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
| 367 | + else |
|
| 368 | + $instance['add_location_filter'] = '0'; |
|
| 369 | + $instance['use_viewing_post_type'] = isset($new_instance['use_viewing_post_type']) && $new_instance['use_viewing_post_type'] ? 1 : 0; |
|
| 370 | + return $instance; |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * Back-end best of widget settings form. |
|
| 375 | + * |
|
| 376 | + * @since 1.3.9 |
|
| 377 | + * @since 1.5.1 Declare function public. |
|
| 378 | + * |
|
| 379 | + * @param array $instance Previously saved values from database. |
|
| 380 | + */ |
|
| 381 | + public function form($instance) |
|
| 382 | + { |
|
| 383 | + $instance = wp_parse_args((array)$instance, |
|
| 384 | + array( |
|
| 385 | + 'title' => '', |
|
| 386 | + 'post_type' => '', |
|
| 387 | + 'post_limit' => '5', |
|
| 388 | + 'categ_limit' => '3', |
|
| 389 | + 'character_count' => '20', |
|
| 390 | + 'add_location_filter' => '1', |
|
| 391 | + 'tab_layout' => 'bestof-tabs-on-top', |
|
| 392 | + 'excerpt_type' => 'show-desc', |
|
| 393 | + 'use_viewing_post_type' => '' |
|
| 394 | + ) |
|
| 395 | + ); |
|
| 396 | + $title = strip_tags($instance['title']); |
|
| 397 | + $post_type = strip_tags($instance['post_type']); |
|
| 398 | + $post_limit = strip_tags($instance['post_limit']); |
|
| 399 | + $categ_limit = strip_tags($instance['categ_limit']); |
|
| 400 | + $character_count = strip_tags($instance['character_count']); |
|
| 401 | + $tab_layout = strip_tags($instance['tab_layout']); |
|
| 402 | + $excerpt_type = strip_tags($instance['excerpt_type']); |
|
| 403 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
| 404 | + $use_viewing_post_type = isset($instance['use_viewing_post_type']) && $instance['use_viewing_post_type'] ? true : false; |
|
| 405 | + |
|
| 406 | + ?> |
|
| 407 | 407 | <p> |
| 408 | 408 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
| 409 | 409 | |
@@ -418,14 +418,14 @@ discard block |
||
| 418 | 418 | for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'geodirectory');?> |
| 419 | 419 | |
| 420 | 420 | <?php $postypes = geodir_get_posttypes(); |
| 421 | - /** |
|
| 422 | - * Filter the post types to display in widget. |
|
| 423 | - * |
|
| 424 | - * @since 1.3.9 |
|
| 425 | - * |
|
| 426 | - * @param array $postypes Post types array. |
|
| 427 | - */ |
|
| 428 | - $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?> |
|
| 421 | + /** |
|
| 422 | + * Filter the post types to display in widget. |
|
| 423 | + * |
|
| 424 | + * @since 1.3.9 |
|
| 425 | + * |
|
| 426 | + * @param array $postypes Post types array. |
|
| 427 | + */ |
|
| 428 | + $postypes = apply_filters('geodir_post_type_list_in_p_widget', $postypes); ?> |
|
| 429 | 429 | |
| 430 | 430 | <select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>" |
| 431 | 431 | name="<?php echo $this->get_field_name('post_type'); ?>" |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | <?php foreach ($postypes as $postypes_obj) { ?> |
| 435 | 435 | |
| 436 | 436 | <option <?php if ($post_type == $postypes_obj) { |
| 437 | - echo 'selected="selected"'; |
|
| 438 | - } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
| 439 | - echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
| 437 | + echo 'selected="selected"'; |
|
| 438 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj); |
|
| 439 | + echo geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
| 440 | 440 | |
| 441 | 441 | <?php } ?> |
| 442 | 442 | |
@@ -482,14 +482,14 @@ discard block |
||
| 482 | 482 | name="<?php echo $this->get_field_name('tab_layout'); ?>"> |
| 483 | 483 | |
| 484 | 484 | <option <?php if ($tab_layout == 'bestof-tabs-on-top') { |
| 485 | - echo 'selected="selected"'; |
|
| 486 | - } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
| 485 | + echo 'selected="selected"'; |
|
| 486 | + } ?> value="bestof-tabs-on-top"><?php _e('Tabs on Top', 'geodirectory'); ?></option> |
|
| 487 | 487 | <option <?php if ($tab_layout == 'bestof-tabs-on-left') { |
| 488 | - echo 'selected="selected"'; |
|
| 489 | - } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
| 488 | + echo 'selected="selected"'; |
|
| 489 | + } ?> value="bestof-tabs-on-left"><?php _e('Tabs on Left', 'geodirectory'); ?></option> |
|
| 490 | 490 | <option <?php if ($tab_layout == 'bestof-tabs-as-dropdown') { |
| 491 | - echo 'selected="selected"'; |
|
| 492 | - } ?> |
|
| 491 | + echo 'selected="selected"'; |
|
| 492 | + } ?> |
|
| 493 | 493 | value="bestof-tabs-as-dropdown"><?php _e('Tabs as Dropdown', 'geodirectory'); ?></option> |
| 494 | 494 | </select> |
| 495 | 495 | </label> |
@@ -503,11 +503,11 @@ discard block |
||
| 503 | 503 | name="<?php echo $this->get_field_name('excerpt_type'); ?>"> |
| 504 | 504 | |
| 505 | 505 | <option <?php if ($excerpt_type == 'show-desc') { |
| 506 | - echo 'selected="selected"'; |
|
| 507 | - } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
| 506 | + echo 'selected="selected"'; |
|
| 507 | + } ?> value="show-desc"><?php _e('Show Description', 'geodirectory'); ?></option> |
|
| 508 | 508 | <option <?php if ($excerpt_type == 'show-reviews') { |
| 509 | - echo 'selected="selected"'; |
|
| 510 | - } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
| 509 | + echo 'selected="selected"'; |
|
| 510 | + } ?> value="show-reviews"><?php _e('Show Reviews if Available', 'geodirectory'); ?></option> |
|
| 511 | 511 | </select> |
| 512 | 512 | </label> |
| 513 | 513 | </p> |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | for="<?php echo $this->get_field_id('use_viewing_post_type'); ?>"><?php _e('Use current viewing post type:', 'geodirectory'); ?> |
| 527 | 527 | <input type="checkbox" id="<?php echo $this->get_field_id('use_viewing_post_type'); ?>" |
| 528 | 528 | name="<?php echo $this->get_field_name('use_viewing_post_type'); ?>" <?php if ($use_viewing_post_type) { |
| 529 | - echo 'checked="checked"'; |
|
| 530 | - } ?> value="1"/> |
|
| 529 | + echo 'checked="checked"'; |
|
| 530 | + } ?> value="1"/> |
|
| 531 | 531 | </label> |
| 532 | 532 | </p> |
| 533 | 533 | <?php |
| 534 | - } |
|
| 534 | + } |
|
| 535 | 535 | } // class geodir_bestof_widget |
| 536 | 536 | |
| 537 | 537 | register_widget('geodir_bestof_widget'); |
@@ -551,68 +551,68 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | function geodir_bestof_places_by_term($query_args) |
| 553 | 553 | { |
| 554 | - global $gd_session; |
|
| 555 | - |
|
| 556 | - /** |
|
| 557 | - * This action called before querying widget listings. |
|
| 558 | - * |
|
| 559 | - * @since 1.0.0 |
|
| 560 | - */ |
|
| 561 | - do_action('geodir_bestof_get_widget_listings_before'); |
|
| 562 | - |
|
| 563 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
| 564 | - |
|
| 565 | - /** |
|
| 566 | - * This action called after querying widget listings. |
|
| 567 | - * |
|
| 568 | - * @since 1.0.0 |
|
| 569 | - */ |
|
| 570 | - do_action('geodir_bestof_get_widget_listings_after'); |
|
| 571 | - |
|
| 572 | - $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
| 573 | - |
|
| 574 | - if (!isset($character_count)) { |
|
| 575 | - /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
| 576 | - $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count); |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 580 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 581 | - |
|
| 582 | - global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 583 | - $current_post = $post; |
|
| 584 | - $current_map_jason = $map_jason; |
|
| 585 | - $current_map_canvas_arr = $map_canvas_arr; |
|
| 586 | - $current_grid_view = $gridview_columns_widget; |
|
| 587 | - $gridview_columns_widget = null; |
|
| 588 | - |
|
| 589 | - $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false; |
|
| 590 | - $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : ''; |
|
| 591 | - |
|
| 592 | - $gd_session->set('gd_listing_view', '1'); |
|
| 593 | - $geodir_is_widget_listing = true; |
|
| 594 | - |
|
| 595 | - /** |
|
| 596 | - * Includes the template for the listing listview. |
|
| 597 | - * |
|
| 598 | - * @since 1.3.9 |
|
| 599 | - */ |
|
| 600 | - include($template); |
|
| 601 | - |
|
| 602 | - $geodir_is_widget_listing = false; |
|
| 603 | - |
|
| 604 | - $GLOBALS['post'] = $current_post; |
|
| 605 | - if (!empty($current_post)) { |
|
| 606 | - setup_postdata($current_post); |
|
| 607 | - } |
|
| 608 | - if ($gd_listing_view_set) { // Set back previous value |
|
| 609 | - $gd_session->set('gd_listing_view', $gd_listing_view_old); |
|
| 610 | - } else { |
|
| 611 | - $gd_session->un_set('gd_listing_view'); |
|
| 612 | - } |
|
| 613 | - $map_jason = $current_map_jason; |
|
| 614 | - $map_canvas_arr = $current_map_canvas_arr; |
|
| 615 | - $gridview_columns_widget = $current_grid_view; |
|
| 554 | + global $gd_session; |
|
| 555 | + |
|
| 556 | + /** |
|
| 557 | + * This action called before querying widget listings. |
|
| 558 | + * |
|
| 559 | + * @since 1.0.0 |
|
| 560 | + */ |
|
| 561 | + do_action('geodir_bestof_get_widget_listings_before'); |
|
| 562 | + |
|
| 563 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
| 564 | + |
|
| 565 | + /** |
|
| 566 | + * This action called after querying widget listings. |
|
| 567 | + * |
|
| 568 | + * @since 1.0.0 |
|
| 569 | + */ |
|
| 570 | + do_action('geodir_bestof_get_widget_listings_after'); |
|
| 571 | + |
|
| 572 | + $character_count = isset($query_args['excerpt_length']) ? $query_args['excerpt_length'] : ''; |
|
| 573 | + |
|
| 574 | + if (!isset($character_count)) { |
|
| 575 | + /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
| 576 | + $character_count = $character_count == '' ? 50 : apply_filters('bestof_widget_character_count', $character_count); |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
| 580 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 581 | + |
|
| 582 | + global $post, $map_jason, $map_canvas_arr, $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 583 | + $current_post = $post; |
|
| 584 | + $current_map_jason = $map_jason; |
|
| 585 | + $current_map_canvas_arr = $map_canvas_arr; |
|
| 586 | + $current_grid_view = $gridview_columns_widget; |
|
| 587 | + $gridview_columns_widget = null; |
|
| 588 | + |
|
| 589 | + $gd_listing_view_set = $gd_session->get('gd_listing_view') ? true : false; |
|
| 590 | + $gd_listing_view_old = $gd_listing_view_set ? $gd_session->get('gd_listing_view') : ''; |
|
| 591 | + |
|
| 592 | + $gd_session->set('gd_listing_view', '1'); |
|
| 593 | + $geodir_is_widget_listing = true; |
|
| 594 | + |
|
| 595 | + /** |
|
| 596 | + * Includes the template for the listing listview. |
|
| 597 | + * |
|
| 598 | + * @since 1.3.9 |
|
| 599 | + */ |
|
| 600 | + include($template); |
|
| 601 | + |
|
| 602 | + $geodir_is_widget_listing = false; |
|
| 603 | + |
|
| 604 | + $GLOBALS['post'] = $current_post; |
|
| 605 | + if (!empty($current_post)) { |
|
| 606 | + setup_postdata($current_post); |
|
| 607 | + } |
|
| 608 | + if ($gd_listing_view_set) { // Set back previous value |
|
| 609 | + $gd_session->set('gd_listing_view', $gd_listing_view_old); |
|
| 610 | + } else { |
|
| 611 | + $gd_session->un_set('gd_listing_view'); |
|
| 612 | + } |
|
| 613 | + $map_jason = $current_map_jason; |
|
| 614 | + $map_canvas_arr = $current_map_canvas_arr; |
|
| 615 | + $gridview_columns_widget = $current_grid_view; |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | //Ajax functions |
@@ -629,51 +629,51 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | function geodir_bestof_callback() |
| 631 | 631 | { |
| 632 | - check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
| 633 | - //set variables |
|
| 634 | - $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
| 635 | - $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
| 636 | - $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
| 637 | - $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
| 638 | - $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
| 639 | - $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
| 640 | - $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
| 641 | - |
|
| 642 | - $query_args = array( |
|
| 643 | - 'posts_per_page' => $post_limit, |
|
| 644 | - 'is_geodir_loop' => true, |
|
| 645 | - 'post_type' => $post_type, |
|
| 646 | - 'gd_location' => $add_location_filter ? true : false, |
|
| 647 | - 'order_by' => 'high_review' |
|
| 648 | - ); |
|
| 649 | - |
|
| 650 | - if ($character_count >= 0) { |
|
| 651 | - $query_args['excerpt_length'] = $character_count; |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - $tax_query = array( |
|
| 655 | - 'taxonomy' => $taxonomy, |
|
| 656 | - 'field' => 'id', |
|
| 657 | - 'terms' => $term_id |
|
| 658 | - ); |
|
| 659 | - |
|
| 660 | - $query_args['tax_query'] = array($tax_query); |
|
| 661 | - if ($term_id && $taxonomy) { |
|
| 662 | - $term = get_term_by('id', $term_id, $taxonomy); |
|
| 663 | - $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)); |
|
| 664 | - /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
| 665 | - $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
|
| 666 | - |
|
| 667 | - 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>'; |
|
| 668 | - } |
|
| 669 | - if ($excerpt_type == 'show-reviews') { |
|
| 670 | - add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 671 | - } |
|
| 672 | - geodir_bestof_places_by_term($query_args); |
|
| 673 | - if ($excerpt_type == 'show-reviews') { |
|
| 674 | - remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 675 | - } |
|
| 676 | - gd_die(); |
|
| 632 | + check_ajax_referer('geodir-bestof-nonce', 'geodir_bestof_nonce'); |
|
| 633 | + //set variables |
|
| 634 | + $post_type = strip_tags(esc_sql($_POST['post_type'])); |
|
| 635 | + $post_limit = strip_tags(esc_sql($_POST['post_limit'])); |
|
| 636 | + $character_count = strip_tags(esc_sql($_POST['char_count'])); |
|
| 637 | + $taxonomy = strip_tags(esc_sql($_POST['taxonomy'])); |
|
| 638 | + $add_location_filter = strip_tags(esc_sql($_POST['add_location_filter'])); |
|
| 639 | + $term_id = strip_tags(esc_sql($_POST['term_id'])); |
|
| 640 | + $excerpt_type = strip_tags(esc_sql($_POST['excerpt_type'])); |
|
| 641 | + |
|
| 642 | + $query_args = array( |
|
| 643 | + 'posts_per_page' => $post_limit, |
|
| 644 | + 'is_geodir_loop' => true, |
|
| 645 | + 'post_type' => $post_type, |
|
| 646 | + 'gd_location' => $add_location_filter ? true : false, |
|
| 647 | + 'order_by' => 'high_review' |
|
| 648 | + ); |
|
| 649 | + |
|
| 650 | + if ($character_count >= 0) { |
|
| 651 | + $query_args['excerpt_length'] = $character_count; |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + $tax_query = array( |
|
| 655 | + 'taxonomy' => $taxonomy, |
|
| 656 | + 'field' => 'id', |
|
| 657 | + 'terms' => $term_id |
|
| 658 | + ); |
|
| 659 | + |
|
| 660 | + $query_args['tax_query'] = array($tax_query); |
|
| 661 | + if ($term_id && $taxonomy) { |
|
| 662 | + $term = get_term_by('id', $term_id, $taxonomy); |
|
| 663 | + $view_all_link = add_query_arg(array('sort_by' => 'rating_count_desc'), get_term_link($term)); |
|
| 664 | + /** This filter is documented in geodirectory-widgets/geodirectory_bestof_widget.php */ |
|
| 665 | + $view_all_link = apply_filters('geodir_bestof_widget_view_all_link', $view_all_link, $post_type, $term); |
|
| 666 | + |
|
| 667 | + 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>'; |
|
| 668 | + } |
|
| 669 | + if ($excerpt_type == 'show-reviews') { |
|
| 670 | + add_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 671 | + } |
|
| 672 | + geodir_bestof_places_by_term($query_args); |
|
| 673 | + if ($excerpt_type == 'show-reviews') { |
|
| 674 | + remove_filter('get_the_excerpt', 'best_of_show_review_in_excerpt'); |
|
| 675 | + } |
|
| 676 | + gd_die(); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | //Javascript |
@@ -686,8 +686,8 @@ discard block |
||
| 686 | 686 | */ |
| 687 | 687 | function geodir_bestof_js() |
| 688 | 688 | { |
| 689 | - $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
| 690 | - ?> |
|
| 689 | + $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
| 690 | + ?> |
|
| 691 | 691 | <script type="text/javascript"> |
| 692 | 692 | jQuery(document).ready(function () { |
| 693 | 693 | jQuery('.geodir-bestof-cat-list a, #geodir_bestof_tab_dd').on("click change", function (e) { |
@@ -766,18 +766,18 @@ discard block |
||
| 766 | 766 | |
| 767 | 767 | function best_of_show_review_in_excerpt($excerpt) |
| 768 | 768 | { |
| 769 | - global $wpdb, $post; |
|
| 770 | - $review_table = GEODIR_REVIEW_TABLE; |
|
| 771 | - $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
| 772 | - $comments = $wpdb->get_results($request); |
|
| 773 | - |
|
| 774 | - if ($comments) { |
|
| 775 | - foreach ($comments as $comment) { |
|
| 776 | - // Set the extra comment info needed. |
|
| 777 | - $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
| 778 | - $comment_content = $comment_extra->comment_content; |
|
| 779 | - $excerpt = strip_tags($comment_content); |
|
| 780 | - } |
|
| 781 | - } |
|
| 782 | - return $excerpt; |
|
| 769 | + global $wpdb, $post; |
|
| 770 | + $review_table = GEODIR_REVIEW_TABLE; |
|
| 771 | + $request = "SELECT comment_ID FROM $review_table WHERE post_id = $post->ID ORDER BY post_date DESC, id DESC LIMIT 1"; |
|
| 772 | + $comments = $wpdb->get_results($request); |
|
| 773 | + |
|
| 774 | + if ($comments) { |
|
| 775 | + foreach ($comments as $comment) { |
|
| 776 | + // Set the extra comment info needed. |
|
| 777 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"); |
|
| 778 | + $comment_content = $comment_extra->comment_content; |
|
| 779 | + $excerpt = strip_tags($comment_content); |
|
| 780 | + } |
|
| 781 | + } |
|
| 782 | + return $excerpt; |
|
| 783 | 783 | } |
| 784 | 784 | \ 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> |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | //save the widget |
| 62 | 62 | $instance = $old_instance; |
| 63 | 63 | $instance['title'] = strip_tags($new_instance['title']); |
| 64 | - $category_limit = (int)$new_instance['category_limit']; |
|
| 64 | + $category_limit = (int) $new_instance['category_limit']; |
|
| 65 | 65 | $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
| 66 | 66 | $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
| 67 | 67 | $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
@@ -81,13 +81,13 @@ discard block |
||
| 81 | 81 | public function form($instance) |
| 82 | 82 | {
|
| 83 | 83 | //widgetform in backend |
| 84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
|
|
| 84 | + $instance = wp_parse_args((array) $instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
|
|
| 85 | 85 | |
| 86 | 86 | $title = strip_tags($instance['title']); |
| 87 | - $category_limit = (int)$instance['category_limit']; |
|
| 87 | + $category_limit = (int) $instance['category_limit']; |
|
| 88 | 88 | $category_limit = $category_limit > 0 ? $category_limit : 15; |
| 89 | 89 | $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
| 90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
| 90 | + $parent_only = !empty($instance['parent_only']) ? true : false; |
|
| 91 | 91 | |
| 92 | 92 | $post_type_options = geodir_get_posttypes('options');
|
| 93 | 93 | ?> |
@@ -97,23 +97,23 @@ discard block |
||
| 97 | 97 | </label> |
| 98 | 98 | </p> |
| 99 | 99 | <p> |
| 100 | - <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory');?>
|
|
| 100 | + <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Default post type to use (if not set by page)', 'geodirectory'); ?>
|
|
| 101 | 101 | <select class="widefat" id="<?php echo $this->get_field_id('default_post_type'); ?>" name="<?php echo $this->get_field_name('default_post_type'); ?>">
|
| 102 | 102 | <?php foreach ($post_type_options as $name => $title) { ?>
|
| 103 | - <option value="<?php echo $name;?>" <?php selected($name, $default_post_type);?>><?php echo $title; ?></option> |
|
| 103 | + <option value="<?php echo $name; ?>" <?php selected($name, $default_post_type); ?>><?php echo $title; ?></option> |
|
| 104 | 104 | <?php } ?> |
| 105 | 105 | </select> |
| 106 | 106 | </label> |
| 107 | 107 | </p> |
| 108 | 108 | <p> |
| 109 | 109 | <label for="<?php echo $this->get_field_id('category_limit'); ?>"><?php _e('Customize categories count to appear by default:', 'geodirectory'); ?>
|
| 110 | - <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int)esc_attr($category_limit); ?>"/>
|
|
| 110 | + <input class="widefat" id="<?php echo $this->get_field_id('category_limit'); ?>" name="<?php echo $this->get_field_name('category_limit'); ?>" type="text" value="<?php echo (int) esc_attr($category_limit); ?>"/>
|
|
| 111 | 111 | <p class="description" 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>
|
| 112 | 112 | </label> |
| 113 | 113 | </p> |
| 114 | 114 | <p> |
| 115 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked( $parent_only ); ?> value="1" />
|
|
| 116 | - <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></label>
|
|
| 115 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('parent_only'); ?>" name="<?php echo $this->get_field_name('parent_only'); ?>"<?php checked($parent_only); ?> value="1" />
|
|
| 116 | + <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e('Show parent categories only', 'geodirectory'); ?></label>
|
|
| 117 | 117 | </p> |
| 118 | 118 | <?php |
| 119 | 119 | } |
@@ -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,83 +14,83 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class geodir_popular_post_category extends WP_Widget |
| 16 | 16 | {
|
| 17 | - /** |
|
| 18 | - * Register the popular post category widget. |
|
| 19 | - * |
|
| 20 | - * @since 1.0.0 |
|
| 21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 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 | - } |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * Front-end display content for popular post category widget. |
|
| 34 | - * |
|
| 35 | - * @since 1.0.0 |
|
| 36 | - * @since 1.5.1 Declare function public. |
|
| 37 | - * |
|
| 38 | - * @param array $args Widget arguments. |
|
| 39 | - * @param array $instance Saved values from database. |
|
| 40 | - */ |
|
| 41 | - public function widget($args, $instance) |
|
| 42 | - {
|
|
| 43 | - geodir_popular_post_category_output($args, $instance); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Sanitize popular post category widget form values as they are saved. |
|
| 48 | - * |
|
| 49 | - * @since 1.0.0 |
|
| 50 | - * @since 1.5.1 Declare function public. |
|
| 51 | - * @since 1.5.1 Added default_post_type parameter. |
|
| 52 | - * @since 1.6.9 Added parent_only parameter. |
|
| 53 | - * |
|
| 54 | - * @param array $new_instance Values just sent to be saved. |
|
| 55 | - * @param array $old_instance Previously saved values from database. |
|
| 56 | - * |
|
| 57 | - * @return array Updated safe values to be saved. |
|
| 58 | - */ |
|
| 59 | - public function update($new_instance, $old_instance) |
|
| 60 | - {
|
|
| 61 | - //save the widget |
|
| 62 | - $instance = $old_instance; |
|
| 63 | - $instance['title'] = strip_tags($new_instance['title']); |
|
| 64 | - $category_limit = (int)$new_instance['category_limit']; |
|
| 65 | - $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
| 66 | - $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
| 67 | - $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
| 68 | - return $instance; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Back-end popular post category widget settings form. |
|
| 73 | - * |
|
| 74 | - * @since 1.0.0 |
|
| 75 | - * @since 1.5.1 Declare function public. |
|
| 76 | - * @since 1.5.1 Added option to set default post type. |
|
| 77 | - * @since 1.6.9 Added option to show parent categories only. |
|
| 78 | - * |
|
| 79 | - * @param array $instance Previously saved values from database. |
|
| 80 | - */ |
|
| 81 | - public function form($instance) |
|
| 82 | - {
|
|
| 83 | - //widgetform in backend |
|
| 84 | - $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
|
|
| 85 | - |
|
| 86 | - $title = strip_tags($instance['title']); |
|
| 87 | - $category_limit = (int)$instance['category_limit']; |
|
| 88 | - $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
| 89 | - $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
| 90 | - $parent_only = !empty($instance['parent_only']) ? true: false; |
|
| 17 | + /** |
|
| 18 | + * Register the popular post category widget. |
|
| 19 | + * |
|
| 20 | + * @since 1.0.0 |
|
| 21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 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 | + } |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * Front-end display content for popular post category widget. |
|
| 34 | + * |
|
| 35 | + * @since 1.0.0 |
|
| 36 | + * @since 1.5.1 Declare function public. |
|
| 37 | + * |
|
| 38 | + * @param array $args Widget arguments. |
|
| 39 | + * @param array $instance Saved values from database. |
|
| 40 | + */ |
|
| 41 | + public function widget($args, $instance) |
|
| 42 | + {
|
|
| 43 | + geodir_popular_post_category_output($args, $instance); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Sanitize popular post category widget form values as they are saved. |
|
| 48 | + * |
|
| 49 | + * @since 1.0.0 |
|
| 50 | + * @since 1.5.1 Declare function public. |
|
| 51 | + * @since 1.5.1 Added default_post_type parameter. |
|
| 52 | + * @since 1.6.9 Added parent_only parameter. |
|
| 53 | + * |
|
| 54 | + * @param array $new_instance Values just sent to be saved. |
|
| 55 | + * @param array $old_instance Previously saved values from database. |
|
| 56 | + * |
|
| 57 | + * @return array Updated safe values to be saved. |
|
| 58 | + */ |
|
| 59 | + public function update($new_instance, $old_instance) |
|
| 60 | + {
|
|
| 61 | + //save the widget |
|
| 62 | + $instance = $old_instance; |
|
| 63 | + $instance['title'] = strip_tags($new_instance['title']); |
|
| 64 | + $category_limit = (int)$new_instance['category_limit']; |
|
| 65 | + $instance['category_limit'] = $category_limit > 0 ? $category_limit : 15; |
|
| 66 | + $instance['default_post_type'] = isset($new_instance['default_post_type']) ? $new_instance['default_post_type'] : ''; |
|
| 67 | + $instance['parent_only'] = !empty($new_instance['parent_only']) ? true : false; |
|
| 68 | + return $instance; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Back-end popular post category widget settings form. |
|
| 73 | + * |
|
| 74 | + * @since 1.0.0 |
|
| 75 | + * @since 1.5.1 Declare function public. |
|
| 76 | + * @since 1.5.1 Added option to set default post type. |
|
| 77 | + * @since 1.6.9 Added option to show parent categories only. |
|
| 78 | + * |
|
| 79 | + * @param array $instance Previously saved values from database. |
|
| 80 | + */ |
|
| 81 | + public function form($instance) |
|
| 82 | + {
|
|
| 83 | + //widgetform in backend |
|
| 84 | + $instance = wp_parse_args((array)$instance, array('title' => '', 'category_limit' => 15, 'default_post_type' => '', 'parent_only' => false));
|
|
| 85 | + |
|
| 86 | + $title = strip_tags($instance['title']); |
|
| 87 | + $category_limit = (int)$instance['category_limit']; |
|
| 88 | + $category_limit = $category_limit > 0 ? $category_limit : 15; |
|
| 89 | + $default_post_type = isset($instance['default_post_type']) ? $instance['default_post_type'] : ''; |
|
| 90 | + $parent_only = !empty($instance['parent_only']) ? true: false; |
|
| 91 | 91 | |
| 92 | - $post_type_options = geodir_get_posttypes('options');
|
|
| 93 | - ?> |
|
| 92 | + $post_type_options = geodir_get_posttypes('options');
|
|
| 93 | + ?> |
|
| 94 | 94 | <p> |
| 95 | 95 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
|
| 96 | 96 | <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); ?>"/>
|
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | <label for="<?php echo $this->get_field_id('parent_only'); ?>"><?php _e( 'Show parent categories only', 'geodirectory' ); ?></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 geodir_utf8_ucfirst($extvalue[1]); ?></option> |
|
| 301 | + echo 'selected="selected"'; |
|
| 302 | + } ?> value="<?php echo $postypes_obj; ?>"><?php $extvalue = explode('_', $postypes_obj);
|
|
| 303 | + echo geodir_utf8_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 geodir_utf8_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 |
@@ -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 |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | ?> |
| 79 | 79 | <div class="widget geodir_recent_reviews_section"> |
| 80 | 80 | <?php if ($title) {
|
| 81 | - echo $before_title . $title . $after_title; |
|
| 81 | + echo $before_title.$title.$after_title; |
|
| 82 | 82 | } ?> |
| 83 | 83 | <ul class="geodir_recent_reviews"><?php echo $comments_li; ?></ul> |
| 84 | 84 | </div> |
@@ -118,7 +118,7 @@ discard block |
||
| 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 | ?> |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | function geodir_activation() |
| 25 | 25 | {
|
| 26 | 26 | |
| 27 | - geodir_install(); |
|
| 28 | - add_action('wp_loaded', 'geodir_flush_activation');
|
|
| 27 | + geodir_install(); |
|
| 28 | + add_action('wp_loaded', 'geodir_flush_activation');
|
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function geodir_flush_activation() |
| 38 | 38 | {
|
| 39 | - // Remove rewrite rules and then recreate rewrite rules. |
|
| 40 | - // flush late so everything is loaded |
|
| 41 | - flush_rewrite_rules(); |
|
| 39 | + // Remove rewrite rules and then recreate rewrite rules. |
|
| 40 | + // flush late so everything is loaded |
|
| 41 | + flush_rewrite_rules(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,44 +50,44 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function geodir_install() |
| 52 | 52 | {
|
| 53 | - global $geodir_settings; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Called before the GD installation scripts have run. |
|
| 57 | - * |
|
| 58 | - * @since 1.0.0 |
|
| 59 | - * @see 'geodir_installation_end' |
|
| 60 | - */ |
|
| 61 | - do_action('geodir_installation_start');
|
|
| 62 | - |
|
| 63 | - // Do install |
|
| 64 | - if (!get_option('geodir_default_data_installed')) {
|
|
| 65 | - geodir_create_tables(); // in admin db install.php |
|
| 66 | - geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
| 67 | - geodir_create_default_fields(); |
|
| 68 | - //geodir_default_taxonomies(); |
|
| 69 | - geodir_set_default_options(); |
|
| 70 | - geodir_create_pages(); |
|
| 71 | - geodir_set_default_widgets(); |
|
| 72 | - gd_install_theme_compat(); |
|
| 73 | - |
|
| 74 | - update_option('geodir_default_data_installed', 1);
|
|
| 75 | - |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if (!get_option('geodir_default_data_installed_1.2.8')) {
|
|
| 79 | - //geodir_create_tables(); // in admin db install.php |
|
| 80 | - update_option('geodir_default_data_installed_1.2.8', 1);
|
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - geodir_installation_end(); |
|
| 84 | - /** |
|
| 85 | - * Called after the GD installation scripts have run. |
|
| 86 | - * |
|
| 87 | - * @since 1.0.0 |
|
| 88 | - * @see 'geodir_installation_start' |
|
| 89 | - */ |
|
| 90 | - do_action('geodir_installation_end');
|
|
| 53 | + global $geodir_settings; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Called before the GD installation scripts have run. |
|
| 57 | + * |
|
| 58 | + * @since 1.0.0 |
|
| 59 | + * @see 'geodir_installation_end' |
|
| 60 | + */ |
|
| 61 | + do_action('geodir_installation_start');
|
|
| 62 | + |
|
| 63 | + // Do install |
|
| 64 | + if (!get_option('geodir_default_data_installed')) {
|
|
| 65 | + geodir_create_tables(); // in admin db install.php |
|
| 66 | + geodir_register_defaults(); // geodir_functions/ taxonomy_functions.php |
|
| 67 | + geodir_create_default_fields(); |
|
| 68 | + //geodir_default_taxonomies(); |
|
| 69 | + geodir_set_default_options(); |
|
| 70 | + geodir_create_pages(); |
|
| 71 | + geodir_set_default_widgets(); |
|
| 72 | + gd_install_theme_compat(); |
|
| 73 | + |
|
| 74 | + update_option('geodir_default_data_installed', 1);
|
|
| 75 | + |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if (!get_option('geodir_default_data_installed_1.2.8')) {
|
|
| 79 | + //geodir_create_tables(); // in admin db install.php |
|
| 80 | + update_option('geodir_default_data_installed_1.2.8', 1);
|
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + geodir_installation_end(); |
|
| 84 | + /** |
|
| 85 | + * Called after the GD installation scripts have run. |
|
| 86 | + * |
|
| 87 | + * @since 1.0.0 |
|
| 88 | + * @see 'geodir_installation_start' |
|
| 89 | + */ |
|
| 90 | + do_action('geodir_installation_end');
|
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | } |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | function geodir_create_pages() |
| 105 | 105 | {
|
| 106 | 106 | |
| 107 | - //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
|
|
| 108 | - geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 109 | - geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
|
|
| 110 | - geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
|
|
| 111 | - geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
|
|
| 112 | - geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
|
|
| 107 | + //geodir_create_page( esc_sql( _x('home-map', 'page_slug', 'geodirectory') ), 'geodir_home_map_page', __('Home Map', 'geodirectory'), '',0,'publish' );
|
|
| 108 | + geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), '');
|
|
| 109 | + geodir_create_page(esc_sql(_x('add-listing', 'page_slug', 'geodirectory')), 'geodir_add_listing_page', __('Add Listing', 'geodirectory'), '');
|
|
| 110 | + geodir_create_page(esc_sql(_x('listing-preview', 'page_slug', 'geodirectory')), 'geodir_preview_page', __('Listing Preview', 'geodirectory'), '');
|
|
| 111 | + geodir_create_page(esc_sql(_x('listing-success', 'page_slug', 'geodirectory')), 'geodir_success_page', __('Listing Success', 'geodirectory'), '');
|
|
| 112 | + geodir_create_page(esc_sql(_x('location', 'page_slug', 'geodirectory')), 'geodir_location_page', __('Location', 'geodirectory'), '');
|
|
| 113 | 113 | |
| 114 | - //New since 1.5.3 |
|
| 115 | - geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 116 | - geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 114 | + //New since 1.5.3 |
|
| 115 | + geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), '');
|
|
| 116 | + geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), '');
|
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | } |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | function geodir_installation_end() |
| 131 | 131 | {
|
| 132 | - //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
| 132 | + //update_option( "geodir_db_version", GEODIRECTORY_VERSION ); |
|
| 133 | 133 | |
| 134 | - update_option("geodir_installed", 1);
|
|
| 135 | - update_option("geodir_installation_redirect", 1);
|
|
| 136 | - update_option('skip_install_geodir_pages', 0);
|
|
| 134 | + update_option("geodir_installed", 1);
|
|
| 135 | + update_option("geodir_installation_redirect", 1);
|
|
| 136 | + update_option('skip_install_geodir_pages', 0);
|
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -147,45 +147,45 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | function geodir_set_default_options() |
| 149 | 149 | {
|
| 150 | - global $geodir_settings; |
|
| 151 | - /** |
|
| 152 | - * Contains settings array for general tab. |
|
| 153 | - * |
|
| 154 | - * @since 1.0.0 |
|
| 155 | - * @package GeoDirectory |
|
| 156 | - */ |
|
| 157 | - include_once("option-pages/general_settings_array.php");
|
|
| 158 | - /** |
|
| 159 | - * Contains settings array for design tab. |
|
| 160 | - * |
|
| 161 | - * @since 1.0.0 |
|
| 162 | - * @package GeoDirectory |
|
| 163 | - */ |
|
| 164 | - include_once("option-pages/design_settings_array.php");
|
|
| 165 | - /** |
|
| 166 | - * Contains settings array for notifications tab. |
|
| 167 | - * |
|
| 168 | - * @since 1.0.0 |
|
| 169 | - * @package GeoDirectory |
|
| 170 | - */ |
|
| 171 | - include_once("option-pages/notifications_settings_array.php");
|
|
| 172 | - /** |
|
| 173 | - * Contains settings array for permalink tab. |
|
| 174 | - * |
|
| 175 | - * @since 1.0.0 |
|
| 176 | - * @package GeoDirectory |
|
| 177 | - */ |
|
| 178 | - include_once("option-pages/permalink_settings_array.php");
|
|
| 179 | - /** |
|
| 180 | - * Contains settings array for title / meta tab. |
|
| 181 | - * |
|
| 182 | - * @since 1.5.4 |
|
| 183 | - * @package GeoDirectory |
|
| 184 | - */ |
|
| 185 | - include_once("option-pages/title_meta_settings_array.php");
|
|
| 186 | - foreach ($geodir_settings as $value) {
|
|
| 187 | - geodir_update_options($value, true); |
|
| 188 | - } |
|
| 150 | + global $geodir_settings; |
|
| 151 | + /** |
|
| 152 | + * Contains settings array for general tab. |
|
| 153 | + * |
|
| 154 | + * @since 1.0.0 |
|
| 155 | + * @package GeoDirectory |
|
| 156 | + */ |
|
| 157 | + include_once("option-pages/general_settings_array.php");
|
|
| 158 | + /** |
|
| 159 | + * Contains settings array for design tab. |
|
| 160 | + * |
|
| 161 | + * @since 1.0.0 |
|
| 162 | + * @package GeoDirectory |
|
| 163 | + */ |
|
| 164 | + include_once("option-pages/design_settings_array.php");
|
|
| 165 | + /** |
|
| 166 | + * Contains settings array for notifications tab. |
|
| 167 | + * |
|
| 168 | + * @since 1.0.0 |
|
| 169 | + * @package GeoDirectory |
|
| 170 | + */ |
|
| 171 | + include_once("option-pages/notifications_settings_array.php");
|
|
| 172 | + /** |
|
| 173 | + * Contains settings array for permalink tab. |
|
| 174 | + * |
|
| 175 | + * @since 1.0.0 |
|
| 176 | + * @package GeoDirectory |
|
| 177 | + */ |
|
| 178 | + include_once("option-pages/permalink_settings_array.php");
|
|
| 179 | + /** |
|
| 180 | + * Contains settings array for title / meta tab. |
|
| 181 | + * |
|
| 182 | + * @since 1.5.4 |
|
| 183 | + * @package GeoDirectory |
|
| 184 | + */ |
|
| 185 | + include_once("option-pages/title_meta_settings_array.php");
|
|
| 186 | + foreach ($geodir_settings as $value) {
|
|
| 187 | + geodir_update_options($value, true); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
@@ -199,103 +199,103 @@ discard block |
||
| 199 | 199 | function geodir_set_default_widgets() |
| 200 | 200 | {
|
| 201 | 201 | |
| 202 | - $widget_option_list = array(); |
|
| 203 | - $widgetinfo = array(); |
|
| 204 | - $sidebarvalue_array = array(); |
|
| 205 | - $sidebars_widgets = array(); |
|
| 202 | + $widget_option_list = array(); |
|
| 203 | + $widgetinfo = array(); |
|
| 204 | + $sidebarvalue_array = array(); |
|
| 205 | + $sidebars_widgets = array(); |
|
| 206 | 206 | |
| 207 | - /*===========================*/ |
|
| 208 | - /* Widgets ON HOME PAGE */ |
|
| 209 | - /*===========================*/ |
|
| 207 | + /*===========================*/ |
|
| 208 | + /* Widgets ON HOME PAGE */ |
|
| 209 | + /*===========================*/ |
|
| 210 | 210 | |
| 211 | - $widget_option_list['geodir_home_top'] = |
|
| 212 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 213 | - 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
|
|
| 214 | - 'geodir_advance_search' => array()); |
|
| 211 | + $widget_option_list['geodir_home_top'] = |
|
| 212 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 213 | + 'geodir_map_v3_home_map' => array("autozoom" => 1, "width" => '100%', "heigh" => '425'),
|
|
| 214 | + 'geodir_advance_search' => array()); |
|
| 215 | 215 | |
| 216 | - $widget_option_list['geodir_home_content'] = |
|
| 217 | - array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
|
|
| 216 | + $widget_option_list['geodir_home_content'] = |
|
| 217 | + array('popular_post_view' => array("title" => __('Popular Places', 'geodirectory'), "layout" => 'list', "add_location_filter" => '1'));
|
|
| 218 | 218 | |
| 219 | - $widget_option_list['geodir_home_right'] = |
|
| 220 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 221 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 219 | + $widget_option_list['geodir_home_right'] = |
|
| 220 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 221 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 222 | 222 | |
| 223 | - /*===========================*/ |
|
| 224 | - /* Widgets ON LISTING PAGE */ |
|
| 225 | - /*===========================*/ |
|
| 223 | + /*===========================*/ |
|
| 224 | + /* Widgets ON LISTING PAGE */ |
|
| 225 | + /*===========================*/ |
|
| 226 | 226 | |
| 227 | - $widget_option_list['geodir_listing_top'] = |
|
| 228 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 229 | - 'geodir_advance_search' => array()); |
|
| 227 | + $widget_option_list['geodir_listing_top'] = |
|
| 228 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 229 | + 'geodir_advance_search' => array()); |
|
| 230 | 230 | |
| 231 | - $widget_option_list['geodir_listing_right_sidebar'] = |
|
| 232 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 233 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 234 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 231 | + $widget_option_list['geodir_listing_right_sidebar'] = |
|
| 232 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 233 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 234 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 235 | 235 | |
| 236 | 236 | |
| 237 | - /*===========================*/ |
|
| 238 | - /* Widgets ON SEARCH PAGE */ |
|
| 239 | - /*===========================*/ |
|
| 237 | + /*===========================*/ |
|
| 238 | + /* Widgets ON SEARCH PAGE */ |
|
| 239 | + /*===========================*/ |
|
| 240 | 240 | |
| 241 | - $widget_option_list['geodir_search_top'] = |
|
| 242 | - array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 243 | - 'geodir_advance_search' => array()); |
|
| 241 | + $widget_option_list['geodir_search_top'] = |
|
| 242 | + array('popular_post_category' => array("title" => __('Popular Categories', 'geodirectory')),
|
|
| 243 | + 'geodir_advance_search' => array()); |
|
| 244 | 244 | |
| 245 | - $widget_option_list['geodir_search_right_sidebar'] = |
|
| 246 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 247 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 248 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 245 | + $widget_option_list['geodir_search_right_sidebar'] = |
|
| 246 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 247 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 248 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 249 | 249 | |
| 250 | - /*===========================*/ |
|
| 251 | - /* Widgets ON DETAIL/SINGLE PAGE */ |
|
| 252 | - /*===========================*/ |
|
| 250 | + /*===========================*/ |
|
| 251 | + /* Widgets ON DETAIL/SINGLE PAGE */ |
|
| 252 | + /*===========================*/ |
|
| 253 | 253 | |
| 254 | - $widget_option_list['geodir_detail_sidebar'] = |
|
| 255 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 256 | - 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 257 | - 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 254 | + $widget_option_list['geodir_detail_sidebar'] = |
|
| 255 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')),
|
|
| 256 | + 'geodir_map_v3_listing_map' => array("autozoom" => 1, "sticky" => 1),
|
|
| 257 | + 'popular_post_view' => array("title" => __('Latest Places', 'geodirectory'), "add_location_filter" => '1'));
|
|
| 258 | 258 | |
| 259 | 259 | |
| 260 | - /*===========================*/ |
|
| 261 | - /* Widgets ON AUTHOR PAGE */ |
|
| 262 | - /*===========================*/ |
|
| 260 | + /*===========================*/ |
|
| 261 | + /* Widgets ON AUTHOR PAGE */ |
|
| 262 | + /*===========================*/ |
|
| 263 | 263 | |
| 264 | 264 | |
| 265 | - $widget_option_list['geodir_author_right_sidebar'] = |
|
| 266 | - array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
|
|
| 265 | + $widget_option_list['geodir_author_right_sidebar'] = |
|
| 266 | + array('geodir_loginbox' => array("title" => __('My Dashboard', 'geodirectory')));
|
|
| 267 | 267 | |
| 268 | 268 | |
| 269 | - $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 269 | + $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 270 | 270 | |
| 271 | - foreach ($widget_option_list as $key => $widget_options) {
|
|
| 271 | + foreach ($widget_option_list as $key => $widget_options) {
|
|
| 272 | 272 | |
| 273 | - foreach ($widget_options as $key2 => $widget_options_obj) {
|
|
| 274 | - $widgetid = 'widget_' . $key2; |
|
| 273 | + foreach ($widget_options as $key2 => $widget_options_obj) {
|
|
| 274 | + $widgetid = 'widget_' . $key2; |
|
| 275 | 275 | |
| 276 | - $widgetinfo[$widgetid][] = $widget_options_obj; |
|
| 276 | + $widgetinfo[$widgetid][] = $widget_options_obj; |
|
| 277 | 277 | |
| 278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 278 | + $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 279 | 279 | |
| 280 | - $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
| 280 | + $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
|
| 281 | 281 | |
| 282 | - } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - if (!empty($sidebarvalue_array[$key])) {
|
|
| 284 | + if (!empty($sidebarvalue_array[$key])) {
|
|
| 285 | 285 | |
| 286 | - $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 287 | - $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
| 288 | - update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 286 | + $sidebars_widgets = get_option('sidebars_widgets');
|
|
| 287 | + $sidebars_widgets[$key] = $sidebarvalue_array[$key]; |
|
| 288 | + update_option('sidebars_widgets', $sidebars_widgets);
|
|
| 289 | 289 | |
| 290 | - foreach ($widget_update as $key => $value) {
|
|
| 290 | + foreach ($widget_update as $key => $value) {
|
|
| 291 | 291 | |
| 292 | - update_option($key, $value); |
|
| 292 | + update_option($key, $value); |
|
| 293 | 293 | |
| 294 | - } |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - } |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - } |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | 300 | |
| 301 | 301 | } |
@@ -271,11 +271,11 @@ |
||
| 271 | 271 | foreach ($widget_option_list as $key => $widget_options) {
|
| 272 | 272 | |
| 273 | 273 | foreach ($widget_options as $key2 => $widget_options_obj) {
|
| 274 | - $widgetid = 'widget_' . $key2; |
|
| 274 | + $widgetid = 'widget_'.$key2; |
|
| 275 | 275 | |
| 276 | 276 | $widgetinfo[$widgetid][] = $widget_options_obj; |
| 277 | 277 | |
| 278 | - $sidebarvalue_array[$key][] = $key2 . "-" . (count($widgetinfo[$widgetid])); |
|
| 278 | + $sidebarvalue_array[$key][] = $key2."-".(count($widgetinfo[$widgetid])); |
|
| 279 | 279 | |
| 280 | 280 | $widget_update[$widgetid][count($widgetinfo[$widgetid])] = $widget_options_obj; |
| 281 | 281 | |
@@ -16,28 +16,28 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function jupiter_action_calls() |
| 18 | 18 | { |
| 19 | - // REMOVE BREADCRUMB |
|
| 20 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | - |
|
| 27 | - // REMOVE PAGE TITLES |
|
| 28 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 29 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
| 30 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 31 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 32 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - // CAHNGE PAGE TITLES |
|
| 36 | - remove_action('page_title', 'mk_page_title'); |
|
| 37 | - add_action('page_title', 'gd_mk_page_title'); |
|
| 38 | - // CHANGE BREADCRUMS FOR GD PAGES |
|
| 39 | - remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
| 40 | - add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
| 19 | + // REMOVE BREADCRUMB |
|
| 20 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
| 21 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
| 22 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
| 23 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
| 24 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
| 25 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
| 26 | + |
|
| 27 | + // REMOVE PAGE TITLES |
|
| 28 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
| 29 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
| 30 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
| 31 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
| 32 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + // CAHNGE PAGE TITLES |
|
| 36 | + remove_action('page_title', 'mk_page_title'); |
|
| 37 | + add_action('page_title', 'gd_mk_page_title'); |
|
| 38 | + // CHANGE BREADCRUMS FOR GD PAGES |
|
| 39 | + remove_action('theme_breadcrumbs', 'mk_theme_breadcrumbs'); |
|
| 40 | + add_action('theme_breadcrumbs', 'gd_mk_theme_breadcrumbs'); |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | } |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | function gd_mk_theme_breadcrumbs() |
| 53 | 53 | { |
| 54 | 54 | |
| 55 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 56 | - jupiter_geodir_breadcrumb(); |
|
| 57 | - } elseif (geodir_is_page('listing')) { |
|
| 58 | - jupiter_geodir_breadcrumb(); |
|
| 59 | - } elseif (geodir_is_page('detail')) { |
|
| 60 | - jupiter_geodir_breadcrumb(); |
|
| 61 | - } elseif (geodir_is_page('search')) { |
|
| 62 | - jupiter_geodir_breadcrumb(); |
|
| 63 | - } elseif (geodir_is_page('author')) { |
|
| 64 | - jupiter_geodir_breadcrumb(); |
|
| 65 | - } else { |
|
| 66 | - mk_theme_breadcrumbs(); |
|
| 67 | - } |
|
| 55 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 56 | + jupiter_geodir_breadcrumb(); |
|
| 57 | + } elseif (geodir_is_page('listing')) { |
|
| 58 | + jupiter_geodir_breadcrumb(); |
|
| 59 | + } elseif (geodir_is_page('detail')) { |
|
| 60 | + jupiter_geodir_breadcrumb(); |
|
| 61 | + } elseif (geodir_is_page('search')) { |
|
| 62 | + jupiter_geodir_breadcrumb(); |
|
| 63 | + } elseif (geodir_is_page('author')) { |
|
| 64 | + jupiter_geodir_breadcrumb(); |
|
| 65 | + } else { |
|
| 66 | + mk_theme_breadcrumbs(); |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -76,35 +76,35 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function gd_mk_page_title() |
| 78 | 78 | { |
| 79 | - global $wp; |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 83 | - jupiter_geodir_page_title(); |
|
| 84 | - } elseif (geodir_is_page('listing')) { |
|
| 85 | - ob_start(); // Start buffering; |
|
| 86 | - geodir_action_listings_title(); |
|
| 87 | - $gd_title = ob_get_clean(); |
|
| 88 | - $title_p = explode('">', $gd_title); |
|
| 89 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
| 90 | - jupiter_geodir_page_title($title); |
|
| 91 | - } elseif (geodir_is_page('search')) { |
|
| 92 | - ob_start(); // Start buffering; |
|
| 93 | - geodir_action_listings_title(); |
|
| 94 | - $gd_title = ob_get_clean(); |
|
| 95 | - $title_p = explode('">', $gd_title); |
|
| 96 | - $title = str_replace('</h1></header>', "", $title_p[2]); |
|
| 97 | - jupiter_geodir_page_title($title); |
|
| 98 | - } elseif (geodir_is_page('author')) { |
|
| 99 | - ob_start(); // Start buffering; |
|
| 100 | - geodir_action_author_page_title(); |
|
| 101 | - $gd_title = ob_get_clean(); |
|
| 102 | - $gd_title = str_replace('<h1>', "", $gd_title); |
|
| 103 | - $gd_title = str_replace('</h1>', "", $gd_title); |
|
| 104 | - jupiter_geodir_page_title($gd_title); |
|
| 105 | - } else { |
|
| 106 | - mk_page_title(); |
|
| 107 | - } |
|
| 79 | + global $wp; |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + if (is_page_geodir_home() || geodir_is_page('location')) { |
|
| 83 | + jupiter_geodir_page_title(); |
|
| 84 | + } elseif (geodir_is_page('listing')) { |
|
| 85 | + ob_start(); // Start buffering; |
|
| 86 | + geodir_action_listings_title(); |
|
| 87 | + $gd_title = ob_get_clean(); |
|
| 88 | + $title_p = explode('">', $gd_title); |
|
| 89 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
| 90 | + jupiter_geodir_page_title($title); |
|
| 91 | + } elseif (geodir_is_page('search')) { |
|
| 92 | + ob_start(); // Start buffering; |
|
| 93 | + geodir_action_listings_title(); |
|
| 94 | + $gd_title = ob_get_clean(); |
|
| 95 | + $title_p = explode('">', $gd_title); |
|
| 96 | + $title = str_replace('</h1></header>', "", $title_p[2]); |
|
| 97 | + jupiter_geodir_page_title($title); |
|
| 98 | + } elseif (geodir_is_page('author')) { |
|
| 99 | + ob_start(); // Start buffering; |
|
| 100 | + geodir_action_author_page_title(); |
|
| 101 | + $gd_title = ob_get_clean(); |
|
| 102 | + $gd_title = str_replace('<h1>', "", $gd_title); |
|
| 103 | + $gd_title = str_replace('</h1>', "", $gd_title); |
|
| 104 | + jupiter_geodir_page_title($gd_title); |
|
| 105 | + } else { |
|
| 106 | + mk_page_title(); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | } |
@@ -119,48 +119,48 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | function jupiter_geodir_breadcrumb() |
| 121 | 121 | { |
| 122 | - $item = ''; |
|
| 123 | - ob_start(); // Start buffering; |
|
| 124 | - geodir_breadcrumb(); |
|
| 125 | - $gd_crums = ob_get_clean(); |
|
| 126 | - if ($gd_crums) { |
|
| 127 | - $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
| 128 | - $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
| 129 | - $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
| 130 | - $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
| 131 | - $gd_crums = explode(" > ", $gd_crums); |
|
| 132 | - $trail_end = array_pop($gd_crums); |
|
| 133 | - $gd_crums['trail_end'] = $trail_end; |
|
| 134 | - //print_r($gd_crums);exit; |
|
| 135 | - //print_r($trail); |
|
| 136 | - $item = $gd_crums; |
|
| 137 | - |
|
| 138 | - } |
|
| 139 | - if (!$item) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 142 | - global $mk_options, $post; |
|
| 143 | - $post_id = global_get_post_id(); |
|
| 144 | - |
|
| 145 | - if ($post_id) { |
|
| 146 | - $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
| 147 | - $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
| 148 | - if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
| 149 | - $breadcrumb_skin_class = $breadcrumb_skin; |
|
| 150 | - } else { |
|
| 151 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
| 152 | - } |
|
| 153 | - } else { |
|
| 154 | - $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - $delimiter = ' / '; |
|
| 159 | - |
|
| 160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
| 161 | - |
|
| 162 | - echo implode($delimiter, $item); |
|
| 163 | - echo "</div></div>"; |
|
| 122 | + $item = ''; |
|
| 123 | + ob_start(); // Start buffering; |
|
| 124 | + geodir_breadcrumb(); |
|
| 125 | + $gd_crums = ob_get_clean(); |
|
| 126 | + if ($gd_crums) { |
|
| 127 | + $gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>', "", $gd_crums); |
|
| 128 | + $gd_crums = str_replace('</li></ul></div>', "", $gd_crums); |
|
| 129 | + $gd_crums = str_replace(' > ', " > ", $gd_crums); |
|
| 130 | + $gd_crums = str_replace('</li><li>', "", $gd_crums); |
|
| 131 | + $gd_crums = explode(" > ", $gd_crums); |
|
| 132 | + $trail_end = array_pop($gd_crums); |
|
| 133 | + $gd_crums['trail_end'] = $trail_end; |
|
| 134 | + //print_r($gd_crums);exit; |
|
| 135 | + //print_r($trail); |
|
| 136 | + $item = $gd_crums; |
|
| 137 | + |
|
| 138 | + } |
|
| 139 | + if (!$item) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | + global $mk_options, $post; |
|
| 143 | + $post_id = global_get_post_id(); |
|
| 144 | + |
|
| 145 | + if ($post_id) { |
|
| 146 | + $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); |
|
| 147 | + $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); |
|
| 148 | + if ($local_skining == 'true' && !empty($breadcrumb_skin)) { |
|
| 149 | + $breadcrumb_skin_class = $breadcrumb_skin; |
|
| 150 | + } else { |
|
| 151 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
| 152 | + } |
|
| 153 | + } else { |
|
| 154 | + $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + $delimiter = ' / '; |
|
| 159 | + |
|
| 160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
| 161 | + |
|
| 162 | + echo implode($delimiter, $item); |
|
| 163 | + echo "</div></div>"; |
|
| 164 | 164 | |
| 165 | 165 | } |
| 166 | 166 | |
@@ -174,41 +174,41 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function jupiter_geodir_page_title($title = '', $subtitle = '') |
| 176 | 176 | { |
| 177 | - global $mk_options; |
|
| 178 | - |
|
| 179 | - $post_id = global_get_post_id(); |
|
| 180 | - $shadow_css = ''; |
|
| 181 | - if ($mk_options['page_title_shadow'] == 'true') { |
|
| 182 | - $shadow_css = 'mk-drop-shadow'; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - $align = !empty($align) ? $align : 'left'; |
|
| 186 | - |
|
| 187 | - //$title = 'xxxx'; |
|
| 188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
| 189 | - echo '<div class="mk-grid">'; |
|
| 190 | - if (!empty($title)) { |
|
| 191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
| 192 | - |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if (!empty($subtitle)) { |
|
| 196 | - echo '<div class="page-introduce-subtitle">'; |
|
| 197 | - echo $subtitle; |
|
| 198 | - echo '</div>'; |
|
| 199 | - } |
|
| 200 | - if ($mk_options['disable_breadcrumb'] == 'true') { |
|
| 201 | - if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
| 202 | - /** |
|
| 203 | - * Calls the theme breadcrumbs for Jupiter theme. |
|
| 204 | - * |
|
| 205 | - * @since 1.4.0 |
|
| 206 | - */ |
|
| 207 | - do_action('theme_breadcrumbs', $post_id); |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - echo '<div class="clearboth"></div></div></section>'; |
|
| 177 | + global $mk_options; |
|
| 178 | + |
|
| 179 | + $post_id = global_get_post_id(); |
|
| 180 | + $shadow_css = ''; |
|
| 181 | + if ($mk_options['page_title_shadow'] == 'true') { |
|
| 182 | + $shadow_css = 'mk-drop-shadow'; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + $align = !empty($align) ? $align : 'left'; |
|
| 186 | + |
|
| 187 | + //$title = 'xxxx'; |
|
| 188 | + echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
| 189 | + echo '<div class="mk-grid">'; |
|
| 190 | + if (!empty($title)) { |
|
| 191 | + echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
| 192 | + |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if (!empty($subtitle)) { |
|
| 196 | + echo '<div class="page-introduce-subtitle">'; |
|
| 197 | + echo $subtitle; |
|
| 198 | + echo '</div>'; |
|
| 199 | + } |
|
| 200 | + if ($mk_options['disable_breadcrumb'] == 'true') { |
|
| 201 | + if (get_post_meta($post_id, '_disable_breadcrumb', true) != 'false') { |
|
| 202 | + /** |
|
| 203 | + * Calls the theme breadcrumbs for Jupiter theme. |
|
| 204 | + * |
|
| 205 | + * @since 1.4.0 |
|
| 206 | + */ |
|
| 207 | + do_action('theme_breadcrumbs', $post_id); |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + echo '<div class="clearboth"></div></div></section>'; |
|
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $delimiter = ' / '; |
| 159 | 159 | |
| 160 | - echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; |
|
| 160 | + echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner '.$breadcrumb_skin_class.'-skin">'; |
|
| 161 | 161 | |
| 162 | 162 | echo implode($delimiter, $item); |
| 163 | 163 | echo "</div></div>"; |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | $align = !empty($align) ? $align : 'left'; |
| 186 | 186 | |
| 187 | 187 | //$title = 'xxxx'; |
| 188 | - echo '<section id="mk-page-introduce" class="intro-' . $align . '">'; |
|
| 188 | + echo '<section id="mk-page-introduce" class="intro-'.$align.'">'; |
|
| 189 | 189 | echo '<div class="mk-grid">'; |
| 190 | 190 | if (!empty($title)) { |
| 191 | - echo '<h1 class="page-introduce-title ' . $shadow_css . '">' . $title . '</h1>'; |
|
| 191 | + echo '<h1 class="page-introduce-title '.$shadow_css.'">'.$title.'</h1>'; |
|
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | global $gd_session; |
| 13 | 13 | |
| 14 | 14 | if (!isset($_REQUEST['backandedit'])) { |
| 15 | - $gd_session->un_set('listing'); |
|
| 15 | + $gd_session->un_set('listing'); |
|
| 16 | 16 | } |
| 17 | 17 | // call header |
| 18 | 18 | get_header(); |
@@ -198,7 +198,9 @@ discard block |
||
| 198 | 198 | $mapview = $maptype; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 201 | + if (empty($mapzoom)) { |
|
| 202 | + $mapzoom = $zoom; |
|
| 203 | + } |
|
| 202 | 204 | |
| 203 | 205 | // Set default map options |
| 204 | 206 | $map_args['ajax_url'] = geodir_get_ajax_url(); |
@@ -326,8 +328,9 @@ discard block |
||
| 326 | 328 | |
| 327 | 329 | foreach ($map_zoom_level as $level) {
|
| 328 | 330 | $selected = ''; |
| 329 | - if ($level == $zoom) |
|
| 330 | - $selected = 'selected="selected"'; |
|
| 331 | + if ($level == $zoom) { |
|
| 332 | + $selected = 'selected="selected"'; |
|
| 333 | + } |
|
| 331 | 334 | |
| 332 | 335 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
| 333 | 336 | |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | function init_listing_map_script() |
| 20 | 20 | {
|
| 21 | - global $list_map_json; |
|
| 21 | + global $list_map_json; |
|
| 22 | 22 | |
| 23 | - $list_map_json = array(); |
|
| 23 | + $list_map_json = array(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -35,18 +35,18 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function create_list_jsondata($post) |
| 37 | 37 | {
|
| 38 | - global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
| 39 | - |
|
| 40 | - if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
|
|
| 41 | - /** |
|
| 42 | - * Filter the json data for search listing map. |
|
| 43 | - * |
|
| 44 | - * @since 1.5.7 |
|
| 45 | - * @param string $post->marker_json JSON representation of the post marker info. |
|
| 46 | - * @param object $post The post object. |
|
| 47 | - */ |
|
| 48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 49 | - } |
|
| 38 | + global $wpdb, $list_map_json, $add_post_in_marker_array; |
|
| 39 | + |
|
| 40 | + if ((is_main_query() || $add_post_in_marker_array) && isset($post->marker_json) && $post->marker_json != '') {
|
|
| 41 | + /** |
|
| 42 | + * Filter the json data for search listing map. |
|
| 43 | + * |
|
| 44 | + * @since 1.5.7 |
|
| 45 | + * @param string $post->marker_json JSON representation of the post marker info. |
|
| 46 | + * @param object $post The post object. |
|
| 47 | + */ |
|
| 48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,29 +59,29 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | function show_listing_widget_map() |
| 61 | 61 | {
|
| 62 | - global $list_map_json; |
|
| 62 | + global $list_map_json; |
|
| 63 | 63 | |
| 64 | - if (!empty($list_map_json)) {
|
|
| 65 | - $list_map_json = array_unique($list_map_json); |
|
| 66 | - $cat_content_info[] = implode(',', $list_map_json);
|
|
| 67 | - } |
|
| 64 | + if (!empty($list_map_json)) {
|
|
| 65 | + $list_map_json = array_unique($list_map_json); |
|
| 66 | + $cat_content_info[] = implode(',', $list_map_json);
|
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $totalcount = count(array_unique($list_map_json)); |
|
| 69 | + $totalcount = count(array_unique($list_map_json)); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - if (!empty($cat_content_info)) {
|
|
| 73 | - $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 74 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 75 | - $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 77 | - } else {
|
|
| 78 | - $list_json = '[{"totalcount":"0"}]';
|
|
| 79 | - } |
|
| 72 | + if (!empty($cat_content_info)) {
|
|
| 73 | + $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 74 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 75 | + $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
|
| 76 | + $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 77 | + } else {
|
|
| 78 | + $list_json = '[{"totalcount":"0"}]';
|
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - $listing_map_args = array('list_json' => $list_json);
|
|
| 81 | + $listing_map_args = array('list_json' => $list_json);
|
|
| 82 | 82 | |
| 83 | - // Pass the json data in listing map script |
|
| 84 | - wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
|
|
| 83 | + // Pass the json data in listing map script |
|
| 84 | + wp_localize_script('geodir-listing-map-widget', 'listing_map_args', $listing_map_args);
|
|
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,187 +93,187 @@ discard block |
||
| 93 | 93 | class geodir_map_listingpage extends WP_Widget |
| 94 | 94 | {
|
| 95 | 95 | |
| 96 | - /** |
|
| 96 | + /** |
|
| 97 | 97 | * Register the listing page map widget. |
| 98 | 98 | * |
| 99 | 99 | * @since 1.0.0 |
| 100 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 100 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
| 101 | 101 | */ |
| 102 | - public function __construct() {
|
|
| 103 | - $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
|
|
| 104 | - parent::__construct( |
|
| 105 | - 'geodir_map_v3_listing_map', // Base ID |
|
| 106 | - __('GD > GMap - Listing page', 'geodirectory'), // Name
|
|
| 107 | - $widget_ops// Args |
|
| 108 | - ); |
|
| 102 | + public function __construct() {
|
|
| 103 | + $widget_ops = array('classname' => 'widget geodir-map-listing-page', 'description' => __('Google Map for Listing page. It will show you google map V3 for Listing page.', 'geodirectory'));
|
|
| 104 | + parent::__construct( |
|
| 105 | + 'geodir_map_v3_listing_map', // Base ID |
|
| 106 | + __('GD > GMap - Listing page', 'geodirectory'), // Name
|
|
| 107 | + $widget_ops// Args |
|
| 108 | + ); |
|
| 109 | 109 | |
| 110 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
|
|
| 110 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
|
|
| 111 | 111 | |
| 112 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array
|
|
| 112 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array
|
|
| 113 | 113 | |
| 114 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
|
|
| 115 | - } |
|
| 114 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
|
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Front-end display content for listing page map widget. |
| 119 | 119 | * |
| 120 | 120 | * @since 1.0.0 |
| 121 | - * @since 1.5.1 Declare function public. |
|
| 121 | + * @since 1.5.1 Declare function public. |
|
| 122 | + * |
|
| 123 | + * @global object $post The current post object. |
|
| 122 | 124 | * |
| 123 | - * @global object $post The current post object. |
|
| 124 | - * |
|
| 125 | 125 | * @param array $args Widget arguments. |
| 126 | 126 | * @param array $instance Saved values from database. |
| 127 | 127 | */ |
| 128 | - public function widget($args, $instance) |
|
| 129 | - {
|
|
| 130 | - |
|
| 131 | - if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
|
|
| 132 | - || geodir_is_page('detail')
|
|
| 133 | - ) : |
|
| 134 | - |
|
| 135 | - extract($args, EXTR_SKIP); |
|
| 136 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 137 | - $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
|
|
| 138 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 139 | - $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 140 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 141 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 142 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 143 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 144 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 145 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 146 | - /** |
|
| 147 | - * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @param bool $sticky True if should be sticky, false if not |
|
| 151 | - */ |
|
| 152 | - $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
|
|
| 153 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
| 154 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 155 | - $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
|
|
| 128 | + public function widget($args, $instance) |
|
| 129 | + {
|
|
| 130 | + |
|
| 131 | + if (geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search')
|
|
| 132 | + || geodir_is_page('detail')
|
|
| 133 | + ) : |
|
| 134 | + |
|
| 135 | + extract($args, EXTR_SKIP); |
|
| 136 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 137 | + $width = empty($instance['width']) ? '294' : apply_filters('widget_width', $instance['width']);
|
|
| 138 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 139 | + $height = empty($instance['heigh']) ? '370' : apply_filters('widget_heigh', $instance['heigh']);
|
|
| 140 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 141 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']);
|
|
| 142 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 143 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']);
|
|
| 144 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 145 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']);
|
|
| 146 | + /** |
|
| 147 | + * Filter the listing map value widget_sticky, to set if the map should be sticky or not (scroll with page). |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @param bool $sticky True if should be sticky, false if not |
|
| 151 | + */ |
|
| 152 | + $sticky = empty($instance['sticky']) ? '' : apply_filters('widget_sticky', $instance['sticky']);
|
|
| 153 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
| 154 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']);
|
|
| 155 | + $showall = empty($instance['showall']) ? '0' : apply_filters('widget_showall', $instance['showall']);
|
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * Filter the listing map should to be displayed or not. |
|
| 159 | - * |
|
| 160 | - * @since 1.4.6 |
|
| 158 | + * Filter the listing map should to be displayed or not. |
|
| 161 | 159 | * |
| 162 | - * @param bool $display true if map should be displayed, false if not. |
|
| 163 | - */ |
|
| 160 | + * @since 1.4.6 |
|
| 161 | + * |
|
| 162 | + * @param bool $display true if map should be displayed, false if not. |
|
| 163 | + */ |
|
| 164 | 164 | $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
| 165 | 165 | if ( !$show_map ) {
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $map_args = array(); |
|
| 170 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
|
|
| 171 | - $map_args['width'] = $width; |
|
| 172 | - $map_args['height'] = $height; |
|
| 173 | - |
|
| 174 | - $map_args['scrollwheel'] = $scrollwheel; |
|
| 175 | - $map_args['showall'] = $showall; |
|
| 176 | - $map_args['child_collapse'] = '0'; |
|
| 177 | - $map_args['sticky'] = $sticky; |
|
| 178 | - $map_args['enable_cat_filters'] = false; |
|
| 179 | - $map_args['enable_text_search'] = false; |
|
| 180 | - $map_args['enable_post_type_filters'] = false; |
|
| 181 | - $map_args['enable_location_filters'] = false; |
|
| 182 | - $map_args['enable_jason_on_load'] = true; |
|
| 169 | + $map_args = array(); |
|
| 170 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']);
|
|
| 171 | + $map_args['width'] = $width; |
|
| 172 | + $map_args['height'] = $height; |
|
| 173 | + |
|
| 174 | + $map_args['scrollwheel'] = $scrollwheel; |
|
| 175 | + $map_args['showall'] = $showall; |
|
| 176 | + $map_args['child_collapse'] = '0'; |
|
| 177 | + $map_args['sticky'] = $sticky; |
|
| 178 | + $map_args['enable_cat_filters'] = false; |
|
| 179 | + $map_args['enable_text_search'] = false; |
|
| 180 | + $map_args['enable_post_type_filters'] = false; |
|
| 181 | + $map_args['enable_location_filters'] = false; |
|
| 182 | + $map_args['enable_jason_on_load'] = true; |
|
| 183 | 183 | |
| 184 | - if (is_single()) {
|
|
| 185 | - |
|
| 186 | - global $post; |
|
| 187 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 188 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 189 | - $mapview = $post->post_mapview; |
|
| 190 | - $mapzoom = $post->post_mapzoom; |
|
| 191 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 192 | - |
|
| 193 | - } else {
|
|
| 194 | - $default_location = geodir_get_default_location(); |
|
| 195 | - |
|
| 196 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 197 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 198 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 199 | - $mapview = $maptype; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 203 | - |
|
| 204 | - // Set default map options |
|
| 205 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 206 | - $map_args['latitude'] = $map_default_lat; |
|
| 207 | - $map_args['longitude'] = $map_default_lng; |
|
| 208 | - $map_args['zoom'] = $zoom; |
|
| 209 | - //$map_args['scrollwheel'] = true; |
|
| 210 | - $map_args['scrollwheel'] = $scrollwheel; |
|
| 211 | - $map_args['showall'] = $showall; |
|
| 212 | - $map_args['streetViewControl'] = true; |
|
| 213 | - $map_args['maptype'] = $maptype; |
|
| 214 | - $map_args['showPreview'] = '0'; |
|
| 215 | - $map_args['maxZoom'] = 21; |
|
| 216 | - $map_args['autozoom'] = $autozoom; |
|
| 217 | - $map_args['bubble_size'] = 'small'; |
|
| 184 | + if (is_single()) {
|
|
| 185 | + |
|
| 186 | + global $post; |
|
| 187 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 188 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 189 | + $mapview = $post->post_mapview; |
|
| 190 | + $mapzoom = $post->post_mapzoom; |
|
| 191 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 192 | + |
|
| 193 | + } else {
|
|
| 194 | + $default_location = geodir_get_default_location(); |
|
| 195 | + |
|
| 196 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 197 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 198 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 199 | + $mapview = $maptype; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + if (empty($mapzoom)) $mapzoom = $zoom; |
|
| 203 | + |
|
| 204 | + // Set default map options |
|
| 205 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 206 | + $map_args['latitude'] = $map_default_lat; |
|
| 207 | + $map_args['longitude'] = $map_default_lng; |
|
| 208 | + $map_args['zoom'] = $zoom; |
|
| 209 | + //$map_args['scrollwheel'] = true; |
|
| 210 | + $map_args['scrollwheel'] = $scrollwheel; |
|
| 211 | + $map_args['showall'] = $showall; |
|
| 212 | + $map_args['streetViewControl'] = true; |
|
| 213 | + $map_args['maptype'] = $maptype; |
|
| 214 | + $map_args['showPreview'] = '0'; |
|
| 215 | + $map_args['maxZoom'] = 21; |
|
| 216 | + $map_args['autozoom'] = $autozoom; |
|
| 217 | + $map_args['bubble_size'] = 'small'; |
|
| 218 | 218 | |
| 219 | - $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
|
|
| 219 | + $map_args['enable_marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($instance['marker_cluster']) ? true : false;
|
|
| 220 | 220 | |
| 221 | - echo $before_widget; |
|
| 222 | - geodir_draw_map($map_args); |
|
| 223 | - echo $after_widget; |
|
| 221 | + echo $before_widget; |
|
| 222 | + geodir_draw_map($map_args); |
|
| 223 | + echo $after_widget; |
|
| 224 | 224 | |
| 225 | - endif; |
|
| 226 | - } |
|
| 225 | + endif; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * Sanitize listing page map widget form values as they are saved. |
| 230 | 230 | * |
| 231 | 231 | * @since 1.0.0 |
| 232 | - * @since 1.5.1 Declare function public. |
|
| 232 | + * @since 1.5.1 Declare function public. |
|
| 233 | 233 | * |
| 234 | 234 | * @param array $new_instance Values just sent to be saved. |
| 235 | 235 | * @param array $old_instance Previously saved values from database. |
| 236 | 236 | * |
| 237 | 237 | * @return array Updated safe values to be saved. |
| 238 | 238 | */ |
| 239 | - public function update($new_instance, $old_instance) {
|
|
| 240 | - //save the widget |
|
| 241 | - $instance = $old_instance; |
|
| 242 | - $instance['width'] = strip_tags($new_instance['width']); |
|
| 243 | - $instance['heigh'] = ($new_instance['heigh']); |
|
| 244 | - $instance['maptype'] = ($new_instance['maptype']); |
|
| 245 | - $instance['zoom'] = ($new_instance['zoom']); |
|
| 246 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 247 | - $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
| 248 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 249 | - $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
| 250 | - $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
|
|
| 251 | - |
|
| 252 | - return $instance; |
|
| 253 | - } |
|
| 239 | + public function update($new_instance, $old_instance) {
|
|
| 240 | + //save the widget |
|
| 241 | + $instance = $old_instance; |
|
| 242 | + $instance['width'] = strip_tags($new_instance['width']); |
|
| 243 | + $instance['heigh'] = ($new_instance['heigh']); |
|
| 244 | + $instance['maptype'] = ($new_instance['maptype']); |
|
| 245 | + $instance['zoom'] = ($new_instance['zoom']); |
|
| 246 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
| 247 | + $instance['sticky'] = isset($new_instance['sticky']) ? $new_instance['sticky'] : ''; |
|
| 248 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
| 249 | + $instance['showall'] = isset($new_instance['showall']) ? ($new_instance['showall']) : ''; |
|
| 250 | + $instance['marker_cluster'] = defined('GDCLUSTER_VERSION') && !empty($new_instance['marker_cluster']) ? 1 : '';
|
|
| 251 | + |
|
| 252 | + return $instance; |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * Back-end listing page map widget settings form. |
| 257 | 257 | * |
| 258 | 258 | * @since 1.0.0 |
| 259 | - * @since 1.5.1 Declare function public. |
|
| 259 | + * @since 1.5.1 Declare function public. |
|
| 260 | 260 | * |
| 261 | 261 | * @param array $instance Previously saved values from database. |
| 262 | 262 | */ |
| 263 | - public function form($instance) {
|
|
| 264 | - // widget form in backend |
|
| 265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 263 | + public function form($instance) {
|
|
| 264 | + // widget form in backend |
|
| 265 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 266 | 266 | |
| 267 | - $width = strip_tags($instance['width']); |
|
| 268 | - $heigh = strip_tags($instance['heigh']); |
|
| 269 | - $maptype = strip_tags($instance['maptype']); |
|
| 270 | - $zoom = strip_tags($instance['zoom']); |
|
| 271 | - $autozoom = strip_tags($instance['autozoom']); |
|
| 272 | - $sticky = strip_tags($instance['sticky']); |
|
| 273 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 274 | - $showall = strip_tags($instance['showall']); |
|
| 275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
| 276 | - ?> |
|
| 267 | + $width = strip_tags($instance['width']); |
|
| 268 | + $heigh = strip_tags($instance['heigh']); |
|
| 269 | + $maptype = strip_tags($instance['maptype']); |
|
| 270 | + $zoom = strip_tags($instance['zoom']); |
|
| 271 | + $autozoom = strip_tags($instance['autozoom']); |
|
| 272 | + $sticky = strip_tags($instance['sticky']); |
|
| 273 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
| 274 | + $showall = strip_tags($instance['showall']); |
|
| 275 | + $marker_cluster = (int)$instance['marker_cluster']; |
|
| 276 | + ?> |
|
| 277 | 277 | <p> |
| 278 | 278 | <label |
| 279 | 279 | for="<?php echo $this->get_field_id('width'); ?>"><?php _e('Map Width <small>(Default is : 294) you can use px or % here</small>', 'geodirectory'); ?>
|
@@ -302,14 +302,14 @@ discard block |
||
| 302 | 302 | name="<?php echo $this->get_field_name('maptype'); ?>">
|
| 303 | 303 | |
| 304 | 304 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') {
|
| 305 | - echo 'selected="selected"'; |
|
| 306 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 305 | + echo 'selected="selected"'; |
|
| 306 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option>
|
|
| 307 | 307 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') {
|
| 308 | - echo 'selected="selected"'; |
|
| 309 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 308 | + echo 'selected="selected"'; |
|
| 309 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option>
|
|
| 310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 311 | - echo 'selected="selected"'; |
|
| 312 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 311 | + echo 'selected="selected"'; |
|
| 312 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
|
| 313 | 313 | <option <?php selected($maptype, 'TERRAIN');?> |
| 314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 315 | 315 | </select> |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | </p> |
| 318 | 318 | |
| 319 | 319 | <?php |
| 320 | - $map_zoom_level = geodir_map_zoom_level(); |
|
| 321 | - ?> |
|
| 320 | + $map_zoom_level = geodir_map_zoom_level(); |
|
| 321 | + ?> |
|
| 322 | 322 | |
| 323 | 323 | <p> |
| 324 | 324 | <label |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>"
|
| 329 | 329 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php
|
| 330 | 330 | |
| 331 | - foreach ($map_zoom_level as $level) {
|
|
| 332 | - $selected = ''; |
|
| 333 | - if ($level == $zoom) |
|
| 334 | - $selected = 'selected="selected"'; |
|
| 331 | + foreach ($map_zoom_level as $level) {
|
|
| 332 | + $selected = ''; |
|
| 333 | + if ($level == $zoom) |
|
| 334 | + $selected = 'selected="selected"'; |
|
| 335 | 335 | |
| 336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 336 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 337 | 337 | |
| 338 | - } ?> |
|
| 338 | + } ?> |
|
| 339 | 339 | |
| 340 | 340 | </select> |
| 341 | 341 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | for="<?php echo $this->get_field_id('autozoom'); ?>">
|
| 348 | 348 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>"
|
| 349 | 349 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) {
|
| 350 | - echo 'checked="checked"'; |
|
| 351 | - } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
|
|
| 350 | + echo 'checked="checked"'; |
|
| 351 | + } ?> /> <?php _e('Map Auto Zoom ?', 'geodirectory'); ?></label>
|
|
| 352 | 352 | </p> |
| 353 | 353 | |
| 354 | 354 | <p> |
@@ -356,8 +356,8 @@ discard block |
||
| 356 | 356 | for="<?php echo $this->get_field_id('sticky'); ?>">
|
| 357 | 357 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('sticky'); ?>"
|
| 358 | 358 | name="<?php echo $this->get_field_name('sticky'); ?>"<?php if ($sticky) {
|
| 359 | - echo 'checked="checked"'; |
|
| 360 | - } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
|
|
| 359 | + echo 'checked="checked"'; |
|
| 360 | + } ?> /> <?php _e('Map Sticky(should stick to the right of screen) ?', 'geodirectory'); ?>
|
|
| 361 | 361 | </label> |
| 362 | 362 | </p> |
| 363 | 363 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | </p> --> |
| 384 | 384 | |
| 385 | 385 | <?php |
| 386 | - } |
|
| 386 | + } |
|
| 387 | 387 | } // class geodir_map_listingpage |
| 388 | 388 | |
| 389 | 389 | register_widget('geodir_map_listingpage');
|
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $post->marker_json JSON representation of the post marker info. |
| 46 | 46 | * @param object $post The post object. |
| 47 | 47 | */ |
| 48 | - $list_map_json[] = apply_filters('geodir_create_list_jsondata',$post->marker_json,$post);
|
|
| 48 | + $list_map_json[] = apply_filters('geodir_create_list_jsondata', $post->marker_json, $post);
|
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $json_content = substr(implode(',', $cat_content_info), 1);
|
| 74 | 74 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
| 75 | 75 | $json_content = wp_specialchars_decode($json_content); // Fixed #post-320722 on 2016-12-08 |
| 76 | - $list_json = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 76 | + $list_json = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
|
|
| 77 | 77 | } else {
|
| 78 | 78 | $list_json = '[{"totalcount":"0"}]';
|
| 79 | 79 | } |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @param bool $display true if map should be displayed, false if not. |
| 163 | 163 | */ |
| 164 | - $show_map = apply_filters( 'geodir_show_map_listing', $display = true ); |
|
| 165 | - if ( !$show_map ) {
|
|
| 164 | + $show_map = apply_filters('geodir_show_map_listing', $display = true);
|
|
| 165 | + if (!$show_map) {
|
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function form($instance) {
|
| 264 | 264 | // widget form in backend |
| 265 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 265 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'sticky' => '', 'scrollwheel' => '0', 'showall' => '0', 'marker_cluster' => '0'));
|
|
| 266 | 266 | |
| 267 | 267 | $width = strip_tags($instance['width']); |
| 268 | 268 | $heigh = strip_tags($instance['heigh']); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $sticky = strip_tags($instance['sticky']); |
| 273 | 273 | $scrollwheel = strip_tags($instance['scrollwheel']); |
| 274 | 274 | $showall = strip_tags($instance['showall']); |
| 275 | - $marker_cluster = (int)$instance['marker_cluster']; |
|
| 275 | + $marker_cluster = (int) $instance['marker_cluster']; |
|
| 276 | 276 | ?> |
| 277 | 277 | <p> |
| 278 | 278 | <label |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') {
|
| 311 | 311 | echo 'selected="selected"'; |
| 312 | 312 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option>
|
| 313 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
| 313 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
| 314 | 314 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option>
|
| 315 | 315 | </select> |
| 316 | 316 | </label> |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if ($level == $zoom) |
| 334 | 334 | $selected = 'selected="selected"'; |
| 335 | 335 | |
| 336 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
| 336 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
| 337 | 337 | |
| 338 | 338 | } ?> |
| 339 | 339 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | for="<?php echo $this->get_field_id('scrollwheel'); ?>">
|
| 367 | 367 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>"
|
| 368 | 368 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1"
|
| 369 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
|
|
| 369 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> <?php _e('Enable mouse scroll zoom ?', 'geodirectory'); ?>
|
|
| 370 | 370 | </label> |
| 371 | 371 | </p> |
| 372 | 372 | <?php if (defined('GDCLUSTER_VERSION')) { ?>
|