/** * Generates popular postview HTML. * * @since 1.0.0 * @since 1.5.1 View all link fixed for location filter disabled. * @package GeoDirectory * @global object $post The current post object. * @global string $gridview_columns_widget The girdview style of the listings for widget. * @global bool $geodir_is_widget_listing Is this a widget listing?. Default: false. * @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array|string $instance The settings for the particular instance of the widget. */ function geodir_popular_postview_output($args = '', $instance = '') { //print_r($args); //print_r($instance); // prints the widget extract($args, EXTR_SKIP); echo $before_widget; /** This filter is documented in geodirectory_widgets.php */ $title = empty($instance['title']) ? ucwords($instance['category_title']) : apply_filters('widget_title', __($instance['title'], 'geodirectory')); /** * Filter the widget post type. * * @since 1.0.0 * @param string $instance['post_type'] Post type of listing. */ $post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('widget_post_type', $instance['post_type']); /** * Filter the widget's term. * * @since 1.0.0 * @param string $instance['category'] Filter by term. Can be any valid term. */ $category = empty($instance['category']) ? '0' : apply_filters('widget_category', $instance['category']); /** * Filter the widget listings limit. * * @since 1.0.0 * @param string $instance['post_number'] Number of listings to display. */ $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); /** * Filter widget's "layout" type. * * @since 1.0.0 * @param string $instance['layout'] Widget layout type. */ $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); /** * Filter widget's "add_location_filter" value. * * @since 1.0.0 * @param string|bool $instance['add_location_filter'] Do you want to add location filter? Can be 1 or 0. */ $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); /** * Filter widget's listing width. * * @since 1.0.0 * @param string $instance['listing_width'] Listing width. */ $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); /** * Filter widget's "list_sort" type. * * @since 1.0.0 * @param string $instance['list_sort'] Listing sort by type. */ $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); $use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false; // set post type to current viewing post type if ($use_viewing_post_type) { $current_post_type = geodir_get_current_posttype(); if ($current_post_type != '' && $current_post_type != $post_type) { $post_type = $current_post_type; $category = array(); // old post type category will not work for current changed post type } } // replace widget title dynamically $posttype_plural_label = __(get_post_type_plural_label($post_type), 'geodirectory'); $posttype_singular_label = __(get_post_type_singular_label($post_type), 'geodirectory'); $title = str_replace("%posttype_plural_label%", $posttype_plural_label, $title); $title = str_replace("%posttype_singular_label%", $posttype_singular_label, $title); if (isset($instance['character_count'])) { /** * Filter the widget's excerpt character count. * * @since 1.0.0 * @param int $instance['character_count'] Excerpt character count. */ $character_count = apply_filters('widget_list_character_count', $instance['character_count']); } else { $character_count = ''; } if (empty($title) || $title == 'All') { $title .= ' ' . __(get_post_type_plural_label($post_type), 'geodirectory'); } $location_url = array(); $city = get_query_var('gd_city'); if (!empty($city)) { if (get_option('geodir_show_location_url') == 'all') { $country = get_query_var('gd_country'); $region = get_query_var('gd_region'); if (!empty($country)) { $location_url[] = $country; } if (!empty($region)) { $location_url[] = $region; } } $location_url[] = $city; } $location_url = implode("/", $location_url); $skip_location = false; if (!$add_location_filter && !empty($_SESSION['gd_multi_location'])) { $skip_location = true; unset($_SESSION['gd_multi_location']); } if (get_option('permalink_structure')) { $viewall_url = get_post_type_archive_link($post_type); } else { $viewall_url = get_post_type_archive_link($post_type); } if (!empty($category) && $category[0] != '0') { global $geodir_add_location_url; $geodir_add_location_url = '0'; if ($add_location_filter != '0') { $geodir_add_location_url = '1'; } $viewall_url = get_term_link((int) $category[0], $post_type . 'category'); $geodir_add_location_url = NULL; } if ($skip_location) { $_SESSION['gd_multi_location'] = 1; } $query_args = array('posts_per_page' => $post_number, 'is_geodir_loop' => true, 'gd_location' => $add_location_filter ? true : false, 'post_type' => $post_type, 'order_by' => $list_sort); if ($character_count) { $query_args['excerpt_length'] = $character_count; } if (!empty($instance['show_featured_only'])) { $query_args['show_featured_only'] = 1; } if (!empty($instance['show_special_only'])) { $query_args['show_special_only'] = 1; } if (!empty($instance['with_pics_only'])) { $query_args['with_pics_only'] = 0; $query_args['featured_image_only'] = 1; } if (!empty($instance['with_videos_only'])) { $query_args['with_videos_only'] = 1; } $with_no_results = !empty($instance['without_no_results']) ? false : true; if (!empty($category) && $category[0] != '0') { $category_taxonomy = geodir_get_taxonomies($post_type); ######### WPML ######### if (function_exists('icl_object_id')) { $category = gd_lang_object_ids($category, $category_taxonomy[0]); } ######### WPML ######### $tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $category); $query_args['tax_query'] = array($tax_query); } global $gridview_columns_widget, $geodir_is_widget_listing; $widget_listings = geodir_get_widget_listings($query_args); if (!empty($widget_listings) || $with_no_results) { ?> <div class="geodir_locations geodir_location_listing"> <?php /** * Called before the div containing the title and view all link in popular post view widget. * * @since 1.0.0 */ do_action('geodir_before_view_all_link_in_widget'); ?> <div class="geodir_list_heading clearfix"> <?php if ($title == 'ร้านอาหาร') { echo '<img src = "/wordpress/wp-content/food.png" width="100%">'; } else { echo '<img src = "/wordpress/wp-content/u.png" width="100%">'; } ?> <?php //echo $before_title . $title . $after_title; ?> <a href="<?php echo $viewall_url; ?> " class="geodir-viewall"><?php _e('View all', 'geodirectory'); ?> </a> </div> <?php /** * Called after the div containing the title and view all link in popular post view widget. * * @since 1.0.0 */ do_action('geodir_after_view_all_link_in_widget'); ?> <?php if (strstr($layout, 'gridview')) { $listing_view_exp = explode('_', $layout); $gridview_columns_widget = $layout; $layout = $listing_view_exp[0]; } else { $gridview_columns_widget = ''; } /** * Filter the widget listing listview template path. * * @since 1.0.0 */ $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); if (!isset($character_count)) { /** * Filter the widget's excerpt character count. * * @since 1.0.0 * @param int $instance['character_count'] Excerpt character count. */ $character_count = $character_count == '' ? 50 : apply_filters('widget_character_count', $character_count); } global $post, $map_jason, $map_canvas_arr; $current_post = $post; $current_map_jason = $map_jason; $current_map_canvas_arr = $map_canvas_arr; $geodir_is_widget_listing = true; /** * Includes related listing listview template. * * @since 1.0.0 */ include $template; $geodir_is_widget_listing = false; $GLOBALS['post'] = $current_post; if (!empty($current_post)) { setup_postdata($current_post); } $map_jason = $current_map_jason; $map_canvas_arr = $current_map_canvas_arr; ?> </div> <?php } echo $after_widget; }
function geodir_advance_search_selected_fields_note($note, $sub_tab, $listing_type) { switch ($sub_tab) { case 'advance_search': $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in advance search form on %s listing and search results page.', GEODIRECTORY_TEXTDOMAIN), get_post_type_singular_label($listing_type)); break; } return $note; }
/** * Returns description for given sub tab - selected fields box. * * @since 1.0.0 * @package GeoDirectory * @param string $note The box description. * @param string $sub_tab The sub tab slug. * @param string $listing_type The post type. * @return string The box description. */ function geodir_cf_panel_selected_fields_note($note, $sub_tab, $listing_type) { switch ($sub_tab) { case 'custom_fields': $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); break; case 'sorting_options': $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order in sorting option dropdown box on %s listing and search results page.', 'geodirectory'), get_post_type_singular_label($listing_type)); break; } return $note; }
/** * Adds comment multi rating form fields to the detail page. * * @since 1.0.0 * @package GeoDirectory_Review_Rating_Manager * * @global object $post The current post object. */ function geodir_reviewrating_rating_frm_html() { if ($overall_star = get_option('geodir_reviewrating_overall_count')) { $overall_star_lable = get_option('geodir_reviewrating_overall_rating_texts'); $star_color = get_option('geodir_reviewrating_overall_color'); $overall_star_offimg = get_option('geodir_reviewrating_overall_off_img'); $star_width = get_option('geodir_reviewrating_overall_off_img_width'); global $post; ?> <div id="gd_ratings_module"> <div id="rating_frm" style="margin-top:15px;"> <div class="gd-rating-box-in clearfix"> <div class="gd-rating-box-in-left"> <div class="gd-rate-area clearfix"> <span class="gd-ratehead"><?php printf(__('Rate this %s (overall):', GEODIRREVIEWRATING_TEXTDOMAIN), get_post_type_singular_label($post->post_type)); ?> </span> <ul class="rate-area-list"> <?php for ($star = 1; $star <= $overall_star; $star++) { $overall_star_text = isset($overall_star_lable[$star - 1]) ? esc_attr($overall_star_lable[$star - 1]) : ''; $overall_star_text = stripslashes_deep(__($overall_star_text, GEODIRECTORY_TEXTDOMAIN)); ?> <li star_rating="<?php echo $star; ?> " star_lable="<?php echo $overall_star_text; ?> " class="gd-multirating-star"><a><img src="<?php echo $overall_star_offimg; ?> " style="width:<?php echo $star_width; ?> px; height:auto;" alt="<?php esc_attr_e('rating icon', GEODIRREVIEWRATING_TEXTDOMAIN); ?> " /></a></li> <?php } ?> </ul> <style>ul.geodir-tabs-content li ul.rate-area-list li.active, ul.rate-area-list li.active{background-color:<?php echo $star_color; ?> }</style> <span class="gd-rank"> </span> <input type="hidden" name="geodir_rating[overall]" value="0" /> </div> <?php $post_arr = (array) $post; if (isset($post_arr[$post->post_type . 'category'])) { $post_categories = explode(",", $post_arr[$post->post_type . 'category']); } else { $post_categories = wp_get_post_categories($post->ID, array('fields' => 'ids')); } $ratings = geodir_reviewrating_rating_categories(); if ($ratings) { $rating_style_html = ''; foreach ($ratings as $rating) { if (!in_array($post->post_type, explode(",", $rating->post_type))) { continue; } // if not for this post type then skip. $rating->title = isset($rating->title) && $rating->title != '' ? __($rating->title, GEODIRECTORY_TEXTDOMAIN) : ''; //$star_lable = explode(",",$rating->star_lables); $star_lable = geodir_reviewrating_star_lables_to_arr($rating->star_lables, true); $rating_cat = explode(",", $rating->category); // fix id's if wpml is active if (function_exists('icl_object_id')) { if (is_array($rating_cat)) { foreach ($rating_cat as $key => $std_cat) { $rating_cat[$key] = icl_object_id($std_cat, $post->post_type . 'category', false); } } } $showing_cat = array_intersect($rating_cat, $post_categories); if (!empty($showing_cat)) { if ($rating->check_text_rating_cond) { $rating_style_html .= '<div class="clearfix gd-rate-cat-in">'; $rating_style_html .= '<span class="lable">' . __(stripslashes_deep($rating->title), GEODIRREVIEWRATING_TEXTDOMAIN) . '</span>'; $rating_style_html .= '<ul class="rate-area-list rating-' . $rating->id . '">'; for ($star = 1; $star <= $rating->star_number; $star++) { $star_lable_text = isset($star_lable[$star - 1]) ? esc_attr($star_lable[$star - 1]) : ''; $star_lable_text = stripslashes_deep($star_lable_text); $rating_style_html .= '<li star_rating="' . $star . '" star_lable="' . $star_lable_text . '" class="gd-multirating-star"><a><img src="' . $rating->s_img_off . '" style="width:' . $rating->s_img_width . 'px;height:auto" alt="' . esc_attr(__('rating icon', GEODIRREVIEWRATING_TEXTDOMAIN)) . '" /></a></li>'; } $rating_style_html .= '</ul>'; $rating_style_html .= ' <style>ul.geodir-tabs-content li ul.rating-' . $rating->id . ' li.active, body ul.rating-' . $rating->id . ' li.active{background-color:' . $rating->star_color . '}</style>'; $rating_style_html .= '<span class="gd-rank"> </span>'; $rating_style_html .= '<input type="hidden" name="geodir_rating[' . $rating->id . ']" value="0" />'; $rating_style_html .= '</div>'; } else { $rating_style_html .= '<div class="clearfix gd-rate-cat-in">'; $rating_style_html .= '<span class="lable">' . stripslashes_deep($rating->title) . '</span>'; $rating_style_html .= '<select name="geodir_rating[' . $rating->id . ']" > '; for ($star = 1; $star <= $rating->star_number; $star++) { $star_lable_text = isset($star_lable[$star - 1]) ? esc_attr($star_lable[$star - 1]) : ''; $star_lable_text = stripslashes_deep($star_lable_text); $rating_style_html .= '<option value="' . $star . '">'; $rating_style_html .= $star_lable_text; $rating_style_html .= '</option> '; } $rating_style_html .= '</select>'; $rating_style_html .= '</div>'; } } } if ($rating_style_html != '') { ?> <div class="gd-rate-category clearfix"> <span class="gd-ratehead"><?php printf(__('Rate this %s individually for:', GEODIRREVIEWRATING_TEXTDOMAIN), get_post_type_singular_label($post->post_type)); ?> </span> <div> <?php echo $rating_style_html; ?> </div> </div><?php } } ?> </div> </div> </div> </div><?php } }