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


PHP BigPlural函数代码示例

本文整理汇总了PHP中BigPlural函数的典型用法代码示例。如果您正苦于以下问题:PHP BigPlural函数的具体用法?PHP BigPlural怎么用?PHP BigPlural使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: writeTableRow

    function writeTableRow($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= c('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'rows';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
        <tr class="<?php 
        echo CssClass($Row);
        ?>
">
            <td class="CategoryName">
                <div class="Wrap">
                    <?php 
        echo GetOptions($Row);
        echo CategoryPhoto($Row);
        echo "<{$H}>";
        echo anchor(htmlspecialchars($Row['Name']), $Row['Url']);
        Gdn::controller()->EventArguments['Category'] = $Row;
        Gdn::controller()->fireEvent('AfterCategoryTitle');
        echo "</{$H}>";
        ?>
                    <div class="CategoryDescription">
                        <?php 
        echo $Row['Description'];
        ?>
                    </div>
                    <?php 
        if ($WriteChildren === 'list') {
            ?>
                        <div class="ChildCategories">
                            <?php 
            echo wrap(t('Child Categories') . ': ', 'b');
            echo CategoryString($Children, $Depth + 1);
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
            <td class="BigCount CountDiscussions">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountDiscussions']})";
        echo BigPlural($Row['CountAllDiscussions'], '%s discussion');
        ?>
                </div>
            </td>
            <td class="BigCount CountComments">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountComments']})";
        echo BigPlural($Row['CountAllComments'], '%s comment');
        ?>
                </div>
            </td>
            <td class="BlockColumn LatestPost">
                <div class="Block Wrap">
                    <?php 
        if ($Row['LastTitle']) {
            ?>
                        <?php 
            echo userPhoto($Row, array('Size' => 'Small', 'Px' => 'Last'));
            echo anchor(SliceString(Gdn_Format::text($Row['LastTitle']), 100), $Row['LastUrl'], 'BlockTitle LatestPostTitle', array('title' => html_entity_decode($Row['LastTitle'])));
            ?>
                        <div class="Meta">
                            <?php 
            echo userAnchor($Row, 'UserLink MItem', 'Last');
            ?>
                            <span class="Bullet">•</span>
                            <?php 
            echo anchor(Gdn_Format::date($Row['LastDateInserted'], 'html'), $Row['LastUrl'], 'CommentDate MItem');
            if (isset($Row['LastCategoryID'])) {
                $LastCategory = CategoryModel::categories($Row['LastCategoryID']);
                echo ' <span>', sprintf('in %s', anchor($LastCategory['Name'], CategoryUrl($LastCategory, '', '//'))), '</span>';
            }
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
        </tr>
        <?php 
        if ($WriteChildren === 'rows') {
            foreach ($Children as $ChildRow) {
                WriteTableRow($ChildRow, $Depth + 1);
            }
        }
    }
开发者ID:caidongyun,项目名称:vanilla,代码行数:98,代码来源:helper_functions.php

示例2: writeDiscussionRow

    /**
     * Writes a discussion in table row format.
     */
    function writeDiscussionRow($Discussion, $Sender, $Session)
    {
        if (!property_exists($Sender, 'CanEditDiscussions')) {
            $Sender->CanEditDiscussions = val('PermsDiscussionsEdit', CategoryModel::categories($Discussion->CategoryID)) && c('Vanilla.AdminCheckboxes.Use');
        }
        $CssClass = CssClass($Discussion);
        $DiscussionUrl = $Discussion->Url;
        if ($Session->UserID) {
            $DiscussionUrl .= '#latest';
        }
        $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
        $Sender->EventArguments['Discussion'] =& $Discussion;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        $First = UserBuilder($Discussion, 'First');
        if ($Discussion->LastUserID) {
            $Last = UserBuilder($Discussion, 'Last');
        } else {
            $Last = $First;
        }
        $Sender->EventArguments['FirstUser'] =& $First;
        $Sender->EventArguments['LastUser'] =& $Last;
        $Sender->fireEvent('BeforeDiscussionName');
        $DiscussionName = $Discussion->Name;
        // If there are no word character detected in the title treat it as if it is blank.
        if (!preg_match('/\\w/u', $DiscussionName)) {
            $DiscussionName = t('Blank Discussion Topic');
        }
        $Sender->EventArguments['DiscussionName'] =& $DiscussionName;
        static $FirstDiscussion = true;
        if (!$FirstDiscussion) {
            $Sender->fireEvent('BetweenDiscussion');
        } else {
            $FirstDiscussion = false;
        }
        $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
        $FirstPageUrl = DiscussionUrl($Discussion, 1);
        $LastPageUrl = DiscussionUrl($Discussion, val('CountPages', $Discussion)) . '#latest';
        ?>
        <tr id="Discussion_<?php 
        echo $Discussion->DiscussionID;
        ?>
" class="<?php 
        echo $CssClass;
        ?>
">
            <?php 
        $Sender->fireEvent('BeforeDiscussionContent');
        ?>
            <?php 
        echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>'));
        ?>
            <td class="DiscussionName">
                <div class="Wrap">
         <span class="Options">
            <?php 
        echo OptionsList($Discussion);
        echo BookmarkButton($Discussion);
        ?>
         </span>
                    <?php 
        $Sender->fireEvent('BeforeDiscussionTitle');
        echo anchor($DiscussionName, $DiscussionUrl, 'Title') . ' ';
        $Sender->fireEvent('AfterDiscussionTitle');
        WriteMiniPager($Discussion);
        echo NewComments($Discussion);
        if ($Sender->data('_ShowCategoryLink', true)) {
            echo CategoryLink($Discussion, ' ' . t('in') . ' ');
        }
        // Other stuff that was in the standard view that you may want to display:
        echo '<div class="Meta Meta-Discussion">';
        WriteTags($Discussion);
        echo '</div>';
        //			if ($Source = val('Source', $Discussion))
        //				echo ' '.sprintf(t('via %s'), t($Source.' Source', $Source));
        //
        ?>
                </div>
            </td>
            <td class="BlockColumn BlockColumn-User FirstUser">
                <div class="Block Wrap">
                    <?php 
        echo userPhoto($First, array('Size' => 'Small'));
        echo userAnchor($First, 'UserLink BlockTitle');
        echo '<div class="Meta">';
        echo anchor(Gdn_Format::date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem');
        echo '</div>';
        ?>
                </div>
            </td>
            <td class="BigCount CountComments">
                <div class="Wrap">
                    <?php 
        // Exact Number
        // echo number_format($Discussion->CountComments);
        // Round Number
        echo BigPlural($Discussion->CountComments, '%s comment');
        ?>
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:table_functions.php

示例3: WriteDiscussionRow

    /**
     * Writes a discussion in table row format.
     */
    function WriteDiscussionRow($Discussion, &$Sender, &$Session, $Alt2)
    {
        if (!property_exists($Sender, 'CanEditDiscussions')) {
            $Sender->CanEditDiscussions = GetValue('PermsDiscussionsEdit', CategoryModel::Categories($Discussion->CategoryID)) && C('Vanilla.AdminCheckboxes.Use');
        }
        $CssClass = CssClass($Discussion);
        $DiscussionUrl = $Discussion->Url;
        if ($Session->UserID) {
            $DiscussionUrl .= '#latest';
        }
        $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
        $Sender->EventArguments['Discussion'] =& $Discussion;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        $First = UserBuilder($Discussion, 'First');
        if ($Discussion->LastUserID) {
            $Last = UserBuilder($Discussion, 'Last');
        } else {
            $Last = $First;
        }
        //   $Sender->EventArguments['FirstUser'] = &$First;
        //   $Sender->EventArguments['LastUser'] = &$Last;
        //
        //   $Sender->FireEvent('BeforeDiscussionName');
        $DiscussionName = $Discussion->Name;
        if ($DiscussionName == '') {
            $DiscussionName = T('Blank Discussion Topic');
        }
        $Sender->EventArguments['DiscussionName'] =& $DiscussionName;
        $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
        $FirstPageUrl = DiscussionUrl($Discussion, 1);
        $LastPageUrl = DiscussionUrl($Discussion, FALSE) . '#latest';
        ?>
<tr id="Discussion_<?php 
        echo $Discussion->DiscussionID;
        ?>
" class="<?php 
        echo $CssClass;
        ?>
">
   <?php 
        echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>'));
        ?>
	<td class="DiscussionName">
		<div class="Wrap">
         <span class="Options">
            <?php 
        echo OptionsList($Discussion);
        echo BookmarkButton($Discussion);
        ?>
         </span>
			<?php 
        echo Anchor($DiscussionName, $DiscussionUrl, 'Title') . ' ';
        $Sender->FireEvent('AfterDiscussionTitle');
        WriteMiniPager($Discussion);
        echo NewComments($Discussion);
        if ($Sender->Data('_ShowCategoryLink', TRUE)) {
            echo CategoryLink($Discussion, ' ' . T('in') . ' ');
        }
        // Other stuff that was in the standard view that you may want to display:
        echo '<div class="Meta Meta-Discussion">';
        WriteTags($Discussion);
        echo '</div>';
        //			if ($Source = GetValue('Source', $Discussion))
        //				echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source));
        //
        ?>
		</div>
	</td>
	<td class="BlockColumn BlockColumn-User FirstUser">
		<div class="Block Wrap">
			<?php 
        echo UserPhoto($First, array('Size' => 'Small'));
        echo UserAnchor($First, 'UserLink BlockTitle');
        echo '<div class="Meta">';
        echo Anchor(Gdn_Format::Date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem');
        echo '</div>';
        ?>
		</div>
   </td>
	<td class="BigCount CountComments">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountComments);
        // Round Number
        echo BigPlural($Discussion->CountComments, '%s comment');
        ?>
      </div>
	</td>
	<td class="BigCount CountViews">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountViews);
        // Round Number
        echo BigPlural($Discussion->CountViews, '%s view');
        ?>
//.........这里部分代码省略.........
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:101,代码来源:table_functions.php

示例4: newComments

 function newComments($Discussion)
 {
     if (!Gdn::session()->isValid()) {
         return '';
     }
     if ($Discussion->CountUnreadComments === TRUE) {
         $Title = htmlspecialchars(t("You haven't read this yet."));
         return ' <strong class="HasNew JustNew NewCommentCount" title="' . $Title . '">' . t('new discussion', 'new') . '</strong>';
     } elseif ($Discussion->CountUnreadComments > 0) {
         $Title = htmlspecialchars(Plural($Discussion->CountUnreadComments, "%s new comment since you last read this.", "%s new comments since you last read this."));
         return ' <strong class="HasNew NewCommentCount" title="' . $Title . '">' . plural($Discussion->CountUnreadComments, '%s new', '%s new plural', BigPlural($Discussion->CountUnreadComments, '%s new', '%s new plural')) . '</strong>';
     }
     return '';
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:14,代码来源:helper_functions.php

示例5: getOptions

            if ($Category->DisplayAs === 'Heading') {
                $CatList .= '<li id="Category_' . $CategoryID . '" class="CategoryHeading ' . $CssClass . '">
               <div class="ItemContent Category"><div class="Options">' . getOptions($Category, $this) . '</div>' . Gdn_Format::text($Category->Name) . '</div>
            </li>';
                $Alt = FALSE;
            } else {
                $LastComment = UserBuilder($Category, 'Last');
                $AltCss = $Alt ? ' Alt' : '';
                $Alt = !$Alt;
                $CatList .= '<li id="Category_' . $CategoryID . '" class="' . $CssClass . '">
               <div class="ItemContent Category">' . '<div class="Options">' . getOptions($Category, $this) . '</div>' . CategoryPhoto($Category) . '<div class="TitleWrap">' . anchor(Gdn_Format::text($Category->Name), CategoryUrl($Category), 'Title') . '</div>
                  <div class="CategoryDescription">' . $Category->Description . '</div>
                  <div class="Meta">
                     <span class="MItem RSS">' . anchor(img('applications/dashboard/design/images/rss.gif', array('alt' => T('RSS Feed'))), '/categories/' . $Category->UrlCode . '/feed.rss', '', array('title' => T('RSS Feed'))) . '</span>
                     <span class="MItem DiscussionCount">' . sprintf(PluralTranslate($Category->CountDiscussions, '%s discussion html', '%s discussions html', t('%s discussion'), t('%s discussions')), BigPlural($Category->CountDiscussions, '%s discussion')) . '</span>
                     <span class="MItem CommentCount">' . sprintf(PluralTranslate($Category->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Category->CountComments, '%s comment')) . '</span>';
                if ($Category->LastTitle != '') {
                    $CatList .= '<span class="MItem LastDiscussionTitle">' . sprintf(t('Most recent: %1$s by %2$s'), anchor(Gdn_Format::text(sliceString($Category->LastTitle, 40)), $Category->LastUrl), userAnchor($LastComment)) . '</span>' . '<span class="MItem LastCommentDate">' . Gdn_Format::date($Category->LastDateInserted) . '</span>';
                }
                // If this category is one level above the max display depth, and it
                // has children, add a replacement string for them.
                if ($MaxDisplayDepth > 0 && $Category->Depth == $MaxDisplayDepth - 1 && $Category->TreeRight - $Category->TreeLeft > 1) {
                    $CatList .= '{ChildCategories}';
                }
                $CatList .= '</div>
               </div>
            </li>';
            }
        }
    }
}
开发者ID:R-J,项目名称:vanilla,代码行数:31,代码来源:all.php

示例6: T

   <h4><?php 
    echo T('Categories');
    ?>
</h4>
   <ul class="PanelInfo PanelCategories">
   <?php 
    echo '<li' . ($OnCategories ? ' class="Active"' : '') . '>' . Wrap(Anchor(Gdn_Format::Text(T('All Categories')), '/categories'), 'strong') . ' <span class="Aside"><span class="Count">' . BigPlural($CountDiscussions, '%s discussion') . '</span></span></li>';
    $MaxDepth = C('Vanilla.Categories.MaxDisplayDepth');
    $DoHeadings = C('Vanilla.Categories.DoHeadings');
    foreach ($this->Data->Result() as $Category) {
        if ($Category->CategoryID < 0 || $MaxDepth > 0 && $Category->Depth > $MaxDepth) {
            continue;
        }
        if ($DoHeadings && $Category->Depth == 1) {
            $CssClass = 'Heading';
        } else {
            $CssClass = 'Depth' . $Category->Depth . ($CategoryID == $Category->CategoryID ? ' Active' : '');
        }
        echo '<li class="ClearFix ' . $CssClass . '">';
        if ($DoHeadings && $Category->Depth == 1) {
            echo Gdn_Format::Text($Category->Name);
        } else {
            echo Wrap(Anchor(Gdn_Format::Text($Category->Name), CategoryUrl($Category)), 'strong') . ' <span class="Aside"><span class="Count">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
        }
        echo "</li>\n";
    }
    ?>
   </ul>
</div>
   <?php 
}
开发者ID:rnovino,项目名称:Garden,代码行数:31,代码来源:categories.php

示例7: T

    echo T('Categories');
    ?>
</h4>
   <ul class="PanelInfo PanelCategories">
   <?php 
    echo '<li' . ($OnCategories ? ' class="Active"' : '') . '>' . Anchor(T('All Categories') . ' <span class="Aside"><span class="Count">' . BigPlural($CountDiscussions, '%s discussion') . '</span></span>', '/categories', 'ItemLink') . '</li>';
    $MaxDepth = C('Vanilla.Categories.MaxDisplayDepth');
    $DoHeadings = C('Vanilla.Categories.DoHeadings');
    foreach ($this->Data->Result() as $Category) {
        if ($Category->CategoryID < 0 || $MaxDepth > 0 && $Category->Depth > $MaxDepth) {
            continue;
        }
        if ($DoHeadings && $Category->Depth == 1) {
            $CssClass = 'Heading ' . $Category->CssClass;
        } else {
            $CssClass = 'Depth' . $Category->Depth . ($CategoryID == $Category->CategoryID ? ' Active' : '') . ' ' . $Category->CssClass;
        }
        echo '<li class="ClearFix ' . $CssClass . '">';
        if ($DoHeadings && $Category->Depth == 1) {
            echo htmlspecialchars($Category->Name) . ' <span class="Aside"><span class="Count Hidden">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
        } else {
            $CountText = ' <span class="Aside"><span class="Count">' . BigPlural($Category->CountAllDiscussions, '%s discussion') . '</span></span>';
            echo Anchor(htmlspecialchars($Category->Name) . $CountText, CategoryUrl($Category), 'ItemLink');
        }
        echo "</li>\n";
    }
    ?>
   </ul>
</div>
   <?php 
}
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:31,代码来源:categories.php


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