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


PHP DiscussHelper::hasPassword方法代码示例

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


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

示例1: formatPost

 public static function formatPost($posts, $isSearch = false, $isFrontpage = false)
 {
     $config = DiscussHelper::getConfig();
     if (!$posts) {
         return $posts;
     }
     $model = DiscussHelper::getModel('Posts');
     $result = array();
     for ($i = 0; $i < count($posts); $i++) {
         $row = $posts[$i];
         $obj = DiscussHelper::getTable('Post');
         $obj->bind($row);
         // Set post owner
         $owner = DiscussHelper::getTable('Profile');
         $owner->load($row->user_id);
         if ($row->user_id == 0 || $row->user_type == DISCUSS_POSTER_GUEST) {
             $owner->id = 0;
             $owner->name = 'Guest';
         } else {
             $owner->id = $row->user_id;
             $owner->name = $owner->getName();
         }
         $obj->user = $owner;
         $obj->title = self::wordFilter($row->title);
         $obj->content = self::wordFilter($row->content);
         $obj->isFeatured = $row->featured;
         $obj->category = JText::_($row->category);
         // get total replies
         $totalReplies = isset($row->num_replies) ? $row->num_replies : '0';
         $obj->totalreplies = $totalReplies;
         if ($totalReplies > 0) {
             // get last reply
             $lastReply = $model->getLastReply($row->id);
             if (!empty($lastReply)) {
                 $replier = DiscussHelper::getTable('Profile');
                 $replier->load($lastReply->user_id);
                 $replier->poster_name = $lastReply->user_id ? $replier->getName() : $lastReply->poster_name;
                 $replier->poster_email = $lastReply->user_id ? $replier->user->email : $lastReply->poster_email;
                 $obj->reply = $replier;
             }
         }
         //check whether the post is still withing the 'new' duration.
         $obj->isnew = DiscussHelper::isNew($row->noofdays);
         //get post duration so far.
         $durationObj = new stdClass();
         $durationObj->daydiff = $row->daydiff;
         $durationObj->timediff = $row->timediff;
         $obj->duration = DiscussHelper::getDurationString($durationObj);
         // Some result set may already been optimized using the `totalFavourites` column.
         if (!isset($row->totalFavourites)) {
             $favouritesModel = DiscussHelper::getModel('Favourites');
             // Get total favourites based on post id
             $obj->totalFavourites = $favouritesModel->getFavouritesCount($row->id);
         } else {
             $obj->totalFavourites = $row->totalFavourites;
         }
         if (!$isSearch) {
             $postsTagsModel = DiscussHelper::getModel('PostsTags');
             $tags = $postsTagsModel->getPostTags($row->id);
             $obj->tags = $tags;
             // Some result set may already been optimized using the `polls_cnt` column
             if (isset($row->polls_cnt)) {
                 $obj->polls = $row->polls_cnt;
             } else {
                 $obj->polls = $model->hasPolls($row->id);
             }
             if (isset($row->attachments_cnt)) {
                 $obj->attachments = $row->attachments_cnt;
             } else {
                 $obj->attachments = $model->hasAttachments($row->id, DISCUSS_QUESTION_TYPE);
             }
         } else {
             $obj->tags = '';
             $obj->polls = '';
             $obj->attachments = '';
         }
         if ($config->get('main_password_protection') && !empty($row->password) && !DiscussHelper::hasPassword($row)) {
             $tpl = new DiscussThemes();
             $tpl->set('post', $obj);
             $obj->content = $tpl->fetch('entry.password.php');
             $obj->introtext = $obj->content;
         }
         // @since 3.0
         // Format introtext here.
         if (!empty($row->password) && !DiscussHelper::hasPassword($row)) {
             if (!$obj->isProtected()) {
                 $obj->introtext = $row->content;
                 //display password input form.
                 $obj->introtext = strip_tags($obj->introtext);
             }
         } else {
             $obj->content_raw = $row->content;
             // Remove codes block
             $obj->content = EasyDiscussParser::removeCodes($row->content);
             // bbcode translation if there are any.
             $obj->content = self::formatContent($obj);
             $obj->introtext = strip_tags($obj->content);
             // Truncate it now.
             $obj->introtext = JString::substr($obj->introtext, 0, $config->get('layout_introtextlength')) . JText::_('COM_EASYDISCUSS_ELLIPSES');
         }
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:helper.php

示例2:

"><?php 
        echo JString::strlen($post->title) > $params->get('max_title', 50) ? JString::substr($post->title, 0, $params->get('max_title', 50)) . '...' : $post->title;
        ?>
</a>
					<div class="small"><?php 
        echo JText::sprintf('MOD_RECENTDISCUSSIONS_STARTED_BY', '<a href="' . $post->profile->getLink() . '">' . $post->profile->getName() . '</a>');
        ?>
</div>
				</div>

				<?php 
        if ($params->get('show_content') && !$params->get('show_content_tooltips', false)) {
            ?>
				<div class="mod-story">
					<?php 
            if (empty($post->password) || isset($post->password) && DiscussHelper::hasPassword($post)) {
                ?>
					<?php 
                echo $post_content;
                ?>
					<?php 
            } else {
                ?>
						<i><?php 
                echo JText::_('MOD_RECENTDISCUSSIONS_PASSWORD_PROTECTED');
                ?>
</i>
					<?php 
            }
            ?>
				</div>
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:default.php


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