コード例 #1
0
ファイル: class.hooks.php プロジェクト: unlight/Candy
 protected function _AddTopMenu($Sender)
 {
     $Menu = $Sender->Menu;
     $Version = C('Candy.Version');
     if ($Menu && $Version >= 0.36) {
         $SectionModel = Gdn::Factory('SectionModel');
         $Items = $SectionModel->GetNodes(array('InTopMenu' => 1, 'CacheNodes' => True));
         foreach ($Items as $Item) {
             $ParentItem = $SectionModel->GetNode($Item->ParentID, array('InTopMenu' => 1));
             $Url = SectionUrl($Item);
             if ($ParentItem == FALSE) {
                 $Menu->AddLink($Item->Name, $Item->Name, $Url, FALSE);
             } else {
                 $Menu->AddLink($ParentItem->Name, $Item->Name, $Url, FALSE);
             }
         }
     }
 }
コード例 #2
0
ファイル: bootstrap.php プロジェクト: unlight/Candy
 function SectionAnchor($Node, $Attributes = Null)
 {
     $Url = SectionUrl($Node);
     $NoFollowExternal = GetValue('NoFollowExternal', $Attributes, False, True);
     if ($NoFollowExternal) {
         static $OurHost;
         if (is_null($OurHost)) {
             $OurHost = Gdn::Request()->Host();
         }
         $UrlHost = parse_url($Url, PHP_URL_HOST);
         if ($UrlHost && $UrlHost != $OurHost) {
             if (isset($Attributes['rel'])) {
                 $Attributes['rel'] .= ' nofollow';
             } else {
                 $Attributes['rel'] = 'nofollow';
             }
         }
     }
     $Name = $Url ? Anchor($Node->Name, $Url, '', $Attributes) : $Node->Name;
     return $Name;
 }