当前位置: 首页>>代码示例>>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;未经允许,请勿转载。