/** * "Share this" button code. * * To display "share this" button, you can call this function. * * @since 1.0.0 * @package GeoDirectory * @global object $post The current post object. */ function geodir_share_this_button_code() { global $post; ?> <div class="addthis_toolbox addthis_default_style"> <span id='st_sharethis'></span> <script type="text/javascript">var switchTo5x = false;</script> <script type="text/javascript" src="//ws.sharethis.com/button/buttons.js"></script> <script type="text/javascript">stLight.options({ publisher: "2bee0c38-7c7d-4ce7-9d9a-05e920d509b4", doNotHash: false, doNotCopy: false, hashAddressBar: false }); stWidget.addEntry({ "service": "sharethis", "element": document.getElementById('st_sharethis'), "url": "<?php echo geodir_curPageURL(); ?> ", "title": "<?php echo $post->post_title; ?> ", "type": "chicklet", "text": "<?php _e('Share', 'geodirectory'); ?> " });</script> </div> <?php }
/** * Front-end display content for social like widget. * * @since 1.0.0 * @since 1.5.1 Declare function public. * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { // prints the widget extract($args, EXTR_SKIP); /** * Filter the widget title text. * * @since 1.0.0 * @global object $current_user Current user object. * @param string $title The widget title text. */ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); global $current_user, $post; echo $before_widget; ?> <?php //if ( get_option('gd_tweet_button') ) { ?> <a href="http://twitter.com/share" class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?> </a> <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> <?php //} ?> <?php // if ( get_option('gd_facebook_button') ) { ?> <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { echo 'allowtransparency="true"'; } ?> class="facebook" src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(geodir_curPageURL()); ?> &layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" style="border:none; overflow:hidden; width:100px; height:20px"></iframe> <?php //} ?> <?php //if ( get_option('gd_google_button') ) { ?> <script> window.___gcfg = { parsetags: 'explicit' } </script> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <div id="plusone-div"></div> <script type="text/javascript">gapi.plusone.render('plusone-div', { "size": "medium", "count": "true" });</script> <?php //} echo $after_widget; }
/** * Generates login box HTML. * * @since 1.0.0 * @package GeoDirectory * @global object $current_user Current user object. * @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_loginwidget_output($args = '', $instance = '') { //print_r($args); //print_r($instance); // prints the widget extract($args, EXTR_SKIP); /** This filter is documented in geodirectory_widgets.php */ $title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); echo $before_widget; echo $before_title . $title . $after_title; if (is_user_logged_in()) { global $current_user; $login_url = geodir_getlink(home_url(), array('geodir_signup' => 'true'), false); $add_listurl = get_permalink(geodir_add_listing_page_id()); $add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place')); $author_link = get_author_posts_url($current_user->data->ID); $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); echo '<ul class="geodir-loginbox-list">'; ob_start(); ?> <li><a class="signin" href="<?php echo wp_logout_url(home_url()); ?> "><?php _e('Logout', 'geodirectory'); ?> </a></li> <?php $post_types = geodir_get_posttypes('object'); $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard'); $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend'); if (!empty($show_add_listing_post_types_main_nav)) { $addlisting_links = ''; foreach ($post_types as $key => $postobj) { if (in_array($key, $show_add_listing_post_types_main_nav)) { if ($add_link = geodir_get_addlisting_link($key)) { $name = $postobj->labels->name; $selected = ''; if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) { $selected = 'selected="selected"'; } /** * Filter add listing link. * * @since 1.0.0 * @param string $add_link Add listing link. * @param string $key Add listing array key. * @param int $current_user->ID Current user ID. */ $add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID); $addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; } } } if ($addlisting_links != '') { ?> <li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr(__('Add Listing', 'geodirectory')); ?> "> <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(__('Add Listing', 'geodirectory')); ?> </option> <?php echo $addlisting_links; ?> </select></li> <?php } } // My Favourites in Dashboard $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); $user_favourite = geodir_user_favourite_listing_count(); if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { $favourite_links = ''; foreach ($post_types as $key => $postobj) { if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { $name = $postobj->labels->name; $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); $selected = ''; if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { $selected = 'selected="selected"'; } /** * Filter favorite listing link. * * @since 1.0.0 * @param string $post_type_link Favorite listing link. * @param string $key Favorite listing array key. * @param int $current_user->ID Current user ID. */ $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $current_user->ID); $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; } } if ($favourite_links != '') { ?> <li> <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr(__('My Favorites', 'geodirectory')); ?> "> <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(__('My Favorites', 'geodirectory')); ?> </option> <?php echo $favourite_links; ?> </select> </li> <?php } } $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); $user_listing = geodir_user_post_listing_count(); if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { $listing_links = ''; foreach ($post_types as $key => $postobj) { if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { $name = $postobj->labels->name; $listing_link = geodir_getlink($author_link, array('stype' => $key), false); $selected = ''; if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { $selected = 'selected="selected"'; } /** * Filter my listing link. * * @since 1.0.0 * @param string $listing_link My listing link. * @param string $key My listing array key. * @param int $current_user->ID Current user ID. */ $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $current_user->ID); $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>'; } } if ($listing_links != '') { ?> <li> <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" data-placeholder="<?php echo esc_attr(__('My Listings', 'geodirectory')); ?> "> <option value="" disabled="disabled" selected="selected" style='display:none;'><?php echo esc_attr(__('My Listings', 'geodirectory')); ?> </option> <?php echo $listing_links; ?> </select> </li> <?php } } $dashboard_link = ob_get_clean(); /** * Filter dashboard links HTML. * * @since 1.0.0 * @param string $dashboard_link Dashboard links HTML. */ echo apply_filters('geodir_dashboard_links', $dashboard_link); echo '</ul>'; } else { ?> <?php /** * Filter signup form action link. * * @since 1.0.0 */ ?> <form name="loginform" class="loginform1" action="<?php echo apply_filters('geodir_signup_reg_submit_link', home_url() . '/index.php?geodir_signup=true'); ?> " method="post"> <div class="geodir_form_row"><input placeholder="<?php _e('Email', 'geodirectory'); ?> " name="log" type="text" class="textfield user_login1"/> <span class="user_loginInfo"></span></div> <div class="geodir_form_row"><input placeholder="<?php _e('Password', 'geodirectory'); ?> " name="pwd" type="password" class="textfield user_pass1 input-text"/><span class="user_passInfo"></span></div> <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars(geodir_curPageURL()); ?> "/> <input type="hidden" name="testcookie" value="1"/> <div class="geodir_form_row clearfix"><input type="submit" name="submit" value="<?php echo SIGN_IN_BUTTON; ?> " class="b_signin"/> <p class="geodir-new-forgot-link"> <?php /** * Filter signup page register form link. * * @since 1.0.0 */ ?> <a href="<?php echo apply_filters('geodir_signup_reg_form_link', home_url() . '/?geodir_signup=true&page1=sign_up'); ?> " class="goedir-newuser-link"><?php echo NEW_USER_TEXT; ?> </a> <?php /** * Filter signup page forgot password form link. * * @since 1.0.0 */ ?> <a href="<?php echo apply_filters('geodir_signup_forgot_form_link', home_url() . '/?geodir_signup=true&page1=sign_in'); ?> " class="goedir-forgot-link"><?php echo FORGOT_PW_TEXT; ?> </a></p></div> </form> <?php } echo $after_widget; }
/** * Output the posts microdata in the source code. * * This micordata is used by things like Google as a standard way of declaring things like telephone numbers etc. * * @global bool $preview True of on a preview page. False if not. * @global object $post The current post object. * @since 1.0.0 * @package GeoDirectory */ function geodir_action_details_micordata() { global $post, $preview; if (!$preview) { $c_url = geodir_curPageURL(); $c_url = strtok($c_url, "#"); $c_url = strtok($c_url, "?"); ?> <span style="display:none;" class="url"><?php echo $c_url; ?> </span> <span class="updated" style="display:none;"><?php the_modified_date('c'); ?> </span> <span class="vcard author" style="display:none;"> <span class="fn"><?php echo get_the_author(); ?> </span> <span class="org"><?php the_title(); ?> </span> <span class="role"><?php _e('Admin', GEODIRECTORY_TEXTDOMAIN); ?> </span> </span> <meta itemprop="name" content="<?php the_title_attribute(); ?> "/> <meta itemprop="url" content="<?php echo $c_url; ?> "/> <?php if ($post->geodir_contact) { echo '<meta itemprop="telephone" content="' . $post->geodir_contact . '" />'; } } }
<input type="hidden" name="testcookie" value="1"/> <a href="javascript:void(0);showhide_forgetpw();"><?php echo FORGOT_PW_TEXT; ?> </a> </form> <div id="lostpassword_form" style="display:none;"> <h4><?php echo FORGOT_PW_TEXT; ?> </h4> <form name="lostpasswordform" id="lostpasswordform" action="<?php echo htmlspecialchars(geodir_curPageURL()); ?> " method="post"> <input type="hidden" name="action" value="lostpassword"/> <div class="form_row clearfix"> <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?> ' type="text" name="user_login" value="<?php echo esc_attr($user_login); ?> " size="20" class="user_login1 textfield"/> <?php /**
/** * Loads template based on the current page. * * @since 1.0.0 * @package GeoDirectory * @global object $wp_query WordPress Query object. * @todo $wp_query declared twice - fix it. * @global object $post The current post object. * @global object $current_user Current user object. * @param string $template The template path. * @return bool|string The template path. */ function geodir_template_loader($template) { global $wp_query; /** * Filter the custom page list. * * @since 1.0.0 */ $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array('geodir_signup_page' => apply_filters('geodir_set_custom_signup_page', false), 'geodir_add_listing_page' => apply_filters('geodir_set_custom_add_listing_page', false), 'geodir_preview_page' => apply_filters('geodir_set_custom_preview_page', false), 'geodir_listing_success_page' => apply_filters('geodir_set_custom_listing_success_page', false), 'geodir_listing_detail_page' => apply_filters('geodir_set_custom_listing_detail_page', false), 'geodir_listing_page' => apply_filters('geodir_set_custom_listing_page', false), 'geodir_search_page' => apply_filters('geodir_set_custom_search_page', false), 'geodir_author_page' => apply_filters('geodir_set_custom_author_page', false), 'geodir_home_map_page' => apply_filters('geodir_set_custom_home_map_page', false))); if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) { $template = geodir_locate_template('signup'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; } /** * Filter the signup template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_signup', $template); } if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) { if (!geodir_is_default_location_set()) { global $information; $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>'); $template = geodir_locate_template('information'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; } /** * Filter the information template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_information', $template); } // check if pid exists in the record if yes then check if this post belongs to the user who is logged in. if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { global $information; $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory'); $is_current_user_owner = geodir_listing_belong_to_current_user(); if (!$is_current_user_owner) { $template = geodir_locate_template('information'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; } /** * Filter the information template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_information', $template); } } //geodir_is_login(true); global $current_user; if (!$current_user->ID) { wp_redirect(geodir_login_url(array('redirect_add_listing' => urlencode(geodir_curPageURL()))), 302); exit; } $template = geodir_locate_template('add-listing'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; } /** * Filter the add listing template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_add_listing', $template); } if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) { global $preview; $preview = true; $template = geodir_locate_template('preview'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; } /** * Filter the preview template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_preview', $template); } if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) { $template = geodir_locate_template('success'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; } /** * Filter the success template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_success', $template); } if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) { $template = geodir_locate_template('detail'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; } /** * Filter the detail template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_detail', $template); } if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) { $template = geodir_locate_template('listing'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; } /** * Filter the listing template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_listing', $template); } if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) { $template = geodir_locate_template('search'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; } /** * Filter the search template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_search', $template); } if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) { $template = geodir_locate_template('author'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; } /** * Filter the author template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_author', $template); } if (get_option('geodir_set_as_home') || geodir_is_page('home') || geodir_is_page('location')) { global $post, $wp_query; if (geodir_is_page('home') || 'page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front') || is_home() && !$wp_query->is_posts_page) { $template = geodir_locate_template('geodir-home'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; } /** * Filter the home page template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_homepage', $template); } elseif (geodir_is_page('location')) { $template = geodir_locate_template('location'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; } /** * Filter the location template path. * * @since 1.0.0 * @param string $template The template path. */ return $template = apply_filters('geodir_template_location', $template); } else { return $template; } } return $template; }
function gdlist_single_loop_item() { global $post; ?> <li class="gd-list-item-wrap"> <h3 class="whoop-tab-title"> <a href="<?php echo esc_url(add_query_arg(array('list_id' => $post->ID), geodir_curPageURL())); ?> "> <?php echo get_the_title($post); ?> </a> <span class="gd-list-item-count"> </span> </h3> <p class="gd-list-item-desc"> <?php echo wp_trim_words(stripslashes(strip_tags(get_the_content($post))), 20); ?> </p> <ul class="gd-list-item-comments"> <?php gdlist_all_listed_posts(); ?> </ul> </li> <?php }
/** * Output the posts microdata in the source code. * * This micordata is used by things like Google as a standard way of declaring things like telephone numbers etc. * * @global bool $preview True of on a preview page. False if not. * @global object $post The current post object. * @since 1.0.0 * @since 1.5.4 Changed to JSON-LD and added filters. * @since 1.5.7 Added $post param. * @param object $post Optional. The post object or blank. * @package GeoDirectory */ function geodir_action_details_micordata($post = '') { global $preview; if (empty($post)) { global $post; } if ($preview || !geodir_is_page('detail')) { return; } // url $c_url = geodir_curPageURL(); // post reviews $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve')); if (empty($post_reviews)) { $reviews = ''; } else { foreach ($post_reviews as $review) { $reviews[] = array("@type" => "Review", "author" => $review->comment_author, "datePublished" => $review->comment_date, "description" => $review->comment_content, "reviewRating" => array("@type" => "Rating", "bestRating" => "5", "ratingValue" => geodir_get_commentoverall($review->comment_ID), "worstRating" => "1")); } } // post images $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img')); if (empty($post_images)) { $images = ''; } else { $i_arr = array(); foreach ($post_images as $img) { $i_arr[] = $img->src; } if (count($i_arr) == 1) { $images = $i_arr[0]; } else { $images = $i_arr; } } //print_r($post); // external links $external_links = array(); $external_links[] = $post->geodir_website; $external_links[] = $post->geodir_twitter; $external_links[] = $post->geodir_facebook; $external_links = array_filter($external_links); if (!empty($external_links)) { $external_links = array_values($external_links); } // reviews $comment_count = geodir_get_review_count_total($post->ID); $post_avgratings = geodir_get_post_rating($post->ID); // schema type $schema_type = 'LocalBusiness'; if (isset($post->default_category) && $post->default_category) { $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); if (!$schema_type && $post->post_type == 'gd_event') { $schema_type = 'Event'; } } $schema = array(); $schema['@context'] = "http://schema.org"; $schema['@type'] = $schema_type; $schema['name'] = $post->post_name; $schema['description'] = wp_strip_all_tags($post->post_content, true); $schema['telephone'] = $post->geodir_contact; $schema['url'] = $c_url; $schema['sameAs'] = $external_links; $schema['image'] = $images; $schema['address'] = array("@type" => "PostalAddress", "streetAddress" => $post->post_address, "addressLocality" => $post->post_city, "addressRegion" => $post->post_region, "addressCountry" => $post->post_country, "postalCode" => $post->post_zip); if ($post->post_latitude && $post->post_longitude) { $schema['geo'] = array("@type" => "GeoCoordinates", "latitude" => $post->post_latitude, "longitude" => $post->post_longitude); } if ($post_avgratings) { $schema['aggregateRating'] = array("@type" => "AggregateRating", "ratingValue" => $post_avgratings, "bestRating" => "5", "worstRating" => "1", "ratingCount" => $comment_count); } $schema['review'] = $reviews; /** * Allow the schema JSON-LD info to be filtered. * * @since 1.5.4 * @since 1.5.7 Added $post variable. * @param array $schema The array of schema data to be filtered. * @param object $post The post object. */ $schema = apply_filters('geodir_details_schema', $schema, $post); echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; }