예제 #1
0
 function meta_description()
 {
     $location = Rewrite::newInstance()->get_location();
     $section = Rewrite::newInstance()->get_section();
     $text = '';
     switch ($location) {
         case 'item':
             switch ($section) {
                 case 'item_add':
                     $text = '';
                     break;
                 case 'item_edit':
                     $text = '';
                     break;
                 case 'send_friend':
                     $text = '';
                     break;
                 case 'contact':
                     $text = '';
                     break;
                 default:
                     $text = osc_item_category() . ', ' . osc_highlight(strip_tags(osc_item_description()), 140) . '..., ' . osc_item_category();
                     break;
             }
             break;
         case 'page':
             $text = osc_highlight(strip_tags(osc_static_page_text()), 140);
             break;
         case 'search':
             $result = '';
             if (osc_count_items() == 0) {
                 $text = '';
             }
             if (osc_has_items()) {
                 $result = osc_item_category() . ', ' . osc_highlight(strip_tags(osc_item_description()), 140) . '..., ' . osc_item_category();
             }
             osc_reset_items();
             $text = $result;
         case '':
             // home
             $result = '';
             if (osc_count_latest_items() == 0) {
                 $text = '';
             }
             if (osc_has_latest_items()) {
                 $result = osc_item_category() . ', ' . osc_highlight(strip_tags(osc_item_description()), 140) . '..., ' . osc_item_category();
             }
             osc_reset_items();
             $text = $result;
             break;
     }
     $text = str_replace('"', "'", $text);
     return $text;
 }
예제 #2
0
function meta_keywords()
{
    $text = '';
    // search
    if (osc_is_search_page()) {
        if (osc_has_items()) {
            $keywords = array();
            $keywords[] = osc_item_category();
            if (osc_item_city() != '') {
                $keywords[] = osc_item_city();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city());
            }
            if (osc_item_region() != '') {
                $keywords[] = osc_item_region();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region());
            }
            if (osc_item_city() != '' && osc_item_region() != '') {
                $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city());
                $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city());
            }
            $text = implode(', ', $keywords);
        }
        osc_reset_items();
    }
    // listing
    if (osc_is_ad_page()) {
        $keywords = array();
        $keywords[] = osc_item_category();
        if (osc_item_city() != '') {
            $keywords[] = osc_item_city();
            $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city());
        }
        if (osc_item_region() != '') {
            $keywords[] = osc_item_region();
            $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region());
        }
        if (osc_item_city() != '' && osc_item_region() != '') {
            $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city());
            $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city());
        }
        $text = implode(', ', $keywords);
    }
    return osc_apply_filter('meta_keywords_filter', $text);
}
function allSeo_description_filter($text)
{
    // CLEAN EXISTING DESCRIPTION
    $text = '';
    // HOME PAGE
    if (osc_is_home_page()) {
        $text = osc_page_description();
    }
    // STATIC PAGE
    if (osc_is_static_page()) {
        if (GetPageDesc() == '') {
            $text = osc_highlight(osc_static_page_text(), 140, '', '');
        } else {
            $text = GetPageDesc();
        }
    }
    // SEARCH & CATEGORY PAGE
    if (osc_is_search_page()) {
        $cat = osc_search_category_id();
        $cat_id = $cat[0];
        $cat_field = Category::newInstance()->findByPrimaryKey($cat_id);
        $country = GetCtrDesc(osc_search_country()) ? GetCtrDesc(osc_search_country()) : osc_search_country();
        $region = GetRegDesc(osc_search_region()) ? GetRegDesc(osc_search_region()) : osc_search_region();
        $city = osc_search_city();
        if (GetCatDesc($cat_id) != '') {
            $desc = GetCatDesc($cat_id);
        } else {
            $desc = $cat_field['s_name'];
        }
        $text = $desc;
        // ADD LOCATION DESCRIPTION
        if ($country != '') {
            $text .= ($text != '' ? ' - ' : '') . $country;
        }
        if ($region != '') {
            $text .= ($text != '' ? ' - ' : '') . $region;
        }
        if ($city != '') {
            $text .= ($text != '' ? ' - ' : '') . $city;
        }
        // Improve search/category title adding part of listings in this category/search
        if (osc_get_preference('allSeo_search_improve_desc', 'plugin-all_in_one') == 1) {
            osc_reset_custom_items();
            osc_query_item(array("category" => $cat_id, "country_name" => $country, "region_name" => $region, "city_name" => $city));
            while (osc_has_custom_items()) {
                $item = Item::newInstance()->findByPrimaryKey(osc_item_id());
                $con = strip_tags($item['s_description']);
                if (osc_item_city() != '') {
                    $text .= ' - ' . osc_item_city();
                }
                if ($con != '') {
                    $text .= ', ' . osc_highlight($con, 100);
                }
            }
        }
        $text = osc_highlight($text, 500);
        osc_reset_items();
    }
    // Listing page
    if (osc_is_ad_page()) {
        if (GetItemDesc() == '') {
            if (GetCatDesc(osc_item_category_id()) != '') {
                $desc = GetCatDesc(osc_item_category_id());
            } else {
                $desc = osc_item_category();
            }
            $item = Item::newInstance()->findByPrimaryKey(osc_item_id());
            $text = $desc . ' - ' . osc_highlight($item['s_description'], 120) . ', ' . SeoLocationShow();
        } else {
            $text = GetItemDesc();
        }
    }
    return $text;
}
예제 #4
0
function seo_meta_keywords_filter()
{
    $text = '';
    //home page
    if (osc_is_home_page()) {
        if (osc_get_preference('seo_metakeywords_home', 'seo_plugin')) {
            $text = osc_get_preference('seo_metakeywords_home', 'seo_plugin');
        }
    }
    // static page
    if (osc_is_static_page()) {
        if (osc_get_preference('seo_metakeywords_page_' . osc_static_page_id(), 'seo_plugin')) {
            $text = osc_get_preference('seo_metakeywords_page_' . osc_static_page_id(), 'seo_plugin');
        }
    }
    //contact page
    if (osc_is_contact_page()) {
        if (osc_get_preference('seo_metakeywords_page_contact', 'seo_plugin')) {
            $text = osc_get_preference('seo_metakeywords_page_contact', 'seo_plugin');
        }
    }
    // search
    if (osc_is_search_page()) {
        if (osc_has_items()) {
            $keywords = array();
            $keywords[] = osc_item_category();
            if (osc_item_city() != '') {
                $keywords[] = osc_item_city();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city());
            }
            if (osc_item_region() != '') {
                $keywords[] = osc_item_region();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region());
            }
            if (osc_item_city() != '' && osc_item_region() != '') {
                $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city());
                $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city());
            }
            $text = implode(', ', $keywords);
        }
        osc_reset_items();
    }
    // listing
    if (osc_is_ad_page()) {
        $detail = seo_get_row(osc_item_id());
        if (empty($detail['seo_item_meta_keywords'])) {
            $keywords = array();
            $keywords[] = osc_item_category();
            if (osc_item_city() != '') {
                $keywords[] = osc_item_city();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_city());
            }
            if (osc_item_region() != '') {
                $keywords[] = osc_item_region();
                $keywords[] = sprintf('%s %s', osc_item_category(), osc_item_region());
            }
            if (osc_item_city() != '' && osc_item_region() != '') {
                $keywords[] = sprintf('%s %s %s', osc_item_category(), osc_item_region(), osc_item_city());
                $keywords[] = sprintf('%s %s', osc_item_region(), osc_item_city());
            }
            $text = implode(', ', $keywords);
        } else {
            $text = $detail['seo_item_meta_keywords'];
        }
    }
    return $text;
}