コード例 #1
0
function vbseo_blog_url($urlformat, $apars = array())
{
    global $vbseo_gcache;
    $userid = $apars['bloguserid'] ? $apars['bloguserid'] : $apars['u'];
    $blogid = $apars['b'] ? $apars['b'] : $apars['blogid'];
    $catid = $apars[VBSEO_BLOG_CATID_URI];
    $attid = $apars['attachmentid'];
    $comid = $apars['bt'];
    $replace = array();
    if ($comid) {
        $replace['%comment_id%'] = $comid;
    }
    if ($attid) {
        $replace['%original_filename%'] = vbseo_filter_text($vbseo_gcache['battach'][$attid]['filename'], '.');
        $blogid = $vbseo_gcache['battach'][$attid]['blogid'];
        if (!$blogid) {
            return '';
        }
        if ($apars['d']) {
            $attid .= 'd' . $apars['d'];
        }
        if ($apars['thumb']) {
            $attid .= 't';
        }
        $replace['%attachment_id%'] = $attid;
    }
    if ($blogid) {
        $bloginfo =& $vbseo_gcache['blog'][$blogid];
        if (!isset($bloginfo['seotitle'])) {
            $bloginfo['seotitle'] = vbseo_filter_text($bloginfo['title']);
        }
        $userid = $bloginfo['userid'];
        $replace['%blog_id%'] = $bloginfo['blogid'];
        $replace['%blog_title%'] = $bloginfo['seotitle'];
    }
    if ($catid) {
        if ($catid == -1) {
            $catinfo = array('blogcategoryid' => 0, 'title' => VBSEO_BLOG_CAT_UNDEF);
        } else {
            $catinfo =& $vbseo_gcache['blogcat'][$catid];
        }
        if (!isset($catinfo['seotitle'])) {
            $catinfo['seotitle'] = vbseo_filter_text($catinfo['title'], '', false);
            vbseo_append_a($catinfo['seotitle']);
        }
        $replace['%category_id%'] = $catinfo['blogcategoryid'];
        $replace['%category_title%'] = $catinfo['seotitle'];
    }
    if ($userid) {
        $tmpuser =& $vbseo_gcache['user'][$userid];
        $tmpuser['userid'] = $userid;
        if (!$tmpuser['username']) {
            $tmpuser['username'] = $bloginfo['username'];
        }
        if (!isset($tmpuser['seoname'])) {
            $tmpuser['seoname'] = vbseo_filter_text($tmpuser['username'], null, false, true);
        }
        $replace['%user_id%'] = $tmpuser['userid'];
        $replace['%user_name%'] = $tmpuser['seoname'];
    }
    if ($apars['y']) {
        $replace['%year%'] = $apars['y'];
        $replace['%month%'] = $apars['m'];
        $replace['%day%'] = $apars['d'];
    }
    if ($apars['page']) {
        $replace['%page%'] = $apars['page'];
    }
    $returl = str_replace(array_keys($replace), $replace, $urlformat);
    if (VBSEO_URL_BLOG_DOMAIN) {
        $returl = VBSEO_URL_BLOG_DOMAIN . $returl;
    }
    return $returl;
}
コード例 #2
0
ファイル: vbseo.php プロジェクト: holandacz/nb4
                 $vbseo_url_suggest = '';
             }
         } else {
             if (isset($vbseo_arr['forum_id'])) {
                 vbseo_set_self('forumdisplay.' . VBSEO_VB_EXT . '?' . VBSEO_FORUMID_URI . '=' . $vbseo_arr['forum_id'] . ($vbseo_arr['forum_page'] > 1 ? '&' . VBSEO_PAGENUM_URI . '=' . $vbseo_arr['forum_page'] : ''));
                 $vbseo_found_fn = 'forumdisplay.' . VBSEO_VB_EXT;
                 $vbseo_found = true;
                 if ($vbseo_arra || $vbseo_arra2) {
                     if ($vbseo_arra) {
                         vbseo_prepare_seo_replace();
                         vbseo_get_forum_info();
                         $fa_ann = vbseo_get_forum_announcement($vbseo_arr['forum_id']);
                         $a_ann = $fa_ann['announcement'];
                         if (!$vbseo_arr['announcement_id'] && $a_ann) {
                             while (list($aid, $announce) = each($a_ann)) {
                                 if (preg_replace(array_keys($seo_replace_inurls), $seo_replace_inurls, vbseo_filter_text($announce)) == $vbseo_arr['announcement_title']) {
                                     $vbseo_arr['announcement_id'] = $aid;
                                     break;
                                 }
                             }
                         }
                     }
                     $vbseo_url_ = 'announcement.' . VBSEO_VB_EXT . '?' . VBSEO_FORUMID_URI . '=' . $vbseo_arr['forum_id'] . '&announcementid=' . $vbseo_arr['announcement_id'];
                     vbseo_set_self($vbseo_url_);
                     $vbseo_found_fn = 'announcement.' . VBSEO_VB_EXT;
                     $vbseo_found = true;
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: functions_vbseo_seo.php プロジェクト: holandacz/nb4
function vbseo_prepare_cat_anchors()
{
    global $vbulletin, $vbseo_gcache;
    if (VBSEO_CATEGORY_ANCHOR_LINKS) {
        $cutbburl = preg_replace('#/$#', '', $vbulletin->options['bburl']);
        $cutbburl = vbseo_http_s_url($cutbburl);
        if (isset($vbulletin->forumcache)) {
            foreach ($vbulletin->forumcache as $fk => $fv) {
                if (!($fv['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'])) {
                    if (!$vbulletin->forumcache[$fk]['link']) {
                        $nametitle = vbseo_filter_text($fv['title']);
                        $lnk = $cutbburl . '/' . ($vbulletin->options['forumhome'] == 'index' && VBSEO_HP_FORCEINDEXROOT ? '' : $vbulletin->options['forumhome'] . '.' . VBSEO_VB_EXT) . '#' . $nametitle;
                        if ($newurl = vbseo_apply_crr($lnk, $nofollow)) {
                            $lnk = $newurl;
                        }
                        $vbulletin->forumcache[$fk]['link'] = $lnk;
                        $vbulletin->forumcache[$fk]['nametitle'] = urldecode($nametitle);
                        if ($vbseo_gcache['forum']) {
                            $vbseo_gcache['forum'][$fk] = $vbulletin->forumcache[$fk];
                        }
                    }
                }
            }
        }
    }
}