當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Anchor函數代碼示例

本文整理匯總了PHP中Anchor函數的典型用法代碼示例。如果您正苦於以下問題:PHP Anchor函數的具體用法?PHP Anchor怎麽用?PHP Anchor使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Anchor函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ToString

 public function ToString()
 {
     $HasPermission = Gdn::Session()->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', 'any');
     if ($HasPermission) {
         echo Anchor(T('Ask a Question'), '/post/discussion?Type=Question', 'Button BigButton NewQuestion');
     }
 }
開發者ID:mcnasby,項目名稱:datto-vanilla,代碼行數:7,代碼來源:class.newquestionmodule.php

示例2: InformNotifications

 /**
  * Grabs all new notifications and adds them to the sender's inform queue.
  *
  * This method gets called by dashboard's hooks file to display new
  * notifications on every pageload. 
  *
  * @since 2.0.18
  * @access public
  *
  * @param Gdn_Controller $Sender The object calling this method.
  */
 public static function InformNotifications($Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         return;
     }
     $ActivityModel = new ActivityModel();
     // Get five pending notifications.
     $Where = array('NotifyUserID' => Gdn::Session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
     // If we're in the middle of a visit only get very recent notifications.
     $Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-5 minutes'));
     $Activities = $ActivityModel->GetWhere($Where, 0, 5)->ResultArray();
     $ActivityIDs = ConsolidateArrayValuesByKey($Activities, 'ActivityID');
     $ActivityModel->SetNotified($ActivityIDs);
     foreach ($Activities as $Activity) {
         if ($Activity['Photo']) {
             $UserPhoto = Anchor(Img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
         } else {
             $UserPhoto = '';
         }
         $Excerpt = Gdn_Format::Display($Activity['Story']);
         $ActivityClass = ' Activity-' . $Activity['ActivityType'];
         $Sender->InformMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
     }
 }
開發者ID:elpum,項目名稱:TgaForumBundle,代碼行數:36,代碼來源:class.notificationscontroller.php

示例3: ToString

    public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo Gdn::Translate('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo Anchor($User->Name, '/profile/' . urlencode($User->Name), 'UserLink');
            ?>
</strong>
               <?php 
            echo Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
開發者ID:jhampha,項目名稱:Garden,代碼行數:33,代碼來源:class.inthisdiscussionmodule.php

示例4: ToString

 public function ToString() {
    if ($this->_TagData->NumRows() == 0)
       return '';
    
    $String = '';
    ob_start();
    ?>
    <div class="Box Tags">
       <h4><?php echo T($this->_DiscussionID > 0 ? 'Tagged' : 'Popular Tags'); ?></h4>
       <ul class="PanelInfo">
       <?php
       foreach ($this->_TagData->Result() as $Tag) {
          if ($Tag->Name != '') {
       ?>
          <li><strong><?php 
                         if (urlencode($Tag->Name) == $Tag->Name) {
                            echo Anchor(htmlspecialchars($Tag->Name), 'discussions/tagged/'.urlencode($Tag->Name));
                         } else {
                            echo Anchor(htmlspecialchars($Tag->Name), 'discussions/tagged?Tag='.urlencode($Tag->Name));
                         }
                      ?></strong><span class="Count"><?php echo number_format($Tag->CountDiscussions); ?></span></li>
       <?php
          }
       }
       ?>
       </ul>
    </div>
    <?php
    $String = ob_get_contents();
    @ob_end_clean();
    return $String;
 }
開發者ID:nerdgirl,項目名稱:Forums-ILoveBadTV,代碼行數:32,代碼來源:class.tagmodule.php

示例5: WriteDiscussion

function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Sender->FireEvent('BeforeDiscussionName');
    $DiscussionName = Gdn_Format::Text($Discussion->Name);
    if ($DiscussionName == '') {
        $DiscussionName = T('Blank Discussion Topic');
    }
    static $FirstDiscussion = TRUE;
    if (!$FirstDiscussion) {
        $Sender->FireEvent('BetweenDiscussion');
    } else {
        $FirstDiscussion = FALSE;
    }
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Discussion->FirstPhoto != '') {
        if (strtolower(substr($Discussion->FirstPhoto, 0, 7)) == 'http://' || strtolower(substr($Discussion->FirstPhoto, 0, 8)) == 'https://') {
            $PhotoUrl = $Discussion->FirstPhoto;
        } else {
            $PhotoUrl = 'uploads/' . ChangeBasename($Discussion->FirstPhoto, 'n%s');
        }
        echo Img($PhotoUrl, array('alt' => $Discussion->FirstName));
    }
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <span class="Author"><?php 
    echo $Discussion->FirstName;
    ?>
</span>
         <?php 
    echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
    if ($Discussion->LastCommentID != '') {
        echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
    }
    echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span> ';
    ?>
      </div>
   </div>
</li>
<?php 
}
開發者ID:tautomers,項目名稱:knoopvszombies,代碼行數:60,代碼來源:helper_functions.php

示例6: DPRenderQuestionForm

function DPRenderQuestionForm($PollForm, $DiscussionPoll, $Disabled, $Closed)
{
    echo '<div class="P" id="DP_Form">';
    if (!C('Plugins.DiscussionPolls.DisablePollTitle', FALSE)) {
        echo $PollForm->Label('Discussion Poll Title', 'DP_Title');
        echo Wrap($PollForm->TextBox('DP_Title', array_merge($Disabled, array('maxlength' => 100, 'class' => 'InputBox BigInput'))), 'div', array('class' => 'TextBoxWrapper'));
    }
    echo Anchor(' ', '/plugin/discussionpolls/', array('id' => 'DP_PreviousQuestion', 'title' => T('Previous Question')));
    $QuestionCount = 0;
    // set and the form data for existing questions and render a form
    foreach ($DiscussionPoll->Questions as $Question) {
        DPRenderQuestionField($PollForm, $QuestionCount, $Question, $Disabled);
        $QuestionCount++;
    }
    // If there is no data, render a single question form with 2 options to get started
    if (!$QuestionCount) {
        DPRenderQuestionField($PollForm);
    }
    // the end of the form
    if (!$Closed) {
        echo Anchor(T('Add a Question'), '/plugin/discussionpolls/addquestion/', array('id' => 'DP_NextQuestion', 'title' => T('Add a Question')));
        echo Anchor(T('Add an Option'), '/plugin/discussionpolls/addoption', array('id' => 'DP_AddOption', 'title' => T('Add an Option')));
    } else {
        if ($QuestionCount > 1) {
            echo Anchor(T('Next Question'), '/plugin/discussionpolls/addquestion/', array('id' => 'DP_NextQuestion', 'title' => T('Next Question')));
        }
    }
    echo '</div>';
}
開發者ID:Nordic-T,項目名稱:vanilla-plugins,代碼行數:29,代碼來源:questions.php

示例7: WriteModuleDiscussion

function WriteModuleDiscussion($Discussion, $Px = 'Bookmark')
{
    ?>
<li id="<?php 
    echo "{$Px}_{$Discussion->DiscussionID}";
    ?>
" class="<?php 
    echo CssClass($Discussion);
    ?>
">
   <span class="Options">
      <?php 
    //      echo OptionsList($Discussion);
    echo BookmarkButton($Discussion);
    ?>
   </span>
   <div class="Title"><?php 
    echo Anchor(Gdn_Format::Text($Discussion->Name, FALSE), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
    ?>
</div>
   <div class="Meta">
      <?php 
    $Last = new stdClass();
    $Last->UserID = $Discussion->LastUserID;
    $Last->Name = $Discussion->LastName;
    echo NewComments($Discussion);
    echo '<span class="MItem">' . Gdn_Format::Date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>';
    ?>
   </div>
</li>
<?php 
}
開發者ID:rnovino,項目名稱:Garden,代碼行數:32,代碼來源:helper_functions.php

示例8: DiscussionController_CommentOptions_Handler

 public function DiscussionController_CommentOptions_Handler($Sender)
 {
     $Comment = $Sender->CurrentComment;
     $Session = Gdn::Session();
     $Inc = $this->GetScoreIncrements($Comment->CommentID);
     $Signs = array(-1 => 'Neg', +1 => 'Pos');
     // Create a container for the score.
     echo '<div class="CommentScore">';
     $SumScore = is_null($Comment->SumScore) ? 0 : $Comment->SumScore;
     // Write the current score.
     echo '<span class="Score">' . sprintf(Plural($SumScore, '%s point', '%s points'), $SumScore) . '</span>';
     // Write the buttons.
     foreach ($Inc as $Key => $IncAmount) {
         $Button = '<span>' . ($Key < 0 ? '-' : '+') . '</span>';
         $Attributes = array();
         $CssClass = $Signs[$Key] . ' Inc';
         $Href = '/vanilla/discussion/score/' . $Comment->CommentID . '/' . $Signs[$Key] . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl);
         if ($IncAmount == 0) {
             $Attributes['href2'] = Url($Href);
             $CssClass .= ' Disabled';
             $Href = '';
         } else {
             $Attributes['title'] = ($Key > 0 ? '+' : '') . $Inc[$Key];
         }
         // Display an increment button.
         $Foo = Anchor($Button, $Href, $CssClass, $Attributes, TRUE);
         echo $Foo;
     }
     echo '</div>';
 }
開發者ID:kidmax,項目名稱:Garden,代碼行數:30,代碼來源:class.commentscore.plugin.php

示例9: ToString

 public function ToString()
 {
     if ($this->_UserData->NumRows() == 0) {
         return '';
     }
     $String = '';
     ob_start();
     ?>
   <div class="Box">
      <?php 
     echo panelHeading(T('In this Discussion'));
     ?>
      <ul class="PanelInfo">
         <?php 
     foreach ($this->_UserData->Result() as $User) {
         ?>
            <li>
               <?php 
         echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
         ?>
            </li>
         <?php 
     }
     ?>
      </ul>
   </div>
   <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
開發者ID:embo-hd,項目名稱:vanilla,代碼行數:31,代碼來源:class.inthisdiscussionmodule.php

示例10: GetOptions

/**
 * Render options that the user has for this discussion.
 */
function GetOptions($Category, $Sender)
{
    if (!Gdn::Session()->IsValid()) {
        return;
    }
    $Result = '';
    $Options = '';
    $CategoryID = GetValue('CategoryID', $Category);
    $Result = '<div class="Options">';
    $TKey = urlencode(Gdn::Session()->TransientKey());
    // Mark category read.
    $Options .= '<li>' . Anchor(T('Mark Read'), "/vanilla/category/markread?categoryid={$CategoryID}&tkey={$TKey}") . '</li>';
    // Follow/Unfollow category.
    if (!GetValue('Following', $Category)) {
        $Options .= '<li>' . Anchor(T('Follow'), "/vanilla/category/follow?categoryid={$CategoryID}&value=1&tkey={$TKey}") . '</li>';
    } else {
        $Options .= '<li>' . Anchor(T('Unfollow'), "/vanilla/category/follow?categoryid={$CategoryID}&value=0&tkey={$TKey}") . '</li>';
    }
    // Allow plugins to add options
    $Sender->FireEvent('DiscussionOptions');
    if ($Options != '') {
        $Result .= '<div class="ToggleFlyout OptionsMenu"><div class="MenuTitle">' . T('Options') . '</div>' . '<ul class="Flyout MenuItems">' . $Options . '</ul>' . '</div>';
        $Result .= '</div>';
        return $Result;
    }
}
開發者ID:seedbank,項目名稱:old-repo,代碼行數:29,代碼來源:helper_functions.php

示例11: smarty_function_anchor

function smarty_function_anchor($Params, &$Smarty)
{
    $Text = ArrayValue('text', $Params, '');
    $Destination = ArrayValue('destination', $Params, '');
    $CssClass = ArrayValue('class', $Params, '');
    return Anchor($Text, $Destination, $CssClass);
}
開發者ID:Aetasiric,項目名稱:Garden,代碼行數:7,代碼來源:function.anchor.php

示例12: ToString

    public function ToString()
    {
        if ($this->_TagData->NumRows() == 0) {
            return '';
        }
        $String = '';
        ob_start();
        ?>
      <div class="Box Tags">
         <h4><?php 
        echo T($this->_DiscussionID > 0 ? 'Tagged' : 'Popular Tags');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_TagData->Result() as $Tag) {
            ?>
            <li><strong><?php 
            echo Anchor($Tag->Name, 'discussions/tagged/' . $Tag->Name);
            ?>
</strong> <?php 
            echo $Tag->CountDiscussions;
            ?>
</li>
         <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
開發者ID:BradA1878,項目名稱:Garden,代碼行數:34,代碼來源:class.tagmodule.php

示例13: SettingsController_Render_Before

    public function SettingsController_Render_Before(&$Sender)
    {
        // Save the action if editing registration settings
        if (strcasecmp($Sender->RequestMethod, 'registration') == 0 && $Sender->Form->AuthenticatedPostBack() === TRUE) {
            $this->SaveStep('Plugins.GettingStarted.Registration');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'plugins') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Plugins');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'managecategories') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Categories');
        }
        // Add messages & their css on dashboard
        if (strcasecmp($Sender->RequestMethod, 'index') == 0) {
            $Sender->AddCssFile('plugins/GettingStarted/style.css');
            $Session = Gdn::Session();
            $WelcomeMessage = '<div class="GettingStarted">' . Anchor('×', '/dashboard/plugin/dismissgettingstarted/' . $Session->TransientKey(), 'Dismiss') . "<p>Here's how to get started:</p>" . '<ul>
      <li class="One' . (Gdn::Config('Plugins.GettingStarted.Registration', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Define how users register for your forum'), '/settings/registration') . '</li>
      <li class="Two' . (Gdn::Config('Plugins.GettingStarted.Plugins', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Manage your plugins'), 'settings/plugins') . '</li>
      <li class="Three' . (Gdn::Config('Plugins.GettingStarted.Categories', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Organize your discussion categories'), 'vanilla/settings/managecategories') . '</li>
      <li class="Four' . (Gdn::Config('Plugins.GettingStarted.Profile', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Customize your profile'), 'profile') . '</li>
      <li class="Five' . (Gdn::Config('Plugins.GettingStarted.Discussion', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Start your first discussion'), 'post/discussion') . '</li>
   </ul>
</div>';
            $Sender->AddAsset('Messages', $WelcomeMessage, 'WelcomeMessage');
        }
    }
開發者ID:kerphi,項目名稱:Garden,代碼行數:29,代碼來源:default.php

示例14: ToString

 public function ToString()
 {
     $Session = Gdn::Session();
     $Controller = Gdn::Controller();
     $UserID = $Controller->User->UserID;
     $MemberOptions = array();
     $ProfileOptions = array();
     $Controller->EventArguments['UserID'] = $UserID;
     $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
     $Controller->EventArguments['MemberOptions'] =& $MemberOptions;
     if ($Controller->EditMode) {
         return '<div class="ProfileOptions">' . Anchor(T('Back to Profile'), UserUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
         //         $ProfileOptions[] = array('Text' => T('Back to Profile'), 'Url' => UserUrl($Controller->User), 'CssClass' => 'BackToProfile');
     } else {
         // Profile Editing
         if (hasEditProfile($Controller->User->UserID)) {
             $ProfileOptions[] = array('Text' => Sprite('SpEditProfile') . ' ' . T('Edit Profile'), 'Url' => UserUrl($Controller->User, '', 'edit'));
         }
         // Ban/Unban
         $MayBan = CheckPermission('Garden.Moderation.Manage') || CheckPermission('Garden.Users.Edit') || CheckPermission('Moderation.Users.Ban');
         if ($MayBan && $UserID != $Session->UserID) {
             if ($Controller->User->Banned) {
                 $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
             } elseif (!$Controller->User->Admin) {
                 $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
             }
         }
         // Delete content.
         if (CheckPermission('Garden.Moderation.Manage')) {
             $ProfileOptions[] = array('Text' => Sprite('SpDelete') . ' ' . T('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
         }
     }
     return parent::ToString();
 }
開發者ID:3marproof,項目名稱:vanilla,代碼行數:34,代碼來源:class.profileoptionsmodule.php

示例15: WriteHomepageOption

function WriteHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
    $SpriteClass = $CssClass;
    if ($Current == $Url) {
        $CssClass .= ' Current';
    }
    echo Anchor(T($Title) . Wrap(Sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description));
}
開發者ID:rnovino,項目名稱:Garden,代碼行數:8,代碼來源:homepage.php


注:本文中的Anchor函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。