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


PHP ET::formatter方法代码示例

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


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

示例1: formatAttachment

 /**
  * Format an attachment to be outputted on the page, either in the attachment list
  * at the bottom of the post or embedded inside the post.
  *
  * @param array $attachment The attachment details.
  * @param bool $expanded Whether or not the attachment should be displayed in its
  * 		full form (i.e. whether or not the attachment is embedded in the post.)
  * @return string The HTML to output.
  */
 function formatAttachment($attachment, $expanded = false)
 {
     $extension = strtolower(pathinfo($attachment["filename"], PATHINFO_EXTENSION));
     $url = URL("attachment/" . $attachment["attachmentId"] . "_" . $attachment["filename"]);
     $filename = sanitizeHTML($attachment["filename"]);
     $displayFilename = ET::formatter()->init($filename)->highlight(ET::$session->get("highlight"))->get();
     // For images, either show them directly or show a thumbnail.
     if (in_array($extension, array("jpg", "jpeg", "png", "gif"))) {
         if ($expanded) {
             return "<span class='attachment attachment-image'><img src='" . $url . "' alt='" . $filename . "' title='" . $filename . "'></span>";
         } else {
             return "<a href='" . $url . "' class='' target='_blank'><img src='" . URL("attachment/thumb/" . $attachment["attachmentId"]) . "' alt='" . $filename . "' title='" . $filename . "'></a>";
         }
     }
     // Embed video.
     if (in_array($extension, array("mp4", "mov", "mpg", "avi", "m4v")) and $expanded) {
         return "<video width='400' height='225' controls><source src='" . $url . "'></video>";
     }
     // Embed audio.
     if (in_array($extension, array("mp3", "mid", "wav")) and $expanded) {
         return "<audio controls><source src='" . $url . "'></video>";
     }
     $icons = array("pdf" => "file-text-alt", "doc" => "file-text-alt", "docx" => "file-text-alt", "zip" => "archive", "rar" => "archive", "gz" => "archive");
     $icon = isset($icons[$extension]) ? $icons[$extension] : "file";
     return "<a href='" . $url . "' class='attachment' target='_blank'><i class='icon-{$icon}'></i><span class='filename'>" . $displayFilename . "</span></a>";
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:35,代码来源:plugin.php

示例2: memberController_about

 public function memberController_about($sender, $member = "")
 {
     if (!($member = $sender->profile($member, "about"))) {
         return;
     }
     $about = @$member["preferences"]["about"];
     $about = ET::formatter()->init($about)->format()->get();
     $sender->data("about", $about);
     $sender->renderProfile($this->getView("about"));
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:10,代码来源:plugin.php

示例3: handler_conversationController_formatPostForTemplate

 public function handler_conversationController_formatPostForTemplate($sender, &$formatted, $post, $conversation)
 {
     if ($post["deleteMemberId"]) {
         return;
     }
     // Lets check if the Likes plugin is active,
     // if so we need to output the signature HTML a bit different.
     if (in_array("Likes", C("esoTalk.enabledPlugins"))) {
         $signature = ET::formatter()->init($post["preferences"]["signature"])->format()->get();
         if ($signature != "") {
             addToArray($formatted["footer"], "<div class='signature'>" . substr($signature, 0, C("plugin.Signature.characters")) . "</div>", 0);
         }
     } else {
         $signature = $post["preferences"]["signature"];
         if ($signature != "") {
             addToArray($formatted["footer"], "<p class='signature-no-likes'>" . substr($signature, 0, C("plugin.Signature.characters")) . "</p>", 0);
         }
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:19,代码来源:plugin.php

示例4: linksCallback

 /**
  * The callback function used to replace URL BBCode with HTML anchor tags.
  *
  * @param array $matches An array of matches from the regular expression.
  * @return string The replacement HTML anchor tag.
  */
 public function linksCallback($matches)
 {
     return ET::formatter()->formatLink($matches[1] . $matches[2], $matches[3]);
 }
开发者ID:davchezt,项目名称:fireside,代码行数:10,代码来源:plugin.php

示例5: postEmail

 /**
  * Returns a formatted email subject+body for the "post" activity type.
  *
  * @see mentionEmail() for parameter and return information.
  */
 public static function postEmail($item, $member)
 {
     $content = ET::formatter()->init($item["data"]["content"])->format()->get();
     $url = URL(conversationURL($item["data"]["conversationId"], $item["data"]["title"]) . "/unread", true);
     return array(sprintf(T("email.post.subject"), $item["data"]["title"]), sprintf(T("email.post.body"), name($item["fromMemberName"]), sanitizeHTML($item["data"]["title"]), $content, "<a href='{$url}'>{$url}</a>"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:11,代码来源:ETActivityModel.class.php

示例6: displayPost

 /**
  * Format a post's content to be displayed.
  *
  * @param string $content The post content to format.
  * @return string The formatted post content.
  */
 protected function displayPost($content)
 {
     $words = ET::$session->get("highlight");
     return ET::formatter()->init($content)->highlight($words)->format()->get();
 }
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:11,代码来源:ETConversationController.class.php

示例7: URL

}
echo "</span> ";
// Output the conversation title, highlighting search keywords.
echo "<strong class='title'><a href='" . URL($conversationURL . ((ET::$session->user and $conversation["unread"]) ? "/unread" : "")) . "'>";
if (SWC_MAIN_THUMB_DISPLAY && $menuImgUrl) {
    // メニュー画像サムネイル出力
    echo "<img src='" . $menuImgUrl . "' width='28' height='20' alt='' title=''>";
}
echo highlight(sanitizeHTML($conversation["title"]), ET::$session->get("highlight")) . "</a></strong> ";
// If we're highlighting search terms (i.e. if we did a fulltext search), then output a "show matching posts" link.
if (ET::$session->get("highlight")) {
    echo "<span class='controls'><a href='" . URL($conversationURL . "/?search=" . urlencode($data["fulltextString"])) . "' class='showMatchingPosts'>" . T("Show matching posts") . "</a></span>";
}
// If this conversation is stickied, output an excerpt from its first post.
if ($conversation["sticky"]) {
    echo "<div class='excerpt'>" . ET::formatter()->init($conversation["firstPost"])->inline(true)->firstLine()->clip(200)->format()->get() . "</div>";
}
?>
</div>
<div class='col-channel'><?php 
$channel = $data["channelInfo"][$conversation["channelId"]];
echo "<a href='" . URL(searchURL("", $channel["slug"])) . "' class='channel channel-{$conversation["channelId"]}' data-channel='{$channel["slug"]}'>{$channel["title"]}</a>";
?>
</div>
<div class='col-lastPost'><?php 
echo "<span class='action'>" . avatar(array("memberId" => $conversation["lastPostMemberId"], "username" => $conversation["lastPostMember"], "avatarFormat" => $conversation["lastPostMemberAvatarFormat"], "email" => $conversation["lastPostMemberEmail"]), "thumb"), " ", sprintf(T("%s posted %s"), "<span class='lastPostMember name'>" . memberLink($conversation["lastPostMemberId"], $conversation["lastPostMember"]) . "</span>", "<a href='" . URL($conversationURL . "/unread") . "' class='lastPostTime'>" . SwcUtils::getStrfTime($conversation["lastPostTime"]) . "</a>"), "</span>";
?>
</div>
<div class='col-replies'><?php 
echo "<span><a href='" . URL($conversationURL . "/unread") . "'>" . $conversation["replies"] . "</a></span>";
?>
开发者ID:m-mori,项目名称:forum,代码行数:31,代码来源:conversation.php

示例8: T

echo $post["postId"];
?>
'><?php 
echo T("See post in context");
?>
</a>
		</div>
		<div class='controls'>
			<?php 
if ($conversation["startMemberId"] == ET::$session->userId or $conversation["canModerate"]) {
    ?>
			<a href='<?php 
    echo URL("conversation/unanswer/" . $conversation["conversationId"] . "?token=" . ET::$session->token);
    ?>
' title='<?php 
    echo T("Remove answer");
    ?>
' class='control-unanswer'><i class='icon-remove'></i></a>
			<?php 
}
?>
		</div>
	</div>

	<div class='postBody'>
		<?php 
$words = ET::$session->get("highlight");
echo ET::formatter()->init($post["content"])->highlight($words)->format()->get();
?>
	</div>
</div>
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:31,代码来源:answer.php

示例9: create

 /**
  * Create a post in the specified conversation.
  *
  * This function will go through the post content and notify any members who are @mentioned.
  *
  * @param int $conversationId The ID of the conversation to create the post in.
  * @param int $memberId The ID of the author of the post.
  * @param string $content The post content.
  * @param string $title The title of the conversation (so it can be added alongside the post, for fulltext purposes.)
  * @return bool|int The new post's ID, or false if there were errors.
  */
 public function create($conversationId, $memberId, $content, $title = "")
 {
     // Validate the post content.
     $this->validate("content", $content, array($this, "validateContent"));
     if ($this->errorCount()) {
         return false;
     }
     // Prepare the post details for the query.
     $data = array("conversationId" => $conversationId, "memberId" => $memberId, "time" => time(), "content" => $content, "title" => $title);
     $id = parent::create($data);
     // Update the member's post count.
     ET::SQL()->update("member")->set("countPosts", "countPosts + 1", false)->where("memberId", $memberId)->exec();
     // Update the channel's post count.
     ET::SQL()->update("channel")->set("countPosts", "countPosts + 1", false)->where("channelId", ET::SQL()->select("channelId")->from("conversation")->where("conversationId=:conversationId")->bind(":conversationId", $conversationId)->exec()->result())->exec();
     // Parse the post content for @mentions, and notify any members who were mentioned.
     if (C("esoTalk.format.mentions")) {
         $names = ET::formatter()->getMentions($content);
         if (count($names)) {
             // Get the member details from the database.
             $sql = ET::SQL()->where("m.username IN (:names)")->bind(":names", $names)->where("m.memberId != :userId")->bind(":userId", $memberId);
             $members = ET::memberModel()->getWithSQL($sql);
             $data = array("conversationId" => $conversationId, "postId" => (int) $id, "title" => $title);
             $emailData = array("content" => $content);
             $i = 0;
             foreach ($members as $member) {
                 // Only send notifications to the first 10 members who are mentioned to prevent abuse of the system.
                 if ($i++ > 10) {
                     break;
                 }
                 // Check if this member is allowed to view this conversation before sending them a notification.
                 $sql = ET::SQL()->select("conversationId")->from("conversation c")->where("conversationId", $conversationId);
                 ET::conversationModel()->addAllowedPredicate($sql, $member);
                 if (!$sql->exec()->numRows()) {
                     continue;
                 }
                 ET::activityModel()->create("mention", $member, ET::$session->user, $data, $emailData);
             }
         }
     }
     return $id;
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:52,代码来源:ETPostModel.class.php

示例10: action_memberController_about

 public function action_memberController_about($sender, $member = "")
 {
     if (!($member = $sender->profile($member, "about"))) {
         return;
     }
     $model = ET::getInstance("profileFieldModel");
     $fields = $model->getData($member["memberId"]);
     foreach ($fields as $k => &$field) {
         // If this field is hidden from guests and we're a guest, don't display it.
         if ($field["hideFromGuests"] and !ET::$session->user) {
             unset($fields[$k]);
         }
         switch ($field["type"]) {
             case "textarea":
                 $field["data"] = ET::formatter()->init($field["data"])->format()->get();
                 break;
             case "checkboxes":
                 $items = explode("\n", $field["data"]);
                 $items = array_map("sanitizeHTML", $items);
                 $field["data"] = implode("<br>", $items);
                 break;
             case "member":
                 $field["data"] = "<a href='" . URL("member/name/" . urlencode($field["data"])) . "'>" . sanitizeHTML($field["data"]) . "</a>";
                 break;
             default:
                 $field["data"] = ET::formatter()->init($field["data"])->inline(true)->format()->get();
         }
     }
     $sender->data("fields", $fields);
     $sender->renderProfile($this->view("about"));
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:31,代码来源:plugin.php

示例11: postActivity

 /**
  * Returns a formatted activity item for the "post" activity type. For example, '[member] posted in [title]'.
  *
  * @param array $item The activity item's details.
  * @param array $member The details of the member this activity is for.
  * @return array 0 => activity title, 1 => activity body
  */
 public static function postActivity($item, $member)
 {
     return array(sprintf(T($item["start"] ? "%s started the conversation %s." : "%s posted in %s."), name($member["username"]), "<a href='" . URL(postURL($item["postId"])) . "'>" . sanitizeHTML($item["title"]) . "</a>"), ET::formatter()->init($item["content"])->basic(true)->removeQuotes()->format()->clip(250)->get());
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:11,代码来源:ETActivityModel.class.php

示例12: postMemberEmail

 public static function postMemberEmail($item, $member)
 {
     $content = ET::formatter()->init($item["data"]["content"])->basic(true)->format()->get();
     return array(sprintf(T("email.postMember.subject"), name($item["fromMemberName"], false)), sprintf(T("email.postMember.body"), name($item["fromMemberName"]), sanitizeHTML($item["data"]["title"]), $content, URL(conversationURL($item["data"]["conversationId"], $item["data"]["title"]) . "/unread", true)));
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:5,代码来源:plugin.php

示例13: issueCallback

 public function issueCallback($matches)
 {
     return ET::formatter()->formatLink($this->repositoryURL() . "/issues/" . $matches[1], $matches[0]);
 }
开发者ID:ZerGabriel,项目名称:GitHubLinks,代码行数:4,代码来源:plugin.php


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