当前位置: 首页>>代码示例>>PHP>>正文


PHP Format::Text方法代码示例

本文整理汇总了PHP中Format::Text方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::Text方法的具体用法?PHP Format::Text怎么用?PHP Format::Text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Format的用法示例。


在下文中一共展示了Format::Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: BuildProfile

 public function BuildProfile($UserReference = '')
 {
     $Session = Gdn::Session();
     $this->CssClass = 'Profile';
     if (!$this->GetUserInfo($UserReference)) {
         return FALSE;
     }
     if ($this->Head) {
         $this->Head->Title(Format::Text($this->User->Name));
     }
     if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
         $UserInfoModule = new UserInfoModule($this);
         $UserInfoModule->User = $this->User;
         $UserInfoModule->Roles = $this->Roles;
         $this->AddModule($UserInfoModule);
         if ($this->Head) {
             $this->Head->AddScript('/js/library/jquery.jcrop.pack.js');
             $this->Head->AddScript('/applications/garden/js/profile.js');
             $this->Head->AddScript('/applications/garden/js/activity.js');
         }
         $this->AddProfileTab('Activity');
         if ($this->User->UserID == $Session->UserID) {
             $Notifications = Gdn::Translate('Notifications');
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $Notifications .= '<span>' . $CountNotifications . '</span>';
             }
             $this->AddProfileTab(array($Notifications => 'profile/notifications'));
         }
         $this->FireEvent('AddProfileTabs');
     }
     return TRUE;
 }
开发者ID:jhampha,项目名称:Garden,代码行数:33,代码来源:profile.php

示例2: BuildProfile

 public function BuildProfile($UserReference = '')
 {
     $Session = Gdn::Session();
     $this->CssClass = 'Profile';
     if (!$this->GetUserInfo($UserReference)) {
         return FALSE;
     }
     if ($this->Head) {
         $this->Head->Title(Format::Text($this->User->Name));
     }
     if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
         $UserInfoModule = new UserInfoModule($this);
         $UserInfoModule->User = $this->User;
         $UserInfoModule->Roles = $this->Roles;
         $this->AddModule($UserInfoModule);
         if ($this->Head) {
             $this->Head->AddScript('/js/library/jquery.jcrop.pack.js');
             $this->Head->AddScript('/applications/garden/js/profile.js');
             $this->Head->AddScript('/applications/garden/js/activity.js');
         }
         $this->AddProfileTab(array('Activity' => ''));
         $this->FireEvent('AddProfileTabs');
     }
     return TRUE;
 }
开发者ID:Valooo,项目名称:Garden,代码行数:25,代码来源:profile.php

示例3: Index

 public function Index($Offset = 0, $Limit = NULL)
 {
     $this->AddJsFile('/js/library/jquery.gardenmorepager.js');
     $this->AddJsFile('search.js');
     $this->Title(Translate('Search'));
     if (!is_numeric($Limit)) {
         $Limit = Gdn::Config('Garden.Search.PerPage', 20);
     }
     $Search = $this->Form->GetFormValue('Search');
     $ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
     $this->SetData('SearchResults', $ResultSet, TRUE);
     $this->SetData('SearchTerm', Format::Text($Search), TRUE);
     $NumResults = $ResultSet->NumRows();
     if ($NumResults == $Offset + $Limit) {
         $NumResults++;
     }
     // Build a pager
     $PagerFactory = new PagerFactory();
     $Pager = $PagerFactory->GetPager('MorePager', $this);
     $Pager->MoreCode = 'More Results';
     $Pager->LessCode = 'Previous Results';
     $Pager->ClientID = 'Pager';
     $Pager->Configure($Offset, $Limit, $NumResults, 'garden/search/%1$s/%2$s/?Search=' . Format::Url($Search));
     $this->SetData('Pager', $Pager, TRUE);
     $this->View = 'results';
     $this->Render();
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:27,代码来源:search.php

示例4: RecordActivity

 public function RecordActivity($UserID, $DiscussionID, $DiscussionName)
 {
     // Report that the discussion was created
     AddActivity($UserID, 'NewDiscussion', Anchor(Format::Text($DiscussionName), 'vanilla/discussion/' . $DiscussionID . '/' . Format::Url($DiscussionName)));
     // Get the user's discussion count
     $Data = $this->SQL->Select('DiscussionID', 'count', 'CountDiscussions')->From('Discussion')->Where('InsertUserID', $UserID)->Get();
     // Save the count to the user table
     $this->SQL->Update('User')->Set('CountDiscussions', $Data->NumRows() > 0 ? $Data->FirstRow()->CountDiscussions : 0)->Where('UserID', $UserID)->Put();
 }
开发者ID:Valooo,项目名称:Garden,代码行数:9,代码来源:class.discussionmodel.php

示例5: Anchor

    }
    ?>
><strong><?php 
    echo Anchor(Format::Text(T('All Discussions')), '/discussions');
    ?>
</strong> <?php 
    echo $CountDiscussions;
    ?>
</li>
      <?php 
    foreach ($this->_CategoryData->Result() as $Category) {
        ?>
      <li<?php 
        if ($CategoryID == $Category->CategoryID) {
            echo ' class="Active"';
        }
        ?>
><strong><?php 
        echo Anchor(Format::Text(str_replace('&rarr;', '→', $Category->Name)), '/categories/' . $Category->UrlCode);
        ?>
</strong> <?php 
        echo $Category->CountDiscussions;
        ?>
</li>
      <?php 
    }
    ?>
   </ul>
</div>
   <?php 
}
开发者ID:nbudin,项目名称:Garden,代码行数:31,代码来源:categories.php

示例6: SubTitle

 public function SubTitle($SubTitle = FALSE, $Title = FALSE, $TitleDivider = ' - ')
 {
     $this->_TitleDivider = '';
     if ($Title === FALSE) {
         $Title = Gdn::Config('Garden.Title', FALSE);
     }
     if ($Title !== FALSE) {
         $this->_Title = Format::Text($Title);
     }
     if ($SubTitle !== FALSE) {
         $this->_SubTitle = $SubTitle;
     }
     if ($this->_SubTitle != '' && $this->_Title != '') {
         $this->_TitleDivider = $TitleDivider;
     }
     return $this->_Title . $this->_TitleDivider . $this->_SubTitle;
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:17,代码来源:class.headmodule.php

示例7: foreach

<ul class="DataList SearchResults">
<?php 
if (method_exists($this->SearchResults, 'NumRows') && $this->SearchResults->NumRows() > 0) {
    foreach ($this->SearchResults->ResultObject() as $Row) {
        ?>
	<li class="Item">
		<div class="ItemContent">
			<?php 
        echo Anchor(Format::Text($Row->Title), $Row->Url, 'Title');
        ?>
			<div class="Excerpt"><?php 
        echo Anchor(Format::Text(SliceString($Row->Summary, 250)), $Row->Url);
        ?>
</div>
			<div class="Meta">
				<span><?php 
        printf(T('Comment by %s'), UserAnchor($Row));
        ?>
</span>
				<span><?php 
        echo Format::Date($Row->DateInserted);
        ?>
</span>
				<span><?php 
        echo Anchor(T('permalink'), $Row->Url);
        ?>
</span>
			</div>
		</div>
	</li>
<?php 
开发者ID:nbudin,项目名称:Garden,代码行数:31,代码来源:results.php

示例8: foreach

echo $this->Pager->ToString('less');
?>
<ul class="DataList SearchResults">
<?php 
if ($this->SearchResults->NumRows() > 0) {
    foreach ($this->SearchResults->ResultObject() as $Row) {
        ?>
	<li class="Row">
		<ul>
			<li class="Title">
				<strong><?php 
        echo Anchor(Format::Text($Row->Title), $Row->Url);
        ?>
</strong>
				<?php 
        echo Anchor(Format::Text($Row->Summary), $Row->Url);
        ?>
			</li>
			<li class="Meta">
				<span><?php 
        printf(Gdn::Translate('Comment by %s'), UserAnchor($Row));
        ?>
</span>
				<span><?php 
        echo Format::Date($Row->DateInserted);
        ?>
</span>
				<span><?php 
        echo Anchor(Gdn::Translate('permalink'), $Row->Url);
        ?>
</span>
开发者ID:Aetasiric,项目名称:Garden,代码行数:31,代码来源:results.php

示例9: foreach

if (!defined('APPLICATION')) {
    exit;
}
$Session = Gdn::Session();
$ShowOptions = TRUE;
$Alt = '';
foreach ($this->DraftData->Result() as $Draft) {
    $EditUrl = !is_numeric($Draft->DiscussionID) || $Draft->DiscussionID <= 0 ? '/post/editdiscussion/0/' . $Draft->DraftID : '/post/editcomment/0/' . $Draft->DraftID;
    $Alt = $Alt == ' Alt' ? '' : ' Alt';
    ?>
   <li class="<?php 
    echo 'DiscussionRow Draft' . $Alt;
    ?>
">
      <ul>
         <li class="Title">
            <?php 
    echo Anchor('Delete', 'vanilla/drafts/delete/' . $Draft->DraftID . '/' . $Session->TransientKey() . '?Target=' . urlencode($this->SelfUrl), 'DeleteDraft');
    ?>
            <strong><?php 
    echo Anchor($Draft->Name, $EditUrl, 'DraftLink');
    ?>
</strong>
            <?php 
    echo Anchor(SliceString(Format::Text($Draft->Body), 200), $EditUrl);
    ?>
         </li>
      </ul>
   </li>
   <?php 
}
开发者ID:jhampha,项目名称:Garden,代码行数:31,代码来源:drafts.php

示例10: trim

    $Class = trim($Class);
    $Name = $Session->UserID == $Conversation->LastMessageUserID ? 'You' : $Conversation->LastMessageName;
    $JumpToItem = $Conversation->CountMessages - $Conversation->CountNewMessages;
    ?>
<li<?php 
    echo $Class == '' ? '' : ' class="' . $Class . '"';
    ?>
>
   <?php 
    $LastAuthor = UserBuilder($Conversation, 'LastMessage');
    echo UserPhoto($LastAuthor, 'Photo');
    ?>
   <div>
      <?php 
    echo UserAnchor($LastAuthor, 'Name');
    echo Anchor(SliceString(Format::Text($Conversation->LastMessage), 100), '/messages/' . $Conversation->ConversationID . '/#Item_' . $JumpToItem, 'Message');
    echo '<div class="Meta">';
    echo Format::Date($Conversation->DateLastMessage);
    echo '<span>&bull;</span>';
    printf(Gdn::Translate(Plural($Conversation->CountMessages, '%s message', '%s messages')), $Conversation->CountMessages);
    if ($Conversation->CountNewMessages > 0) {
        echo '<span>&bull;</span>';
        echo '<em>';
        printf(Gdn::Translate('%s new'), $Conversation->CountNewMessages);
        echo '</em>';
    }
    echo '</div>';
    ?>
   </div>
</li>
<?php 
开发者ID:robi-bobi,项目名称:Garden,代码行数:31,代码来源:conversations.php

示例11: RecordActivity

 public function RecordActivity($Discussion, $ActivityUserID, $CommentID)
 {
     // Get the author of the discussion
     if ($Discussion->InsertUserID != $ActivityUserID) {
         AddActivity($ActivityUserID, 'DiscussionComment', Anchor(Format::Text($Discussion->Name), 'discussion/comment/' . $CommentID . '/#Comment_' . $CommentID), $Discussion->InsertUserID, 'discussion/comment/' . $CommentID . '/#Comment_' . $CommentID);
     }
 }
开发者ID:jhampha,项目名称:Garden,代码行数:7,代码来源:class.commentmodel.php

示例12: Anchor

<div>
         <strong><?php 
    echo $Message->Enabled == '1' ? 'Enabled' : 'Disabled';
    ?>
</strong>
         <span>|</span>
         <?php 
    echo Anchor('Edit', '/garden/messages/edit/' . $Message->MessageID, 'EditMessage');
    ?>
         <span>|</span>
         <?php 
    echo Anchor('Delete', '/garden/messages/delete/' . $Message->MessageID . '/' . $Session->TransientKey(), 'DeleteMessage');
    ?>
         </div>
      </td>
      <td class="Alt"><?php 
    if ($Message->CssClass != '') {
        echo '<div class="' . $Message->CssClass . '">';
    }
    echo Format::Text($Message->Content);
    if ($Message->CssClass != '') {
        echo '</div>';
    }
    ?>
</td>
   </tr>
<?php 
}
?>
   </tbody>
</table>
开发者ID:Valooo,项目名称:Garden,代码行数:31,代码来源:index.php

示例13: foreach

if (!defined('APPLICATION')) {
    exit;
}
if ($this->_DraftData !== FALSE && $this->_DraftData->NumRows() > 0) {
    ?>
<div class="Box">
   <h4><?php 
    echo Gdn::Translate('My Drafts');
    ?>
</h4>
   <ul class="PanelDiscussions">
      <?php 
    foreach ($this->_DraftData->Result() as $Draft) {
        $EditUrl = !is_numeric($Draft->DiscussionID) || $Draft->DiscussionID <= 0 ? '/post/editdiscussion/0/' . $Draft->DraftID : '/post/editcomment/0/' . $Draft->DraftID;
        ?>
      <li>
         <strong><?php 
        echo Anchor($Draft->Name, $EditUrl, 'DraftLink');
        ?>
</strong>
         <?php 
        echo Anchor(SliceString(Format::Text($Draft->Body), 200), $EditUrl, 'DraftCommentLink');
        ?>
      </li>
      <?php 
    }
    ?>
   </ul>
</div>
<?php 
}
开发者ID:kidmax,项目名称:Garden,代码行数:31,代码来源:drafts.php

示例14: WriteDiscussion

function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CountUnreadComments = $Discussion->CountComments - $Discussion->CountCommentWatch;
    $CssClass .= $CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Last = UserBuilder($Discussion, 'Last');
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    WriteOptions($Discussion, $Sender, $Session);
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor(Format::Text($Discussion->Name), '/discussion/' . $Discussion->DiscussionID . '/' . Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <?php 
    if ($Discussion->Announce == '1') {
        ?>
         <span class="Announcement"><?php 
        echo T('Announcement');
        ?>
</span>
         <?php 
    }
    ?>
         <span><?php 
    printf(Plural($Discussion->CountComments, '%s comment', '%s comments'), $Discussion->CountComments);
    ?>
</span>
         <?php 
    if ($CountUnreadComments > 0 && $Session->IsValid()) {
        echo '<strong>', sprintf(T('%s new'), $CountUnreadComments), '</strong>';
    }
    ?>
         <span><?php 
    printf(T('Most recent by %1$s %2$s'), UserAnchor($Last), Format::Date($Discussion->LastDate));
    ?>
</span>
         <span><?php 
    echo Anchor($Discussion->Category, '/categories/' . $Discussion->CategoryUrlCode, 'Category');
    ?>
</span>
         <?php 
    $Sender->FireEvent('DiscussionMeta');
    ?>
      </div>
   </div>
</li>
<?php 
}
开发者ID:nbudin,项目名称:Garden,代码行数:62,代码来源:helper_functions.php

示例15: Index

 public function Index($DiscussionID = '', $Offset = '', $Limit = '')
 {
     $this->AddCssFile('vanilla.css');
     $Session = Gdn::Session();
     if ($this->Head) {
         $this->Head->AddScript('/js/library/jquery.resizable.js');
         $this->Head->AddScript('/js/library/jquery.ui.packed.js');
         $this->Head->AddScript('/js/library/jquery.autogrow.js');
         $this->Head->AddScript('/js/library/jquery.gardenmorepager.js');
         $this->Head->AddScript('/applications/vanilla/js/options.js');
         $this->Head->AddScript('/applications/vanilla/js/bookmark.js');
         $this->Head->AddScript('/applications/vanilla/js/discussion.js');
         $this->Head->AddScript('/applications/vanilla/js/autosave.js');
     }
     // Load the discussion record
     $DiscussionID = is_numeric($DiscussionID) && $DiscussionID > 0 ? $DiscussionID : 0;
     $this->SetData('Discussion', $this->DiscussionModel->GetID($DiscussionID), TRUE);
     if (!is_object($this->Discussion)) {
         Redirect('FileNotFound');
     }
     // Check Permissions
     $this->Permission('Vanilla.Discussions.View', $this->Discussion->CategoryID);
     $this->SetData('CategoryID', $this->CategoryID = $this->Discussion->CategoryID, TRUE);
     if ($this->Discussion === FALSE) {
         return $this->ReDispatch('garden/home/filenotfound');
     } else {
         // Setup
         if ($this->Head) {
             $this->Head->Title(Format::Text($this->Discussion->Name));
         }
         // Define the query offset & limit
         if (!is_numeric($Limit) || $Limit < 0) {
             $Limit = Gdn::Config('Vanilla.Comments.PerPage', 50);
         }
         $this->Offset = $Offset;
         if (!is_numeric($this->Offset) || $this->Offset < 0) {
             // Round down to the appropriate offset based on the user's read comments & comments per page
             $CountCommentWatch = $this->Discussion->CountCommentWatch > 0 ? $this->Discussion->CountCommentWatch : 0;
             if ($CountCommentWatch > $this->Discussion->CountComments) {
                 $CountCommentWatch = $this->Discussion->CountComments;
             }
             // (((67 comments / 10 perpage) = 6.7) rounded down = 6) * 10 perpage = offset 60;
             $this->Offset = floor($CountCommentWatch / $Limit) * $Limit;
         }
         if ($this->Offset < 0) {
             $this->Offset = 0;
         }
         // Make sure to set the user's discussion watch records
         $this->CommentModel->SetWatch($this->Discussion, $Limit, $this->Offset, $this->Discussion->CountComments);
         // Load the comments
         $this->SetData('CommentData', $this->CommentData = $this->CommentModel->Get($DiscussionID, $Limit, $this->Offset), TRUE);
         // Build a pager
         $PagerFactory = new PagerFactory();
         $this->Pager = $PagerFactory->GetPager('MorePager', $this);
         $this->Pager->MoreCode = '%1$s more comments';
         $this->Pager->LessCode = '%1$s older comments';
         $this->Pager->ClientID = 'Pager';
         $this->Pager->Configure($this->Offset, $Limit, $this->Discussion->CountComments, 'vanilla/discussion/' . $DiscussionID . '/%1$s/%2$s/' . Format::Url($this->Discussion->Name));
     }
     // Define the form for the comment input
     $this->Form = Gdn::Factory('Form', 'Comment');
     $this->DiscussionID = $this->Discussion->DiscussionID;
     $this->Form->AddHidden('DiscussionID', $this->DiscussionID);
     $this->Form->AddHidden('CommentID', '');
     $this->Form->AddHidden('DraftID', '');
     $this->Form->Action = Url('/vanilla/post/comment/');
     // Deliver json data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'comments';
     }
     // Add Modules
     $this->AddModule('NewDiscussionModule');
     $this->AddModule('CategoriesModule');
     $DraftsModule = new DraftsModule($this);
     $DraftsModule->GetData(20, $DiscussionID);
     $this->AddModule($DraftsModule);
     $BookmarkedModule = new BookmarkedModule($this);
     $BookmarkedModule->GetData();
     $this->AddModule($BookmarkedModule);
     $this->FireEvent('DiscussionRenderBefore');
     $this->Render();
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:84,代码来源:discussion.php


注:本文中的Format::Text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。