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


PHP CountString函数代码示例

本文整理汇总了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');
     }
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:26,代码来源:class.hooks.php

示例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');
     }
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:20,代码来源:class.hooks.php

示例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>
//.........这里部分代码省略.........
开发者ID:caidongyun,项目名称:vanilla,代码行数:101,代码来源:helper_functions.php

示例4: FilterCountString

 function FilterCountString($Count, $Url = '')
 {
     $Count = CountString($Count, $Url);
     return $Count != '' ? '<span class="Aside">' . $Count . '</span>' : '';
 }
开发者ID:rnovino,项目名称:Garden,代码行数:5,代码来源:discussionfilter.php


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