/**
 * Outputs the listings template title.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wp The WordPress object.
 * @global string $term Current term slug.
 */
function geodir_action_listings_title()
{
    global $wp, $term;
    $gd_post_type = geodir_get_current_posttype();
    $post_type_info = get_post_type_object($gd_post_type);
    $add_string_in_title = __('All', GEODIRECTORY_TEXTDOMAIN) . ' ';
    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
        $add_string_in_title = __('My Favorite', GEODIRECTORY_TEXTDOMAIN) . ' ';
    }
    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), GEODIRECTORY_TEXTDOMAIN);
    $single_name = $post_type_info->labels->singular_name;
    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
    $gd_country = get_query_var('gd_country');
    $gd_region = get_query_var('gd_region');
    $gd_city = get_query_var('gd_city');
    if (!empty($term)) {
        $location_name = '';
        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
            if ($gd_country != '') {
                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
            }
            if ($gd_region != '') {
                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
            }
            if ($gd_city != '') {
                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
            }
        }
        $current_term = get_term_by('slug', $term, $taxonomy[0]);
        if (!empty($current_term)) {
            $current_term_name = __(ucfirst($current_term->name), GEODIRECTORY_TEXTDOMAIN);
            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
                $location_last_char = substr($location_name, -1);
                $location_name_attach = strtolower($location_last_char) == 's' ? __("'", GEODIRECTORY_TEXTDOMAIN) : __("'s", GEODIRECTORY_TEXTDOMAIN);
                $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
            } else {
                $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . $current_term_name . "'";
            }
        } else {
            if (count($taxonomy) > 1) {
                $current_term = get_term_by('slug', $term, $taxonomy[1]);
                if (!empty($current_term)) {
                    $current_term_name = __(ucfirst($current_term->name), GEODIRECTORY_TEXTDOMAIN);
                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
                        $location_last_char = substr($location_name, -1);
                        $location_name_attach = strtolower($location_last_char) == 's' ? __("'", GEODIRECTORY_TEXTDOMAIN) : __("'s", GEODIRECTORY_TEXTDOMAIN);
                        $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
                    } else {
                        $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . $current_term_name . "'";
                    }
                }
            }
        }
    } else {
        $gd_country = isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '' ? $wp->query_vars['gd_country'] : '';
        $gd_region = isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '' ? $wp->query_vars['gd_region'] : '';
        $gd_city = isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '' ? $wp->query_vars['gd_city'] : '';
        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
        if (function_exists('get_actual_location_name')) {
            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
        }
        if ($gd_city != '') {
            if ($gd_city_actual != '') {
                $gd_city = $gd_city_actual;
            } else {
                $gd_city = preg_replace('/-(\\d+)$/', '', $gd_city);
                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
                $gd_city = __(ucwords($gd_city), GEODIRECTORY_TEXTDOMAIN);
            }
            $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . $gd_city . "'";
        } else {
            if ($gd_region != '') {
                if ($gd_region_actual != '') {
                    $gd_region = $gd_region_actual;
                } else {
                    $gd_region = preg_replace('/-(\\d+)$/', '', $gd_region);
                    $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
                    $gd_region = __(ucwords($gd_region), GEODIRECTORY_TEXTDOMAIN);
                }
                $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . $gd_region . "'";
            } else {
                if ($gd_country != '') {
                    if ($gd_country_actual != '') {
                        $gd_country = $gd_country_actual;
                    } else {
                        $gd_country = preg_replace('/-(\\d+)$/', '', $gd_country);
                        $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
                        $gd_country = __(ucwords($gd_country), GEODIRECTORY_TEXTDOMAIN);
                    }
                    $list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . $gd_country . "'";
                }
            }
        }
    }
    if (is_search()) {
        $list_title = __('Search', GEODIRECTORY_TEXTDOMAIN) . ' ' . __(ucfirst($post_type_info->labels->name), GEODIRECTORY_TEXTDOMAIN) . __(' For :', GEODIRECTORY_TEXTDOMAIN) . " '" . get_search_query() . "'";
    }
    /** This action is documented in geodirectory_template_actions.php */
    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
    /** This action is documented in geodirectory_template_actions.php */
    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
}
/**
 * Outputs the listings template title.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wp The WordPress object.
 * @global string $term Current term slug.
 */
function geodir_action_listings_title()
{
    global $wp, $term;
    $gd_post_type = geodir_get_current_posttype();
    $post_type_info = get_post_type_object($gd_post_type);
    $add_string_in_title = __('All', 'geodirectory') . ' ';
    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
    }
    $list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), 'geodirectory');
    $single_name = $post_type_info->labels->singular_name;
    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
    $gd_country = get_query_var('gd_country');
    $gd_region = get_query_var('gd_region');
    $gd_city = get_query_var('gd_city');
    if (!empty($term)) {
        $location_name = '';
        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
            if ($gd_country != '') {
                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
            }
            if ($gd_region != '') {
                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
            }
            if ($gd_city != '') {
                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
            }
        }
        $current_term = get_term_by('slug', $term, $taxonomy[0]);
        if (!empty($current_term)) {
            $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
                $location_last_char = substr($location_name, -1);
                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
            } else {
                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
            }
        } else {
            if (count($taxonomy) > 1) {
                $current_term = get_term_by('slug', $term, $taxonomy[1]);
                if (!empty($current_term)) {
                    $current_term_name = __(ucfirst($current_term->name), 'geodirectory');
                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
                        $location_last_char = substr($location_name, -1);
                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
                    } else {
                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
                    }
                }
            }
        }
    } else {
        $gd_country = isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '' ? $wp->query_vars['gd_country'] : '';
        $gd_region = isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '' ? $wp->query_vars['gd_region'] : '';
        $gd_city = isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '' ? $wp->query_vars['gd_city'] : '';
        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
        if (function_exists('get_actual_location_name')) {
            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
        }
        if ($gd_city != '') {
            if ($gd_city_actual != '') {
                $gd_city = $gd_city_actual;
            } else {
                $gd_city = preg_replace('/-(\\d+)$/', '', $gd_city);
                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
            }
            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
        } else {
            if ($gd_region != '') {
                if ($gd_region_actual != '') {
                    $gd_region = $gd_region_actual;
                } else {
                    $gd_region = preg_replace('/-(\\d+)$/', '', $gd_region);
                    $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
                    $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
                }
                $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
            } else {
                if ($gd_country != '') {
                    if ($gd_country_actual != '') {
                        $gd_country = $gd_country_actual;
                    } else {
                        $gd_country = preg_replace('/-(\\d+)$/', '', $gd_country);
                        $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
                        $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
                    }
                    $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
                }
            }
        }
    }
    if (is_search()) {
        $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
    }
    /** This action is documented in geodirectory_template_actions.php */
    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
    /** This action is documented in geodirectory_template_actions.php */
    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
    $title = $list_title;
    if (geodir_is_page('pt')) {
        $gd_page = 'pt';
        $title = get_option('geodir_page_title_pt') ? get_option('geodir_page_title_pt') : $title;
    } elseif (geodir_is_page('listing')) {
        $gd_page = 'listing';
        global $wp_query;
        $current_term = $wp_query->get_queried_object();
        if (strpos($current_term->taxonomy, '_tags') !== false) {
            $title = get_option('geodir_page_title_tag-listing') ? get_option('geodir_page_title_tag-listing') : $title;
        } else {
            $title = get_option('geodir_page_title_cat-listing') ? get_option('geodir_page_title_cat-listing') : $title;
        }
    } elseif (geodir_is_page('author')) {
        $gd_page = 'author';
        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
            $title = get_option('geodir_page_title_favorite') ? get_option('geodir_page_title_favorite') : $title;
        } else {
            $title = get_option('geodir_page_title_author') ? get_option('geodir_page_title_author') : $title;
        }
    }
    /**
     * Filter page title to replace variables.
     *
     * @since 1.5.4
     * @param string $title The page title including variables.
     * @param string $gd_page The GeoDirectory page type if any.
     */
    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
}