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


PHP Gdn_Format::text方法代码示例

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


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

示例1: extendedProfileFields

 /**
  * Output markup for extended profile fields.
  *
  * @param array $profileFields Formatted profile fields.
  * @param array $allFields Extended profile field data.
  * @param array $magicLabels "Magic" labels configured on the Profile Extender plug-in class.
  */
 function extendedProfileFields($profileFields, $allFields, $magicLabels = [])
 {
     foreach ($profileFields as $name => $value) {
         // Skip empty and hidden fields.
         if (!$value || !val('OnProfile', $allFields[$name])) {
             continue;
         }
         // Non-magic fields must be plain text, but we'll auto-link
         if (!in_array($name, $magicLabels)) {
             $value = Gdn_Format::links(Gdn_Format::text($value));
         }
         $class = 'Profile' . Gdn_Format::alphaNumeric($name);
         $label = Gdn_Format::text($allFields[$name]['Label']);
         $filteredVal = Gdn_Format::htmlFilter($value);
         echo " <dt class=\"ProfileExtend {$class}\">{$label}</dt> ";
         echo " <dd class=\"ProfileExtend {$class}\">{$filteredVal}</dd> ";
     }
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:25,代码来源:helper_functions.php

示例2: plainTextEmail

 /**
  * Renders a plaintext email.
  *
  * @return string A plaintext email.
  */
 protected function plainTextEmail()
 {
     return Gdn_Format::plainText(Gdn_Format::text($this->getMessage()));
 }
开发者ID:R-J,项目名称:vanilla,代码行数:9,代码来源:class.rawemailtemplate.php

示例3: formatQuote

    /**
     *
     *
     * @param $Type
     * @param $ID
     * @param $QuoteData
     * @param bool $Format
     */
    protected function formatQuote($Type, $ID, &$QuoteData, $Format = false)
    {
        // Temporarily disable Emoji parsing (prevent double-parsing to HTML)
        $emojiEnabled = Emoji::instance()->enabled;
        Emoji::instance()->enabled = false;
        if (!$Format) {
            $Format = c('Garden.InputFormatter');
        }
        $Type = strtolower($Type);
        $Model = false;
        switch ($Type) {
            case 'comment':
                $Model = new CommentModel();
                break;
            case 'discussion':
                $Model = new DiscussionModel();
                break;
            default:
                break;
        }
        //$QuoteData = array();
        if ($Model) {
            $Data = $Model->getID($ID);
            $NewFormat = $Format;
            if ($NewFormat == 'Wysiwyg') {
                $NewFormat = 'Html';
            }
            $QuoteFormat = $Data->Format;
            if ($QuoteFormat == 'Wysiwyg') {
                $QuoteFormat = 'Html';
            }
            // Perform transcoding if possible
            $NewBody = $Data->Body;
            if ($QuoteFormat != $NewFormat) {
                if (in_array($NewFormat, array('Html', 'Wysiwyg'))) {
                    $NewBody = Gdn_Format::to($NewBody, $QuoteFormat);
                } elseif ($QuoteFormat == 'Html' && $NewFormat == 'BBCode') {
                    $NewBody = Gdn_Format::text($NewBody, false);
                } elseif ($QuoteFormat == 'Text' && $NewFormat == 'BBCode') {
                    $NewBody = Gdn_Format::text($NewBody, false);
                } else {
                    $NewBody = Gdn_Format::plainText($NewBody, $QuoteFormat);
                }
                if (!in_array($NewFormat, array('Html', 'Wysiwyg'))) {
                    Gdn::controller()->informMessage(sprintf(t('The quote had to be converted from %s to %s.', 'The quote had to be converted from %s to %s. Some formatting may have been lost.'), htmlspecialchars($QuoteFormat), htmlspecialchars($NewFormat)));
                }
            }
            $Data->Body = $NewBody;
            // Format the quote according to the format.
            switch ($Format) {
                case 'Html':
                    // HTML
                    $Quote = '<blockquote class="Quote" rel="' . htmlspecialchars($Data->InsertName) . '">' . $Data->Body . '</blockquote>' . "\n";
                    break;
                case 'BBCode':
                    $Author = htmlspecialchars($Data->InsertName);
                    if ($ID) {
                        $IDString = ';' . htmlspecialchars($ID);
                    }
                    $QuoteBody = $Data->Body;
                    // TODO: Strip inner quotes...
                    //                  $QuoteBody = trim(preg_replace('`(\[quote.*/quote\])`si', '', $QuoteBody));
                    $Quote = <<<BQ
[quote="{$Author}{$IDString}"]{$QuoteBody}[/quote]

BQ;
                    break;
                case 'Markdown':
                case 'Display':
                case 'Text':
                    $QuoteBody = $Data->Body;
                    // Strip inner quotes and mentions...
                    $QuoteBody = self::_stripMarkdownQuotes($QuoteBody);
                    $QuoteBody = self::_stripMentions($QuoteBody);
                    $Quote = '> ' . sprintf(t('%s said:'), '@' . $Data->InsertName) . "\n" . '> ' . str_replace("\n", "\n> ", $QuoteBody) . "\n";
                    break;
                case 'Wysiwyg':
                    $Attribution = sprintf(t('%s said:'), userAnchor($Data, null, array('Px' => 'Insert')));
                    $QuoteBody = $Data->Body;
                    // TODO: Strip inner quotes...
                    //                  $QuoteBody = trim(preg_replace('`(<blockquote.*/blockquote>)`si', '', $QuoteBody));
                    $Quote = <<<BLOCKQUOTE
<blockquote class="Quote">
  <div class="QuoteAuthor">{$Attribution}</div>
  <div class="QuoteText">{$QuoteBody}</div>
</blockquote>

BLOCKQUOTE;
                    break;
            }
            $QuoteData = array_merge($QuoteData, array('status' => 'success', 'body' => $Quote, 'format' => $Format, 'authorid' => $Data->InsertUserID, 'authorname' => $Data->InsertName, 'type' => $Type, 'typeid' => $ID));
        }
//.........这里部分代码省略.........
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:101,代码来源:class.quotes.plugin.php

示例4: autoComplete

 /**
  * Autocomplete a username.
  *
  * @since 2.0.0
  * @access public
  */
 public function autoComplete()
 {
     $this->deliveryType(DELIVERY_TYPE_NONE);
     $Q = getIncomingValue('q');
     $UserModel = new UserModel();
     $Data = $UserModel->getLike(array('u.Name' => $Q), 'u.Name', 'asc', 10, 0);
     foreach ($Data->result() as $User) {
         echo htmlspecialchars($User->Name) . '|' . Gdn_Format::text($User->UserID) . "\n";
     }
     $this->render();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:17,代码来源:class.usercontroller.php

示例5: _formatStringCallback

 /**
  * The callback helper for {@link formatString()}.
  *
  * @param array $Match Either the array of arguments or the regular expression match.
  * @param bool $SetArgs Whether this is a call to initialize the arguments or a matching callback.
  * @return mixed Returns the matching string or nothing when setting the arguments.
  * @access private
  */
 function _formatStringCallback($Match, $SetArgs = false)
 {
     static $Args = array(), $ContextUserID = null;
     if ($SetArgs) {
         $Args = $Match;
         if (isset($Args['_ContextUserID'])) {
             $ContextUserID = $Args['_ContextUserID'];
         } else {
             $ContextUserID = Gdn::session() && Gdn::session()->isValid() ? Gdn::session()->UserID : null;
         }
         return '';
     }
     $Match = $Match[1];
     if ($Match == '{') {
         return $Match;
     }
     // Parse out the field and format.
     $Parts = explode(',', $Match);
     $Field = trim($Parts[0]);
     $Format = trim(val(1, $Parts, ''));
     $SubFormat = strtolower(trim(val(2, $Parts, '')));
     $FormatArgs = val(3, $Parts, '');
     if (in_array($Format, array('currency', 'integer', 'percent'))) {
         $FormatArgs = $SubFormat;
         $SubFormat = $Format;
         $Format = 'number';
     } elseif (is_numeric($SubFormat)) {
         $FormatArgs = $SubFormat;
         $SubFormat = '';
     }
     $Value = valr($Field, $Args, null);
     if ($Value === null && !in_array($Format, array('url', 'exurl', 'number', 'plural'))) {
         $Result = '';
     } else {
         switch (strtolower($Format)) {
             case 'date':
                 switch ($SubFormat) {
                     case 'short':
                         $Result = Gdn_Format::date($Value, '%d/%m/%Y');
                         break;
                     case 'medium':
                         $Result = Gdn_Format::date($Value, '%e %b %Y');
                         break;
                     case 'long':
                         $Result = Gdn_Format::date($Value, '%e %B %Y');
                         break;
                     default:
                         $Result = Gdn_Format::date($Value);
                         break;
                 }
                 break;
             case 'html':
             case 'htmlspecialchars':
                 $Result = htmlspecialchars($Value);
                 break;
             case 'number':
                 if (!is_numeric($Value)) {
                     $Result = $Value;
                 } else {
                     switch ($SubFormat) {
                         case 'currency':
                             $Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2);
                             break;
                         case 'integer':
                             $Result = (string) round($Value);
                             if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) {
                                 $Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result;
                             }
                             break;
                         case 'percent':
                             $Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0);
                             break;
                         default:
                             $Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0);
                             break;
                     }
                 }
                 break;
             case 'plural':
                 if (is_array($Value)) {
                     $Value = count($Value);
                 } elseif (StringEndsWith($Field, 'UserID', true)) {
                     $Value = 1;
                 }
                 if (!is_numeric($Value)) {
                     $Result = $Value;
                 } else {
                     if (!$SubFormat) {
                         $SubFormat = rtrim("%s {$Field}", 's');
                     }
                     if (!$FormatArgs) {
                         $FormatArgs = $SubFormat . 's';
//.........这里部分代码省略.........
开发者ID:sitexa,项目名称:vanilla,代码行数:101,代码来源:functions.general.php

示例6: panelHeading

    exit;
}
?>
<div class="Box BoxDrafts">
    <?php 
echo panelHeading(t('My Drafts'));
?>
    <ul class="PanelInfo PanelDiscussions">
        <?php 
foreach ($this->Data->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);
    ?>
</strong>
                <?php 
    echo anchor(sliceString(Gdn_Format::text($Draft->Body), 200), $EditUrl, 'DraftCommentLink');
    ?>
            </li>
        <?php 
}
?>
        <li class="ShowAll"><?php 
echo anchor(t('↳ Show All'), 'drafts');
?>
</li>
    </ul>
</div>
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:30,代码来源:drafts.php

示例7: refetchPageInfo

 /**
  * Re-fetch a discussion's content based on its foreign url.
  * @param type $DiscussionID
  */
 public function refetchPageInfo($DiscussionID)
 {
     // Make sure we are posting back.
     if (!$this->Request->isAuthenticatedPostBack(true)) {
         throw permissionException('Javascript');
     }
     // Grab the discussion.
     $Discussion = $this->DiscussionModel->getID($DiscussionID);
     if (!$Discussion) {
         throw notFoundException('Discussion');
     }
     // Make sure the user has permission to edit this discussion.
     $this->permission('Vanilla.Discussions.Edit', true, 'Category', $Discussion->PermissionCategoryID);
     $ForeignUrl = valr('Attributes.ForeignUrl', $Discussion);
     if (!$ForeignUrl) {
         throw new Gdn_UserException(t("This discussion isn't associated with a url."));
     }
     $Stub = $this->DiscussionModel->fetchPageInfo($ForeignUrl, true);
     // Save the stub.
     $this->DiscussionModel->setField($DiscussionID, (array) $Stub);
     // Send some of the stuff back.
     if (isset($Stub['Name'])) {
         $this->jsonTarget('.PageTitle h1', Gdn_Format::text($Stub['Name']));
     }
     if (isset($Stub['Body'])) {
         $this->jsonTarget("#Discussion_{$DiscussionID} .Message", Gdn_Format::to($Stub['Body'], $Stub['Format']));
     }
     $this->informMessage('The page was successfully fetched.');
     $this->render('Blank', 'Utility', 'Dashboard');
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:34,代码来源:class.discussioncontroller.php

示例8: joinRecentPosts

 /**
  *
  *
  * @param $Data
  * @param null $CategoryID
  * @return bool
  */
 public static function joinRecentPosts(&$Data, $CategoryID = null)
 {
     $DiscussionIDs = array();
     $CommentIDs = array();
     $Joined = false;
     foreach ($Data as &$Row) {
         if (!is_null($CategoryID) && $Row['CategoryID'] != $CategoryID) {
             continue;
         }
         if (isset($Row['LastTitle']) && $Row['LastTitle']) {
             continue;
         }
         if ($Row['LastDiscussionID']) {
             $DiscussionIDs[] = $Row['LastDiscussionID'];
         }
         if ($Row['LastCommentID']) {
             $CommentIDs[] = $Row['LastCommentID'];
         }
         $Joined = true;
     }
     // Create a fresh copy of the Sql object so as not to pollute.
     $Sql = clone Gdn::sql();
     $Sql->reset();
     $Discussions = null;
     // Grab the discussions.
     if (count($DiscussionIDs) > 0) {
         $Discussions = $Sql->whereIn('DiscussionID', $DiscussionIDs)->get('Discussion')->resultArray();
         $Discussions = Gdn_DataSet::Index($Discussions, array('DiscussionID'));
     }
     if (count($CommentIDs) > 0) {
         $Comments = $Sql->whereIn('CommentID', $CommentIDs)->get('Comment')->resultArray();
         $Comments = Gdn_DataSet::Index($Comments, array('CommentID'));
     }
     foreach ($Data as &$Row) {
         if (!is_null($CategoryID) && $Row['CategoryID'] != $CategoryID) {
             continue;
         }
         $Discussion = val($Row['LastDiscussionID'], $Discussions);
         $NameUrl = 'x';
         if ($Discussion) {
             $Row['LastTitle'] = Gdn_Format::text($Discussion['Name']);
             $Row['LastUserID'] = $Discussion['InsertUserID'];
             $Row['LastDiscussionUserID'] = $Discussion['InsertUserID'];
             $Row['LastDateInserted'] = $Discussion['DateInserted'];
             $NameUrl = Gdn_Format::text($Discussion['Name'], true);
             $Row['LastUrl'] = DiscussionUrl($Discussion, false, '/') . '#latest';
         }
         if (!empty($Comments) && ($Comment = val($Row['LastCommentID'], $Comments))) {
             $Row['LastUserID'] = $Comment['InsertUserID'];
             $Row['LastDateInserted'] = $Comment['DateInserted'];
             $Row['DateLastComment'] = $Comment['DateInserted'];
         } else {
             $Row['NoComment'] = true;
         }
         touchValue('LastTitle', $Row, '');
         touchValue('LastUserID', $Row, null);
         touchValue('LastDiscussionUserID', $Row, null);
         touchValue('LastDateInserted', $Row, null);
         touchValue('LastUrl', $Row, null);
     }
     return $Joined;
 }
开发者ID:R-J,项目名称:vanilla,代码行数:69,代码来源:class.categorymodel.php

示例9: t

        }
        ?>
                    <div>
                        <strong><?php 
        echo $Message->Enabled == '1' ? t('Enabled') : t('Disabled');
        ?>
</strong>
                        <?php 
        echo anchor(t('Edit'), '/dashboard/message/edit/' . $Message->MessageID, 'EditMessage SmallButton');
        echo anchor(t('Delete'), '/dashboard/message/delete/' . $Message->MessageID . '/' . $Session->TransientKey(), 'DeleteMessage SmallButton');
        ?>
                    </div>
                </td>
                <td class="Alt">
                    <div
                        class="Message <?php 
        echo $Message->CssClass;
        ?>
"><?php 
        echo Gdn_Format::text($Message->Content);
        ?>
</div>
                </td>
            </tr>
        <?php 
    }
    ?>
        </tbody>
    </table>
<?php 
}
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:index.php

示例10: moderationController_splitComments_create

 /**
  * Add a method to the ModerationController to handle splitting comments out to a new discussion.
  */
 public function moderationController_splitComments_create($Sender)
 {
     $Session = Gdn::session();
     $Sender->Form = new Gdn_Form();
     $Sender->title(t('Split Comments'));
     $Sender->Category = false;
     $DiscussionID = val('0', $Sender->RequestArgs, '');
     if (!is_numeric($DiscussionID)) {
         return;
     }
     $DiscussionModel = new DiscussionModel();
     $Discussion = $DiscussionModel->getID($DiscussionID);
     if (!$Discussion) {
         return;
     }
     // Verify that the user has permission to perform the split
     $Sender->permission('Vanilla.Discussions.Edit', true, 'Category', $Discussion->PermissionCategoryID);
     $CheckedComments = Gdn::userModel()->getAttribute($Session->User->UserID, 'CheckedComments', array());
     if (!is_array($CheckedComments)) {
         $CheckedComments = array();
     }
     $CommentIDs = array();
     foreach ($CheckedComments as $DiscID => $Comments) {
         foreach ($Comments as $Comment) {
             if ($DiscID == $DiscussionID) {
                 $CommentIDs[] = str_replace('Comment_', '', $Comment);
             }
         }
     }
     // Load category data.
     $Sender->ShowCategorySelector = (bool) c('Vanilla.Categories.Use');
     $CountCheckedComments = count($CommentIDs);
     $Sender->setData('CountCheckedComments', $CountCheckedComments);
     // Perform the split
     if ($Sender->Form->authenticatedPostBack()) {
         // Create a new discussion record
         $Data = $Sender->Form->formValues();
         $Data['Body'] = sprintf(t('This discussion was created from comments split from: %s.'), anchor(Gdn_Format::text($Discussion->Name), 'discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::url($Discussion->Name) . '/'));
         $Data['Format'] = 'Html';
         $Data['Type'] = 'Discussion';
         $NewDiscussionID = $DiscussionModel->save($Data);
         $Sender->Form->setValidationResults($DiscussionModel->validationResults());
         if ($Sender->Form->errorCount() == 0 && $NewDiscussionID > 0) {
             // Re-assign the comments to the new discussion record
             $DiscussionModel->SQL->update('Comment')->set('DiscussionID', $NewDiscussionID)->whereIn('CommentID', $CommentIDs)->put();
             // Update counts on both discussions
             $CommentModel = new CommentModel();
             $CommentModel->updateCommentCount($DiscussionID);
             //            $CommentModel->UpdateUserCommentCounts($DiscussionID);
             $CommentModel->updateCommentCount($NewDiscussionID);
             $CommentModel->removePageCache($DiscussionID, 1);
             // Clear selections
             unset($CheckedComments[$DiscussionID]);
             Gdn::userModel()->saveAttribute($Session->UserID, 'CheckedComments', $CheckedComments);
             ModerationController::informCheckedComments($Sender);
             $Sender->RedirectUrl = url('discussion/' . $NewDiscussionID . '/' . Gdn_Format::url($Data['Name']));
         }
     } else {
         $Sender->Form->setValue('CategoryID', val('CategoryID', $Discussion));
     }
     $Sender->render($this->getView('splitcomments.php'));
 }
开发者ID:alim4egg,项目名称:vanilla,代码行数:65,代码来源:class.splitmerge.plugin.php

示例11: buildProfile

 /**
  * Build the user profile.
  *
  * Set the page title, add data to page modules, add modules to assets,
  * add tabs to tab menu. $this->User must be defined, or this method will throw an exception.
  *
  * @since 2.0.0
  * @access public
  * @return bool Always true.
  */
 public function buildProfile()
 {
     if (!is_object($this->User)) {
         throw new Exception(t('Cannot build profile information if user is not defined.'));
     }
     $Session = Gdn::session();
     if (strpos($this->CssClass, 'Profile') === false) {
         $this->CssClass .= ' Profile';
     }
     $this->title(Gdn_Format::text($this->User->Name));
     if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
         // Javascript needed
         // see note above about jcrop
         $this->addJsFile('jquery.jcrop.min.js');
         $this->addJsFile('profile.js');
         $this->addJsFile('jquery.gardenmorepager.js');
         $this->addJsFile('activity.js');
         // Build activity URL
         $ActivityUrl = 'profile/activity/';
         if ($this->User->UserID != $Session->UserID) {
             $ActivityUrl = userUrl($this->User, '', 'activity');
         }
         // Show activity?
         if (c('Garden.Profile.ShowActivities', true)) {
             $this->addProfileTab(t('Activity'), $ActivityUrl, 'Activity', sprite('SpActivity') . ' ' . t('Activity'));
         }
         // Show notifications?
         if ($this->User->UserID == $Session->UserID) {
             $Notifications = t('Notifications');
             $NotificationsHtml = sprite('SpNotifications') . ' ' . $Notifications;
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $NotificationsHtml .= ' <span class="Aside"><span class="Count">' . $CountNotifications . '</span></span>';
             }
             $this->addProfileTab($Notifications, 'profile/notifications', 'Notifications', $NotificationsHtml);
         }
         // Show invitations?
         if (c('Garden.Registration.Method') == 'Invitation') {
             $this->addProfileTab(t('Invitations'), 'profile/invitations', 'InvitationsLink', sprite('SpInvitations') . ' ' . t('Invitations'));
         }
         $this->fireEvent('AddProfileTabs');
     }
     return true;
 }
开发者ID:korelstar,项目名称:vanilla,代码行数:54,代码来源:class.profilecontroller.php

示例12: val

    $discussionID = val('DiscussionID', $Draft);
    $excerpt = sliceString(Gdn_Format::text(val('Body', $Draft)), 200);
    $isDiscussion = !is_numeric($discussionID) || $discussionID <= 0;
    $orphaned = !val('DiscussionExists', $Draft);
    $editUrl = $isDiscussion || $orphaned ? '/post/editdiscussion/0/' . $draftID : '/discussion/' . $discussionID . '/' . $Offset . '/#Form_Comment';
    $deleteUrl = 'vanilla/drafts/delete/' . $draftID . '/' . Gdn::session()->transientKey() . '?Target=' . urlencode($this->SelfUrl);
    ?>
    <li class="Item Draft">
        <div
            class="Options"><?php 
    echo anchor(t('Draft.Delete', 'Delete'), $deleteUrl, 'Delete');
    ?>
</div>
        <div class="ItemContent">
            <?php 
    echo anchor(Gdn_Format::text(val('Name', $Draft), false), $editUrl, 'Title DraftLink');
    ?>
            <?php 
    if ($excerpt) {
        ?>
                <div class="Excerpt">
                    <?php 
        echo anchor($excerpt, $editUrl);
        ?>
                </div>
            <?php 
    }
    ?>
        </div>
    </li>
<?php 
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:drafts.php

示例13: t

                        </div>
                    </div>
                    <?php 
                if ($NumComplaintsInThread > 1) {
                    echo '<div class="OtherComplaints">' . "\n";
                }
            } else {
                ?>
                    <div class="FlaggedOtherCell">
                        <div
                            class="FlaggedItemInfo"><?php 
                echo t('On') . ' ' . $Flag['DateInserted'] . ', <strong>' . anchor($Flag['InsertName'], "profile/{$Flag['InsertUserID']}/{$Flag['InsertName']}") . '</strong> ' . t('said:');
                ?>
</div>
                        <div class="FlaggedItemComment">"<?php 
                echo Gdn_Format::text($Flag['Comment']);
                ?>
"</div>
                    </div>
                <?php 
            }
        }
        if ($NumComplaintsInThread > 1) {
            echo "</div>\n";
        }
        ?>
        </div>
    <?php 
    }
}
?>
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:flagging.php

示例14: writeEmbedCommentForm

    function writeEmbedCommentForm()
    {
        $Session = Gdn::session();
        $Controller = Gdn::controller();
        $Discussion = $Controller->data('Discussion');
        if ($Discussion && $Discussion->Closed == '1') {
            ?>
            <div class="Foot Closed">
                <div class="Note Closed"><?php 
            echo t('This discussion has been closed.');
            ?>
</div>
            </div>
        <?php 
        } else {
            ?>
            <h2><?php 
            echo t('Leave a comment');
            ?>
</h2>
            <div class="MessageForm CommentForm EmbedCommentForm">
                <?php 
            echo $Controller->Form->open(array('id' => 'Form_Comment'));
            echo $Controller->Form->errors();
            echo $Controller->Form->Hidden('Name');
            echo wrap($Controller->Form->textBox('Body', array('MultiLine' => TRUE)), 'div', array('class' => 'TextBoxWrapper'));
            echo "<div class=\"Buttons\">\n";
            $AllowSigninPopup = c('Garden.SignIn.Popup');
            $Attributes = array('tabindex' => '-1', 'target' => '_top');
            // If we aren't ajaxing this call then we need to target the url of the parent frame.
            $ReturnUrl = $Controller->data('ForeignSource.vanilla_url', Gdn::request()->PathAndQuery());
            if ($Session->isValid()) {
                $AuthenticationUrl = Gdn::authenticator()->SignOutUrl($ReturnUrl);
                echo wrap(sprintf(t('Commenting as %1$s (%2$s)', 'Commenting as %1$s <span class="SignOutWrap">(%2$s)</span>'), Gdn_Format::text($Session->User->Name), anchor(t('Sign Out'), $AuthenticationUrl, 'SignOut', $Attributes)), 'div', array('class' => 'Author'));
                echo $Controller->Form->button('Post Comment', array('class' => 'Button CommentButton'));
            } else {
                $AuthenticationUrl = url(SignInUrl($ReturnUrl), true);
                if ($AllowSigninPopup) {
                    $CssClass = 'SignInPopup Button Stash';
                } else {
                    $CssClass = 'Button Stash';
                }
                echo anchor(t('Comment As ...'), $AuthenticationUrl, $CssClass, $Attributes);
            }
            echo "</div>\n";
            echo $Controller->Form->close();
            ?>
            </div>
        <?php 
        }
    }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:51,代码来源:helper_functions.php

示例15: toString

 /**
  * Render the entire head module.
  */
 public function toString()
 {
     // Add the canonical Url if necessary.
     if (method_exists($this->_Sender, 'CanonicalUrl') && !c('Garden.Modules.NoCanonicalUrl', false)) {
         $CanonicalUrl = $this->_Sender->canonicalUrl();
         if (!isUrl($CanonicalUrl)) {
             $CanonicalUrl = Gdn::router()->ReverseRoute($CanonicalUrl);
         }
         $this->_Sender->canonicalUrl($CanonicalUrl);
         //            $CurrentUrl = url('', true);
         //            if ($CurrentUrl != $CanonicalUrl) {
         $this->addTag('link', array('rel' => 'canonical', 'href' => $CanonicalUrl));
         //            }
     }
     // Include facebook open-graph meta information.
     if ($FbAppID = c('Plugins.Facebook.ApplicationID')) {
         $this->addTag('meta', array('property' => 'fb:app_id', 'content' => $FbAppID));
     }
     $SiteName = c('Garden.Title', '');
     if ($SiteName != '') {
         $this->addTag('meta', array('property' => 'og:site_name', 'content' => $SiteName));
     }
     $Title = Gdn_Format::text($this->title('', true));
     if ($Title != '') {
         $this->addTag('meta', array('property' => 'og:title', 'itemprop' => 'name', 'content' => $Title));
     }
     if (isset($CanonicalUrl)) {
         $this->addTag('meta', array('property' => 'og:url', 'content' => $CanonicalUrl));
     }
     if ($Description = $this->_Sender->Description()) {
         $this->addTag('meta', array('name' => 'description', 'property' => 'og:description', 'itemprop' => 'description', 'content' => $Description));
     }
     // Default to the site logo if there were no images provided by the controller.
     if (count($this->_Sender->Image()) == 0) {
         $Logo = c('Garden.ShareImage', c('Garden.Logo', ''));
         if ($Logo != '') {
             // Fix the logo path.
             if (stringBeginsWith($Logo, 'uploads/')) {
                 $Logo = substr($Logo, strlen('uploads/'));
             }
             $Logo = Gdn_Upload::url($Logo);
             $this->addTag('meta', array('property' => 'og:image', 'itemprop' => 'image', 'content' => $Logo));
         }
     } else {
         foreach ($this->_Sender->Image() as $Img) {
             $this->addTag('meta', array('property' => 'og:image', 'itemprop' => 'image', 'content' => $Img));
         }
     }
     $this->fireEvent('BeforeToString');
     $Tags = $this->_Tags;
     // Make sure that css loads before js (for jquery)
     usort($this->_Tags, array('HeadModule', 'TagCmp'));
     // "link" comes before "script"
     $Tags2 = $this->_Tags;
     // Start with the title.
     $Head = '<title>' . Gdn_Format::text($this->title()) . "</title>\n";
     $TagStrings = array();
     // Loop through each tag.
     foreach ($this->_Tags as $Index => $Attributes) {
         $Tag = $Attributes[self::TAG_KEY];
         // Inline the content of the tag, if necessary.
         if (val('_hint', $Attributes) == 'inline') {
             $Path = val('_path', $Attributes);
             if (!stringBeginsWith($Path, 'http')) {
                 $Attributes[self::CONTENT_KEY] = file_get_contents($Path);
                 if (isset($Attributes['src'])) {
                     $Attributes['_src'] = $Attributes['src'];
                     unset($Attributes['src']);
                 }
                 if (isset($Attributes['href'])) {
                     $Attributes['_href'] = $Attributes['href'];
                     unset($Attributes['href']);
                 }
             }
         }
         // If we set an IE conditional AND a "Not IE" condition, we will need to make a second pass.
         do {
             // Reset tag string
             $TagString = '';
             // IE conditional? Validates condition.
             $IESpecific = isset($Attributes['_ie']) && preg_match('/((l|g)t(e)? )?IE [0-9\\.]/', $Attributes['_ie']);
             // Only allow $NotIE if we're not doing a conditional this loop.
             $NotIE = !$IESpecific && isset($Attributes['_notie']);
             // Open IE conditional tag
             if ($IESpecific) {
                 $TagString .= '<!--[if ' . $Attributes['_ie'] . ']>';
             }
             if ($NotIE) {
                 $TagString .= '<!--[if !IE]> -->';
             }
             // Build tag
             $TagString .= '  <' . $Tag . Attribute($Attributes, '_');
             if (array_key_exists(self::CONTENT_KEY, $Attributes)) {
                 $TagString .= '>' . $Attributes[self::CONTENT_KEY] . '</' . $Tag . '>';
             } elseif ($Tag == 'script') {
                 $TagString .= '></script>';
             } else {
//.........这里部分代码省略.........
开发者ID:korelstar,项目名称:vanilla,代码行数:101,代码来源:class.headmodule.php


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