本文整理汇总了PHP中CountString函数的典型用法代码示例。如果您正苦于以下问题:PHP CountString函数的具体用法?PHP CountString怎么用?PHP CountString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CountString函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProfileController_AddProfileTabs_Handler
/**
* Adds 'Discussions' tab to profiles and adds CSS & JS files to their head.
*
* @since 2.0.0
* @package Vanilla
*
* @param object $Sender ProfileController.
*/
public function ProfileController_AddProfileTabs_Handler($Sender)
{
if (is_object($Sender->User) && $Sender->User->UserID > 0) {
$UserID = $Sender->User->UserID;
// Add the discussion tab
$DiscussionsLabel = Sprite('SpDiscussions') . ' ' . T('Discussions');
$CommentsLabel = Sprite('SpComments') . ' ' . T('Comments');
if (C('Vanilla.Profile.ShowCounts', TRUE)) {
$DiscussionsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountDiscussions', $Sender, NULL), "/profile/count/discussions?userid={$UserID}") . '</span>';
$CommentsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountComments', $Sender, NULL), "/profile/count/comments?userid={$UserID}") . '</span>';
}
$Sender->AddProfileTab(T('Discussions'), 'profile/discussions/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Discussions', $DiscussionsLabel);
$Sender->AddProfileTab(T('Comments'), 'profile/comments/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Comments', $CommentsLabel);
// Add the discussion tab's CSS and Javascript.
$Sender->AddJsFile('jquery.gardenmorepager.js');
$Sender->AddJsFile('discussions.js');
}
}
示例2: ProfileController_AddProfileTabs_Handler
/**
* Adds 'Discussions' tab to profiles and adds CSS & JS files to their head.
*
* @since 2.0.0
* @package Vanilla
*
* @param object $Sender ProfileController.
*/
public function ProfileController_AddProfileTabs_Handler(&$Sender)
{
if (is_object($Sender->User) && $Sender->User->UserID > 0) {
$UserID = $Sender->User->UserID;
// Add the discussion tab
$Sender->AddProfileTab('Discussions', 'profile/discussions/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Discussions', T('Discussions') . CountString(GetValueR('User.CountDiscussions', $Sender, NULL), "/profile/count/discussions?userid={$UserID}"));
$Sender->AddProfileTab('Comments', 'profile/comments/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Comments', T('Comments') . CountString(GetValueR('User.CountComments', $Sender, NULL), "/profile/count/comments?userid={$UserID}"));
// Add the discussion tab's CSS and Javascript.
$Sender->AddJsFile('jquery.gardenmorepager.js');
$Sender->AddJsFile('discussions.js');
}
}
示例3: writeFilterTabs
function writeFilterTabs($Sender)
{
$Session = Gdn::session();
$Title = property_exists($Sender, 'Category') ? val('Name', $Sender->Category, '') : '';
if ($Title == '') {
$Title = t('All Discussions');
}
$Bookmarked = t('My Bookmarks');
$MyDiscussions = t('My Discussions');
$MyDrafts = t('My Drafts');
$CountBookmarks = 0;
$CountDiscussions = 0;
$CountDrafts = 0;
if ($Session->isValid()) {
$CountBookmarks = $Session->User->CountBookmarks;
$CountDiscussions = $Session->User->CountDiscussions;
$CountDrafts = $Session->User->CountDrafts;
}
if (c('Vanilla.Discussions.ShowCounts', true)) {
$Bookmarked .= CountString($CountBookmarks, url('/discussions/UserBookmarkCount'));
$MyDiscussions .= CountString($CountDiscussions);
$MyDrafts .= CountString($CountDrafts);
}
?>
<div class="Tabs DiscussionsTabs">
<?php
if (!property_exists($Sender, 'CanEditDiscussions')) {
$Sender->CanEditDiscussions = $Session->checkPermission('Vanilla.Discussions.Edit', TRUE, 'Category', 'any') && c('Vanilla.AdminCheckboxes.Use');
}
if ($Sender->CanEditDiscussions) {
?>
<span class="Options"><span class="AdminCheck">
<input type="checkbox" name="Toggle"/>
</span></span>
<?php
}
?>
<ul>
<?php
$Sender->fireEvent('BeforeDiscussionTabs');
?>
<li<?php
echo strtolower($Sender->ControllerName) == 'discussionscontroller' && strtolower($Sender->RequestMethod) == 'index' ? ' class="Active"' : '';
?>
><?php
echo anchor(t('All Discussions'), 'discussions', 'TabLink');
?>
</li>
<?php
$Sender->fireEvent('AfterAllDiscussionsTab');
?>
<?php
if (c('Vanilla.Categories.ShowTabs')) {
$CssClass = '';
if (strtolower($Sender->ControllerName) == 'categoriescontroller' && strtolower($Sender->RequestMethod) == 'all') {
$CssClass = 'Active';
}
echo " <li class=\"{$CssClass}\">" . anchor(t('Categories'), '/categories/all', 'TabLink') . '</li> ';
}
?>
<?php
if ($CountBookmarks > 0 || $Sender->RequestMethod == 'bookmarked') {
?>
<li<?php
echo $Sender->RequestMethod == 'bookmarked' ? ' class="Active"' : '';
?>
><?php
echo anchor($Bookmarked, '/discussions/bookmarked', 'MyBookmarks TabLink');
?>
</li>
<?php
$Sender->fireEvent('AfterBookmarksTab');
}
if (($CountDiscussions > 0 || $Sender->RequestMethod == 'mine') && c('Vanilla.Discussions.ShowMineTab', true)) {
?>
<li<?php
echo $Sender->RequestMethod == 'mine' ? ' class="Active"' : '';
?>
><?php
echo anchor($MyDiscussions, '/discussions/mine', 'MyDiscussions TabLink');
?>
</li>
<?php
}
if ($CountDrafts > 0 || $Sender->ControllerName == 'draftscontroller') {
?>
<li<?php
echo $Sender->ControllerName == 'draftscontroller' ? ' class="Active"' : '';
?>
><?php
echo anchor($MyDrafts, '/drafts', 'MyDrafts TabLink');
?>
</li>
<?php
}
$Sender->fireEvent('AfterDiscussionTabs');
?>
</ul>
</div>
//.........这里部分代码省略.........
示例4: FilterCountString
function FilterCountString($Count, $Url = '')
{
$Count = CountString($Count, $Url);
return $Count != '' ? '<span class="Aside">' . $Count . '</span>' : '';
}